libyui  3.10.0
YWidget.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YWidget.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 #ifndef YWidget_h
26 #define YWidget_h
27 
28 #include <string>
29 #include <iosfwd>
30 
31 #include "YTypes.h"
32 #include "YProperty.h"
33 #include "YUISymbols.h"
34 #include "YUIException.h"
35 #include "YChildrenManager.h"
36 #include "ImplPtr.h"
37 
38 
39 class YDialog;
40 class YWidgetID;
41 class YMacroRecorder;
42 
43 
47 
48 class YWidgetPrivate;
49 
50 
51 /**
52  * Abstract base class of all UI widgets
53  **/
54 class YWidget
55 {
56 protected:
57  /**
58  * Constructor.
59  **/
60  YWidget( YWidget * parent );
61 
62 public:
63  /**
64  * Destructor.
65  **/
66  virtual ~YWidget();
67 
68  /**
69  * Returns a descriptive name of this widget class for logging,
70  * debugging etc.
71  **/
72  virtual const char * widgetClass() const { return "YWidget"; }
73 
74  /**
75  * Returns a descriptive label of this widget instance.
76  *
77  * This default implementation returns this widget's "shortcut property"
78  * (possibly trunctated to avoid over-long texts) - the property that
79  * contains the keyboard shortcut used to activate this widget or to move
80  * the keyboard focus to it. In most cases this is this widget's label.
81  *
82  * Note: This is usually translated to the user's target language.
83  * This makes this useful for debugging only.
84  **/
85  virtual std::string debugLabel() const;
86 
87  /**
88  * Return the help text for this widget.
89  **/
90  std::string helpText() const;
91 
92  /**
93  * Set a help text for this widget.
94  *
95  * Currently, the UI does not do anything with this text but store it.
96  * Displaying the text at a convenient time is currently the application's
97  * responsibility. This may change in future versions.
98  **/
99  void setHelpText( const std::string & helpText );
100 
101 
102  //
103  // Property Management
104  //
105 
106  /**
107  * Return this class's property set.
108  * This also initializes the property upon the first call.
109  *
110  * Derived classes should reimplement this.
111  *
112  * Remember to add the base class's property set to your own
113  * in reimplemented versions, e.g.:
114  *
115  * const YPropertySet &
116  * MyWidgetClass::propertySet()
117  * {
118  * static YPropertySet propSet;
119  *
120  * if ( propSet.isEmpty() )
121  * {
122  * // Add properties for the derived class
123  * propSet.add( YProperty( YUIProperty_Value, YStringProperty ) );
124  * propSet.add( YProperty( YUIProperty_Label, YStringProperty ) );
125  *
126  * // Add base class properties
127  * propSet.add( YWidget::propertySet() );
128  * }
129  *
130  * return propSet;
131  * }
132  *
133  * Otherwise the base class's properties will not be available in the
134  * derived class. It is also important that the base class's properties
135  * are added after those of the derived class so the derived class's
136  * properties have priority over those of the base class.
137  **/
138  virtual const YPropertySet & propertySet();
139 
140  /**
141  * Set a property. Derived classes need to implement this.
142  *
143  * This method may throw exceptions, for example
144  * - if there is no property with that name
145  * - if the expected type and the type mismatch
146  * - if the value is out of range
147  *
148  * This function returns 'true' if the value was successfully set and
149  * 'false' if that value requires special handling (not in error cases:
150  * those are covered by exceptions).
151  **/
152  virtual bool setProperty( const std::string & propertyName,
153  const YPropertyValue & val );
154 
155  /**
156  * Get a property. Derived classes need to implement this.
157  *
158  * This method may throw exceptions, for example
159  * - if there is no property with that name
160  **/
161  virtual YPropertyValue getProperty( const std::string & propertyName );
162 
163 
164  //
165  // Children Management
166  //
167  // Even though many widget classes are leaf classes and thus cannot have
168  // children by design, it makes sense to have the children management in
169  // this base class: Then descending down a widget tree is transparent to
170  // the outside without the need to check for container widget classes,
171  // casting to those container widget classes and only calling child
172  // management methods in that case.
173  //
174  // By default, YWidget and derived classes have a YWidgetChildrenRejector
175  // as their children manager, i.e. any attempt to add a child will result
176  // in a YUITooManyChildrenException.
177  //
178  // Derived classes that can (semantically) handle children should set the
179  // children manager to one of
180  //
181  // - YWidgetChildrenManager: handles any number of child widgets;
182  // useful for VBox / HBox
183  //
184  // - YSingleWidgetChildManager: handles exactly one child
185  // useful for widgets like Alignment, Frame, Dialog
186  //
187 
188 
189  /**
190  * Returns 'true' if this widget has any children.
191  **/
192  bool hasChildren() const
193  { return childrenManager()->hasChildren(); }
194 
195  /**
196  * Returns the first child or 0 if there is none.
197  * Useful mostly for children managers that handle only one child.
198  **/
199  YWidget * firstChild() const
200  { return childrenManager()->firstChild(); }
201 
202  /**
203  * Returns the last child or 0 if there is none.
204  **/
205  YWidget * lastChild() const
206  { return childrenManager()->lastChild(); }
207 
208  /**
209  * Return an iterator that points to the first child or to childrenEnd() if
210  * there are no children.
211  **/
212  YWidgetListIterator childrenBegin() const
213  { return childrenManager()->begin(); }
214 
215  /**
216  * Return an interator that points after the last child.
217  **/
218  YWidgetListIterator childrenEnd() const
219  { return childrenManager()->end(); }
220 
221  /**
222  * Return a const iterator that points to the first child or to childrenEnd() if
223  * there are no children.
224  **/
225  YWidgetListConstIterator childrenConstBegin() const
226  { return childrenManager()->begin(); }
227 
228  /**
229  * Return a const interator that points after the last child.
230  **/
231  YWidgetListConstIterator childrenConstEnd() const
232  { return childrenManager()->end(); }
233 
234  /**
235  * A helper for the range-based "for" loop
236  * @return Iterator pointing to the beginning of the children list
237  */
238  YWidgetListIterator begin()
239  { return childrenBegin(); }
240 
241  /**
242  * A helper for the range-based "for" loop
243  * @return Iterator pointing to the end of the children list
244  */
245  YWidgetListIterator end()
246  { return childrenEnd(); }
247 
248  /**
249  * Returns the current number of children.
250  **/
251  int childrenCount() const { return childrenManager()->count(); }
252 
253  /**
254  * Checks if 'child' is a (direct!) child of this widget.
255  **/
256  bool contains( YWidget * child ) const
257  { return childrenManager()->contains( child ); }
258 
259  /**
260  * Add a new child.
261  *
262  * This may throw exceptions if more children are added than this widget
263  * can handle.
264  **/
265  virtual void addChild( YWidget * child );
266 
267  /**
268  * Remove a child. This only removes the child from the children manager's
269  * list; it does not delete it.
270  **/
271  virtual void removeChild( YWidget * child );
272 
273  /**
274  * Delete all children and remove them from the children manager's list.
275  **/
276  void deleteChildren();
277 
278  /**
279  * Return this widget's parent or 0 if it doesn't have a parent.
280  **/
281  YWidget * parent() const;
282 
283  /**
284  * Return 'true' if this widget has a parent, 'false' if not.
285  **/
286  bool hasParent() const;
287 
288  /**
289  * Set this widget's parent.
290  **/
291  void setParent( YWidget * newParent );
292 
293  /**
294  * Traverse up the widget hierarchy and find the dialog this widget belongs
295  * to. Returns 0 if there is none.
296  **/
297  YDialog * findDialog();
298 
299  /**
300  * Recursively find a widget by its ID.
301  * If there is no widget with that ID, this function throws a
302  * YUIWidgetNotFoundException if 'doThrow' is 'true'. It returns 0 if
303  * 'doThrow' is 'false'.
304  **/
305  YWidget * findWidget( YWidgetID * id, bool doThrow = true ) const;
306 
307 
308  //
309  // Geometry Management
310  //
311 
312  /**
313  * Preferred width of the widget.
314  *
315  * Derived classes are required to implement this.
316  **/
317  virtual int preferredWidth() = 0;
318 
319  /**
320  * Preferred height of the widget.
321  *
322  * Derived classes are required to implement this.
323  **/
324  virtual int preferredHeight() = 0;
325 
326  /**
327  * Preferred size of the widget in the specified dimension.
328  * This default implementation calls preferredWidth() or preferredHeight()
329  * which makes sense for most cases.
330  *
331  * Derived classes can reimplement this, but this is discouraged.
332  *
333  * Note: Even in that case, preferredWidth() and preferredHeight() need to
334  * be implemented, but they might then call preferredSize().
335  **/
336  virtual int preferredSize( YUIDimension dim );
337 
338  /**
339  * Set the new size of the widget.
340  *
341  * Layout manager widgets (like YLayoutBox) call this during geometry
342  * management after all widgets are queried about their preferred widths
343  * and heights. Depending on layout constraints, widgets might be resized
344  * beyond or below their preferred size.
345  *
346  * The sizes passed here are not meant to affect any future
347  * preferredWidth() or preferredHeight() calls; they are just the outcome
348  * of all kinds of compromises (too little screen space or too much) for
349  * the current geometry management calculation.
350  *
351  * Derived classes are required to implement this function.
352  **/
353  virtual void setSize( int newWidth, int newHeight ) = 0;
354 
355 
356  //
357  // Misc
358  //
359 
360 
361  /**
362  * Checks whether or not this object is valid. This is to enable
363  * dangling pointer error checking (i.e. this object is already
364  * deallocated, but a pointer to it is still in use).
365  *
366  * See also the YUI_CHECK_WIDGET() macro in YUIException.h
367  **/
368  bool isValid() const;
369 
370  /**
371  * Check if this widget is in the process of being destroyed.
372  **/
373  bool beingDestroyed() const;
374 
375  /**
376  * Return a pointer to the underlying toolkit's (Qt, ...) widget
377  * representing this abstract UI widget.
378  **/
379  void * widgetRep() const;
380 
381  /**
382  * Set the pointer to the underlying toolkit's (Qt, ...) widget
383  * representing this abstract UI widget.
384  *
385  * This pointer might be useful for derived UIs to store a counterpart of
386  * the toolkit widget in each YWidget. The abstract UI does not need that,
387  * though; this is purely for the convenience of derived UIs. All the
388  * abstract UI ever does with that pointer is store it.
389  **/
390  void setWidgetRep( void * toolkitWidgetRep );
391 
392  /**
393  * Returns 'true' if this widget has an ID.
394  **/
395  bool hasId() const;
396 
397  /**
398  * Returns this widget's ID.
399  **/
400  YWidgetID * id() const;
401 
402  /**
403  * Set this widget's ID.
404  *
405  * The widget assumes ownership of this ID and will delete it when needed.
406  * (In the widget's destructor or when a new ID is set)
407  *
408  * Widget IDs are purely for application use. C++ applications don't need
409  * to use them; they are much better off using widget pointers. For other
410  * languages, though, that can't use C++ pointers (e.g. Ruby) it makes
411  * sense to have widget IDs to identify widgets.
412  **/
413  void setId( YWidgetID * newId_disown );
414 
415  /**
416  * Enable or disable this widget, i.e. make it accept or reject user input.
417  *
418  * Derived classes should call the base class method to update the internal
419  *"enabled" flag.
420  **/
421  virtual void setEnabled( bool enabled = true );
422 
423  /**
424  * Disable this widget (overloaded for better readability).
425  **/
426  void setDisabled() { setEnabled( false); }
427 
428  /**
429  * Returns 'true' if this widget is enabled.
430  **/
431  virtual bool isEnabled() const;
432 
433  /**
434  * This is a boolean value that determines whether the widget is resizable
435  * beyond its preferred size in the specified dimension. A selection box is
436  * stretchable in both dimensions, a push button is not stretchable by
437  * default, a frame is stretchable if its contents are stretchable. Most
438  * widgets accept a `hstretch or `vstretch option to become stretchable
439  * even when by default they are not.
440  **/
441  virtual bool stretchable( YUIDimension dim ) const;
442 
443  /**
444  * Set the stretchable state to "newStretch" regardless of any `hstretch or
445  * `vstretch options.
446  **/
447  void setStretchable( YUIDimension dim, bool newStretch );
448 
449  /**
450  * Set the stretchable state to "newStretch".
451  * `hstretch or `vstretch options may override this.
452  **/
453  void setDefaultStretchable( YUIDimension dim, bool newStretch );
454 
455  /**
456  * The weight is used in situations where all widgets can get their
457  * preferred size and yet space is available. The remaining space will be
458  * devided between all stretchable widgets according to their weights. A
459  * widget with greater weight will get more space. The default weight for
460  * all widgets is 0.
461  *
462  * Derived classes can overwrite this function, but they should call this
463  * base class function in the new function.
464  **/
465  virtual int weight( YUIDimension dim );
466 
467  /**
468  * Return whether or not the widget has a weight in the specified
469  * dimension.
470  **/
471  bool hasWeight( YUIDimension dim );
472 
473  /**
474  * Set a weight in the specified dimension.
475  **/
476  void setWeight( YUIDimension dim, int weight );
477 
478  /**
479  * Sets the Notify property
480  **/
481  void setNotify( bool notify = true );
482 
483  /**
484  * Returns whether the widget will notify, i.e. will case UserInput to
485  * return.
486  **/
487  bool notify() const;
488 
489  /**
490  * Sets the notifyContextMenu property
491  **/
492  void setNotifyContextMenu( bool notifyContextMenu = true );
493 
494  /**
495  * Returns whether the widget will send an event when the user
496  * clicks selects the context menu e.g. via right click.
497  **/
498  bool notifyContextMenu() const;
499 
500 
501  /**
502  * Returns 'true' if this widget should send key events, i.e. if it has
503  * `opt(`keyEvent) set.
504  **/
505  bool sendKeyEvents() const;
506 
507  /**
508  * Specify whether or not this widget should send key events.
509  **/
510  void setSendKeyEvents( bool doSend );
511 
512  /**
513  * Returns 'true' if a keyboard shortcut should automatically be assigned
514  * to this widget - without complaints in the log file.
515  **/
516  bool autoShortcut() const;
517 
518  /**
519  * Sets the 'autoShortcut' flag.
520  **/
521  void setAutoShortcut( bool _newAutoShortcut );
522 
523  /**
524  * Return a function key number that is assigned to this widget.
525  * (1 for F1, 2 for F2, etc.; 0 for none)
526  **/
527  int functionKey() const;
528 
529  /**
530  * Check if a function key is assigned to this widget.
531  **/
532  bool hasFunctionKey() const;
533 
534  /**
535  * Assign a function key to this widget
536  * (1 for F1, 2 for F2, etc.; 0 for none)
537  *
538  * Derived classes may want to overwrite this function, but they should
539  * call this base class function in the new function.
540  **/
541  virtual void setFunctionKey( int fkey_no );
542 
543  /**
544  * Set the keyboard focus to this widget.
545  * The default implementation just emits a warning message.
546  * Overwrite this function for all widgets that can accept the
547  * keyboard focus.
548  *
549  * This function returns true if the widget did accept the
550  * keyboard focus, and false if not.
551  **/
552  virtual bool setKeyboardFocus();
553 
554  /**
555  * Get the string of this widget that holds the keyboard shortcut, if any.
556  * Most widgets will return label().
557  *
558  * Overwrite this for widgets that can have keyboard shortcuts.
559  **/
560  virtual std::string shortcutString() const { return std::string( "" ); }
561 
562  /**
563  * Set the string of this widget that holds the keyboard shortcut, if any.
564  * Most widgets will call setLabel().
565  *
566  * Overwrite this for widgets that can have keyboard shortcuts.
567  **/
568  virtual void setShortcutString( const std::string & str );
569 
570  /**
571  * The name of the widget property that will return user input, if there is
572  * any. Widgets that do have user input (such as InputField, ComboBox,
573  * SelBox) should overwrite this methods. Widgets that are purely passive
574  * (such as Label, RichText) should not.
575  **/
576  virtual const char * userInputProperty() { return (const char *) 0; }
577 
578  /**
579  * Debugging function:
580  * Dump the widget tree from here on to the log file.
581  **/
582  void dumpWidgetTree( int indentationLevel = 0 );
583 
584  /**
585  * Debugging function:
586  * Dump the widget tree from this widget's dialog parent.
587  * If there is no such dialog parent, dump the widget tree from
588  * here on.
589  **/
590  void dumpDialogWidgetTree();
591 
592  /**
593  * Enable or disable all widgets in this widget tree.
594  **/
595  void setChildrenEnabled( bool enabled );
596 
597  //
598  // Macro Recorder Support
599  //
600 
601  /**
602  * Recursively save the user input of all child widgets to a macro
603  * recorder:
604  *
605  * All child widgets that could contain data entered by the user
606  * are requested to send their contents to the macro recorder, e.g. input
607  * fields, check boxes etc.
608  *
609  * This default implementation records this widget's user input property
610  * (the property returned by userInputProperty) and then recursively calls
611  * saveUserInput() for all child widgets. This is suitable for most cases,
612  * for container widgets as well as for leaf widgets that have no or
613  * exactly one property that needs to be recorded.
614  *
615  * Widgets that need another number of properties recorded should
616  * reimplement this method (and NOT call this default method in the new
617  * implementation).
618  **/
619  virtual void saveUserInput( YMacroRecorder *macroRecorder );
620 
621  /**
622  * Overloaded operator new to ensure widgets are always created on the
623  * heap, never on the stack.
624  *
625  * Simpler implementations of this have a tendency to be fooled by poorly
626  * implemented derived classes.
627  **/
628  void * operator new( size_t size );
629 
630 
631  // NCurses optimizations
632 
633 
634  /**
635  * In some UIs updating the screen content is an expensive operation. Use
636  * startMultipleChanges() to tell the ui that you're going to perform
637  * multiple chages to the widget. The UI may delay any screen updates
638  * until doneMultipleChanges() is called.
639  **/
640  virtual void startMultipleChanges() {}
641  virtual void doneMultipleChanges() {}
642 
643 
644 protected:
645 
646  /**
647  * Returns this widget's children manager.
648  **/
650 
651  /**
652  * Sets a new children manager for this widget. The widget assumes
653  * ownership of this children manager and will delete it when appropriate.
654  *
655  * The default children manager (a YWidgetChildrenRejector) rejects all
656  * children. This is useful for leaf widgets such as PushButton, ComboBox
657  * etc.
658  *
659  * Derived classes that can handle children might want to set the children
660  * manager to a YWidgetChildrenManager (the base class that does not reject
661  * children) or to a YSingleWidgetChildManager (the class that handles
662  * exactly one child widget).
663  **/
664  void setChildrenManager( YWidgetChildrenManager * manager );
665 
666  /**
667  * Set the "being destroyed" flag, i.e. indicate that this widget is in the
668  * process of being destroyed. The base class method already sets this, but
669  * sometimes it might be useful to call this in a derived class's
670  * destructor so certain optimizations work better.
671  *
672  * This status intentionally cannot be reverted to "not being destroyed".
673  **/
674  void setBeingDestroyed();
675 
676  /**
677  * Helper function for dumpWidgetTree():
678  * Dump one widget to the log file.
679  **/
680  void dumpWidget( YWidget *w, int indentationLevel );
681 
682 
683 private:
684 
685  /**
686  * Make this widget invalid. This operation cannot be reversed.
687  **/
688  void invalidate();
689 
690  /**
691  * Disable copy constructor.
692  **/
693  YWidget( const YWidget & other );
694 
695  /**
696  * Disable assignment operator.
697  **/
698  const YWidget & operator=( const YWidget & other );
699 
700 private:
701 
702  //
703  // Data Members
704  //
705 
706  int _magic; // should always be the first member
708  static YPropertySet _propertySet;
709  static bool _usedOperatorNew;
710 
711 
712 #include "YWidget_OptimizeChanges.h"
713 
714 };
715 
716 
717 std::ostream & operator<<( std::ostream & stream, const YWidget * widget );
718 
719 
720 #endif // YWidget_h
YWidget::parent
YWidget * parent() const
Return this widget's parent or 0 if it doesn't have a parent.
Definition: YWidget.cc:271
YWidget::deleteChildren
void deleteChildren()
Delete all children and remove them from the children manager's list.
Definition: YWidget.cc:202
YWidget::setChildrenEnabled
void setChildrenEnabled(bool enabled)
Enable or disable all widgets in this widget tree.
Definition: YWidget.cc:643
YWidget::preferredSize
virtual int preferredSize(YUIDimension dim)
Preferred size of the widget in the specified dimension.
Definition: YWidget.cc:546
YWidget::functionKey
int functionKey() const
Return a function key number that is assigned to this widget.
Definition: YWidget.cc:324
YWidget
Abstract base class of all UI widgets.
Definition: YWidget.h:54
YWidget::preferredHeight
virtual int preferredHeight()=0
Preferred height of the widget.
YWidget::end
YWidgetListIterator end()
A helper for the range-based "for" loop.
Definition: YWidget.h:245
YWidget::setSendKeyEvents
void setSendKeyEvents(bool doSend)
Specify whether or not this widget should send key events.
Definition: YWidget.cc:306
YWidget::preferredWidth
virtual int preferredWidth()=0
Preferred width of the widget.
YWidget::setShortcutString
virtual void setShortcutString(const std::string &str)
Set the string of this widget that holds the keyboard shortcut, if any.
Definition: YWidget.cc:513
YWidget::hasId
bool hasId() const
Returns 'true' if this widget has an ID.
Definition: YWidget.cc:370
YWidget::findDialog
YDialog * findDialog()
Traverse up the widget hierarchy and find the dialog this widget belongs to.
Definition: YWidget.cc:376
YWidget::childrenEnd
YWidgetListIterator childrenEnd() const
Return an interator that points after the last child.
Definition: YWidget.h:218
YChildrenRejector
Children manager that rejects all children.
Definition: YChildrenManager.h:214
YWidget::setSize
virtual void setSize(int newWidth, int newHeight)=0
Set the new size of the widget.
YWidget::addChild
virtual void addChild(YWidget *child)
Add a new child.
Definition: YWidget.cc:176
YChildrenManager::count
int count() const
Returns the number of children.
Definition: YChildrenManager.h:71
YWidget::saveUserInput
virtual void saveUserInput(YMacroRecorder *macroRecorder)
Recursively save the user input of all child widgets to a macro recorder:
Definition: YWidget.cc:719
YWidget::hasWeight
bool hasWeight(YUIDimension dim)
Return whether or not the widget has a weight in the specified dimension.
Definition: YWidget.cc:590
YWidget::id
YWidgetID * id() const
Returns this widget's ID.
Definition: YWidget.cc:355
YWidget::weight
virtual int weight(YUIDimension dim)
The weight is used in situations where all widgets can get their preferred size and yet space is avai...
Definition: YWidget.cc:578
YWidget::~YWidget
virtual ~YWidget()
Destructor.
Definition: YWidget.cc:137
YWidget::setFunctionKey
virtual void setFunctionKey(int fkey_no)
Assign a function key to this widget (1 for F1, 2 for F2, etc.
Definition: YWidget.cc:336
YWidget::setChildrenManager
void setChildrenManager(YWidgetChildrenManager *manager)
Sets a new children manager for this widget.
Definition: YWidget.cc:166
YWidget::userInputProperty
virtual const char * userInputProperty()
The name of the widget property that will return user input, if there is any.
Definition: YWidget.h:576
YPropertySet
A set of properties to check names and types against.
Definition: YProperty.h:197
YChildrenManager::hasChildren
bool hasChildren() const
Check if there are any children.
Definition: YChildrenManager.h:61
YWidget::contains
bool contains(YWidget *child) const
Checks if 'child' is a (direct!) child of this widget.
Definition: YWidget.h:256
YWidget::hasParent
bool hasParent() const
Return 'true' if this widget has a parent, 'false' if not.
Definition: YWidget.cc:278
YWidget::begin
YWidgetListIterator begin()
A helper for the range-based "for" loop.
Definition: YWidget.h:238
YWidget::autoShortcut
bool autoShortcut() const
Returns 'true' if a keyboard shortcut should automatically be assigned to this widget - without compl...
Definition: YWidget.cc:312
YWidget::childrenCount
int childrenCount() const
Returns the current number of children.
Definition: YWidget.h:251
YWidget::startMultipleChanges
virtual void startMultipleChanges()
In some UIs updating the screen content is an expensive operation.
Definition: YWidget.h:640
YWidget::hasFunctionKey
bool hasFunctionKey() const
Check if a function key is assigned to this widget.
Definition: YWidget.cc:330
YWidget::removeChild
virtual void removeChild(YWidget *child)
Remove a child.
Definition: YWidget.cc:191
YWidget::setEnabled
virtual void setEnabled(bool enabled=true)
Enable or disable this widget, i.e.
Definition: YWidget.cc:500
YWidget::beingDestroyed
bool beingDestroyed() const
Check if this widget is in the process of being destroyed.
Definition: YWidget.cc:258
YWidget::notify
bool notify() const
Returns whether the widget will notify, i.e.
Definition: YWidget.cc:534
YWidget::firstChild
YWidget * firstChild() const
Returns the first child or 0 if there is none.
Definition: YWidget.h:199
YChildrenManager::begin
ChildrenList::iterator begin()
Return an iterator that points to the first child.
Definition: YChildrenManager.h:76
YWidget::setWeight
void setWeight(YUIDimension dim, int weight)
Set a weight in the specified dimension.
Definition: YWidget.cc:584
YWidget::findWidget
YWidget * findWidget(YWidgetID *id, bool doThrow=true) const
Recursively find a widget by its ID.
Definition: YWidget.cc:607
YWidget::childrenManager
YWidgetChildrenManager * childrenManager() const
Returns this widget's children manager.
Definition: YWidget.cc:159
YWidget::sendKeyEvents
bool sendKeyEvents() const
Returns 'true' if this widget should send key events, i.e.
Definition: YWidget.cc:300
YWidget::getProperty
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
Definition: YWidget.cc:457
YWidget::setWidgetRep
void setWidgetRep(void *toolkitWidgetRep)
Set the pointer to the underlying toolkit's (Qt, ...) widget representing this abstract UI widget.
Definition: YWidget.cc:493
YWidget::setNotify
void setNotify(bool notify=true)
Sets the Notify property.
Definition: YWidget.cc:522
YChildrenManager::end
ChildrenList::iterator end()
Return an iterator that points after the last child.
Definition: YChildrenManager.h:82
ImplPtr< YWidgetPrivate >
YWidget::dumpWidget
void dumpWidget(YWidget *w, int indentationLevel)
Helper function for dumpWidgetTree(): Dump one widget to the log file.
Definition: YWidget.cc:692
YWidget::setParent
void setParent(YWidget *newParent)
Set this widget's parent.
Definition: YWidget.cc:285
YWidget::setStretchable
void setStretchable(YUIDimension dim, bool newStretch)
Set the stretchable state to "newStretch" regardless of any hstretch or vstretch options.
Definition: YWidget.cc:560
YWidget::helpText
std::string helpText() const
Return the help text for this widget.
Definition: YWidget.cc:342
YWidget::setNotifyContextMenu
void setNotifyContextMenu(bool notifyContextMenu=true)
Sets the notifyContextMenu property.
Definition: YWidget.cc:528
YChildrenManager::firstChild
T * firstChild()
Returns the first child or 0 if there is none.
Definition: YChildrenManager.h:113
YWidget::setAutoShortcut
void setAutoShortcut(bool _newAutoShortcut)
Sets the 'autoShortcut' flag.
Definition: YWidget.cc:318
YWidget::widgetClass
virtual const char * widgetClass() const
Returns a descriptive name of this widget class for logging, debugging etc.
Definition: YWidget.h:72
YWidget::isValid
bool isValid() const
Checks whether or not this object is valid.
Definition: YWidget.cc:244
YSingleChildManager
Children manager that can handle one single child (rejecting any more).
Definition: YChildrenManager.h:173
YWidgetPrivate
Definition: YWidget.cc:56
YWidget::shortcutString
virtual std::string shortcutString() const
Get the string of this widget that holds the keyboard shortcut, if any.
Definition: YWidget.h:560
YWidget::setDisabled
void setDisabled()
Disable this widget (overloaded for better readability).
Definition: YWidget.h:426
YChildrenManager::lastChild
T * lastChild()
Returns the last child or 0 if there is none.
Definition: YChildrenManager.h:119
YPropertyValue
Transport class for the value of simple properties.
Definition: YProperty.h:104
YWidget::setDefaultStretchable
void setDefaultStretchable(YUIDimension dim, bool newStretch)
Set the stretchable state to "newStretch".
Definition: YWidget.cc:566
YWidget::isEnabled
virtual bool isEnabled() const
Returns 'true' if this widget is enabled.
Definition: YWidget.cc:507
YWidgetID
Abstract base class for widget IDs.
Definition: YWidgetID.h:36
YChildrenManager::contains
bool contains(T *child) const
Check if the children list contains the specified child.
Definition: YChildrenManager.h:150
YWidget::hasChildren
bool hasChildren() const
Returns 'true' if this widget has any children.
Definition: YWidget.h:192
YWidget::dumpWidgetTree
void dumpWidgetTree(int indentationLevel=0)
Debugging function: Dump the widget tree from here on to the log file.
Definition: YWidget.cc:674
YWidget::setHelpText
void setHelpText(const std::string &helpText)
Set a help text for this widget.
Definition: YWidget.cc:348
YWidget::setId
void setId(YWidgetID *newId_disown)
Set this widget's ID.
Definition: YWidget.cc:361
YWidget::childrenBegin
YWidgetListIterator childrenBegin() const
Return an iterator that points to the first child or to childrenEnd() if there are no children.
Definition: YWidget.h:212
YMacroRecorder
Abstract base class for macro recorders.
Definition: YMacroRecorder.h:38
YWidget::dumpDialogWidgetTree
void dumpDialogWidgetTree()
Debugging function: Dump the widget tree from this widget's dialog parent.
Definition: YWidget.cc:663
YWidget::childrenConstEnd
YWidgetListConstIterator childrenConstEnd() const
Return a const interator that points after the last child.
Definition: YWidget.h:231
YWidget::YWidget
YWidget(YWidget *parent)
Constructor.
Definition: YWidget.cc:106
YWidget::stretchable
virtual bool stretchable(YUIDimension dim) const
This is a boolean value that determines whether the widget is resizable beyond its preferred size in ...
Definition: YWidget.cc:572
YWidget::debugLabel
virtual std::string debugLabel() const
Returns a descriptive label of this widget instance.
Definition: YWidget.cc:223
YWidget::childrenConstBegin
YWidgetListConstIterator childrenConstBegin() const
Return a const iterator that points to the first child or to childrenEnd() if there are no children.
Definition: YWidget.h:225
YWidget::widgetRep
void * widgetRep() const
Return a pointer to the underlying toolkit's (Qt, ...) widget representing this abstract UI widget.
Definition: YWidget.cc:486
YWidget::setBeingDestroyed
void setBeingDestroyed()
Set the "being destroyed" flag, i.e.
Definition: YWidget.cc:264
YWidget::setProperty
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
Definition: YWidget.cc:432
YTypes.h
YChildrenManager
Abstract base template class for children management, such as child widgets.
Definition: YChildrenManager.h:37
YWidget::lastChild
YWidget * lastChild() const
Returns the last child or 0 if there is none.
Definition: YWidget.h:205
YWidget::setKeyboardFocus
virtual bool setKeyboardFocus()
Set the keyboard focus to this widget.
Definition: YWidget.cc:599
YWidget::notifyContextMenu
bool notifyContextMenu() const
Returns whether the widget will send an event when the user clicks selects the context menu e....
Definition: YWidget.cc:540
YDialog
A window in the desktop environment.
Definition: YDialog.h:47
YWidget::propertySet
virtual const YPropertySet & propertySet()
Return this class's property set.
Definition: YWidget.cc:395