Class: Wx::PG::PGEditor
Overview
Base class for custom PropertyGrid editors.
- Names of built-in property editors are: TextCtrl, Choice, ComboBox, CheckBox, TextCtrlAndButton, and ChoiceAndButton. Additional editors include SpinCtrl and DatePickerCtrl, but using them requires calling Wx::PG::PropertyGrid#register_additional_editors prior use. - Pointer to built-in editor is available as Wx::PGEditor_EditorName (e.g. Wx::PG_EDITOR_TEXT_CTRL). - Before you start using new editor you just created, you need to register it using static function Wx::PG::PropertyGrid.register_editor_class, with code like this: ```ruby editor = Wx::PG::PropertyGrid.register_editor_class(MyEditorClass.new) ``` After that, PropertyGrid will take ownership of the given object, but you should still store editorPointer somewhere, so you can pass it to Wx::PG::PGProperty#set_editor, or return it from #do_get_editor_class.
Category: PropertyGrid
Direct Known Subclasses
Instance Method Summary collapse
-
#can_contain_custom_image ⇒ Boolean
(also: #can_contain_custom_image?)
Returns true if control itself can contain the custom image.
-
#create_controls(propgrid, property, pos, size) ⇒ Wx::Window, Array<Wx::Window,Wx::Window>
Instantiates editor controls.
-
#delete_item(ctrl, index) ⇒ void
Deletes item from existing control.
-
#draw_value(dc, rect, property, text) ⇒ void
Draws value for given property.
-
#get_name ⇒ String
(also: #name)
Returns pointer to the name of the editor.
-
#get_value_from_control(variant, property, ctrl) ⇒ Boolean
(also: #value_from_control)
Returns value from control, via parameter variant.
-
#initialize ⇒ Wx::PG::PGEditor
constructor
Constructor.
-
#insert_item(ctrl, label, index) ⇒ Integer
Inserts item to existing control.
-
#on_event(propgrid, property, wnd_primary, event) ⇒ Boolean
Handles events.
-
#on_focus(property, wnd) ⇒ void
Extra processing when control gains focus.
-
#set_control_appearance(pg, property, ctrl, appearance, oldAppearance, unspecified) ⇒ void
Called by property grid to set new appearance for the control.
-
#set_control_int_value(property, ctrl, value) ⇒ void
Sets control’s value specifically from int (applies to choice etc.).
-
#set_control_string_value(property, ctrl, txt) ⇒ void
Sets control’s value specifically from string.
-
#set_value_to_unspecified(property, ctrl) ⇒ void
Sets value in control to unspecified.
-
#update_control(property, ctrl) ⇒ void
Loads value from property to the control.
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize ⇒ Wx::PG::PGEditor
Constructor.
50 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 50 def initialize; end |
Instance Method Details
#can_contain_custom_image ⇒ Boolean Also known as: can_contain_custom_image?
Returns true if control itself can contain the custom image.
Default implementation returns false.
177 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 177 def can_contain_custom_image; end |
#create_controls(propgrid, property, pos, size) ⇒ Wx::Window, Array<Wx::Window,Wx::Window>
Instantiates editor controls.
- It is not necessary to call EvtHandler#bind for interesting editor events. All events from controls are automatically forwarded to #on_event and Wx::PG::PGProperty#on_event.
74 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 74 def create_controls(propgrid, property, pos, size) end |
#delete_item(ctrl, index) ⇒ void
This method returns an undefined value.
Deletes item from existing control.
Default implementation does nothing.
163 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 163 def delete_item(ctrl, index) end |
#draw_value(dc, rect, property, text) ⇒ void
This method returns an undefined value.
Draws value for given property.
88 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 88 def draw_value(dc, rect, property, text) end |
#get_name ⇒ String Also known as: name
Returns pointer to the name of the editor.
For example, Wx::PG_EDITOR_TEXT_CTRL has name “TextCtrl”. If you don’t need to access your custom editor by string name, then you do not need to implement this function.
56 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 56 def get_name; end |
#get_value_from_control(variant, property, ctrl) ⇒ Boolean Also known as: value_from_control
Returns value from control, via parameter variant.
Usually ends up calling property’s StringToValue() or IntToValue(). Returns true if value was different.
113 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 113 def get_value_from_control(variant, property, ctrl) end |
#insert_item(ctrl, label, index) ⇒ Integer
Inserts item to existing control.
Index -1 means end of list. Default implementation does nothing. Returns index of item added.
155 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 155 def insert_item(ctrl, label, index) end |
#on_event(propgrid, property, wnd_primary, event) ⇒ Boolean
Handles events.
Returns true if value in control was modified (see Wx::PG::PGProperty#on_event for more information).
Wx::PG::PropertyGrid will automatically unfocus the editor when EVT_TEXT_ENTER is received and when it results in property value being modified. This happens regardless of editor type (i.e. behaviour is same for any TextCtrl and ComboBox based editor).
104 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 104 def on_event(propgrid, property, wnd_primary, event) end |
#on_focus(property, wnd) ⇒ void
This method returns an undefined value.
Extra processing when control gains focus.
For example, TextCtrl based controls should select all text.
171 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 171 def on_focus(property, wnd) end |
#set_control_appearance(pg, property, ctrl, appearance, oldAppearance, unspecified) ⇒ void
132 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 132 def set_control_appearance(pg, property, ctrl, appearance, oldAppearance, unspecified) end |
#set_control_int_value(property, ctrl, value) ⇒ void
This method returns an undefined value.
Sets control’s value specifically from int (applies to choice etc.).
146 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 146 def set_control_int_value(property, ctrl, value) end |
#set_control_string_value(property, ctrl, txt) ⇒ void
This method returns an undefined value.
Sets control’s value specifically from string.
139 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 139 def set_control_string_value(property, ctrl, txt) end |
#set_value_to_unspecified(property, ctrl) ⇒ void
This method returns an undefined value.
Sets value in control to unspecified.
120 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 120 def set_value_to_unspecified(property, ctrl) end |
#update_control(property, ctrl) ⇒ void
This method returns an undefined value.
Loads value from property to the control.
80 |
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 80 def update_control(property, ctrl) end |