kexi
KFormDesigner::FormManager Class Reference
#include <formmanager.h>
Inheritance diagram for KFormDesigner::FormManager:

Detailed Description
This is Form Designer's main class, which is used by external APIs to access FormDesigner.This is the class you have to use to integrate FormDesigner into another program. It deals with creating, saving and loading Form, as well as widget insertion and copying. It also ensures all the components (ObjectTreeView, Form and PropertyEditor) are synced, and link them. It holds the WidgetLibrary, the WidgetPropertySet, links to ObjectTreeView and PropertyEditor, as well as the copied widget and the insert state.
Definition at line 72 of file formmanager.h.
Public Types | |
enum | Options { HideEventsInPopupMenu = 1, SkipFileActions = 2, HideSignalSlotConnections = 4 } |
Public Slots | |
void | deleteWidget () |
void | copyWidget () |
void | cutWidget () |
void | pasteWidget () |
void | selectAll () |
void | clearWidgetContent () |
void | undo () |
void | redo () |
void | editTabOrder () |
void | adjustWidgetSize () |
void | editFormPixmapCollection () |
void | editConnections () |
void | layoutHBox () |
void | layoutVBox () |
void | layoutGrid () |
void | layoutHSplitter () |
void | layoutVSplitter () |
void | layoutHFlow () |
void | layoutVFlow () |
void | breakLayout () |
void | alignWidgetsToLeft () |
void | alignWidgetsToRight () |
void | alignWidgetsToTop () |
void | alignWidgetsToBottom () |
void | alignWidgetsToGrid () |
void | adjustSizeToGrid () |
void | adjustWidthToSmall () |
void | adjustWidthToBig () |
void | adjustHeightToSmall () |
void | adjustHeightToBig () |
void | bringWidgetToFront () |
void | sendWidgetToBack () |
void | insertWidget (const QCString &classname) |
void | stopInsert () |
void | slotPointerClicked () |
void | startCreatingConnection () |
void | stopCreatingConnection () |
void | windowChanged (QWidget *w) |
void | deleteWidgetLater (QWidget *w) |
void | showFormUICode () |
void | changeFont () |
Signals | |
void | propertySetSwitched (KoProperty::Set *set, bool forceReload=false, const QCString &propertyToSelect=QCString()) |
void | dirty (KFormDesigner::Form *form, bool isDirty=true) |
void | widgetSelected (KFormDesigner::Form *form, bool multiple) |
void | formWidgetSelected (KFormDesigner::Form *form) |
void | noFormSelected () |
void | undoEnabled (bool enabled, const QString &text=QString::null) |
void | redoEnabled (bool enabled, const QString &text=QString::null) |
void | createFormSlot (KFormDesigner::Form *form, const QString &widget, const QString &signal) |
void | connectionCreated (KFormDesigner::Form *form, KFormDesigner::Connection &connection) |
void | connectionAborted (KFormDesigner::Form *form) |
void | autoTabStopsSet (KFormDesigner::Form *form, bool set) |
void | aboutToDeleteForm (KFormDesigner::Form *form) |
void | formCreated (KFormDesigner::Form *form) |
Public Member Functions | |
FormManager (QObject *parent=0, int options=0, const char *name=0) | |
virtual | ~FormManager () |
ActionList | createActions (WidgetLibrary *lib, KActionCollection *collection, KXMLGUIClient *client) |
virtual void | enableAction (const char *name, bool enable)=0 |
virtual KAction * | action (const char *name)=0 |
bool | isPasteEnabled () |
WidgetPropertySet * | propertySet () const |
bool | isInserting () const |
QCString | selectedClass () const |
void | setInsertPoint (const QPoint &p) |
bool | isCreatingConnection () |
Connection * | createdConnection () |
void | resetCreatedConnection () |
void | createSignalMenu (QWidget *w) |
void | createSlotMenu (QWidget *w) |
void | emitCreateSlot (const QString &widget, const QString &value) |
Form * | activeForm () const |
Form * | formForWidget (QWidget *w) |
bool | isTopLevel (QWidget *w) |
virtual void | showPropertySet (WidgetPropertySet *set, bool forceReload=false, const QCString &propertyToSelect=QCString()) |
void | blockPropertyEditorUpdating (void *blockingObject) |
void | unblockPropertyEditorUpdating (void *blockingObject, WidgetPropertySet *set) |
void | setEditor (KoProperty::Editor *editor) |
void | setObjectTreeView (ObjectTreeView *treeview) |
void | previewForm (Form *form, QWidget *w, Form *toForm=0) |
void | importForm (Form *form=0, bool preview=false) |
void | deleteForm (Form *form) |
void | createContextMenu (QWidget *w, Container *container, bool popupAtCursor=true) |
bool | snapWidgetsToGrid () |
int | contextMenuKey () const |
void | emitWidgetSelected (KFormDesigner::Form *form, bool multiple) |
void | emitFormWidgetSelected (KFormDesigner::Form *form) |
void | emitNoFormSelected () |
bool | isRedoing () const |
Static Public Member Functions | |
static WidgetLibrary * | createWidgetLibrary (FormManager *m, const QStringList &supportedFactoryGroups) |
static FormManager * | self () |
Protected Slots | |
void | deleteWidgetLaterTimeout () |
void | buddyChosen (int id) |
void | menuSignalChosen (int id) |
void | slotStyle () |
void | slotConnectionCreated (KFormDesigner::Form *, KFormDesigner::Connection &) |
void | slotSettingsChanged (int category) |
Protected Member Functions | |
void | initForm (Form *form) |
void | createLayout (int layoutType) |
void | alignWidgets (int type) |
void | enableFormActions () |
void | disableWidgetActions () |
void | emitUndoEnabled (bool enabled, const QString &text) |
void | emitRedoEnabled (bool enabled, const QString &text) |
Protected Attributes | |
bool | m_emitSelectionSignalsUpdatesPropertySet: 1 |
Friends | |
class | PropertyCommand |
class | GeometryPropertyCommand |
class | CutWidgetCommand |
class | Form |
Member Enumeration Documentation
Options for creating FormManager objects. These are really bit-flags and may be or-ed together.
Definition at line 94 of file formmanager.h.
Constructor & Destructor Documentation
FormManager::FormManager | ( | QObject * | parent = 0 , |
|
int | options = 0 , |
|||
const char * | name = 0 | |||
) |
Constructs FormManager object. Using options you can control manager's behaviour, see Options.
Definition at line 108 of file formmanager.cpp.
Member Function Documentation
WidgetLibrary * FormManager::createWidgetLibrary | ( | FormManager * | m, | |
const QStringList & | supportedFactoryGroups | |||
) | [static] |
Creates widget library for supportedFactoryGroups and initializes FormManager singleton.
m should be always the same for every call.
Definition at line 169 of file formmanager.cpp.
FormManager * FormManager::self | ( | ) | [static] |
ActionList FormManager::createActions | ( | WidgetLibrary * | lib, | |
KActionCollection * | collection, | |||
KXMLGUIClient * | client | |||
) |
Creates all the KActions related to widget insertion, and plug them into the collection. client XML GUI client is used to call lib->addCustomWidgetActions(client). These actions are automatically connected to insertWidget() slot.
- Returns:
- a QPtrList of the created actions.
Definition at line 195 of file formmanager.cpp.
virtual void KFormDesigner::FormManager::enableAction | ( | const char * | name, | |
bool | enable | |||
) | [pure virtual] |
Enables or disables actions name. KFD uses KPart's, action collection here. Kexi implements this to get (shared) actions defined elsewhere.
Implemented in KexiFormManager.
virtual KAction* KFormDesigner::FormManager::action | ( | const char * | name | ) | [pure virtual] |
WidgetPropertySet* KFormDesigner::FormManager::propertySet | ( | ) | const [inline] |
- Returns:
- A pointer to the WidgetPropertySet owned by this Manager.
Definition at line 119 of file formmanager.h.
bool KFormDesigner::FormManager::isInserting | ( | ) | const [inline] |
- Returns:
- true if one of the insert buttons was pressed and the forms are ready to create a widget.
Definition at line 123 of file formmanager.h.
QCString KFormDesigner::FormManager::selectedClass | ( | ) | const [inline] |
- Returns:
- The name of the class being inserted, corresponding to the menu item or the toolbar button clicked.
Definition at line 127 of file formmanager.h.
void FormManager::setInsertPoint | ( | const QPoint & | p | ) |
Sets the point where the pasted widget should be moved to.
Definition at line 782 of file formmanager.cpp.
bool KFormDesigner::FormManager::isCreatingConnection | ( | ) | [inline] |
- Returns:
- If we are creating a Connection by drag-and-drop or not.
Definition at line 133 of file formmanager.h.
Connection* KFormDesigner::FormManager::createdConnection | ( | ) | [inline] |
void FormManager::resetCreatedConnection | ( | ) |
Resets the Connection being created. We stay in Connection creation mode, but we start a new connection (when the user clicks outside of signals/slots menu).
Definition at line 400 of file formmanager.cpp.
void FormManager::createSignalMenu | ( | QWidget * | w | ) |
Creates and display a menu with all the signals of widget w.
Definition at line 788 of file formmanager.cpp.
void FormManager::createSlotMenu | ( | QWidget * | w | ) |
Creates and display a menu with all the slots of widget w.
Definition at line 809 of file formmanager.cpp.
void KFormDesigner::FormManager::emitCreateSlot | ( | const QString & | widget, | |
const QString & | value | |||
) | [inline] |
Emits the signal createFormSlot(). Used by WidgetPropertySet.
Definition at line 150 of file formmanager.h.
Form * FormManager::activeForm | ( | ) | const |
Form * FormManager::formForWidget | ( | QWidget * | w | ) |
Definition at line 583 of file formmanager.cpp.
bool FormManager::isTopLevel | ( | QWidget * | w | ) |
- Returns:
- true if w is a toplevel widget, ie. it is the main widget of a Form (so it should have a caption , an icon ...)
Definition at line 689 of file formmanager.cpp.
void FormManager::showPropertySet | ( | WidgetPropertySet * | set, | |
bool | forceReload = false , |
|||
const QCString & | propertyToSelect = QCString() | |||
) | [virtual] |
- Returns:
- A pointer to the KoProperty::Editor we use.
Shows a property set set in a Property Editor. If buff is 0, Property Editor will be cleared. If forceReload is true, the set will be reloaded even if it's the same as previous one. If propertyToSelect is not empty, an item for this name will be selected (usable when previously there was no set visible).
Definition at line 1153 of file formmanager.cpp.
void FormManager::setEditor | ( | KoProperty::Editor * | editor | ) |
Sets the external property editor pane used by FormDesigner (it may be docked).
Definition at line 177 of file formmanager.cpp.
void FormManager::setObjectTreeView | ( | ObjectTreeView * | treeview | ) |
Sets the external object tree view used by FormDesigner (it may be docked). This function also connects appropriate signals and slots to ensure sync with the current Form.
Definition at line 186 of file formmanager.cpp.
Previews the Form form using the widget w as toplevel container for this Form.
designMode, we need to set it early enough
Definition at line 648 of file formmanager.cpp.
void FormManager::importForm | ( | Form * | form = 0 , |
|
bool | preview = false | |||
) |
Adds a existing form w and changes it to a container
Definition at line 610 of file formmanager.cpp.
void FormManager::deleteForm | ( | Form * | form | ) |
Deletes the Form form and removes it from our list.
Definition at line 594 of file formmanager.cpp.
void FormManager::createContextMenu | ( | QWidget * | w, | |
Container * | container, | |||
bool | popupAtCursor = true | |||
) |
This function creates and displays the context menu corresponding to the widget w. The menu item are disabled if necessary, and the widget specific part is added (menu from the factory and buddy selection).
Definition at line 840 of file formmanager.cpp.
bool FormManager::snapWidgetsToGrid | ( | ) |
void FormManager::deleteWidget | ( | ) | [slot] |
Deletes the selected widget in active Form and all of its children.
Definition at line 705 of file formmanager.cpp.
void FormManager::copyWidget | ( | ) | [slot] |
Copies the slected widget and all its children of the active Form using an XML representation.
Definition at line 724 of file formmanager.cpp.
void FormManager::cutWidget | ( | ) | [slot] |
Cuts (ie Copies and deletes) the selected widget and all its children of the active Form using an XML representation.
Definition at line 756 of file formmanager.cpp.
void FormManager::pasteWidget | ( | ) | [slot] |
Pastes the XML representation of the copied or cut widget. The widget is pasted when the user clicks the Form to indicate the new position of the widget, or at the position of the contextual menu if there is one.
Definition at line 770 of file formmanager.cpp.
void FormManager::selectAll | ( | ) | [slot] |
Selects all toplevel widgets in trhe current form.
Definition at line 1377 of file formmanager.cpp.
void FormManager::clearWidgetContent | ( | ) | [slot] |
Clears the contents of the selected widget(s) (eg for a line edit or a listview).
Definition at line 1392 of file formmanager.cpp.
void FormManager::editTabOrder | ( | ) | [slot] |
Displays a dialog where the user can modify the tab order of the active Form, by drag-n-drop or using up/down buttons.
Definition at line 1187 of file formmanager.cpp.
void FormManager::adjustWidgetSize | ( | ) | [slot] |
Adjusts the size of the selected widget, ie resize it to its size hint.
Definition at line 1287 of file formmanager.cpp.
void FormManager::editFormPixmapCollection | ( | ) | [slot] |
Creates a dialog to edit the activeForm() PixmapCollection.
Definition at line 1220 of file formmanager.cpp.
void FormManager::editConnections | ( | ) | [slot] |
Creates a dialog to edit the Connection of activeForm().
Definition at line 1230 of file formmanager.cpp.
void FormManager::layoutHBox | ( | ) | [slot] |
Lay out selected widgets using HBox layout (calls CreateLayoutCommand).
Definition at line 1053 of file formmanager.cpp.
void FormManager::layoutVBox | ( | ) | [slot] |
void FormManager::layoutGrid | ( | ) | [slot] |
void FormManager::layoutHSplitter | ( | ) | [slot] |
Lay out selected widgets in an horizontal splitter.
Definition at line 1071 of file formmanager.cpp.
void FormManager::layoutVSplitter | ( | ) | [slot] |
void FormManager::layoutHFlow | ( | ) | [slot] |
void FormManager::layoutVFlow | ( | ) | [slot] |
void FormManager::breakLayout | ( | ) | [slot] |
void FormManager::adjustWidthToSmall | ( | ) | [slot] |
Resize all selected widgets to the width of the narrowest widget.
Definition at line 1317 of file formmanager.cpp.
void FormManager::adjustWidthToBig | ( | ) | [slot] |
Resize all selected widgets to the width of the widest widget.
Definition at line 1327 of file formmanager.cpp.
void FormManager::adjustHeightToSmall | ( | ) | [slot] |
Resize all selected widgets to the height of the shortest widget.
Definition at line 1337 of file formmanager.cpp.
void FormManager::adjustHeightToBig | ( | ) | [slot] |
Resize all selected widgets to the height of the tallest widget.
Definition at line 1347 of file formmanager.cpp.
void FormManager::insertWidget | ( | const QCString & | classname | ) | [slot] |
This slot is called when the user presses a "Widget" toolbar button or a "Widget" menu item. Prepares all Forms for creation of a new widget (ie changes cursor ...).
Definition at line 281 of file formmanager.cpp.
void FormManager::stopInsert | ( | ) | [slot] |
Stops the current widget insertion (ie unset the cursor ...).
Definition at line 313 of file formmanager.cpp.
void FormManager::slotPointerClicked | ( | ) | [slot] |
Slot called when the user presses 'Pointer' icon. Switch to Default mode.
Definition at line 348 of file formmanager.cpp.
void FormManager::startCreatingConnection | ( | ) | [slot] |
void FormManager::stopCreatingConnection | ( | ) | [slot] |
void FormManager::windowChanged | ( | QWidget * | w | ) | [slot] |
Calls this slot when the window activated changes (eg connect to QWorkspace::windowActivated(QWidget*)). You need to connect to this slot, it will crash otherwise.
Definition at line 469 of file formmanager.cpp.
void FormManager::deleteWidgetLater | ( | QWidget * | w | ) | [slot] |
Used to delayed widgets' deletion (in Container::deleteItem()).
Definition at line 1402 of file formmanager.cpp.
void FormManager::showFormUICode | ( | ) | [slot] |
For debugging purposes only: shows a text window containing contents of .ui XML definition of the current form.
Definition at line 1417 of file formmanager.cpp.
void FormManager::changeFont | ( | ) | [slot] |
Executes font dialog and changes it for currently selected widget(s).
- Todo:
- this modification is not added to UNDO BUFFER: do it when KoProperty::Set supports multiple selections
Definition at line 1658 of file formmanager.cpp.
void KFormDesigner::FormManager::propertySetSwitched | ( | KoProperty::Set * | set, | |
bool | forceReload = false , |
|||
const QCString & | propertyToSelect = QCString() | |||
) | [signal] |
This signal is emitted as the property set switched. If forceReload is true, the set needs to be reloaded even if it's the same as previous one.
void KFormDesigner::FormManager::dirty | ( | KFormDesigner::Form * | form, | |
bool | isDirty = true | |||
) | [signal] |
This signal is emitted when any change is made to the Form form, so it will need to be saved.
void KFormDesigner::FormManager::widgetSelected | ( | KFormDesigner::Form * | form, | |
bool | multiple | |||
) | [signal] |
Signal emitted when a normal widget is selected inside form (ie not form widget). If multiple is true, then more than one widget is selected. Use this to update actions state.
void KFormDesigner::FormManager::formWidgetSelected | ( | KFormDesigner::Form * | form | ) | [signal] |
Signal emitted when the form widget is selected inside form. Use this to update actions state.
void KFormDesigner::FormManager::noFormSelected | ( | ) | [signal] |
Signal emitted when no form (or a preview form) is selected. Use this to update actions state.
void KFormDesigner::FormManager::undoEnabled | ( | bool | enabled, | |
const QString & | text = QString::null | |||
) | [signal] |
Signal emitted when undo action activation changes. text is the full text of the action (including command name).
void KFormDesigner::FormManager::redoEnabled | ( | bool | enabled, | |
const QString & | text = QString::null | |||
) | [signal] |
Signal emitted when redo action activation changes. text is the full text of the action (including command name).
void KFormDesigner::FormManager::createFormSlot | ( | KFormDesigner::Form * | form, | |
const QString & | widget, | |||
const QString & | signal | |||
) | [signal] |
Signal emitted when the user choose a signal in 'Events' menu in context menu, or in 'Events' in property editor. The code editor should then create the slot connected to this signal.
void KFormDesigner::FormManager::connectionCreated | ( | KFormDesigner::Form * | form, | |
KFormDesigner::Connection & | connection | |||
) | [signal] |
Signal emitted when the Connection creation by drag-and-drop ends. connection is the created Connection. You should copy it, because it is deleted just after the signal is emitted.
void KFormDesigner::FormManager::connectionAborted | ( | KFormDesigner::Form * | form | ) | [signal] |
Signal emitted when the Connection creation by drag-and-drop is aborted by user.
void KFormDesigner::FormManager::autoTabStopsSet | ( | KFormDesigner::Form * | form, | |
bool | set | |||
) | [signal] |
Signal emitted when "autoTabStops" is changed.
void KFormDesigner::FormManager::aboutToDeleteForm | ( | KFormDesigner::Form * | form | ) | [signal] |
Signal emitted before the form gets finally deleted. form is still a valid pointer, but the widgets inside the form are in unknown state.
void KFormDesigner::FormManager::formCreated | ( | KFormDesigner::Form * | form | ) | [signal] |
Signal emitted when new form gets created.
void FormManager::buddyChosen | ( | int | id | ) | [protected, slot] |
Slot called when a buddy is chosen in the buddy list. Sets the label buddy.
Definition at line 997 of file formmanager.cpp.
void FormManager::menuSignalChosen | ( | int | id | ) | [protected, slot] |
Slot called when the user chooses an item in signal (or slot) menu. The createdConnection() is updated, and the connection created (for the signal menu).
Definition at line 1016 of file formmanager.cpp.
void FormManager::slotStyle | ( | ) | [protected, slot] |
Slot called when the user changes current style using combbox in toolbar or menu.
Definition at line 1204 of file formmanager.cpp.
void FormManager::initForm | ( | Form * | form | ) | [protected] |
Inits the Form, adds it to m_forms, and conects slots.
Definition at line 622 of file formmanager.cpp.
void FormManager::createLayout | ( | int | layoutType | ) | [protected] |
Function called by the "Lay out in..." menu items. It creates a layout from the currently selected widgets (that must have the same parent). Calls CreateLayoutCommand.
Definition at line 1095 of file formmanager.cpp.
void FormManager::alignWidgets | ( | int | type | ) | [protected] |
Function called by all other AlignWidgets*() function. Calls AlignWidgetsCommand.
Definition at line 1242 of file formmanager.cpp.
Member Data Documentation
bool KFormDesigner::FormManager::m_emitSelectionSignalsUpdatesPropertySet [protected] |
True if emitSelectionSignals() updates property set so showPropertySet() will not be needed in windowChanged(). False by default. Set to true in KexiFormManager.
Definition at line 435 of file formmanager.h.
The documentation for this class was generated from the following files: