# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx::PG # This class can be used to have multiple buttons in a property editor. # You will need to create a new property editor class, override CreateControls, and have it return {Wx::PG::PGMultiButton} instance in Wx::PGWindowList#set_secondary. # For instance, here we add three buttons to a TextCtrl editor: # # ```ruby # class WxSampleMultiButtonEditor < Wx::PG::PGTextCtrlEditor # # def initialize # super # end # # def create_controls(propGrid, property, pos, sz) # # Create and populate buttons-subwindow # buttons = Wx::PG::PGMultiButton.new(propGrid, sz) # # # Add two regular buttons # buttons.add('...') # buttons.add('A') # # Add a bitmap button # buttons.add(Wx::ArtProvider::get_bitmap(Wx::ART_FOLDER)) # # # Create the 'primary' editor control (textctrl in this case) # primary, _ = super(propGrid, property, pos, buttons.primary_size) # # # Finally, move buttons-subwindow to correct position and make sure # # returned Wx::PG::PGWindowList contains our custom button list. # buttons.finalize(propGrid, pos) # # [primary, buttons] # end # # def on_event(propGrid, property, ctrl, event) # if event.event_type == Wx::EVT_BUTTON # buttons = propGrid.get_editor_control_secondary # # if event.id == buttons.button_id(0) # # # Do something when the first button is pressed # Wx::log_info('First button pressed') # return false # Return false since value did not change # end # if event.id == buttons.get_button_id(1) # # # Do something when the second button is pressed # Wx.message_box('Second button pressed') # return false # Return false since value did not change # end # if event.id == buttons.button_id(2) # # Do something when the third button is pressed # Wx.message_box('Third button pressed') # return false # Return false since value did not change # end # end # super(propGrid, property, ctrl, event) # end # # end # class WxSampleMultiButtonEditor # ``` # # Further to use this editor, code like this can be used: # # ```ruby # # Register editor class - needs only to be called once # @sampleMultiButtonEditor = # Wx::PG::PropertyGrid.register_editor_class(WxSampleMultiButtonEditor.new) # # # ... # # # Insert the property that will have multiple buttons # propGrid.append(Wx::PG::LongStringProperty.new("MultipleButtons", Wx::PG::PG_LABEL)) # # # Change property to use editor created in the previous code segment # propGrid.set_property_editor("MultipleButtons", @sampleMultiButtonEditor) # ``` # # Category: {Wx::PG::PropertyGrid} # # @wxrb_require USE_PROPGRID class PGMultiButton < Window # Constructor. # @param pg [Wx::PG::PropertyGrid] # @param sz [Array(Integer, Integer), Wx::Size] # @return [Wx::PG::PGMultiButton] def initialize(pg, sz) end # @overload add(label, id=-2) # Adds new button, with given label. # @param label [String] # @param id [Integer] # @return [void] # @overload add(bitmap, id=-2) # Adds new bitmap button. # @param bitmap [Wx::BitmapBundle,Wx::Bitmap,Wx::Icon,Wx::Image] # @param id [Integer] # @return [void] def add(*args) end # Call this in CreateControls() of your custom editor class after all buttons have been added. # @param propGrid [Wx::PG::PropertyGrid] {Wx::PG::PropertyGrid} given in CreateControls(). # @param pos [Array(Integer, Integer), Wx::Point] {Wx::Point} given in CreateControls(). # @return [void] def finalize(propGrid, pos) end # Returns pointer to one of the buttons. # @param i [Integer] # @return [Wx::Window] def get_button(i) end alias_method :button, :get_button # Returns Id of one of the buttons. # This is utility function to be used in event handlers. # @param i [Integer] # @return [Integer] def get_button_id(i) end alias_method :button_id, :get_button_id # Returns number of buttons. # @return [Integer] def get_count; end alias_method :count, :get_count # Returns size of primary editor control, as appropriately reduced by number of buttons present. # @return [Wx::Size] def get_primary_size; end alias_method :primary_size, :get_primary_size end # PGMultiButton end