Skip to content

Commit

Permalink
Merge pull request #313 from mcorino/develop
Browse files Browse the repository at this point in the history
add support for the missing #evt_hotkey method (WXMSW and WXOSX only)
mcorino authored Oct 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 2ff84a5 + abdfef6 commit 8bc3598
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/wx/core/event.rb
Original file line number Diff line number Diff line change
@@ -58,4 +58,11 @@ class CommandEvent
Wx::EVT_NC_PAINT,
Wx::NcPaintEvent
]
if Wx.const_defined?(:EVT_HOTKEY)
EvtHandler.register_event_type EvtHandler::EventType[
'evt_hotkey', 1,
Wx::EVT_HOTKEY,
Wx::KeyEvent
]
end
end
6 changes: 6 additions & 0 deletions lib/wx/doc/evthandler.rb
Original file line number Diff line number Diff line change
@@ -142,6 +142,12 @@ def evt_timer(id, meth = nil, &block) end
# @yield [*args] optional arguments
def call_after(meth = nil, *args, &block) end

# Process a {Wx::EVT_HOTKEY} event.
# @param [Integer] id hotkey id
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
# @yieldparam [Wx::KeyEvent] event the event to handle
def evt_hotkey(id, meth = nil, &block) end

end

end
2 changes: 1 addition & 1 deletion tests/lib/leaked_overload_exception_test.rb
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def test_exception_in_overload
szr = ExceptionSizer.new(Wx::Orientation::VERTICAL)
szr.add(Wx::Button.new(frame_win, name: 'button'), Wx::Direction::TOP)
frame_win.sizer = szr
assert_raise_kind_of(RuntimeError) { frame_win.layout }
frame_win.layout
frame_win.sizer = nil
end

2 changes: 1 addition & 1 deletion tests/lib/overload_type_exception_test.rb
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def test_invalid_output
szr = InvalidOutputSizer.new(Wx::Orientation::VERTICAL)
szr.add(Wx::Button.new(frame_win, name: 'button'), Wx::Direction::TOP)
frame_win.sizer = szr
assert_raise_kind_of(TypeError) { frame_win.layout }
frame_win.layout
frame_win.sizer = nil
end

0 comments on commit 8bc3598

Please sign in to comment.