kexi

#include <form.h>

Public Slots

void changeName (const TQCString &oldname, const TQCString &newname)
void setSelectedWidget (TQWidget *selected, bool add=false, bool dontRaise=false, bool moreWillBeSelected=false)
void unSelectWidget (TQWidget *w)
void selectFormWidget ()
void clearSelection ()

Signals

void selectionChanged (TQWidget *w, bool add, bool moreWillBeSelected=false)
void childAdded (ObjectTreeItem *it)
void childRemoved (ObjectTreeItem *it)
void destroying ()

Public Member Functions

 Form (WidgetLibrary *library, const char *name=0, bool designMode=true)
WidgetLibrary * library () const
void createToplevel (TQWidget *container, FormWidget *formWidget=0, const TQCString &classname="TQWidget")
Container * toplevelContainer () const
FormWidget * formWidget () const
ObjectTree * objectTree () const
TQWidget * widget () const
Container * activeContainer ()
Container * parentContainer (TQWidget *w=0)
ObjectTreeItem * commonParentContainer (WidgetList *wlist)
WidgetList * selectedWidgets () const
TQWidget * selectedWidget () const
void emitActionSignals (bool withUndoAction=true)
void emitSelectionSignals ()
void setInteractiveMode (bool interactive)
bool interactiveMode () const
void setDesignMode (bool design)
bool designMode () const
bool isModified ()
int gridSize ()
int defaultMargin ()
int defaultSpacing ()
void emitChildAdded (ObjectTreeItem *item)
void emitChildRemoved (ObjectTreeItem *item)
TQString filename () const
void setFilename (const TQString &file)
KCommandHistory * commandHistory () const
ConnectionBuffer * connectionBuffer () const
PixmapCollection * pixmapCollection () const
void addCommand (KCommand *command, bool execute)
void clearCommandHistory ()
ObjectTreeList * tabStops () const
ObjectTreeListIterator tabStopsIterator () const
void updateTabStopsOrder ()
void addWidgetToTabStops (ObjectTreeItem *it)
bool autoTabStops () const
void setAutoTabStops (bool autoTab)
void autoAssignTabStops ()
ResizeHandleSet * resizeHandlesForWidget (TQWidget *w)
TQMap< TQCString, TQString > * headerProperties () const
uint formatVersion () const
void setFormatVersion (uint ver)
uint originalFormatVersion () const
void setOriginalFormatVersion (uint ver)

Protected Slots

void formDeleted ()
void emitUndoEnabled ()
void emitRedoEnabled ()
void slotCommandExecuted ()
void slotFormRestored ()

Protected Member Functions

void setConnectionBuffer (ConnectionBuffer *b)
void setFormWidget (FormWidget *w)

Friends

class FormManager
class FormWidget
class ConnectionDialog

Detailed Description

A simple class representing a form.

This class represents one form and holds the corresponding ObjectTree and Containers. It takes care of widget selection and pasting widgets.

Definition at line 135 of file form.h.

Constructor & Destructor Documentation

◆ Form()

Form::Form ( WidgetLibrary * library,
const char * name = 0,
bool designMode = true )

Creates a simple Form, child of the FormManager manager.

Definition at line 91 of file form.cpp.

◆ ~Form()

Form::~Form ( )

Definition at line 106 of file form.cpp.

Member Function Documentation

◆ activeContainer()

Container * Form::activeContainer ( )
Returns
A pointer to the currently active Container, ie the parent Container for a simple widget, and the widget's Container if it is itself a container.

Definition at line 151 of file form.cpp.

◆ addCommand()

void Form::addCommand ( KCommand * command,
bool execute )

Adds a widget in the form's command history. Please use it instead of calling directly actionCollection()->addCommand().

Definition at line 401 of file form.cpp.

◆ addWidgetToTabStops()

void Form::addWidgetToTabStops ( ObjectTreeItem * it)

Adds the widget at the end of tabstops list. Called on widget creation.

Definition at line 455 of file form.cpp.

◆ autoAssignTabStops()

