From c991de4581a4bf5052f8e78c5bfe287de4800d43 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 12:17:28 +0200 Subject: [PATCH 1/7] fix doc --- lib/wx/doc/graphics_context.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/wx/doc/graphics_context.rb b/lib/wx/doc/graphics_context.rb index ca0a780e..cf6ce987 100644 --- a/lib/wx/doc/graphics_context.rb +++ b/lib/wx/doc/graphics_context.rb @@ -14,19 +14,22 @@ class GraphicsContext # Deletes the gc object after the block returns. # @see Wx::GraphicsRenderer#create_context # @param window [Wx::Window] - # @return [Wx::GraphicsContext] + # @yieldparam [Wx::GraphicsContext] + # @return [::Object] last result of the given block # @overload self.draw_on(windowDC) # Creates a {Wx::GraphicsContext} from a {Wx::WindowDC} and passes that object to the given block. # Deletes the gc object after the block returns. # @see Wx::GraphicsRenderer#create_context # @param windowDC [Wx::WindowDC] - # @return [Wx::GraphicsContext] + # @yieldparam [Wx::GraphicsContext] + # @return [::Object] last result of the given block # @overload self.draw_on(memoryDC) # Creates a {Wx::GraphicsContext} from a {Wx::MemoryDC} and passes that object to the given block. # Deletes the gc object after the block returns. # @see Wx::GraphicsRenderer#create_context # @param memoryDC [Wx::MemoryDC] - # @return [Wx::GraphicsContext] + # @yieldparam [Wx::GraphicsContext] + # @return [::Object] last result of the given block # @overload self.draw_on(printerDC) # Creates a {Wx::GraphicsContext} from a {Wx::PrinterDC} and passes that object to the given block. # Deletes the gc object after the block returns. @@ -34,18 +37,21 @@ class GraphicsContext # @see Wx::GraphicsRenderer#create_context # @see Printing Under Unix (GTK+) # @param printerDC [Wx::PrinterDC] - # @return [Wx::GraphicsContext] + # @yieldparam [Wx::GraphicsContext] + # @return [::Object] last result of the given block # @wxrb_require USE_PRINTING_ARCHITECTURE,WXMSW|WXOSX|USE_GTKPRINT # @overload self.draw_on(image) # Creates a {Wx::GraphicsContext} associated with a {Wx::Image} and passes that object to the given block. # Deletes the gc object after the block returns. # The image specifies the size of the context as well as whether alpha is supported (if {Wx::Image#has_alpha}) or not and the initial contents of the context. The image object must have a life time greater than that of the new context as the context copies its contents back to the image when it is destroyed. # @param image [Wx::Image] - # @return [Wx::GraphicsContext] + # @yieldparam [Wx::GraphicsContext] + # @return [::Object] last result of the given block # @overload self.draw_on() # Create a lightweight context that can be used only for measuring text and passes that object to the given block. # Deletes the gc object after the block returns. - # @return [Wx::GraphicsContext] + # @yieldparam [Wx::GraphicsContext] + # @return [::Object] last result of the given block def self.draw_on(*args) end end From ca75f3ca6939b4efaef4df85bcb713e12501d987 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 12:23:37 +0200 Subject: [PATCH 2/7] fix Ruby basic object type spec --- lib/wx/doc/client_dc.rb | 4 ++-- lib/wx/doc/clipboard.rb | 2 +- lib/wx/doc/dc_overlay.rb | 4 ++-- lib/wx/doc/enum.rb | 2 +- lib/wx/doc/event_blocker.rb | 2 +- lib/wx/doc/functions.rb | 2 +- lib/wx/doc/gc_dc.rb | 8 ++++---- lib/wx/doc/list_ctrl.rb | 12 ++++++------ lib/wx/doc/mirror_dc.rb | 2 +- lib/wx/doc/persistence_manager.rb | 2 +- lib/wx/doc/persistent_object.rb | 2 +- lib/wx/doc/pg/property_grid_interface.rb | 6 +++--- lib/wx/doc/prt/printer_dc.rb | 4 ++-- lib/wx/doc/region_iterator.rb | 2 +- lib/wx/doc/scaled_dc.rb | 2 +- lib/wx/doc/screen_dc.rb | 2 +- lib/wx/doc/svg_file_dc.rb | 2 +- lib/wx/doc/textctrl.rb | 2 +- lib/wx/doc/tree_ctrl.rb | 4 ++-- lib/wx/doc/validator.rb | 12 ++++++------ lib/wx/doc/variant.rb | 4 ++-- lib/wx/doc/window.rb | 4 ++-- 22 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/wx/doc/client_dc.rb b/lib/wx/doc/client_dc.rb index 532a021c..e03edfd1 100644 --- a/lib/wx/doc/client_dc.rb +++ b/lib/wx/doc/client_dc.rb @@ -13,7 +13,7 @@ class ClientDC < Wx::DC # it's single argument. # @param [Wx::Window] win window to draw on # @yieldparam [Wx::ClientDC] dc the ClientDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on(win) end end @@ -26,7 +26,7 @@ class PaintDC < Wx::ClientDC # @note In wxRuby this method mostly exists to be consistent with the other DC classes. It is however recommended to use Wx::Window#paint instead. # @param [Wx::Window] win window to draw on # @yieldparam [Wx::PaintDC] dc the PaintDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on(win) end end diff --git a/lib/wx/doc/clipboard.rb b/lib/wx/doc/clipboard.rb index 87c4cd29..32c903e7 100644 --- a/lib/wx/doc/clipboard.rb +++ b/lib/wx/doc/clipboard.rb @@ -14,7 +14,7 @@ class Clipboard # Opens the global clipboard and passes the clipboard object to the block. # @yieldparam [Wx::Clipboard] clip the global clipboard object - # @return [Object] block result + # @return [::Object] block result def self.open; end end diff --git a/lib/wx/doc/dc_overlay.rb b/lib/wx/doc/dc_overlay.rb index 3e6ee82c..f9bbf657 100644 --- a/lib/wx/doc/dc_overlay.rb +++ b/lib/wx/doc/dc_overlay.rb @@ -18,7 +18,7 @@ class DCOverlay < Wx::DC # @param [Wx::Overlay] overlay Overlay to connect # @param [Wx::DC] dc Drawing DC # @yieldparam [Wx::DCOverlay] ovl_dc DCOverlay instance to use - # @return [Object] result from block + # @return [::Object] result from block # @overload draw_on(overlay, dc, x, y, width, height) # @param [Wx::Overlay] overlay Overlay to connect # @param [Wx::DC] dc Drawing DC @@ -27,7 +27,7 @@ class DCOverlay < Wx::DC # @param [Integer] width width of area to use # @param [Integer] height height of area to use # @yieldparam [Wx::DCOverlay] ovl_dc DCOverlay instance to use - # @return [Object] result from block + # @return [::Object] result from block def self.draw_on(*arg) end end diff --git a/lib/wx/doc/enum.rb b/lib/wx/doc/enum.rb index 24a4dada..fa9a28c4 100644 --- a/lib/wx/doc/enum.rb +++ b/lib/wx/doc/enum.rb @@ -37,7 +37,7 @@ def real?; end def method_missing(sym, *args) end # Checks type and value equality. - # @param [Object] o the object to compare + # @param [::Object] o the object to compare # @return [true,false] true if o is instance of same enum class as self **and** integer values are equal; false otherwise def eql?(o) end diff --git a/lib/wx/doc/event_blocker.rb b/lib/wx/doc/event_blocker.rb index 655ffb8b..ce39ab28 100644 --- a/lib/wx/doc/event_blocker.rb +++ b/lib/wx/doc/event_blocker.rb @@ -22,7 +22,7 @@ class << self # @param [Wx::Window] win the window to block events for # @param [Integer] evt_type the event type to block # @yieldparam [Wx::EventBlocker] blkr the blocker object - # @return [Object] the value returned by the block + # @return [::Object] the value returned by the block def blocked_for(win, evt_type=Wx::EVT_ANY) end alias :block_for :blocked_for diff --git a/lib/wx/doc/functions.rb b/lib/wx/doc/functions.rb index bcf9a604..33fe562e 100644 --- a/lib/wx/doc/functions.rb +++ b/lib/wx/doc/functions.rb @@ -109,7 +109,7 @@ def self.get_app; end # Returns the pointer address of the underlying C++ object as a hex # string - useful for debugging - # @param obj [Object] wrapped object + # @param obj [::Object] wrapped object # @return [String] string with address in hex format def self.ptr_addr(obj) end diff --git a/lib/wx/doc/gc_dc.rb b/lib/wx/doc/gc_dc.rb index 013014e3..a55f9285 100644 --- a/lib/wx/doc/gc_dc.rb +++ b/lib/wx/doc/gc_dc.rb @@ -15,15 +15,15 @@ class GCDC < Wx::DC # passes the instance to the given block to draw on. # @overload draw_on() # @yieldparam [Wx::GCDC] dc GCDC instance to draw on - # @return [Object] result from block + # @return [::Object] result from block # @overload draw_on(dc) # @param [Wx::WindowDC,Wx::MemoryDC] target DC to draw on # @yieldparam [Wx::GCDC] dc GCDC instance to draw on - # @return [Object] result from block + # @return [::Object] result from block # @overload draw_on(dc) # @param [Wx::PrinterDC] target DC to draw on # @yieldparam [Wx::GCDC] dc GCDC instance to draw on - # @return [Object] result from block + # @return [::Object] result from block # @wxrb_require USE_PRINTING_ARCHITECTURE,WXMSW|WXOSX|USE_GTKPRINT # @overload draw_on(gc) # Note that the context will continue using the same font, pen and brush as before until #set_font, #set_pen @@ -34,7 +34,7 @@ class GCDC < Wx::DC # you need to call the setter methods to bring Wx::DC and Wx::GraphicsContext font, pen and brush in sync with each other. # @param [Wx::GraphicsContext] gc GraphicsContext to draw on # @yieldparam [Wx::GCDC] dc GCDC instance to draw on - # @return [Object] result from block + # @return [::Object] result from block def self.draw_on(*arg) end end diff --git a/lib/wx/doc/list_ctrl.rb b/lib/wx/doc/list_ctrl.rb index fa17ead6..0abb12bf 100644 --- a/lib/wx/doc/list_ctrl.rb +++ b/lib/wx/doc/list_ctrl.rb @@ -13,13 +13,13 @@ class ListCtrl # Iterates all items in the list control passing each item (id) to the given block. # @yieldparam [Integer] item - # @return [Object] result of last block iteration + # @return [::Object] result of last block iteration def each(&block) end # Iterates all selected items in the list control (like #get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)) # passing each item (id) to the given block. # @yieldparam [Integer] item - # @return [Object] result of last block iteration + # @return [::Object] result of last block iteration def each_selected(&block) end # Returns array of selected items. @@ -31,10 +31,10 @@ def get_selections; end # passing the item data for each item as well as the `data` argument given to the #sort_items method. # The block should return 0 if the items are equal, negative value if the first item is less than the second # one and positive value if the first one is greater than the second one. - # @param [Object] data user data to pass on to the sorting block - # @yieldparam [Object] item_data1 data for first item - # @yieldparam [Object] item_data2 data for second item - # @yieldparam [Object] data propagated data argument + # @param [::Object] data user data to pass on to the sorting block + # @yieldparam [::Object] item_data1 data for first item + # @yieldparam [::Object] item_data2 data for second item + # @yieldparam [::Object] data propagated data argument def sort_items(data = nil, &block) end end diff --git a/lib/wx/doc/mirror_dc.rb b/lib/wx/doc/mirror_dc.rb index 5aa808b7..3f50ff71 100644 --- a/lib/wx/doc/mirror_dc.rb +++ b/lib/wx/doc/mirror_dc.rb @@ -14,7 +14,7 @@ class MirrorDC < Wx::DC # @param [Wx::DC] dc DC to duplicate the (mirrored) drawing on # @param [Boolean] mirror whether to mirror or not # @yieldparam [Wx::MirrorDC] dc the MirrorDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on(dc, mirror) end end diff --git a/lib/wx/doc/persistence_manager.rb b/lib/wx/doc/persistence_manager.rb index 2d6d7070..9a4c57ed 100644 --- a/lib/wx/doc/persistence_manager.rb +++ b/lib/wx/doc/persistence_manager.rb @@ -14,7 +14,7 @@ module Wx # instance for the object it is called for. # This method raises a NoImplementError if the object class does not support persistence. # @see Defining Custom Persistent Windows - # @param obj [Object] + # @param obj [::Object] # @return [Wx::PersistentObject] def self.create_persistent_object(obj) end diff --git a/lib/wx/doc/persistent_object.rb b/lib/wx/doc/persistent_object.rb index 32da870c..70a7c93c 100644 --- a/lib/wx/doc/persistent_object.rb +++ b/lib/wx/doc/persistent_object.rb @@ -11,7 +11,7 @@ class PersistentObject < ::Object # Save the specified value using the given name. # @param [String] name The name of the value in the configuration file. - # @param [Object] value The value to save, currently must be a type supported by wxConfig. + # @param [::Object] value The value to save, currently must be a type supported by wxConfig. # @return [Boolean] true if the value was saved or false if an error occurred. def save_value(name, value); end protected :save_value diff --git a/lib/wx/doc/pg/property_grid_interface.rb b/lib/wx/doc/pg/property_grid_interface.rb index 21808911..8bcfd53a 100644 --- a/lib/wx/doc/pg/property_grid_interface.rb +++ b/lib/wx/doc/pg/property_grid_interface.rb @@ -18,7 +18,7 @@ class PropertyGridInterface # @param start [Integer,Wx::PG::Property] start position (either {Wx::Direction::TOP} or {Wx::Direction::BOTTOM} or the property to start at) # @param reverse [true,false] iterate properties in reverse # @yieldparam item [Wx::PG::PGProperty] property - # @return [Object] result of last block execution + # @return [::Object] result of last block execution # @overload each_property(flags, start, reverse:) # @param flags [Integer] flags specifying iteration (see {Wx::PG::PG_ITERATOR_FLAGS}) # @param start [Integer,Wx::PG::Property] start position (either {Wx::Direction::TOP} or {Wx::Direction::BOTTOM} or the property to start at) @@ -35,7 +35,7 @@ def each_property(flags = Wx::PG::PG_ITERATE_DEFAULT, start = nil, reverse: fals # @param start [Integer,Wx::PG::Property] start position (either {Wx::Direction::TOP} or {Wx::Direction::BOTTOM} or the property to start at) # @param reverse [true,false] iterate properties in reverse # @yieldparam item [Wx::PG::PGProperty] property - # @return [Object] result of last block execution + # @return [::Object] result of last block execution # @overload reverse_each_property(flags, start) # @param flags [Integer] flags specifying iteration (see {Wx::PG::PG_ITERATOR_FLAGS}) # @param start [Integer,Wx::PG::Property] start position (either {Wx::Direction::TOP} or {Wx::Direction::BOTTOM} or the property to start at) @@ -50,7 +50,7 @@ def reverse_each_property(flags = Wx::PG::PG_ITERATE_DEFAULT, start = nil, &bloc # @overload each_property_attribute(id , &block) # @param id [String,Wx::PG::PGProperty] (name of) property to iterate attributes of # @yieldparam item [Wx::Variant] attribute - # @return [Object] result of last block execution + # @return [::Object] result of last block execution # @overload each_property_attribute(id) # @param id [String,Wx::PG::PGProperty] (name of) property to iterate attributes of # @return [Enumerator] an enumerator diff --git a/lib/wx/doc/prt/printer_dc.rb b/lib/wx/doc/prt/printer_dc.rb index 0a883f30..c3a28c1a 100644 --- a/lib/wx/doc/prt/printer_dc.rb +++ b/lib/wx/doc/prt/printer_dc.rb @@ -13,7 +13,7 @@ class PrinterDC < Wx::DC # it's single argument. # @param [Wx::PRT::PrintData] print_data print_data defining the print settings # @yieldparam [Wx::PrinterDC] dc the PrinterDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on(print_data) end end @@ -24,7 +24,7 @@ class PostScriptDC < Wx::DC # it's single argument. # @param [Wx::PRT::PrintData] print_data print_data defining the print settings # @yieldparam [Wx::PostScriptDC] dc the PostScriptDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on(print_data) end end diff --git a/lib/wx/doc/region_iterator.rb b/lib/wx/doc/region_iterator.rb index 893184d4..e679cba1 100644 --- a/lib/wx/doc/region_iterator.rb +++ b/lib/wx/doc/region_iterator.rb @@ -31,7 +31,7 @@ def next_rect; end # If no block is given an Enumerator is returned. # @overload each(&block) # @yieldparam [Wx::Rect] rect - # @return [Object] + # @return [::Object] # @overload each() # @return [Enumerator] def each; end diff --git a/lib/wx/doc/scaled_dc.rb b/lib/wx/doc/scaled_dc.rb index 52bce513..f96cf023 100644 --- a/lib/wx/doc/scaled_dc.rb +++ b/lib/wx/doc/scaled_dc.rb @@ -16,7 +16,7 @@ class ScaledDC < Wx::DC # @param [Wx::DC] target DC to draw on (scaled) # @param [Float] scale scale factor # @yieldparam [Wx::ScaledDC] dc scaled dc to draw on - # @return [Object] result from block + # @return [::Object] result from block def self.draw_on(target, scale) end end diff --git a/lib/wx/doc/screen_dc.rb b/lib/wx/doc/screen_dc.rb index f62c9728..2362fc2d 100644 --- a/lib/wx/doc/screen_dc.rb +++ b/lib/wx/doc/screen_dc.rb @@ -12,7 +12,7 @@ class ScreenDC < Wx::DC # Executes the given block providing a temporary (screen) dc as # it's single argument. # @yieldparam [Wx::ScreenDC] dc the ScreenDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on; end end diff --git a/lib/wx/doc/svg_file_dc.rb b/lib/wx/doc/svg_file_dc.rb index f81b7505..f9ae4ca4 100644 --- a/lib/wx/doc/svg_file_dc.rb +++ b/lib/wx/doc/svg_file_dc.rb @@ -18,7 +18,7 @@ class SVGFileDC < Wx::DC # @param [Float] dpi resolution for SVG image # @param [String] title readable name for the SVG document # @yieldparam [Wx::SVGFileDC] dc the SVGFileDC instance to paint on - # @return [Object] result of the block + # @return [::Object] result of the block def self.draw_on(filename, width=320, height=240, dpi=72, title='') end end diff --git a/lib/wx/doc/textctrl.rb b/lib/wx/doc/textctrl.rb index 17422547..381a4a9c 100644 --- a/lib/wx/doc/textctrl.rb +++ b/lib/wx/doc/textctrl.rb @@ -62,7 +62,7 @@ class TextCtrl # Appends the string representation of `obj` to the text value of the control. # Calls #to_s to get the string representation of `obj`. - # @param [Object] obj + # @param [::Object] obj # @return [self] def <<(obj) end diff --git a/lib/wx/doc/tree_ctrl.rb b/lib/wx/doc/tree_ctrl.rb index 5882da00..3ec94a66 100644 --- a/lib/wx/doc/tree_ctrl.rb +++ b/lib/wx/doc/tree_ctrl.rb @@ -37,7 +37,7 @@ def get_first_child(parent_id) end # # Returns an invalid tree item if there are no further children. # @param [Wx::TreeItemId] parent_id the id of the parent tree item for which to iterate children - # @param [Object] cookie cookie value as returned from previous #get_first_cild or #get_next_child call. + # @param [::Object] cookie cookie value as returned from previous #get_first_cild or #get_next_child call. # @return [Array(Wx::TreeItemId, Object)] first child item id (if any) and cookie value def get_next_child(parent_id, cookie) end @@ -74,7 +74,7 @@ def get_selections; end # @param [Integer] pos child item's position to insert before # @param [Integer] image image index for unselected item # @param [Integer] selImage image index for selected item - # @param data [Object] + # @param data [::Object] # @return [Wx::TreeItemId] id of inserted tree item def insert_item_before(parent, pos, text, image=-1, selImage=-1, data=nil) end diff --git a/lib/wx/doc/validator.rb b/lib/wx/doc/validator.rb index 78360f32..5ae91933 100644 --- a/lib/wx/doc/validator.rb +++ b/lib/wx/doc/validator.rb @@ -22,7 +22,7 @@ def initialize(*arg) end # Should retrieve and return the data from the associated window (#get_window). # By default returns nil (which indicates there is no custom data to transfer). # Overload for customized functionality. - # @return [Object] retrieved data from window + # @return [::Object] retrieved data from window def do_transfer_from_window; end protected :do_transfer_from_window @@ -30,7 +30,7 @@ def do_transfer_from_window; end # Should transfer the given data to the associated window and return true if successful. # By default does nothing and just returns true. # Overload for customized functionality. - # @param [Object] data + # @param [::Object] data # @return [Boolean] def do_transfer_to_window(data) end protected :do_transfer_to_window @@ -60,7 +60,7 @@ module Binding # win.set_validator(val) # # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc; to be supplied when no block is given - # @yieldparam [Object] data the data retrieved from the window + # @yieldparam [::Object] data the data retrieved from the window def on_transfer_from_window(meth=nil, &block) end # Installs a callback handler to provide the data to transfer to the associated window. @@ -85,13 +85,13 @@ def on_transfer_from_window(meth=nil, &block) end # win.set_validator(val) # # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc; to be supplied when no block is given - # @yieldreturn [Object] the data to transfer to the window + # @yieldreturn [::Object] the data to transfer to the window def on_transfer_to_window(meth=nil, &block) end # Method called with data transferred from window. # By default will call the on_transfer_from_window handler if defined. # Returns true if successful or none defined. - # @param [Object] data + # @param [::Object] data # @return [Boolean] def do_on_transfer_from_window(data) end protected :do_on_transfer_from_window @@ -100,7 +100,7 @@ def do_on_transfer_from_window(data) end # By default will call the on_transfer_to_window handler if defined. # Returns the handler's result if successful. # Otherwise returns nil. - # @return [Object] + # @return [::Object] def do_on_transfer_to_window; end protected :do_on_transfer_to_window diff --git a/lib/wx/doc/variant.rb b/lib/wx/doc/variant.rb index c40b6507..7dfe99a1 100644 --- a/lib/wx/doc/variant.rb +++ b/lib/wx/doc/variant.rb @@ -16,7 +16,7 @@ class Variant # Returns an enumerator when no block is given. # @overload each(&block) # @yieldparam item [Wx::Variant] variant list item - # @return [Object] result of last block execution + # @return [::Object] result of last block execution # @overload each # @return [Enumerator] an enumerator def each; end @@ -52,7 +52,7 @@ def each; end # @return [self] # @overload assign(value) # Equality test operator. - # @param value [Object] + # @param value [::Object] # @return [self] # @overload assign(value) # Equality test operator. diff --git a/lib/wx/doc/window.rb b/lib/wx/doc/window.rb index a41cd907..e707fbe7 100644 --- a/lib/wx/doc/window.rb +++ b/lib/wx/doc/window.rb @@ -44,13 +44,13 @@ def raise_window; end # Creates a Wx::PaintDC when called from an evt_paint handler and a # Wx::ClientDC otherwise. # @yieldparam [Wx::PaintDC,Wx::ClientDC] dc dc to paint on - # @return [Object] result from block + # @return [::Object] result from block def paint; end # Similar to #paint but this time creates a Wx::AutoBufferedPaintDC when called # from an evt_paint handler and a Wx::ClientDC otherwise. # @yieldparam [Wx::AutoBufferedPaintDC,Wx::ClientDC] dc dc to paint on - # @return [Object] result from block + # @return [::Object] result from block def paint_buffered; end # Yield each child window to the given block. From e5ece80854091a5eb7fc1644d740eda778c518c2 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 14:28:28 +0200 Subject: [PATCH 3/7] use dialog style execution --- samples/dialogs/wizard.rb | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/samples/dialogs/wizard.rb b/samples/dialogs/wizard.rb index c18ad347..32eedc98 100755 --- a/samples/dialogs/wizard.rb +++ b/samples/dialogs/wizard.rb @@ -32,25 +32,26 @@ def initialize(title, pos, size) evt_menu Wx::ID_EXIT, :on_quit evt_menu Wx::ID_ABOUT, :on_about - w = Wx::Wizard.new(self, :title => 'The WxRuby Wizard') - p1 = Wx::WizardPageSimple.new(w) - s = Wx::StaticText.new(p1, :label => 'This is the first page') - - p2 = Wx::WizardPageSimple.new(w, p1) - p1.set_next(p2) - s = Wx::StaticText.new(p2, :label => 'This is the second page') - - p3 = Wx::WizardPageSimple.new(w, p2) - p2.set_next(p3) - s = Wx::StaticText.new(p3, :label => 'This is the final page') - - evt_wizard_page_changed(w) { p "page changed" } - evt_wizard_page_changing(w) { p "page changing" } - evt_wizard_help(w) { p "wizard help" } - evt_wizard_cancel(w) { p "wizard cancelled" } - evt_wizard_finished(w) { p "wizard finished" } - - w.run_wizard(p1) + Wx.Wizard(self, :title => 'The WxRuby Wizard') do |w| + p1 = Wx::WizardPageSimple.new(w) + s = Wx::StaticText.new(p1, :label => 'This is the first page') + + p2 = Wx::WizardPageSimple.new(w, p1) + p1.set_next(p2) + s = Wx::StaticText.new(p2, :label => 'This is the second page') + + p3 = Wx::WizardPageSimple.new(w, p2) + p2.set_next(p3) + s = Wx::StaticText.new(p3, :label => 'This is the final page') + + evt_wizard_page_changed(w) { p "page changed" } + evt_wizard_page_changing(w) { p "page changing" } + evt_wizard_help(w) { p "wizard help" } + evt_wizard_cancel(w) { p "wizard cancelled" } + evt_wizard_finished(w) { p "wizard finished" } + + w.run_wizard(p1) + end end def on_quit From 24e1777f9f299ce1772a407851b0571a1315cd57 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 15:03:25 +0200 Subject: [PATCH 4/7] customize doc gen --- rakelib/lib/generate/doc/animation_ctrl.yaml | 10 ++ rakelib/lib/generate/doc/banner_window.yaml | 35 +++++++ .../lib/generate/doc/graphics_context.yaml | 12 +++ rakelib/lib/generate/doc/graphics_object.yaml | 12 +++ rakelib/lib/generate/doc/grid_ctrl.yaml | 25 +++++ rakelib/lib/generate/doc/header_ctrl.yaml | 91 +++++++++++++++++++ rakelib/lib/generate/doc/icon.yaml | 10 ++ rakelib/lib/generate/doc/info_bar.yaml | 27 ++++++ rakelib/lib/generate/doc/log.yaml | 2 +- rakelib/lib/generate/doc/media_ctrl.yaml | 27 ++++++ .../lib/generate/doc/persistent_window.yaml | 22 +++++ rakelib/lib/generate/doc/pg_editor.yaml | 2 +- rakelib/lib/generate/doc/pg_property.yaml | 8 +- rakelib/lib/generate/doc/rearrange_list.yaml | 14 +++ rakelib/lib/generate/doc/ribbon_panel.yaml | 15 +++ .../doc/rich_text_formatting_dialog.yaml | 26 ++++++ rakelib/lib/generate/doc/text_ctrl.yaml | 2 +- rakelib/lib/generate/doc/wizard.yaml | 27 ++++++ 18 files changed, 360 insertions(+), 7 deletions(-) create mode 100644 rakelib/lib/generate/doc/banner_window.yaml create mode 100644 rakelib/lib/generate/doc/graphics_object.yaml create mode 100644 rakelib/lib/generate/doc/header_ctrl.yaml create mode 100644 rakelib/lib/generate/doc/info_bar.yaml create mode 100644 rakelib/lib/generate/doc/media_ctrl.yaml create mode 100644 rakelib/lib/generate/doc/persistent_window.yaml create mode 100644 rakelib/lib/generate/doc/rearrange_list.yaml create mode 100644 rakelib/lib/generate/doc/ribbon_panel.yaml create mode 100644 rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml create mode 100644 rakelib/lib/generate/doc/wizard.yaml diff --git a/rakelib/lib/generate/doc/animation_ctrl.yaml b/rakelib/lib/generate/doc/animation_ctrl.yaml index 4401f44f..f01867e4 100644 --- a/rakelib/lib/generate/doc/animation_ctrl.yaml +++ b/rakelib/lib/generate/doc/animation_ctrl.yaml @@ -13,3 +13,13 @@ animations.add("throbber_2x.gif") animationCtrl.play if animationCtrl.set_animation(animations) ``` +:wxAnimationCtrl.SetAnimation: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + animationCtrl.set_animation(Wx::AnimationBundle.new('progress.gif')) + ``` diff --git a/rakelib/lib/generate/doc/banner_window.yaml b/rakelib/lib/generate/doc/banner_window.yaml new file mode 100644 index 00000000..a3d6e619 --- /dev/null +++ b/rakelib/lib/generate/doc/banner_window.yaml @@ -0,0 +1,35 @@ +--- +:wxBannerWindow: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + class MyFrame < Wx::Frame + + def initialize(...) + + # ... create the frame itself ... + + # Create and initialize the banner. + banner = Wx::BannerWindow.new(self, Wx::TOP) + banner.set_text("Welcome to my wonderful program", + " Before doing anything else, you need to connect to the online server.\n" + + " Please enter your credentials in the controls below.") + + # And position it along the top edge of the window. + sizer = Wx::VBoxSizer.new + sizer.add(banner, Wx::SizerFlags.new.expand) + + # ... add the rest of the window contents to the same sizer ... + + set_sizer_and_fit(sizer) + + end + + # ... + + end + ``` diff --git a/rakelib/lib/generate/doc/graphics_context.yaml b/rakelib/lib/generate/doc/graphics_context.yaml index 027c3182..5163eac7 100644 --- a/rakelib/lib/generate/doc/graphics_context.yaml +++ b/rakelib/lib/generate/doc/graphics_context.yaml @@ -32,3 +32,15 @@ end end ``` +:wxGraphicsPenInfo: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + ctx = Wx::GraphicsContext.create(dc) + + ctx.set_pen(Wx::GraphicsPenInfo.new(Wx::BLUE).width(1.25).style(Wx::PENSTYLE_DOT)) + ``` diff --git a/rakelib/lib/generate/doc/graphics_object.yaml b/rakelib/lib/generate/doc/graphics_object.yaml new file mode 100644 index 00000000..79607308 --- /dev/null +++ b/rakelib/lib/generate/doc/graphics_object.yaml @@ -0,0 +1,12 @@ +--- +:wxGraphicsRenderer: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + # path = Wx::GraphicsPath from somewhere + brush = path.get_renderer.create_brush(Wx::BLACK_BRUSH) + ``` diff --git a/rakelib/lib/generate/doc/grid_ctrl.yaml b/rakelib/lib/generate/doc/grid_ctrl.yaml index 666c92de..681d2248 100644 --- a/rakelib/lib/generate/doc/grid_ctrl.yaml +++ b/rakelib/lib/generate/doc/grid_ctrl.yaml @@ -23,3 +23,28 @@ end ``` +:wxGrid.GetSelectedBlocks: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + grid.get_selected_blocks.each do |gbc| + break if gbc.intersects(my_block) + end + ``` + :post: + - :pattern: !ruby/regexp /,\s+e\.g\.\s+with\s+range-for\s+loop:/ + :subst: ':' +:wxGridFitMode: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + grid.set_default_cell_fit_mode(Wx::GRID::GridFitMode.clip) + ``` diff --git a/rakelib/lib/generate/doc/header_ctrl.yaml b/rakelib/lib/generate/doc/header_ctrl.yaml new file mode 100644 index 00000000..5e44b12a --- /dev/null +++ b/rakelib/lib/generate/doc/header_ctrl.yaml @@ -0,0 +1,91 @@ +--- +:wxHeaderCtrl.Create: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + Wx::HD_DEFAULT_STYLE & ~Wx::HD_ALLOW_REORDER + ``` +:wxHeaderCtrl.AddColumnsItems: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + menu = Wx::Menu.new + menu.append(100, 'Some custom command') + menu.append_separator + add_columns_items(menu, 200) + rc = get_popup_menu_selection_from_user(menu, pt) + if rc >= 200 + # ... toggle visibility of the column rc-200 ... + end + ``` +:wxHeaderCtrl.UpdateColumnWidthToFit: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + class MyHeaderColumn < Wx::HeaderColumn + # ... + + def set_width(width) + @width = width + end + + def get_width + @width + end + + end + + class MyHeaderCtrl < Wx::HeaderCtrl + # ... + + protected + + def get_column(idx) + # @cols = Array + @cols[idx] + end + + def update_column_width_to_fit(idx, widthTitle) + widthContents = # ... compute minimal width for column idx ... + @cols[idx].set_width([widthContents, widthTitle].max) + true + end + + end + ``` +:wxHeaderCtrlSimple.HideColumn: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + show_column(idx, false) + ``` +:wxHeaderColumnSimple: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + header = Wx::HeaderCtrlSimple.new(...) + col = Wx::HeaderColumnSimple.new('Title') + col.set_width(100) + col.set_sortable(100) + header.append_column(col) + ``` diff --git a/rakelib/lib/generate/doc/icon.yaml b/rakelib/lib/generate/doc/icon.yaml index d2ba4357..c56b1646 100644 --- a/rakelib/lib/generate/doc/icon.yaml +++ b/rakelib/lib/generate/doc/icon.yaml @@ -9,3 +9,13 @@ ```ruby get_icon(Wx::Size.new(size,size)) ``` +:wxIconBundle.GetIcon: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + get_icon(Wx::Size.new(size,size)) + ``` diff --git a/rakelib/lib/generate/doc/info_bar.yaml b/rakelib/lib/generate/doc/info_bar.yaml new file mode 100644 index 00000000..9b2120ce --- /dev/null +++ b/rakelib/lib/generate/doc/info_bar.yaml @@ -0,0 +1,27 @@ +--- +:wxInfoBar: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + class MyFrame < Wx::Frame + + def initialize() + # ... + @infoBar = Wx::InfoBar.new(self) + + sizer = Wx::VBoxSizer.new + sizer.add(@infoBar, Wx::SizerFlags.new.expand) + # ... add other frame controls to the sizer ... + set_sizer(sizer) + end + + def some_method + @infoBar.show_message('Something happened', Wx::ICON_INFORMATION) + end + + end + ``` diff --git a/rakelib/lib/generate/doc/log.yaml b/rakelib/lib/generate/doc/log.yaml index 4e8a7f61..d1dc25bf 100644 --- a/rakelib/lib/generate/doc/log.yaml +++ b/rakelib/lib/generate/doc/log.yaml @@ -7,7 +7,7 @@ :replace: | ```ruby - wxLog.set_component_level("wx/net", Wx::LOG_Error) + Wx::Log.set_component_level('wx/net', Wx::LOG_Error) ``` :wxLog.LogRecord: :detail: diff --git a/rakelib/lib/generate/doc/media_ctrl.yaml b/rakelib/lib/generate/doc/media_ctrl.yaml new file mode 100644 index 00000000..09a01e21 --- /dev/null +++ b/rakelib/lib/generate/doc/media_ctrl.yaml @@ -0,0 +1,27 @@ +--- +:wxMediaCtrl: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + class MyFrame < Wx::Frame + + def initialize() + # ... setup frame controls ... + # bind events + # ... + evt_media_stop MY_ID, :on_media_stop + end + + def on_media_stop(evt) + if @userWantsToSeek + @mediactrl.seek(@mediactrl.length - 1) + evt.veto + end + end + + end + ``` diff --git a/rakelib/lib/generate/doc/persistent_window.yaml b/rakelib/lib/generate/doc/persistent_window.yaml new file mode 100644 index 00000000..eaef4f96 --- /dev/null +++ b/rakelib/lib/generate/doc/persistent_window.yaml @@ -0,0 +1,22 @@ +--- +:wxPersistentComboBox: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + # Suppose you need to ask the user to select their favourite Linux + # distribution, for some reason: + combo = Wx::ComboBox.new(self, Wx::ID_ANY) + unless Wx.persistent_register_and_restore(combo, 'distribution') + # Seed it with some default contents. + combo.append("Debian") + combo.append("Fedora") + combo.append("Ubuntu") + end + + # Optionally, you might want to restore the last used entry: + combo.set_selection(0) + ``` diff --git a/rakelib/lib/generate/doc/pg_editor.yaml b/rakelib/lib/generate/doc/pg_editor.yaml index 42deeb01..a4cb37e0 100644 --- a/rakelib/lib/generate/doc/pg_editor.yaml +++ b/rakelib/lib/generate/doc/pg_editor.yaml @@ -6,6 +6,6 @@ - :pattern: !ruby/regexp /.*/ :replace: | - ``` + ```ruby editor = Wx::PG::PropertyGrid.register_editor_class(MyEditorClass.new) ``` diff --git a/rakelib/lib/generate/doc/pg_property.yaml b/rakelib/lib/generate/doc/pg_property.yaml index b5abc98b..3639e89f 100644 --- a/rakelib/lib/generate/doc/pg_property.yaml +++ b/rakelib/lib/generate/doc/pg_property.yaml @@ -138,7 +138,7 @@ - :pattern: !ruby/regexp /class.*MyProperty.*:.*public.*wxPGProperty/ :replace: | - ``` ruby + ```ruby class MyProperty < Wx::PG::PGProperty # All arguments of this ctor must have a default value - @@ -171,10 +171,10 @@ end ``` :post: - - :pattern: !ruby/regexp /==\swxIntProperty.*==\swxUIntProperty/m + - :pattern: !ruby/regexp /\#\#\swxIntProperty.*\#\#\swxUIntProperty/m :subst: | - == wxIntProperty + ## Wx::PG::IntProperty It derives from {Wx::PG::NumericProperty} and displays value as a signed long integer. Supported special attributes: @@ -182,7 +182,7 @@ - {Wx::PG::PG_ATTR_MIN}, {Wx::PG::PG_ATTR_MAX} to specify acceptable value range. - {Wx::PG::PG_ATTR_SPINCTRL_STEP}, {Wx::PG::PG_ATTR_SPINCTRL_WRAP}, {Wx::PG::PG_ATTR_SPINCTRL_MOTION}: Sets SpinCtrl editor parameters. - == wxUIntProperty + ## Wx::PG::UIntProperty - :pattern: !ruby/regexp /Since\s\{Wx::PG::PGProperty\}\sderives.*For\sinstance:/m :subst: '' diff --git a/rakelib/lib/generate/doc/rearrange_list.yaml b/rakelib/lib/generate/doc/rearrange_list.yaml new file mode 100644 index 00000000..814e7ec7 --- /dev/null +++ b/rakelib/lib/generate/doc/rearrange_list.yaml @@ -0,0 +1,14 @@ +--- +:wxRearrangeList: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + order = [ + 0, # checked item #0 + ~1 # unchecked item #1 + ] + ``` diff --git a/rakelib/lib/generate/doc/ribbon_panel.yaml b/rakelib/lib/generate/doc/ribbon_panel.yaml new file mode 100644 index 00000000..f8ce138b --- /dev/null +++ b/rakelib/lib/generate/doc/ribbon_panel.yaml @@ -0,0 +1,15 @@ +--- +:wxRibbonPanel: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + panel = @ribbon.get_page(0).get_panel_by_id(ID_EDITOR_PANEL) + panel.show(!panel.is_shown) if panel + # Update the UI + @ribbon.realise + @ribbon.layout + ``` diff --git a/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml b/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml new file mode 100644 index 00000000..dda3fed0 --- /dev/null +++ b/rakelib/lib/generate/doc/rich_text_formatting_dialog.yaml @@ -0,0 +1,26 @@ +--- +:wxRichTextFormattingDialog: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + range = if @richTextCtrl.has_selection + @richTextCtrl.get_selection_range + else + (0..@richTextCtrl.get_last_position+1) + end + + pages = Wx::RTC::RICHTEXT_FORMAT_FONT|Wx::RTC::RICHTEXT_FORMAT_INDENTS_SPACING| + Wx::RTC::RICHTEXT_FORMAT_TABS|Wx::RTC::RICHTEXT_FORMAT_BULLETS + + Wx::RTC.RichTextFormattingDialog(pages, self) do |formatDlg| + formatDlg.GetStyle(m_richTextCtrl, range); + + if formatDlg.show_modal == Wx::ID_OK + formatDlg.apply_style(@richTextCtrl, range) + end + end + ``` diff --git a/rakelib/lib/generate/doc/text_ctrl.yaml b/rakelib/lib/generate/doc/text_ctrl.yaml index 0f9b7759..94b9fc65 100644 --- a/rakelib/lib/generate/doc/text_ctrl.yaml +++ b/rakelib/lib/generate/doc/text_ctrl.yaml @@ -15,5 +15,5 @@ text.append_text("Blue on grey text\n") ``` :post: - - :pattern: !ruby/regexp /==\s+wxTextCtrl\s+and\s+C\+\+\s+Streams.*See\s+\{Wx::StreamToTextRedirector\}\s+for\s+more\s+details\./m + - :pattern: !ruby/regexp /\#\#\s+wxTextCtrl\s+and\s+C\+\+\s+Streams.*See\s+\{Wx::StreamToTextRedirector\}\s+for\s+more\s+details\./m :subst: '' diff --git a/rakelib/lib/generate/doc/wizard.yaml b/rakelib/lib/generate/doc/wizard.yaml new file mode 100644 index 00000000..d03218d6 --- /dev/null +++ b/rakelib/lib/generate/doc/wizard.yaml @@ -0,0 +1,27 @@ +--- +:wxWizard: + :detail: + :pre: + :programlisting: + - :pattern: !ruby/regexp /.*/ + :replace: | + + ```ruby + class MyFrame < Wx::Frame + + # ... + + def on_run_wizard(_event) + Wx.Wizard(self) do |wizard| + + wizard.run_wizard(get_initial_page_from_some_where) + + # The wizard is destroyed when the block ends. + end + end + + end + ``` + :post: + - :pattern: !ruby/regexp /Note\s+that\s+\{Wx::Wizard\}\s+inherits\s+from\s+\{Wx::Dialog\}.*typically\s+you\s+would\s+use\s+like\s+this:/ + :subst: 'Note that {Wx::Wizard} inherits from {Wx::Dialog} so that typically you would use it like this:' From 426b4be9a20c4f6a1bd077d92e1c5b0a15205264 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 15:37:32 +0200 Subject: [PATCH 5/7] improve RichTextRange mapping --- rakelib/lib/typemap/richtext.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/rakelib/lib/typemap/richtext.rb b/rakelib/lib/typemap/richtext.rb index f4e7ba4a..329e59ef 100644 --- a/rakelib/lib/typemap/richtext.rb +++ b/rakelib/lib/typemap/richtext.rb @@ -23,6 +23,23 @@ module RichText # ranges of text selections with a special class. It doesn't add # anything much that Ruby's own range class doesn't, so deal with using # typemaps + map 'const wxRichTextRange&' => 'Range' do + + map_in temp: 'wxRichTextRange rng', code: <<~__CODE + int start = NUM2INT( rb_funcall( $input, rb_intern("begin"), 0)); + int end = NUM2INT( rb_funcall( $input, rb_intern("end"), 0)); + rng = wxRichTextRange(start, end); + $1 = &rng; + __CODE + + map_typecheck precedence: 1, code: '$1 = ( CLASS_OF($input) == rb_cRange );' + + map_out code: '$result = rb_range_new (LONG2NUM($1->GetStart()),LONG2NUM($1->GetEnd()),0);' + + map_directorin code: '$input = rb_range_new (LONG2NUM($1.GetStart()),LONG2NUM($1.GetEnd()),0);' + + end + map 'wxRichTextRange&' => 'Range' do map_in temp: 'wxRichTextRange rng', code: <<~__CODE From b9ba2140097aa39e2a958a5b643d268fe53ce21e Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 16:49:57 +0200 Subject: [PATCH 6/7] fix type mapping: take nullptr into account --- rakelib/lib/director/richtext_ctrl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rakelib/lib/director/richtext_ctrl.rb b/rakelib/lib/director/richtext_ctrl.rb index 98dc89d1..9b6d2526 100644 --- a/rakelib/lib/director/richtext_ctrl.rb +++ b/rakelib/lib/director/richtext_ctrl.rb @@ -146,7 +146,7 @@ def setup { if (TYPE(result) == T_FIXNUM) { - *newPos = NUM2LONG(result); + if (newPos) *newPos = NUM2LONG(result); c_result = true; } else From af06d6020fe7f302c5081e5a4787c6e28a86fcbf Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Wed, 1 May 2024 20:11:01 +0200 Subject: [PATCH 7/7] fix standard menu/tool items --- samples/text/richtext.rb | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/samples/text/richtext.rb b/samples/text/richtext.rb index b00a545a..a27d1380 100644 --- a/samples/text/richtext.rb +++ b/samples/text/richtext.rb @@ -734,6 +734,27 @@ def initialize(title, id: Wx::ID_ANY, pos: Wx::DEFAULT_POSITION, size: Wx::DEFAU evt_menu(Wx::ID_SAVE, :on_save) evt_menu(Wx::ID_SAVEAS, :on_save_as) + ## + # In wxRuby we cannot use the ProcessEvent override 'hack' that is used in the C++ sample + # so we solve this properly here. + + evt_menu(Wx::ID_CUT, :on_cut) + evt_menu(Wx::ID_COPY, :on_copy) + evt_menu(Wx::ID_PASTE, :on_paste) + + evt_update_ui(Wx::ID_CUT, :on_update_cut) + evt_update_ui(Wx::ID_COPY, :on_update_copy) + evt_update_ui(Wx::ID_PASTE, :on_update_paste) + + evt_menu(Wx::ID_UNDO, :on_undo) + evt_menu(Wx::ID_REDO, :on_redo) + + evt_update_ui(Wx::ID_UNDO, :on_update_undo) + evt_update_ui(Wx::ID_REDO, :on_update_redo) + + # End + ## + evt_menu(ID::FORMAT_BOLD, :on_bold) evt_menu(ID::FORMAT_ITALIC, :on_italic) evt_menu(ID::FORMAT_UNDERLINE, :on_underline) @@ -886,6 +907,38 @@ def on_save_as(_event) end end + def on_cut(_event) + @richTextCtrl.cut + end + def on_update_cut(event) + event.enable(@richTextCtrl.can_cut?) + end + def on_copy(_event) + @richTextCtrl.copy + end + def on_update_copy(event) + event.enable(@richTextCtrl.can_copy?) + end + def on_paste(_event) + @richTextCtrl.paste + end + def on_update_paste(event) + event.enable(@richTextCtrl.can_paste?) + end + + def on_undo(_event) + @richTextCtrl.undo + end + def on_update_undo(event) + event.enable(@richTextCtrl.can_undo?) + end + def on_redo(_event) + @richTextCtrl.redo_ + end + def on_update_redo(event) + event.enable(@richTextCtrl.can_redo?) + end + def on_bold(_event) @richTextCtrl.apply_bold_to_selection end