From 6392f5a9dfce2bf83617d49bb7f332181ec6004e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 25 May 2014 15:37:31 +0900 Subject: Revert "Finish renaming tdevelop components" This reverts commit 722ce1efbac31c61b1d4b13f7e075c9f311e3e73. --- lib/interfaces/kdevcore.h | 388 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 388 insertions(+) create mode 100644 lib/interfaces/kdevcore.h (limited to 'lib/interfaces/kdevcore.h') diff --git a/lib/interfaces/kdevcore.h b/lib/interfaces/kdevcore.h new file mode 100644 index 00000000..fad2891a --- /dev/null +++ b/lib/interfaces/kdevcore.h @@ -0,0 +1,388 @@ +/* This file is part of the KDE project + Copyright (C) 2001-2002 Matthias Hoelzer-Kluepfel + Copyright (C) 2001-2002 Bernd Gehrmann + Copyright (C) 2001 Sandy Meier + Copyright (C) 2002 Daniel Engelschalt + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2003 Mario Scalas + Copyright (C) 2003 Harald Fernengel + Copyright (C) 2003 Hamish Rodda + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef KDEVCORE_H +#define KDEVCORE_H + +/** +@file kdevcore.h +The interface to the application core and context menu classes. +*/ + +#include +#include +#include + +#include + +class KDialogBase; +class KDevPlugin; +class CodeModelItem; +class ProjectModelItem; + +namespace KParts +{ + class Part; +} + +class TQStatusBar; +class TQPopupMenu; + +/** +Base class for every context. +Think of a Context-based class as "useful +info associated to a context menu". Several context menu can be defined, +each defining different information: because of these context menus being +used in many modules, they are defined here. + +When context menu with a certain "context" associated appears, KDevelop core +sends a notification signal and all plugins which receive this signal have +the ability to add own items into the menu. For example, VCS plugin could +add "commit" and "update" menu items to the context menu of a file. + +How to use context from a plugin: +-# Create a popup menu in context menu event handler: @code TDEPopupMenu menu(this); @endcode +-# Create a context: @code MyContext context(param). @endcode +-# Fill a context menu: @code core()->fillContextMenu(&menu, &context); @endcode +-# Show the popup menu: @code menu.exec(event->globalPos()); @endcode +. +In this example @em event is an object of TQContextMenuEvent class which you have access +to if you reimplement TQWidget::contextMenuEvent method. + +How to fill context menu from a plugin: +-# Create a @code contextMenu(TQPopupMenu *, const Context *) @endcode slot in your plugin class. +-# Connect KDevCore::contextMenu(TQPopupMenu *, const Context *) signal to that slot in +the constructor of your plugin:\n +@code +connect(core(), TQT_SIGNAL(contextMenu(TQPopupMenu *, const Context *)), + this, TQT_SLOT(contextMenu(TQPopupMenu *, const Context *))); +@endcode +-# Fill the menu in the slot you created, for example:\n +@code +if (context->hasType(Context::EditorContext)) +{ + const EditorContext *econtext = static_cast(context); + int id = popup->insertItem(i18n("My Menu Item 1"), this, TQT_SLOT(myMenuAction1())); + popup->setWhatsThis(id, i18n("What's this for my menu item 1")); +} +else if context->hasType(MyContext)) +{ + int id = popup->insertItem(... + ... +} +... +@endcode +*/ +class Context +{ +public: + /**Pre-defined context types. More may be added so it is possible to add custom + contexts. We reserve enum values until 1000 (yeah, it is one thousand ) + for tdevelop official context types.*/ + enum Type + { + EditorContext, /**