void Form::autoAssignTabStops ( )

Tells the Form to reassign the tab stops because the widget layout has changed (called for example before saving or displaying the tab order dialog). Automatically sorts widget from the top-left to bottom-right corner. Widget can be grouped with containers. In paticular, for tab widgets, child widgets should ordered by parent tab's order.

We automatically sort widget from the top-left to bottom-right corner

Todo
Handle RTL layout (ie from top-right to bottom-left)

Definition at line 507 of file form.cpp.

◆ autoTabStops()

bool KFormDesigner::Form::autoTabStops ( ) const
inline
Returns
True if the Form automatically handles tab stops.

Definition at line 279 of file form.h.

◆ changeName

void Form::changeName ( const TQCString & oldname,
const TQCString & newname )
slot

This slot is called when the name of a widget was changed in Property Editor. It renames the ObjectTreeItem associated to this widget.

Definition at line 361 of file form.cpp.

◆ childAdded

This signal is emitted when a new widget is created, to update ObjectTreeView. it is the ObjectTreeItem representing this new widget.

◆ childRemoved

This signal is emitted when a widget is deleted, to update ObjectTreeView. it is the ObjectTreeItem representing this deleted widget.

◆ clearCommandHistory()

void Form::clearCommandHistory ( )

Clears form's command history.

Definition at line 411 of file form.cpp.

◆ clearSelection

void Form::clearSelection ( )
slot

Definition at line 302 of file form.cpp.

◆ commandHistory()

KCommandHistory * KFormDesigner::Form::commandHistory ( ) const
inline

Definition at line 253 of file form.h.

◆ commonParentContainer()

ObjectTreeItem * Form::commonParentContainer ( WidgetList * wlist)
Returns
The Container which is a parent of all widgets in wlist. Used by activeContainer(), and to find where to paste widgets when multiple widgets are selected.

Definition at line 171 of file form.cpp.

◆ connectionBuffer()

ConnectionBuffer * KFormDesigner::Form::connectionBuffer ( ) const
inline

Definition at line 254 of file form.h.

◆ createToplevel()

void Form::createToplevel ( TQWidget * container,
FormWidget * formWidget = 0,
const TQCString & classname = "TQWidget" )

Creates a toplevel widget out of another widget. container will become the Form toplevel widget, will be associated to an ObjectTree and so on.

TQWidget *toplevel = new TQWidget(this);
form->createToplevel(toplevel);

todo: copy caption in Kexi from object's caption

Definition at line 127 of file form.cpp.

◆ defaultMargin()

Returns
the default margin for all the layout inside this Form.

Definition at line 235 of file form.h.

◆ defaultSpacing()

Returns
the default spacing for all the layout inside this Form.

Definition at line 238 of file form.h.

◆ designMode()

bool KFormDesigner::Form::designMode ( ) const
inline
Returns
The actual mode of the Form.

Definition at line 226 of file form.h.

◆ destroying

This signal emitted when Form is about to be destroyed.

◆ emitActionSignals()

void Form::emitActionSignals ( bool withUndoAction = true)

Emits the action signals, and optionaly the undo/redo related signals if withUndoAction == true. See FormManager for signals description.

Definition at line 311 of file form.cpp.

◆ emitChildAdded()

void Form::emitChildAdded ( ObjectTreeItem * item)

This function is used by ObjectTree to emit childAdded() signal (as it is not a TQObject).

Definition at line 385 of file form.cpp.

◆ emitChildRemoved()

void Form::emitChildRemoved ( ObjectTreeItem * item)

This function is used by ObjectTree to emit childRemoved() signal (as it is not a TQObject).

Definition at line 392 of file form.cpp.

◆ emitRedoEnabled

void Form::emitRedoEnabled ( )
protectedslot

Definition at line 437 of file form.cpp.

◆ emitSelectionSignals()

void Form::emitSelectionSignals ( )

Emits again all signal related to selection (ie Form::selectionChanged()). Called eg when the user has the focus again.

Definition at line 334 of file form.cpp.

