class DataPusher : public Pusher
DataPusher is a class that is able to Convert and Display some Value and also allows user to click this value (usually in order to change it). Note that both Convert and Display lifetime must exceed the lifetime of DataPusher (DataPusher stores just the reference to them).
Usual usage pattern is that DataPusher displays some data that can be changed by some complex dialog. This pattern can be implemented either by deriving new class from DataPusher, overriding DoAction method and using SetDataAction at the end of it to both change the value of DataPusher and invoke repainting and WhenAction, or it can use default DoAction implementation and WhenAction callback (do not call SetDataAction in this case).
Derived from Pusher
DataPusher()
Initializes the data pusher.
DataPusher(const Convert& convert, const Display& display = StdDisplay())
Creates DataPusher with specified Convert and Display used to Convert a then Display the Value of DataPusher. Note that both convert and display lifetime must exceed the lifetime of DataPusher (DataPusher stores just the reference to them).
DataPusher(const Display& display)
Creates DataPusher with specified Display.
virtual void DoAction()
This virtual method is invoked when user clicks DataPusher. Default action is to call WhenAction callback.
DataPusher& SetConvert(const Convert& _convert)
Sets the new Convert.
|
Return value |
*this for chaining. |
const Convert& GetConvert() const
Returns current Convert.
|
Return value |
Current Convert. |
DataPusher& SetDisplay(const Display& _display)
Sets the new Display.
|
Return value |
*this for chaining. |
const Display& GetDisplay() const
Returns current Display.
|
Return value |
Current Display. |
void SetDataAction(const Value& value)
Invokes SetData(value) and then UpdateActionRefresh(). Useful when building DataPusher derived class.
void Set(const Value& value)
Alternative way to set data, decoupled from SetData interface. Sets the data to be displayed. Intended to be used by derived classes that implement own SetData/GetData.
virtual void SetData(const Value& value)
Sets the control's data to value.
virtual Value GetData() const
Returns the control's data.
DataPusher& NullText(const char *text = t_("(default)"), Color ink = Brown)
DataPusher& NullText(const char *text, Font fnt, Color ink)
Sets the default text that will be displayed if no data is supplied.
Callback WhenPreAction
This callback is invoked before DoAction.
|