Skip to content

Commit

Permalink
Merge pull request #260 from mcorino/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mcorino authored Mar 27, 2024
2 parents b8edc99 + 3f6b05e commit 08ee81d
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 482 deletions.
6 changes: 5 additions & 1 deletion lib/wx/doc/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ class App
# Optionally runs a given block as the applications #on_init callback
# if no actual #on_init method has been defined.
# A given block will be ignored if an actual #on_init method has been defined.
# @yieldreturn [Boolean] return true if init block succeeded, false otherwise
# @return [Integer] return code from the #on_exit callback (`0` if no #on_exit defined or called)
def run(&block) end

# Convenience method to instantiate an application object of the class
# and call the {#run} method for that application object.
# and call the {Wx::App#run} method for that application object.
# @yieldreturn [Boolean] return true if init block succeeded, false otherwise
# @return [Integer] return code from {Wx::App#run}
def self.run(&block) end

class << self
Expand Down
28 changes: 25 additions & 3 deletions lib/wx/doc/evthandler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,31 @@ def self.clear_filters; end
# @return [Integer] unique event type id
def self.register_class(klass, konstant = nil, meth = nil, arity = nil) end

def connect(first_id, last_id, evt_type, handler) end

def disconnect(first_id, last_id, evt_spec) end
# Connects the given event handler dynamically for id(s) and event type.
#
# This is the core event connecting method.
# In Ruby using named event connector methods like {Wx::EvtHandler#evt_menu} is highly recommended as using #connect
# does not provide any better options (less even) than using named event connectors as all event connecting is dynamic.
#
# @param [Integer] first_id The first ID of the identifier range to be associated with the event handler. Should be Wx::ANY_ID for events that do not require identifiers.
# @param [Integer] last_id The last ID of the identifier range to be associated with the event handler. Should be Wx::ANY_ID for events requiring a single identifier (like {Wx::MenuEvt}).
# @param [Integer] evt_id The event type identifier like {Wx::EVT_MENU}.
# @param [Proc,Method] handler The event handler proc or method.
# @return [Boolean] Always returns true.
def connect(first_id, last_id, evt_id, handler) end

# Disconnects any event handler connected for the specified id(s) and event type.
#
# Looks up connected event handler(s) using the specified parameters as search criteria and returning true if (a)
# matching handler(s) has(have) been found and removed.
#
# @note Note that in wxRuby it is not possible to remove a specific handler if multiple (chained) handler(s) have been connected.
#
# @param [Integer] first_id The first ID of the identifier range associated with the event handler. Should be Wx::ANY_ID for events that have no associated identifiers.
# @param [Integer] last_id The last ID of the identifier range associated with the event handler. Should be Wx::ANY_ID for events that have a single identifier associated.
# @param [Integer,Symbol,nil] evt_id The event type identifier like {Wx::EVT_MENU} or event connector symbol (like `:evt_menu`).
# @return [Boolean] Returns true if any event handler found and removed, false otherwise.
def disconnect(first_id, last_id, evt_id) end

# Processes an event, searching event tables and calling zero or more suitable event handler function(s).
#
Expand Down
3 changes: 2 additions & 1 deletion rakelib/gem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ file WXRuby3::Gem.gem_file => WXRuby3::Gem.manifest do
"'--exclude=lib/wx/(aui|core|grid|html|pg|prt|rbn|rtc|stc|wxruby)/.*'"
gem.metadata = {
"bug_tracker_uri" => "https://github.com/mcorino/wxRuby3/issues",
"homepage_uri" => "https://github.com/mcorino/wxRuby3",
"homepage_uri" => "https://github.com/mcorino/wxRuby3/wiki",
"source_code_uri" => "https://github.com/mcorino/wxRuby3",
"documentation_uri" => "https://mcorino.github.io/wxRuby3",
"github_repo" => "https://github.com/mcorino/wxRuby3"
}
Expand Down
4 changes: 4 additions & 0 deletions rakelib/lib/director/art_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def setup
// ArtId and ArtClient are basically just strings ...
typedef wxString wxArtID;
typedef wxString wxArtClient;
// Missing from docs
%constant const char* wxART_STOP = wxART_STOP;
%constant const char* wxART_REFRESH = wxART_REFRESH;
__HEREDOC
spec.map *%w[wxArtID wxArtClient], as: 'String', swig: false do
map_in
Expand Down
8 changes: 4 additions & 4 deletions rakelib/lib/generate/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,10 @@ def para_to_doc(node)
when /The following event handler macros redirect.*(\{.*})/
event_ref = $1
"The following event-handler methods redirect the events to member method or handler blocks for #{event_ref} events."
when /\AEVT_[A-Z]+/
if event_list? && /\A(EVT_[_A-Z]+)\((.*,)\s+\w+\):(.*)/ =~ para
when /\AEVT_[_A-Z0-9]+/
if event_list? && /\A(EVT_[_A-Z0-9]+)\((.*,)\s+\w+\):(.*)/ =~ para
evthnd_name = $1.downcase
docstr = $3.lstrip
if override_spec = get_event_override(evthnd_name)
evthnd_name, evt_type, evt_arity, evt_klass = override_spec
idarg = case evt_arity
Expand All @@ -511,10 +512,9 @@ def para_to_doc(node)
else
arglist = "#{$2} meth = nil, &block"
end
docstr = $3.lstrip
package.event_docs[evthnd_name] = [arglist, docstr.dup] # register for eventlist doc gen
"{Wx::EvtHandler\##{evthnd_name}}(#{arglist}): #{docstr}"
elsif event_list? && /\A(EVT_[_A-Z]+)(\*)?\(\w+\):(.*)/ =~ para
elsif event_list? && /\A(EVT_[_A-Z0-9]+)(\*)?\(\w+\):(.*)/ =~ para
wildcard = ($2 == '*')
evthnd_name = $1.downcase
arglist = "meth = nil, &block"
Expand Down
21 changes: 0 additions & 21 deletions samples/sampler/back.xpm