◆ emitUndoEnabled

void Form::emitUndoEnabled ( )
protectedslot

Definition at line 429 of file form.cpp.

◆ filename()

TQString KFormDesigner::Form::filename ( ) const
inline
Returns
The filename of the UI file this Form was saved to, or TQString() if the Form hasn't be saved yet.

Definition at line 248 of file form.h.

◆ formatVersion()

uint Form::formatVersion ( ) const
Returns
format version number for this form. For new forms it is equal to KFormDesigner::version().

Definition at line 572 of file form.cpp.

◆ formDeleted

void Form::formDeleted ( )
protectedslot

This slot is called when the toplevel widget of this Form is deleted (ie the window closed) so that the Form gets deleted at the same time.

Definition at line 345 of file form.cpp.

◆ formWidget()

Returns
the FormWidget that holds this Form

Definition at line 164 of file form.h.

◆ gridSize()

Returns
the distance between two dots in the form background.
Todo
make gridSize configurable at global level

Definition at line 232 of file form.h.

◆ headerProperties()

TQMap< TQCString, TQString > * KFormDesigner::Form::headerProperties ( ) const
inline

A set of value/key pairs provided to be stored as attributes in <kfd:customHeader/> XML element (saved as a first child of <UI> element).

Definition at line 309 of file form.h.

◆ interactiveMode()

bool KFormDesigner::Form::interactiveMode ( ) const
inline
Returns
true if the Form is being updated by the user, ie the created widget were drawn on the Form.
false if the Form is being updated by the program, ie the widget are created by FormIO, and so composed widgets should not be populated automatically (such as TQTabWidget).

Definition at line 218 of file form.h.

◆ isModified()

bool KFormDesigner::Form::isModified ( )
inline

Definition at line 228 of file form.h.

◆ library()

Returns
A pointer to the WidgetLibrary supporting this form.

Definition at line 147 of file form.h.

◆ objectTree()

Returns
a pointer to this form's ObjectTree.

Definition at line 167 of file form.h.

◆ originalFormatVersion()

uint Form::originalFormatVersion ( ) const
Returns
original format version number for this form (as loaded from .ui XML string) For new forms it is equal to KFormDesigner::version().

Definition at line 581 of file form.cpp.

◆ parentContainer()

Container * Form::parentContainer ( TQWidget * w = 0)
Returns
A pointer to the parent Container of the currently selected widget. It is the same as activeContainer() for a simple widget, but unlike this function it will also return the parent Container if the widget itself is a Container.

Definition at line 196 of file form.cpp.

◆ pixmapCollection()

PixmapCollection * KFormDesigner::Form::pixmapCollection ( ) const
inline

Definition at line 255 of file form.h.

◆ resizeHandlesForWidget()

ResizeHandleSet * Form::resizeHandlesForWidget ( TQWidget * w)

Internal: called by ResizeHandle when mouse move event causes first resize handle's dragging. As a result, current widget's editing (if any) is finished - see WidgetFactory::resetEditor().

Definition at line 283 of file form.cpp.

◆ selectedWidget()

TQWidget * KFormDesigner::Form::selectedWidget ( ) const
inline
Returns
currently selected widget in this form, or 0 if there is no widget selected or more than one widget selected.
See also
selectedWidgets()

Definition at line 197 of file form.h.

◆ selectedWidgets()

Returns
the list of currently selected widgets in this form

Definition at line 192 of file form.h.

◆ selectFormWidget

void Form::selectFormWidget ( )
slot

Sets the form widget (it will be uniquely selected widget).

Definition at line 296 of file form.cpp.

◆ selectionChanged

void KFormDesigner::Form::selectionChanged ( TQWidget * w,
bool add,
bool moreWillBeSelected = false )
signal

This signal is emitted by setSelectedWidget() when user selects a new widget, to update both Property Editor and ObjectTreeView. w is the newly selected widget.

◆ setAutoTabStops()

void KFormDesigner::Form::setAutoTabStops ( bool autoTab)
inline

