-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from mcorino/develop
Develop
- Loading branch information
Showing
7 changed files
with
320 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
:wxAuiManager: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /AddPane/ | ||
:replace: | | ||
```ruby | ||
@text1 = Wx::TextCtrl.new(self, -1) | ||
@text2 = Wx::TextCtrl.new(self, -1) | ||
@mgr.add_pane(@text1, Wx::LEFT, 'Pane Caption') | ||
@mgr.add_pane(@text2, Wx::BOTTOM, 'Pane Caption') | ||
@mgr.update | ||
``` | ||
- :pattern: !ruby/regexp /GetPane/ | ||
:replace: | | ||
```ruby | ||
@mgr.get_pane(@text1).float | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
--- | ||
:wxWindow.SetScrollbar: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
set_scrollbar(Wx::VERTICAL, 0, 16, 50) | ||
``` | ||
:wxWindow.FromDIP: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
bmp = Wx::Bitmap.new(from_dip(Wx::Size.new(32, 32))) | ||
``` | ||
:wxWindow.ToDIP: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
pt = Wx::Point.new(to_dip(get_position)) | ||
size = Wx::Size.new(to_dip(get_size)) | ||
``` | ||
:wxWindow.SetMaxClientSize: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
set_max_size(client_to_window_size(size)) | ||
``` | ||
:wxWindow.SetMinClientSize: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
set_min_size(client_to_window_size(size)) | ||
``` | ||
:wxWindow.Move: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
set_size(x, y, Wx::DEFAULT_COORD, Wx::DEFAULT_COORD, Wx::SIZE_USE_EXISTING) | ||
``` | ||
:wxWindow.ConvertDialogToPixels: | ||
:detail: | ||
:pre: | ||
:para: | ||
- :pattern: !ruby/regexp /A\s+convenience\s+macro\s+is\s+defined:/ | ||
:subst: '' | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: '' | ||
:wxWindow.SetBackgroundStyle: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
class MyWidget < Wx::Window | ||
def initialize(parent, ...) | ||
super() # Use default ctor here! | ||
# Do this first: | ||
set_background_style(Wx::BG_STYLE_TRANSPARENT) | ||
# And really create the window afterwards: | ||
create(parent, ...) | ||
end | ||
end | ||
``` | ||
:wxWindow.HandleWindowEvent: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
get_event_handler.safely_process_event(event) | ||
``` | ||
:wxWindow.ProcessWindowEvent: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
get_event_handler.process_event(event) | ||
``` | ||
:wxWindow.PushEventHandler: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
W.push_event_handler(A) | ||
W.push_event_handler(B) | ||
``` | ||
:wxWindow.Enable: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
w = MyWindow.new # Note: default ctor is used here. | ||
w.enable(false) | ||
w.create(parent, ... all the usual non-default ctor arguments ...) | ||
``` | ||
:wxWindow.EnableTouchEvents: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
enable_touch_events(Wx::TOUCH_ZOOM_GESTURE | Wx::TOUCH_ROTATE_GESTURE) | ||
``` | ||
:wxWindow.DoUpdateWindowUI: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
# do the window-specific processing after processing the update event | ||
def Wx::TopLevelWindow.do_update_window_ui(event) | ||
if event.get_set_enabled | ||
enable(event.get_enabled) | ||
end | ||
if event.get_set_text | ||
if event.get_text != get_title | ||
set_title(event.get_text) | ||
end | ||
end | ||
end | ||
``` | ||
:wxWindow.UpdateWindowUI: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
class MyWindow | ||
... | ||
def on_internal_idle | ||
update_window_ui(Wx::UPDATE_UI_FROMIDLE) if Wx::UpdateUIEvent.can_update(self) | ||
end | ||
... | ||
end | ||
``` | ||
:wxWindow.Create: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /wxPanel/ | ||
:replace: | | ||
```ruby | ||
panel = Wx::Panel.new # Note: default constructor used. | ||
panel.hide # Can be called before actually creating it. | ||
panel.create(parent, Wx::ID_ANY, ...) # Won't be shown yet. | ||
... create all the panel children ... | ||
panel.show # Now everything will be shown at once. | ||
``` | ||
- :pattern: !ruby/regexp /MyCreateWindowObjectFunction/ | ||
:replace: | | ||
```ruby | ||
# Suppose we have this function (which would typically be in a | ||
# different file from the rest of the code). | ||
def my_create_window_object_function | ||
MyCustomClassDerivingFromWindow.new | ||
end | ||
# Then we can create a window of MyCustomClassDerivingFromWindow | ||
# class without really knowing about this type, as we would have | ||
# to do if we wanted to use the non-default constructor, like this: | ||
# First create the C++ object using the factory function. | ||
window = my_create_window_object_function | ||
# And now create the underlying window. | ||
# | ||
# This should call the base Wx::Window#create. | ||
# In C++ (wxWidgets) this method is not virtual and cannot be overloaded | ||
# so the derived class can't customize this part. | ||
# In wxRuby however this method can be overloaded as long as the following | ||
# is kept in mind: | ||
# 1. the overloaded version will **NOT** be called when using a non-default | ||
# constructor (Create will than be called from C++ which will always be | ||
# the base Wx::Window version); | ||
# 2. when calling the overloaded version from Ruby understand that the window | ||
# will not actually be created until after the `super` version has been called. | ||
# In general it's best not to overload this method but to define a different method | ||
# if a custom initializer is needed. | ||
window.create(parent, Wx::ID_ANY, ...) | ||
``` | ||
:wxWindow.MSWDisableComposited: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
class MyFrame < Wx::Frame | ||
def initialize(...) | ||
... | ||
p = Wx::Panel.new(self) | ||
if Wx::PLATFORM == 'WXMSW' | ||
p.msw_disable_composited | ||
end | ||
# Using Wx::ClientDC will work now with this panel in wxMSW -- | ||
# although it still won't with wxOSX nor wxGTK under Wayland. | ||
end | ||
... | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
:wxWizardPageSimple.Chain: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
firstPage = FirstPage.new # derived from Wx::WizardPageSimple | ||
firstPage.chain(SecondPage.new) | ||
.chain(ThirdPage.new) | ||
.chain(LastPage.new) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
:wxXmlNode.GetNodeContent: | ||
:detail: | ||
:pre: | ||
:para: | ||
- :pattern: !ruby/regexp /tagnametagcontent\/tagname/ | ||
:subst: '<tagname>tagcontent</tagname>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
:wxXmlResource.Load: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
if !Wx::XmlResource.get.load('rc/*.xrc') | ||
Wx.log_error("Couldn't load resources!") | ||
end | ||
``` | ||
:wxXmlResource.LoadDialog: | ||
:detail: | ||
:pre: | ||
:programlisting: | ||
- :pattern: !ruby/regexp /.*/ | ||
:replace: | | ||
```ruby | ||
dlg = MyDialog.new | ||
Wx::XmlResource.get.load_dialog_subclass(dlg, main_frame, 'my_dialog') | ||
dlg.show_modal | ||
dlg.destroy | ||
``` |