| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: pickerbase.h |
| 3 | // Purpose: interface of wxPickerBase |
| 4 | // Author: wxWidgets team |
| 5 | // RCS-ID: $Id$ |
| 6 | // Licence: wxWindows license |
| 7 | ///////////////////////////////////////////////////////////////////////////// |
| 8 | |
| 9 | /** |
| 10 | @class wxPickerBase |
| 11 | |
| 12 | Base abstract class for all pickers which support an auxiliary text control. |
| 13 | |
| 14 | This class handles all positioning and sizing of the text control like a |
| 15 | an horizontal wxBoxSizer would do, with the text control on the left of the |
| 16 | picker button. |
| 17 | |
| 18 | The proportion (see wxSizer documentation for more info about proportion values) |
| 19 | of the picker control defaults to 1 when there isn't a text control associated |
| 20 | (see @c wxPB_USE_TEXTCTRL style) and to 0 otherwise. |
| 21 | |
| 22 | @beginStyleTable |
| 23 | @style{wxPB_USE_TEXTCTRL} |
| 24 | Creates a text control to the left of the picker which is |
| 25 | completely managed by this wxPickerBase class. |
| 26 | @endStyleTable |
| 27 | |
| 28 | @library{wxcore} |
| 29 | @category{pickers} |
| 30 | |
| 31 | @see wxColourPickerCtrl |
| 32 | */ |
| 33 | class wxPickerBase : public wxControl |
| 34 | { |
| 35 | public: |
| 36 | /** |
| 37 | Returns the margin (in pixel) between the picker and the text control. |
| 38 | |
| 39 | This function can be used only when HasTextCtrl() returns @true. |
| 40 | */ |
| 41 | int GetInternalMargin() const; |
| 42 | |
| 43 | /** |
| 44 | Returns the proportion value of the picker. |
| 45 | */ |
| 46 | int GetPickerCtrlProportion() const; |
| 47 | |
| 48 | /** |
| 49 | Returns a pointer to the text control handled by this window or @NULL if the |
| 50 | @c wxPB_USE_TEXTCTRL style was not specified when this control was created. |
| 51 | |
| 52 | @remarks |
| 53 | The contents of the text control could be containing an invalid |
| 54 | representation of the entity which can be chosen through the picker |
| 55 | (e.g. the user entered an invalid colour syntax because of a typo). |
| 56 | Thus you should never parse the content of the textctrl to get the |
| 57 | user's input; rather use the derived-class getter |
| 58 | (e.g. wxColourPickerCtrl::GetColour(), wxFilePickerCtrl::GetPath(), etc). |
| 59 | */ |
| 60 | wxTextCtrl* GetTextCtrl(); |
| 61 | |
| 62 | /** |
| 63 | Returns the proportion value of the text control. |
| 64 | |
| 65 | This function can be used only when HasTextCtrl() returns @true. |
| 66 | */ |
| 67 | int GetTextCtrlProportion() const; |
| 68 | |
| 69 | /** |
| 70 | Returns @true if this window has a valid text control (i.e. if the @c |
| 71 | wxPB_USE_TEXTCTRL style was given when creating this control). |
| 72 | */ |
| 73 | bool HasTextCtrl() const; |
| 74 | |
| 75 | /** |
| 76 | Returns @true if the picker control is growable. |
| 77 | */ |
| 78 | bool IsPickerCtrlGrowable() const; |
| 79 | |
| 80 | /** |
| 81 | Returns @true if the text control is growable. |
| 82 | |
| 83 | This function can be used only when HasTextCtrl() returns @true. |
| 84 | */ |
| 85 | bool IsTextCtrlGrowable() const; |
| 86 | |
| 87 | /** |
| 88 | Sets the margin (in pixel) between the picker and the text control. |
| 89 | |
| 90 | This function can be used only when HasTextCtrl() returns @true. |
| 91 | */ |
| 92 | void SetInternalMargin(int margin); |
| 93 | |
| 94 | /** |
| 95 | Sets the picker control as growable when @c grow is @true. |
| 96 | */ |
| 97 | void SetPickerCtrlGrowable(bool grow = true); |
| 98 | |
| 99 | /** |
| 100 | Sets the proportion value of the picker. |
| 101 | |
| 102 | Look at the detailed description of wxPickerBase for more info. |
| 103 | */ |
| 104 | void SetPickerCtrlProportion(int prop); |
| 105 | |
| 106 | /** |
| 107 | Sets the text control as growable when @c grow is @true. |
| 108 | |
| 109 | This function can be used only when HasTextCtrl() returns @true. |
| 110 | */ |
| 111 | void SetTextCtrlGrowable(bool grow = true); |
| 112 | |
| 113 | /** |
| 114 | Sets the proportion value of the text control. |
| 115 | |
| 116 | Look at the detailed description of wxPickerBase for more info. |
| 117 | |
| 118 | This function can be used only when HasTextCtrl() returns @true. |
| 119 | */ |
| 120 | void SetTextCtrlProportion(int prop); |
| 121 | }; |
| 122 | |