If autoTab is true, then the Form will automatically handle tab stops, and the "Edit Tab Order" dialog will be disabled. The tab widget will be set from the top-left to the bottom-right corner.
If \ autoTab is false, then it's up to the user to change tab stops (which are by default in order of creation).

Definition at line 286 of file form.h.

◆ setConnectionBuffer()

void KFormDesigner::Form::setConnectionBuffer ( ConnectionBuffer * b)
inlineprotected

Definition at line 384 of file form.h.

◆ setDesignMode()

void Form::setDesignMode ( bool design)

If design is true, the Form is in Design Mode (by default). If design is false, then the Form is in Preview Mode, so the ObjectTree and the Containers are removed.

Definition at line 214 of file form.cpp.

◆ setFilename()

void KFormDesigner::Form::setFilename ( const TQString & file)
inline

Sets the filename of this Form to filename.

Definition at line 251 of file form.h.

◆ setFormatVersion()

void Form::setFormatVersion ( uint ver)

Definition at line 577 of file form.cpp.

◆ setFormWidget()

void Form::setFormWidget ( FormWidget * w)
protected

Definition at line 591 of file form.cpp.

◆ setInteractiveMode()

void KFormDesigner::Form::setInteractiveMode ( bool interactive)
inline

Sets the Form interactivity mode. Form is not interactive when pasting widgets, or loading a Form.

Definition at line 210 of file form.h.

◆ setOriginalFormatVersion()

void Form::setOriginalFormatVersion ( uint ver)

Definition at line 586 of file form.cpp.

◆ setSelectedWidget

void Form::setSelectedWidget ( TQWidget * selected,
bool add = false,
bool dontRaise = false,
bool moreWillBeSelected = false )
slot

Sets selected to be the selected widget of this Form. If add is true, the formerly selected widget is still selected, and the new one is just added. If false, selected replace the actually selected widget. The form widget is always selected alone. moreWillBeSelected indicates whether more widgets will be selected soon (so for multiselection we should not update the property pane before the last widget is selected)

Definition at line 237 of file form.cpp.

◆ slotCommandExecuted

void Form::slotCommandExecuted ( )
protectedslot

This slot is called when a command is executed. The undo/redo signals are emitted to update actions.

Definition at line 419 of file form.cpp.

◆ slotFormRestored

void Form::slotFormRestored ( )
protectedslot

This slot is called when form is restored, ie when the user has undone all actions. The form modified flag is updated, and FormManager::dirty() is called.

Definition at line 445 of file form.cpp.

◆ tabStops()

Returns
A pointer to this Form tabstops list : it contains all the widget that can have focus ( ie no labels, etc) in the order of the tabs.

Definition at line 267 of file form.h.

◆ tabStopsIterator()

ObjectTreeListIterator KFormDesigner::Form::tabStopsIterator ( ) const
inline

Definition at line 269 of file form.h.

◆ toplevelContainer()

Returns
the toplevel Container or 0 if this is a preview Form or createToplevel() has not been called yet.

Definition at line 161 of file form.h.

◆ unSelectWidget

void Form::unSelectWidget ( TQWidget * w)
slot

Unselects the widget w. Te widget is removed from the Cntainer 's list and its resizeHandle is removed.

Definition at line 289 of file form.cpp.

◆ updateTabStopsOrder()

void Form::updateTabStopsOrder ( )

Called (e.g. by KexiDBForm) when certain widgets can have updated focusPolicy properties these having no TabFocus flags set are removed from tabStops() list.

Definition at line 480 of file form.cpp.

◆ widget()

TQWidget * Form::widget ( ) const
Returns
the form's toplevel widget, or 0 if designMode() == false.

Definition at line 114 of file form.cpp.

◆ ConnectionDialog

friend class ConnectionDialog
friend

Definition at line 393 of file form.h.

◆ FormManager

friend class FormManager
friend

Definition at line 391 of file form.h.

◆ FormWidget

friend class FormWidget
friend

Definition at line 392 of file form.h.


The documentation for this class was generated from the following files: