Class: Wx::PG::PGEditor

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/pg/pg_editor.rb

Overview

Base class for custom PropertyGrid editors.

Remark:

- 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

Requires:

  • USE_PROPGRID

Instance Method Summary collapse

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::PG::PGEditor

Constructor.



50
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 50

def initialize; end

Instance Method Details

#can_contain_custom_imageBoolean Also known as: can_contain_custom_image?

Returns true if control itself can contain the custom image.

Default implementation returns false.

Returns:

  • (Boolean)


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.

Remark:

- 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.

Parameters:

Returns:



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.

Parameters:



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.

Parameters:



88
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 88

def draw_value(dc, rect, property, text) end

#get_nameString 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.

Returns:

  • (String)


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.

Parameters:

Returns:

  • (Boolean)


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.

Parameters:

  • ctrl (Wx::Window)
  • label (String)
  • index (Integer)

Returns:

  • (Integer)


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).

Remark:

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).

Parameters:

Returns:

  • (Boolean)


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.

Parameters:



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

This method returns an undefined value.

Called by property grid to set new appearance for the control.

Default implementation sets foreground colour, background colour, font, plus text for TextCtrl and ComboCtrl.

Parameters:

  • pg (Wx::PG::PropertyGrid)

    Property grid to which the edited property belongs.

  • property (Wx::PG::PGProperty)

    Edited property to which the editor control belongs.

  • ctrl (Wx::Window)

    Editor control.

  • appearance (Wx::PG::PGCell)

    New appearance to be applied.

  • oldAppearance (Wx::PG::PGCell)

    Previously applied appearance. Used to detect which control attributes need to be changed (e.g. so we only change background colour if really needed).

  • unspecified (Boolean)

    If true tells this function that the new appearance represents an unspecified property value.



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.).

Parameters:



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.

Parameters:



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.

Parameters:



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.

Parameters:



80
# File 'lib/wx/doc/gen/pg/pg_editor.rb', line 80

def update_control(property, ctrl) end