libtdepim

#include <kwidgetlister.h>

Inheritance diagram for KWidgetLister:
ActionEditWidget ConditionEditWidget

Signals

void widgetAdded ()
 
void widgetAdded (TQWidget *)
 
void widgetRemoved ()
 
void clearWidgets ()
 

Public Member Functions

 KWidgetLister (int minWidgets=1, int maxWidgets=8, TQWidget *parent=0, const char *name=0)
 

Protected Slots

virtual void slotMore ()
 
virtual void slotFewer ()
 
virtual void slotClear ()
 

Protected Member Functions

virtual void addWidgetAtEnd (TQWidget *w=0)
 
virtual void removeLastWidget ()
 
virtual void clearWidget (TQWidget *)
 
virtual TQWidget * createWidget (TQWidget *parent)
 
virtual void setNumberOfShownWidgetsTo (int aNum)
 

Protected Attributes

TQPtrList< TQWidget > mWidgetList
 
int mMinWidgets
 
int mMaxWidgets
 

Detailed Description

Widget that manages a list of other widgets (incl.

'more', 'fewer' and 'clear' buttons).

Simple widget that nonetheless does a lot of the dirty work for the filter edit widgets (KMSearchPatternEdit and KMFilterActionEdit). It provides a growable and shrinkable area where widget may be displayed in rows. Widgets can be added by hitting the provided 'More' button, removed by the 'Fewer' button and cleared (e.g. reset, if an derived class implements that and removed for all but mMinWidgets).

To use this widget, derive from it with the template changed to the type of widgets this class should list. Then reimplement addWidgetAtEnd, removeLastWidget, calling the original implementation as necessary. Instantiate an object of the class and put it in your dialog.

Author
Marc Mutz Marc@.nosp@m.Mutz.nosp@m..com
See also
KMSearchPatternEdit::WidgetLister KMFilterActionEdit::WidgetLister

Definition at line 65 of file kwidgetlister.h.

Member Function Documentation

◆ addWidgetAtEnd()

void KWidgetLister::addWidgetAtEnd ( TQWidget *  w = 0)
protectedvirtual

Adds a single widget.

Doesn't care if there are already mMaxWidgets on screen and whether it should enable/disable any controls. It simply does what it is asked to do. You want to reimplement this method if you want to initialize the the widget when showing it on screen. Make sure you call this implementaion, though, since you cannot put the widget on screen from derived classes (mLayout is private). Make sure the parent of the TQWidget to add is this KWidgetLister.

Definition at line 124 of file kwidgetlister.cpp.

◆ clearWidget()

void KWidgetLister::clearWidget ( TQWidget *  )
protectedvirtual

Called to clear a given widget.

The default implementation does nothing.

Reimplemented in ActionEditWidget, and ConditionEditWidget.

Definition at line 145 of file kwidgetlister.cpp.

◆ clearWidgets

void KWidgetLister::clearWidgets ( )
signal

This signal is emitted whenever the clear button is clicked.

◆ createWidget()

TQWidget * KWidgetLister::createWidget ( TQWidget *  parent)
protectedvirtual

Because QT 2.x does not support signals/slots in template classes, we are forced to emulate this by forcing the implementers of subclasses of KWidgetLister to reimplement this function which replaces the "@p new @p T" call.

Reimplemented in ActionEditWidget, and ConditionEditWidget.

Definition at line 149 of file kwidgetlister.cpp.

◆ removeLastWidget()

void KWidgetLister::removeLastWidget ( )
protectedvirtual

Removes a single (always the last) widget.

Doesn't care if there are still only mMinWidgets left on screen and whether it should enable/disable any controls. It simply does what it is asked to do. You want to reimplement this method if you want to save the the widget's state before removing it from screen. Make sure you call this implementaion, though, since you should not remove the widget from screen from derived classes.

Definition at line 136 of file kwidgetlister.cpp.

◆ setNumberOfShownWidgetsTo()

void KWidgetLister::setNumberOfShownWidgetsTo ( int  aNum)
protectedvirtual

Sets the number of widgets on scrren to exactly aNum.

Doesn't check if aNum is inside the range [mMinWidgets,mMaxWidgets].

Definition at line 154 of file kwidgetlister.cpp.

◆ slotClear

void KWidgetLister::slotClear ( )
protectedvirtualslot

Called whenever the user clicks on the 'clear' button.

Reimplementations should call this method, because this implementation does all the dirty work with removing all but mMinWidgets widgets from the layout and enabling/disabling the control buttons.

Definition at line 110 of file kwidgetlister.cpp.

◆ slotFewer

void KWidgetLister::slotFewer ( )
protectedvirtualslot

Called whenever the user clicks on the 'fewer' button.

Reimplementations should call this method, because this implementation does all the dirty work with removing the widgets from the layout (through removeLastWidget) and enabling/disabling the control buttons.

Definition at line 99 of file kwidgetlister.cpp.

◆ slotMore

void KWidgetLister::slotMore ( )
protectedvirtualslot

Called whenever the user clicks on the 'more' button.

Reimplementations should call this method, because this implementation does all the dirty work with adding the widgets to the layout (through addWidgetAtEnd) and enabling/disabling the control buttons.

Definition at line 88 of file kwidgetlister.cpp.

◆ widgetAdded [1/2]

void KWidgetLister::widgetAdded ( )
signal

This signal is emitted whenever a widget was added.

◆ widgetAdded [2/2]

void KWidgetLister::widgetAdded ( TQWidget *  )
signal

This signal is emitted whenever a widget was added.

◆ widgetRemoved

void KWidgetLister::widgetRemoved ( )
signal

This signal is emitted whenever a widget was removed.

Member Data Documentation

◆ mMaxWidgets

int KWidgetLister::mMaxWidgets
protected

The maximum number of widgets that are to be shown on screen.

Definition at line 132 of file kwidgetlister.h.

◆ mMinWidgets

int KWidgetLister::mMinWidgets
protected

The minimum number of widgets that are to stay on screen.

Definition at line 130 of file kwidgetlister.h.

◆ mWidgetList

TQPtrList<TQWidget> KWidgetLister::mWidgetList
protected

The list of widgets.

Note that this list is set to auto-delete, meaning that widgets that are removed from the screen by either slotFewer or slotClear will be destroyed!

Definition at line 128 of file kwidgetlister.h.


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