This file was deleted.

44 changes: 0 additions & 44 deletions samples/sampler/copy.xpm

This file was deleted.

46 changes: 0 additions & 46 deletions samples/sampler/cut.xpm

This file was deleted.

24 changes: 13 additions & 11 deletions samples/sampler/editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ def initialize(sampler, sample, pos: Wx::DEFAULT_POSITION , style: Wx::DEFAULT_F

menuFile = Wx::Menu.new
menuFile.append(ID::SAVE, "&Save\tCtrl-S", 'Save the sample to a local folder')
menuFile.append(ID::RUN, "&Run\tCtrl-G", 'Run the (changed) sample')
runItem = Wx::MenuItem.new(menuFile, ID::RUN, "&Run\tCtrl-G", 'Run the (changed) sample')
runItem.set_bitmap(bitmap(:play))
menuFile.append(runItem)
menuFile.append_separator
menuFile.append(ID::QUIT, "&Close\tCtrl-Q", "Close the sample editor")

Expand Down Expand Up @@ -315,20 +317,20 @@ def initialize(sampler, sample, pos: Wx::DEFAULT_POSITION , style: Wx::DEFAULT_F
panel_szr = Wx::VBoxSizer.new
@tbar = Wx::ToolBar.new(panel, style: Wx::TB_HORIZONTAL | Wx::NO_BORDER | Wx::TB_FLAT)
@tbar.tool_bitmap_size = [ 16, 16 ]
@tbar.add_tool(ID::SAVE, 'Save', bitmap(:filesave), 'Save the sample to a local folder')
@tbar.add_tool(ID::SAVE, 'Save', Wx::ArtProvider.get_bitmap(Wx::ART_FILE_SAVE, Wx::ART_TOOLBAR, [16,16]), 'Save the sample to a local folder')
@tbar.add_tool(ID::RUN, 'Run', bitmap(:play), 'Run the (changed) sample')
@tbar.add_separator
@tbar.add_tool(ID::UNDO, 'Undo', bitmap(:undo), 'Undo change')
@tbar.add_tool(ID::REDO, 'Redo', bitmap(:redo), 'Redo change')
@tbar.add_tool(ID::UNDO, 'Undo', Wx::ArtProvider.get_bitmap(Wx::ART_UNDO, Wx::ART_TOOLBAR, [16,16]), 'Undo change')
@tbar.add_tool(ID::REDO, 'Redo', Wx::ArtProvider.get_bitmap(Wx::ART_REDO, Wx::ART_TOOLBAR, [16,16]), 'Redo change')
@tbar.add_separator
@tbar.add_tool(ID::COPY, 'Copy', bitmap(:copy), 'Copy selection')
@tbar.add_tool(ID::CUT, 'Cut', bitmap(:cut), 'Cut selection')
@tbar.add_tool(ID::PASTE, 'Paste', bitmap(:paste), 'Paste selection')
@tbar.add_tool(ID::COPY, 'Copy', Wx::ArtProvider.get_bitmap(Wx::ART_COPY, Wx::ART_TOOLBAR, [16,16]), 'Copy selection')
@tbar.add_tool(ID::CUT, 'Cut', Wx::ArtProvider.get_bitmap(Wx::ART_CUT, Wx::ART_TOOLBAR, [16,16]), 'Cut selection')
@tbar.add_tool(ID::PASTE, 'Paste', Wx::ArtProvider.get_bitmap(Wx::ART_PASTE, Wx::ART_TOOLBAR, [16,16]), 'Paste selection')
@tbar.add_separator
@tbar.add_tool(ID::FIND, 'Find', bitmap(:find), 'Show Find Dialog')
@tbar.add_tool(ID::FIND_NEXT, 'FindNext', bitmap(:forward), 'Find next occurrence of the search phrase')
@tbar.add_tool(ID::FIND_PREV, 'FindPrev', bitmap(:back), 'Find previous occurrence of the search phrase')
@tbar.add_tool(ID::REPLACE, 'Replace', bitmap(:findrepl), 'Show Replace Dialog')
@tbar.add_tool(ID::FIND, 'Find', Wx::ArtProvider.get_bitmap(Wx::ART_FIND, Wx::ART_TOOLBAR, [16,16]), 'Show Find Dialog')
@tbar.add_tool(ID::FIND_NEXT, 'FindNext', Wx::ArtProvider.get_bitmap(Wx::ART_GO_FORWARD, Wx::ART_TOOLBAR, [16,16]), 'Find next occurrence of the search phrase')
@tbar.add_tool(ID::FIND_PREV, 'FindPrev', Wx::ArtProvider.get_bitmap(Wx::ART_GO_BACK, Wx::ART_TOOLBAR, [16,16]), 'Find previous occurrence of the search phrase')
@tbar.add_tool(ID::REPLACE, 'Replace', Wx::ArtProvider.get_bitmap(Wx::ART_FIND_AND_REPLACE, Wx::ART_TOOLBAR, [16,16]), 'Show Replace Dialog')
@tbar.realize
panel_szr.add(@tbar)

Expand Down
42 changes: 0 additions & 42 deletions samples/sampler/filesave.xpm

This file was deleted.

62 changes: 0 additions & 62 deletions samples/sampler/find.xpm

This file was deleted.

Loading

0 comments on commit 08ee81d

Please sign in to comment.