From 6f09e8d6cdb079fe5192639595761adc4a860ce9 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 30 Mar 2024 14:25:34 +0100 Subject: [PATCH 1/4] add missing name constants --- lib/wx/core/const.rb | 19 +++++++++++++++++++ lib/wx/doc/const.rb | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/lib/wx/core/const.rb b/lib/wx/core/const.rb index 8e902e00..e1d197b2 100644 --- a/lib/wx/core/const.rb +++ b/lib/wx/core/const.rb @@ -68,8 +68,14 @@ module Wx TREE_LIST_CTRL_NAME_STR = 'wxTreeListCtrl' HTML_LIST_BOX_NAME_STR = 'htmlListBox' SIMPLE_HTML_LIST_BOX_NAME_STR = 'simpleHtmlListBox' + HTML_WINDOW_NAME_STR = 'htmlWindow' EDITABLE_LIST_BOX_NAME_STR = 'editableListBox' V_LIST_BOX_NAME_STR = 'wxVListBox' + ACTIVITY_INDICATOR_NAME_STR = 'activityindicator' + TIME_PICKER_CTRL_NAME_STR = 'timectrl' + DATE_PICKER_CTRL_NAME_STR = 'datectrl' + CALENDAR_NAME_STR = 'CalendarCtrl' + SPIN_BUTTON_NAME_STR = 'wxSpinButton' if Wx::PLATFORM == 'WXMSW' # wxMSW only @@ -80,4 +86,17 @@ module Wx PROPERTY_GRID_NAME_STR = 'wxPropertyGrid' STC_NAME_STR = 'stcwindow' + # custom wxRuby addition + MEDIA_CTRL_NAME_STR = 'mediaCtrl' + SPIN_CTRL_NAME_STR = 'wxSpinCtrl' + SPIN_CTRL_DOUBLE_NAME_STR = 'wxSpinCtrlDouble' + SPLITTER_WINDOW_NAME_STR = 'splitter' + CHOICEBOOK_NAME_STR = 'choicebook' + LISTBOOK_NAME_STR = 'listbook' + TOOLBOOK_NAME_STR = 'toolbook' + TREEBOOK_NAME_STR = 'treebook' + SASH_WINDOW_NAME_STR = 'sashWindow' + SASH_LAYOUT_WINDOW_NAME_STR = 'layoutWindow' + SCROLLED_NAME_STR = 'SCROLLED_WINDOW' + end diff --git a/lib/wx/doc/const.rb b/lib/wx/doc/const.rb index 53302f65..3bbcb309 100644 --- a/lib/wx/doc/const.rb +++ b/lib/wx/doc/const.rb @@ -71,8 +71,14 @@ module Wx TREE_LIST_CTRL_NAME_STR = 'wxTreeListCtrl' HTML_LIST_BOX_NAME_STR = 'htmlListBox' SIMPLE_HTML_LIST_BOX_NAME_STR = 'simpleHtmlListBox' + HTML_WINDOW_NAME_STR = 'htmlWindow' EDITABLE_LIST_BOX_NAME_STR = 'editableListBox' V_LIST_BOX_NAME_STR = 'wxVListBox' + ACTIVITY_INDICATOR_NAME_STR = 'activityindicator' + TIME_PICKER_CTRL_NAME_STR = 'timectrl' + DATE_PICKER_CTRL_NAME_STR = 'datectrl' + CALENDAR_NAME_STR = 'CalendarCtrl' + SPIN_BUTTON_NAME_STR = 'wxSpinButton' # wxMSW only MSW_HEADER_CTRL_NAME_STR = 'wxMSWHeaderCtrl' @@ -81,4 +87,14 @@ module Wx PROPERTY_GRID_NAME_STR = 'wxPropertyGrid' STC_NAME_STR = 'stcwindow' + MEDIA_CTRL_NAME_STR = 'mediaCtrl' + SPIN_CTRL_NAME_STR = 'spinCtrl' + SPIN_CTRL_DOUBLE_NAME_STR = 'wxSpinCtrlDouble' + SPLITTER_WINDOW_NAME_STR = 'splitter' + TOOLBOOK_NAME_STR = 'toolbook' + TREEBOOK_NAME_STR = 'treebook' + SASH_WINDOW_NAME_STR = 'sashWindow' + SASH_LAYOUT_WINDOW_NAME_STR = 'layoutWindow' + SCROLLED_NAME_STR = 'SCROLLED_WINDOW' + end From 70611e0cf53a5aa35a6bc9d37ac96f9f280db636 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 30 Mar 2024 14:26:04 +0100 Subject: [PATCH 2/4] complete kw ctors; use proper name constants --- lib/wx/grid/keyword_defs.rb | 2 +- lib/wx/html/keyword_defs.rb | 6 +- lib/wx/keyword_defs.rb | 147 +++++++++++++++++++----------------- lib/wx/pg/keyword_defs.rb | 4 +- lib/wx/rbn/keyword_defs.rb | 2 +- lib/wx/rtc/keyword_defs.rb | 2 +- lib/wx/stc/keyword_defs.rb | 2 +- 7 files changed, 85 insertions(+), 80 deletions(-) diff --git a/lib/wx/grid/keyword_defs.rb b/lib/wx/grid/keyword_defs.rb index 4277ddcf..6bd9b6ba 100644 --- a/lib/wx/grid/keyword_defs.rb +++ b/lib/wx/grid/keyword_defs.rb @@ -13,5 +13,5 @@ # wxGrid A grid (table) window Wx::define_keyword_ctors(Wx::GRID::Grid) do wx_ctor_params :id, :pos, :size, :style => Wx::WANTS_CHARS - wx_ctor_params :name => 'grid' + wx_ctor_params :name => Wx::GRID_NAME_STR end diff --git a/lib/wx/html/keyword_defs.rb b/lib/wx/html/keyword_defs.rb index 6fbe2a1a..5996fad9 100644 --- a/lib/wx/html/keyword_defs.rb +++ b/lib/wx/html/keyword_defs.rb @@ -13,16 +13,16 @@ # wxHtmlWindow - Control for displaying HTML Wx::define_keyword_ctors(Wx::HTML::HtmlWindow) do wx_ctor_params :id, :pos, :size, :style => Wx::HTML::HW_DEFAULT_STYLE - wx_ctor_params :name => 'htmlWindow' + wx_ctor_params :name => Wx::HTML_WINDOW_NAME_STR end # wxHtmlListBox A listbox showing HTML content Wx::define_keyword_ctors(Wx::HTML::HtmlListBox) do - wx_ctor_params :id, :pos, :size, :style, :name => 'HtmlListBox' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::HTML_LIST_BOX_NAME_STR end Wx::define_keyword_ctors(Wx::HTML::SimpleHtmlListBox) do wx_ctor_params :id, :pos, :size wx_ctor_params :choices => [] - wx_ctor_params :style, :validator, :name => 'SimpleHtmlListBox' + wx_ctor_params :style, :validator, :name => Wx::SIMPLE_HTML_LIST_BOX_NAME_STR end diff --git a/lib/wx/keyword_defs.rb b/lib/wx/keyword_defs.rb index 09b17c2d..bff209ea 100644 --- a/lib/wx/keyword_defs.rb +++ b/lib/wx/keyword_defs.rb @@ -12,7 +12,7 @@ # Window : base class for all widgets and frames Wx::define_keyword_ctors(Wx::Window) do wx_ctor_params :id, :pos, :size, :style - wx_ctor_params :name => 'window' + wx_ctor_params :name => Wx::PANEL_NAME_STR end ### FRAMES @@ -22,27 +22,27 @@ # Normal frame Wx::define_keyword_ctors(Wx::Frame) do wx_ctor_params :id, :title, :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE - wx_ctor_params :name => 'frame' + wx_ctor_params :name => Wx::FRAME_NAME_STR end # MDI child frame Wx::define_keyword_ctors(Wx::MDIChildFrame) do wx_ctor_params :id, :title, :pos, :size, :style => Wx::DEFAULT_FRAME_STYLE - wx_ctor_params :name => 'frame' + wx_ctor_params :name => Wx::FRAME_NAME_STR end # MDI parent frame Wx::define_keyword_ctors(Wx::MDIParentFrame) do wx_ctor_params :id, :title, :pos, :size wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE|Wx::VSCROLL|Wx::HSCROLL - wx_ctor_params :name => 'frame' + wx_ctor_params :name => Wx::FRAME_NAME_STR end # wxMiniFrame A frame with a small title bar Wx::define_keyword_ctors(Wx::MiniFrame) do wx_ctor_params :id, :title, :pos, :size wx_ctor_params :style => Wx::DEFAULT_FRAME_STYLE - wx_ctor_params :name => 'frame' + wx_ctor_params :name => Wx::FRAME_NAME_STR end # wxPropertySheetDialog Property sheet dialog @@ -72,31 +72,36 @@ # A window whose colour changes according to current user settings Wx::define_keyword_ctors(Wx::Panel) do wx_ctor_params :id, :pos, :size, :style => Wx::TAB_TRAVERSAL - wx_ctor_params :name => 'panel' + wx_ctor_params :name => Wx::PANEL_NAME_STR end # wxScrolledWindow Window with automatically managed scrollbars Wx::define_keyword_ctors(Wx::ScrolledWindow) do wx_ctor_params :id, :pos, :size, :style => Wx::VSCROLL|Wx::HSCROLL - wx_ctor_params :name => 'scrolledWindow' + wx_ctor_params :name => Wx::SCROLLED_NAME_STR +end + +Wx::define_keyword_ctors(Wx::ScrolledCanvas) do + wx_ctor_params :id, :pos, :size, :style => Wx::VSCROLL|Wx::HSCROLL + wx_ctor_params :name => Wx::SCROLLED_NAME_STR end # Window which can be split vertically or horizontally Wx::define_keyword_ctors(Wx::SplitterWindow) do wx_ctor_params :id, :pos, :size, :style => Wx::SP_3D - wx_ctor_params :name => 'splitterWindow' + wx_ctor_params :name => Wx::SPLITTER_WINDOW_NAME_STR end # Implements the status bar on a frame Wx::define_keyword_ctors(Wx::StatusBar) do wx_ctor_params :id, :style => Wx::STB_SIZEGRIP - wx_ctor_params :name => 'statusBar' + wx_ctor_params :name => Wx::STATUS_BAR_NAME_STR end # Toolbar class Wx::define_keyword_ctors(Wx::ToolBar) do wx_ctor_params :id, :pos, :size, :style => Wx::TB_HORIZONTAL|Wx::NO_BORDER - wx_ctor_params :name => 'toolBar' # not as documented in Wx 2.6.3 + wx_ctor_params :name => Wx::TOOL_BAR_NAME_STR end # ToolBarTool class @@ -116,34 +121,34 @@ # Similar to notebook but using choice control Wx::define_keyword_ctors(Wx::Choicebook) do - wx_ctor_params :id, :pos, :size, :style, :name => 'choiceBook' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::CHOICEBOOK_NAME_STR end # Notebook class Wx::define_keyword_ctors(Wx::Notebook) do - wx_ctor_params :id, :pos, :size, :style, :name => 'noteBook' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::NOTEBOOK_NAME_STR end # Similar to notebook but using list control Wx::define_keyword_ctors(Wx::Listbook) do - wx_ctor_params :id, :pos, :size, :style, :name => 'listBook' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::LISTBOOK_NAME_STR end # Similar to notebook but using toolbar Wx::define_keyword_ctors(Wx::Toolbook) do - wx_ctor_params :id, :pos, :size, :style, :name => 'toolBook' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::TOOLBOOK_NAME_STR end # Similar to notebook but using tree control Wx::define_keyword_ctors(Wx::Treebook) do - wx_ctor_params :id, :pos, :size, :style, :name => 'treeBook' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::TREEBOOK_NAME_STR end # wxSashWindow: Window with four optional sashes that can be dragged Wx::define_keyword_ctors(Wx::SashWindow) do wx_ctor_params :id, :pos, :size wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D - wx_ctor_params :name => 'sashWindow' + wx_ctor_params :name => Wx::SASH_WINDOW_NAME_STR end # wxSashLayoutWindow: Window that can be involved in an IDE-like layout @@ -151,7 +156,7 @@ Wx::define_keyword_ctors(Wx::SashLayoutWindow) do wx_ctor_params :id, :pos, :size wx_ctor_params :style => Wx::CLIP_CHILDREN|Wx::SW_3D - wx_ctor_params :name => 'layoutWindow' + wx_ctor_params :name => Wx::SASH_LAYOUT_WINDOW_NAME_STR end # wxVScrolledWindow: As wxScrolledWindow but supports lines of variable height @@ -173,7 +178,7 @@ Wx::define_keyword_ctors(Wx::Dialog) do wx_ctor_params :id, :title => '' wx_ctor_params :pos, :size, :style => Wx::DEFAULT_DIALOG_STYLE - wx_ctor_params :name => 'dialogBox' + wx_ctor_params :name => Wx::DIALOG_NAME_STR end # wxColourDialog Colour chooser dialog @@ -186,7 +191,7 @@ wx_ctor_params :message => 'Choose a directory' wx_ctor_params :default_path => '' wx_ctor_params :style => Wx::DD_DEFAULT_STYLE - wx_ctor_params :pos, :size, :name => 'wxDirCtrl' + wx_ctor_params :pos, :size, :name => Wx::DIR_DIALOG_NAME_STR end # wxFileDialog File selector dialog @@ -196,13 +201,13 @@ wx_ctor_params :default_file => '' wx_ctor_params :wildcard => '*.*' wx_ctor_params :style => Wx::FD_DEFAULT_STYLE - wx_ctor_params :pos, :size, :name => 'filedlg' + wx_ctor_params :pos, :size, :name => Wx::FILE_DIALOG_NAME_STR end # wxFindReplaceDialog Text search/replace dialog Wx::define_keyword_ctors(Wx::FindReplaceDialog) do wx_ctor_params :find_replace_data => Wx::FindReplaceData.new() - wx_ctor_params :title => 'findReplaceDialog' + wx_ctor_params :title wx_ctor_params :style end @@ -259,7 +264,7 @@ Wx::define_keyword_ctors(Wx::PropertySheetDialog) do wx_ctor_params :id, :title wx_ctor_params :pos, :size, :style => Wx::DEFAULT_DIALOG_STYLE - wx_ctor_params :name => 'propertySheetDialog' + wx_ctor_params :name => Wx::DIALOG_NAME_STR end ### CONTROLS @@ -268,7 +273,7 @@ Wx::define_keyword_ctors(Wx::Button) do wx_ctor_params :id, :label => '' wx_ctor_params :pos, :size, :style - wx_ctor_params :validator, :name => 'button' + wx_ctor_params :validator, :name => Wx::BUTTON_NAME_STR end # Push button control, displaying a bitmap @@ -276,7 +281,7 @@ wx_ctor_params :id wx_ctor_params :bitmap wx_ctor_params :pos, :size, :style => Wx::BU_AUTODRAW - wx_ctor_params :validator, :name => 'button' + wx_ctor_params :validator, :name => Wx::BUTTON_NAME_STR end # Push button control, similar behavior as hyperlinks @@ -284,57 +289,57 @@ wx_ctor_params :id, :mainLabel => '' wx_ctor_params :note => '' wx_ctor_params :pos, :size, :style - wx_ctor_params :validator, :name => 'commandLinkButton' + wx_ctor_params :validator, :name => Wx::BUTTON_NAME_STR end # A button which stays pressed when clicked by user. Wx::define_keyword_ctors(Wx::ToggleButton) do wx_ctor_params :id, :label, :pos, :size, :style - wx_ctor_params :validator, :name => 'toggleButton' + wx_ctor_params :validator, :name => Wx::CHECK_BOX_NAME_STR end Wx::define_keyword_ctors(Wx::BitmapToggleButton) do wx_ctor_params :id, :label, :pos, :size, :style - wx_ctor_params :validator, :name => 'bitmapToggleButton' + wx_ctor_params :validator, :name => Wx::CHECK_BOX_NAME_STR end # Control showing an entire calendar month Wx::define_keyword_ctors(Wx::CalendarCtrl) do wx_ctor_params :id, :date => Time.now() wx_ctor_params :pos, :size, :style => Wx::CAL_SHOW_HOLIDAYS - wx_ctor_params :name => 'calendar' + wx_ctor_params :name => Wx::CALENDAR_NAME_STR end # Checkbox control Wx::define_keyword_ctors(Wx::CheckBox) do wx_ctor_params :id, :label => '' wx_ctor_params :pos, :size, :style - wx_ctor_params :validator, :name => 'checkBox' + wx_ctor_params :validator, :name => Wx::CHECK_BOX_NAME_STR end # wxListBox A list of strings for single or multiple selection Wx::define_keyword_ctors(Wx::ListBox) do wx_ctor_params :id, :pos, :size, :choices => [] wx_ctor_params :style - wx_ctor_params :validator, :name => 'listBox' + wx_ctor_params :validator, :name => Wx::LIST_BOX_NAME_STR end # A listbox with a checkbox to the left of each item Wx::define_keyword_ctors(Wx::CheckListBox) do wx_ctor_params :id, :pos, :size, :choices, :style - wx_ctor_params :validator, :name => 'listBox' + wx_ctor_params :validator, :name => Wx::LIST_BOX_NAME_STR end # wxEditableListBox - an editable listbox is composite control that lets the user easily enter, delete and reorder a list of strings. Wx::define_keyword_ctors(Wx::EditableListBox) do wx_ctor_params :id, :label, :pos, :size, :style => Wx::EL_DEFAULT_STYLE - wx_ctor_params :name => 'editableListBox' + wx_ctor_params :name => Wx::EDITABLE_LIST_BOX_NAME_STR end # wxChoice Choice control (a combobox without the editable area) Wx::define_keyword_ctors(Wx::Choice) do wx_ctor_params :id, :pos, :size, :choices, :style - wx_ctor_params :validator, :name => 'choice' + wx_ctor_params :validator, :name => Wx::CHOICE_NAME_STR end # wxComboBox A choice with an editable area @@ -342,7 +347,7 @@ wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :choices => [] wx_ctor_params :style - wx_ctor_params :validator, :name => 'comboBox' + wx_ctor_params :validator, :name => Wx::COMBO_BOX_NAME_STR end # wxBitmapComboBox A choice with an editable area @@ -350,14 +355,14 @@ wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :choices => [] wx_ctor_params :style - wx_ctor_params :validator, :name => 'comboBox' + wx_ctor_params :validator, :name => Wx::BITMAP_COMBO_BOX_NAME_STR end # wxComboCtrl Wx::define_keyword_ctors(Wx::ComboCtrl) do wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :style - wx_ctor_params :validator, :name => 'comboCtrl' + wx_ctor_params :validator, :name => Wx::COMBO_BOX_NAME_STR end # wxOwnerDrawnComboBox @@ -365,14 +370,14 @@ wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :choices => [] wx_ctor_params :style - wx_ctor_params :validator, :name => 'ownerDrawnComboBox' + wx_ctor_params :validator, :name => Wx::COMBO_BOX_NAME_STR end # wxGauge A control to represent a varying quantity, such as time # remaining Wx::define_keyword_ctors(Wx::Gauge) do wx_ctor_params :id, :range, :pos, :size, :style => Wx::GA_HORIZONTAL - wx_ctor_params :validator, :name => 'gauge' + wx_ctor_params :validator, :name => Wx::GAUGE_NAME_STR end # wxGenericDirCtrl A control for displaying a directory tree @@ -383,13 +388,13 @@ :style => Wx::DIRCTRL_3D_INTERNAL|Wx::SUNKEN_BORDER wx_ctor_params :filter => '' wx_ctor_params :default_filter => 0 - wx_ctor_params :name => 'genericDirCtrl' + wx_ctor_params :name => Wx::TREE_CTRL_NAME_STR end # wxListCtrl A control for displaying lists of strings and/or icons, plus a multicolumn report view Wx::define_keyword_ctors(Wx::ListCtrl) do wx_ctor_params :id, :pos, :size, :style => Wx::LC_ICON - wx_ctor_params :validator, :name => 'listCtrl' + wx_ctor_params :validator, :name => Wx::LIST_CTRL_NAME_STR end # wxListView A simpler interface (facade for wxListCtrl in report mode @@ -397,7 +402,7 @@ # wxTreeCtrl Tree (hierarchy) control Wx::define_keyword_ctors(Wx::TreeCtrl) do wx_ctor_params :id, :pos, :size, :style => Wx::TR_DEFAULT_STYLE - wx_ctor_params :validator, :name => 'treeCtrl' + wx_ctor_params :validator, :name => Wx::TREE_CTRL_NAME_STR end # wxSpinCtrl A spin control - i.e. spin button and text control @@ -407,7 +412,7 @@ wx_ctor_params :min => 0 wx_ctor_params :max => 100 wx_ctor_params :initial => 0 - wx_ctor_params :name => 'spinCtrl' + wx_ctor_params :name => Wx::SPIN_CTRL_NAME_STR end # wxSpinCtrlDouble A spin control - i.e. spin button and text control @@ -418,21 +423,21 @@ wx_ctor_params :max => 100 wx_ctor_params :initial => 0 wx_ctor_params :inc => 1 - wx_ctor_params :name => 'spinCtrlDouble' + wx_ctor_params :name => Wx::SPIN_CTRL_DOUBLE_NAME_STR end # One or more lines of non-editable text Wx::define_keyword_ctors(Wx::StaticText) do - wx_ctor_params :id, :label, :pos, :size, :style, :name => 'staticText' + wx_ctor_params :id, :label, :pos, :size, :style, :name => Wx::STATIC_TEXT_NAME_STR end Wx::define_keyword_ctors(Wx::StaticBox) do - wx_ctor_params :id, :label, :pos, :size, :style, :name => 'staticBox' + wx_ctor_params :id, :label, :pos, :size, :style, :name => Wx::STATIC_BOX_NAME_STR end Wx::define_keyword_ctors(Wx::StaticLine) do wx_ctor_params :id, :pos, :size, :style => Wx::LI_HORIZONTAL - wx_ctor_params :name => 'staticBox' + wx_ctor_params :name => Wx::STATIC_LINE_NAME_STR end # wxStaticBitmap A control to display a bitmap @@ -457,14 +462,14 @@ wx_ctor_params :pos, :size, :choices => [] wx_ctor_params :major_dimension => 0 wx_ctor_params :style => Wx::RA_SPECIFY_COLS - wx_ctor_params :validator, :name => 'radioBox' + wx_ctor_params :validator, :name => Wx::RADIO_BOX_NAME_STR end # wxRadioButton: A round button used with others in a mutually exclusive way Wx::define_keyword_ctors(Wx::RadioButton) do wx_ctor_params :id, :label => '' wx_ctor_params :pos, :size, :style => 0 - wx_ctor_params :validator, :name => 'radioButton' + wx_ctor_params :validator, :name => Wx::RADIO_BUTTON_NAME_STR end # wxSlider A slider that can be dragged by the user @@ -472,19 +477,19 @@ wx_ctor_params :id, :value => 0 wx_ctor_params :min_value, :max_value wx_ctor_params :pos, :size, :style => Wx::SL_HORIZONTAL - wx_ctor_params :validator, :name => 'slider' + wx_ctor_params :validator, :name => Wx::SLIDER_NAME_STR end # wxSpinButton - Has two small up and down (or left and right) arrow buttons Wx::define_keyword_ctors(Wx::SpinButton) do wx_ctor_params :id, :pos, :size, :style => Wx::SP_HORIZONTAL - wx_ctor_params :name => 'spinButton' + wx_ctor_params :name => Wx::SPIN_BUTTON_NAME_STR end # wxScrollBar - standalone scrollbar with arrows and thumb Wx::define_keyword_ctors(Wx::ScrollBar) do wx_ctor_params :id, :pos, :size, :style => Wx::SB_HORIZONTAL - wx_ctor_params :validator, :name => 'scrollBar' + wx_ctor_params :validator, :name => Wx::SCROLL_BAR_NAME_STR end @@ -494,7 +499,7 @@ Wx::define_keyword_ctors(Wx::TextCtrl) do wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :style - wx_ctor_params :validator, :name => 'textCtrl' + wx_ctor_params :validator, :name => Wx::TEXT_CTRL_NAME_STR end # wxHyperTextCtrl - display a clickable URL @@ -502,63 +507,63 @@ wx_ctor_params :id, :label => '' wx_ctor_params :url => '' wx_ctor_params :pos, :size, :style => Wx::HL_DEFAULT_STYLE - wx_ctor_params :name => 'hyperlink' + wx_ctor_params :name => Wx::HYPERLINK_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::CollapsiblePane) do wx_ctor_params :id, :label => '' wx_ctor_params :pos, :size, :style => 0 - wx_ctor_params :validator, :name => 'collapsiblePane' + wx_ctor_params :validator, :name => Wx::COLLAPSIBLE_PANE_NAME_STR end Wx::define_keyword_ctors(Wx::MediaCtrl) do wx_ctor_params :id, :filename => '' wx_ctor_params :pos, :size, :style => 0 wx_ctor_params :backend => '' - wx_ctor_params :validator, :name => 'mediaCtrl' + wx_ctor_params :validator, :name => Wx::MEDIA_CTRL_NAME_STR end if Wx.has_feature?(:USE_MEDIACTRL) Wx::define_keyword_ctors(Wx::SearchCtrl) do wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :style => 0 - wx_ctor_params :validator, :name => 'searchCtrl' + wx_ctor_params :validator, :name => Wx::SEARCH_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::AnimationCtrl) do wx_ctor_params :id, :anim wx_ctor_params :pos, :size, :style => Wx::AC_DEFAULT_STYLE - wx_ctor_params :name => 'animationCtrl' + wx_ctor_params :name => Wx::ANIMATION_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::VScrolledWindow) do - wx_ctor_params :id, :pos, :size, :style, :name => 'VScrolledWindowNameStr' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::PANEL_NAME_STR end Wx::define_keyword_ctors(Wx::VListBox) do - wx_ctor_params :id, :pos, :size, :style, :name => 'VListBoxNameStr' + wx_ctor_params :id, :pos, :size, :style, :name => Wx::V_LIST_BOX_NAME_STR end # wxDatePickerCtrl Small date picker control Wx::define_keyword_ctors(Wx::DatePickerCtrl) do wx_ctor_params :id, :dt, :pos, :size, :style => Wx::DP_DEFAULT|Wx::DP_SHOWCENTURY - wx_ctor_params :validator, :name => 'datePickerCtrl' + wx_ctor_params :validator, :name => Wx::DATE_PICKER_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::TimePickerCtrl) do wx_ctor_params :id, :dt, :pos, :size, :style => Wx::TP_DEFAULT - wx_ctor_params :validator, :name => 'timePickerCtrl' + wx_ctor_params :validator, :name => Wx::TIME_PICKER_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::ColourPickerCtrl) do wx_ctor_params :id, :colour => :BLACK wx_ctor_params :pos, :size, :style => Wx::CLRP_DEFAULT_STYLE - wx_ctor_params :validator, :name => 'colourPickerCtrl' + wx_ctor_params :validator, :name => Wx::COLOUR_PICKER_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::FontPickerCtrl) do wx_ctor_params :id, :font => Wx::NULL_FONT wx_ctor_params :pos, :size, :style => Wx::FNTP_DEFAULT_STYLE - wx_ctor_params :validator, :name => 'fontPickerCtrl' + wx_ctor_params :validator, :name => Wx::FONT_PICKER_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::FilePickerCtrl) do @@ -566,14 +571,14 @@ wx_ctor_params :message => Wx::FILE_SELECTOR_PROMPT_STR wx_ctor_params :wildcard => Wx::FILE_SELECTOR_DEFAULT_WILDCARD_STR wx_ctor_params :pos, :size, :style => Wx::FLP_DEFAULT_STYLE - wx_ctor_params :validator, :name => 'filePickerCtrl' + wx_ctor_params :validator, :name => Wx::FILE_PICKER_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::DirPickerCtrl) do wx_ctor_params :id, :path => '' wx_ctor_params :message => Wx::DIR_SELECTOR_PROMPT_STR wx_ctor_params :pos, :size, :style => Wx::DIRP_DEFAULT_STYLE - wx_ctor_params :validator, :name => 'dirPickerCtrl' + wx_ctor_params :validator, :name => Wx::DIR_PICKER_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::FileCtrl) do @@ -581,18 +586,18 @@ wx_ctor_params :defaultFilename => '' wx_ctor_params :wildcard => Wx::FILE_SELECTOR_DEFAULT_WILDCARD_STR wx_ctor_params :style => Wx::FC_DEFAULT_STYLE - wx_ctor_params :pos, :size, :name => 'fileCtrl' + wx_ctor_params :pos, :size, :name => Wx::FILE_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::ActivityIndicator) do wx_ctor_params :id, :pos, :size, :style => Wx::AC_DEFAULT_STYLE - wx_ctor_params :name => 'activityIndicator' + wx_ctor_params :name => Wx::ACTIVITY_INDICATOR_NAME_STR end Wx::define_keyword_ctors(Wx::BannerWindow) do wx_ctor_params :id, :dir => Wx::Direction::LEFT wx_ctor_params :pos, :size, :style - wx_ctor_params :name => 'bannerwindow' + wx_ctor_params :name => Wx::BANNER_WINDOW_NAME_STR end Wx::define_keyword_ctors(Wx::InfoBar) do @@ -601,16 +606,16 @@ Wx::define_keyword_ctors(Wx::RearrangeList) do wx_ctor_params :id, :pos, :size, :order, :items, :style - wx_ctor_params :validator, :name => 'rearrangeList' + wx_ctor_params :validator, :name => Wx::REARRANGE_LIST_NAME_STR end Wx::define_keyword_ctors(Wx::RearrangeCtrl) do wx_ctor_params :id, :pos, :size, :order, :items, :style - wx_ctor_params :validator, :name => 'rearrangeCtrl' + wx_ctor_params :validator, :name => Wx::REARRANGE_LIST_NAME_STR end Wx::define_keyword_ctors(Wx::HeaderCtrlSimple) do wx_ctor_params :winid => Wx::ID_ANY wx_ctor_params :pos, :size, :style => Wx::HD_DEFAULT_STYLE - wx_ctor_params :name => 'headerCtrlSimple' + wx_ctor_params :name => Wx::HEADER_CTRL_NAME_STR end diff --git a/lib/wx/pg/keyword_defs.rb b/lib/wx/pg/keyword_defs.rb index 5fa15812..cd620a35 100644 --- a/lib/wx/pg/keyword_defs.rb +++ b/lib/wx/pg/keyword_defs.rb @@ -12,11 +12,11 @@ # wxPropertyGrid Wx::define_keyword_ctors(Wx::PG::PropertyGrid) do wx_ctor_params :id, :pos, :size, :style => Wx::PG::PG_DEFAULT_STYLE - wx_ctor_params :name => 'PropertyGrid' + wx_ctor_params :name => Wx::PROPERTY_GRID_NAME_STR end # wxPropertyGridManager Wx::define_keyword_ctors(Wx::PG::PropertyGridManager) do wx_ctor_params :id, :pos, :size, :style => Wx::PG::PG_DEFAULT_STYLE - wx_ctor_params :name => 'PropertyGridManager' + wx_ctor_params :name => Wx::PROPERTY_GRID_MANAGER_NAME_STR end diff --git a/lib/wx/rbn/keyword_defs.rb b/lib/wx/rbn/keyword_defs.rb index 785595c8..fd263267 100644 --- a/lib/wx/rbn/keyword_defs.rb +++ b/lib/wx/rbn/keyword_defs.rb @@ -12,7 +12,7 @@ # wxRibbonControl Wx::define_keyword_ctors(Wx::RBN::RibbonControl) do wx_ctor_params :id, :pos, :size, :style, :validator - wx_ctor_params :name => 'RibbonControl' + wx_ctor_params :name => Wx::CONTROL_NAME_STR end # wxRibbonBar diff --git a/lib/wx/rtc/keyword_defs.rb b/lib/wx/rtc/keyword_defs.rb index 5cbda579..3fd362e5 100644 --- a/lib/wx/rtc/keyword_defs.rb +++ b/lib/wx/rtc/keyword_defs.rb @@ -12,7 +12,7 @@ Wx::define_keyword_ctors(Wx::RTC::RichTextCtrl) do wx_ctor_params :id, :value => '' wx_ctor_params :pos, :size, :style => Wx::TE_MULTILINE - wx_ctor_params :validator, :name => 'textCtrl' + wx_ctor_params :validator, :name => Wx::TEXT_CTRL_NAME_STR end Wx::define_keyword_ctors(Wx::RTC::RichTextStyleListBox) do diff --git a/lib/wx/stc/keyword_defs.rb b/lib/wx/stc/keyword_defs.rb index ca7f4222..1d5c26d4 100644 --- a/lib/wx/stc/keyword_defs.rb +++ b/lib/wx/stc/keyword_defs.rb @@ -11,5 +11,5 @@ Wx::define_keyword_ctors('StyledTextCtrl') do wx_ctor_params :id, :pos, :size, :style => 0 - wx_ctor_params :name => 'styledTextCtrl' + wx_ctor_params :name => Wx::STC_NAME_STR end From 66b7b9f8e6ec2bebac1dafef8bb45de6b7436228 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Sat, 30 Mar 2024 15:42:48 +0100 Subject: [PATCH 3/4] add Wx::Overlay, Wx::DCOverlay and doc --- lib/wx/doc/dc_overlay.rb | 34 ++++++++++++++++++ rakelib/lib/director/derived_dc.rb | 55 ++++++++++++++++++++++++------ rakelib/lib/specs/interfaces.rb | 1 + 3 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 lib/wx/doc/dc_overlay.rb diff --git a/lib/wx/doc/dc_overlay.rb b/lib/wx/doc/dc_overlay.rb new file mode 100644 index 00000000..3e6ee82c --- /dev/null +++ b/lib/wx/doc/dc_overlay.rb @@ -0,0 +1,34 @@ +# :stopdoc: +# Copyright (c) 2023 M.J.N. Corino, The Netherlands +# +# This software is released under the MIT license. +# :startdoc: + + +module Wx + + class DCOverlay < Wx::DC + + private :initialize + + # Connects this overlay to the corresponding drawing dc. If the overlay is not initialized yet, this call will do so. + # Creates a Wx::DCOverlay instance for to do that and passes the instance to the given block to use. + # Uses either the entire area of the drawing DC or the area specified. + # @overload draw_on(overlay, 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 + # @overload draw_on(overlay, dc, x, y, width, height) + # @param [Wx::Overlay] overlay Overlay to connect + # @param [Wx::DC] dc Drawing DC + # @param [Integer] x topleft x coordinate of area to use + # @param [Integer] y topleft y coordinate of area to use + # @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 + def self.draw_on(*arg) end + end + +end diff --git a/rakelib/lib/director/derived_dc.rb b/rakelib/lib/director/derived_dc.rb index f6f2602d..9f217557 100644 --- a/rakelib/lib/director/derived_dc.rb +++ b/rakelib/lib/director/derived_dc.rb @@ -16,7 +16,8 @@ def setup super spec.disable_proxies spec.gc_as_untracked spec.module_name - if spec.module_name == 'wxScreenDC' + case spec.module_name + when 'wxScreenDC' spec.make_abstract 'wxScreenDC' # as a ScreenDC should always be a temporary stack object # we do not allow creation in Ruby but rather provide a class @@ -41,7 +42,7 @@ def setup spec.ignore 'wxScreenDC::StartDrawingOnTop', 'wxScreenDC::EndDrawingOnTop', 'wxScreenDC::wxScreenDC' - elsif spec.module_name == 'wxClientDC' + when 'wxClientDC' spec.make_abstract 'wxClientDC' spec.ignore 'wxClientDC::wxClientDC' # as a ClientDC should best always be a temporary stack object @@ -63,10 +64,10 @@ def setup return rc; } __HEREDOC - elsif spec.module_name == 'wxPaintDC' + when 'wxPaintDC' spec.make_abstract 'wxPaintDC' spec.ignore 'wxPaintDC::wxPaintDC' - elsif spec.module_name == 'wxMemoryDC' + when 'wxMemoryDC' spec.items << 'wxBufferedDC' << 'wxBufferedPaintDC' << 'wxAutoBufferedPaintDC' spec.make_abstract 'wxMemoryDC' spec.make_abstract 'wxBufferedDC' @@ -213,7 +214,7 @@ def setup return rc; } __HEREDOC - elsif spec.module_name == 'wxMirrorDC' + when 'wxMirrorDC' spec.make_abstract 'wxMirrorDC' spec.ignore 'wxMirrorDC::wxMirrorDC' # as a MirrorDC should best always be a temporary stack object @@ -235,7 +236,7 @@ def setup return rc; } __HEREDOC - elsif spec.module_name == 'wxSVGFileDC' + when 'wxSVGFileDC' spec.items.concat %w[wxSVGBitmapHandler wxSVGBitmapFileHandler wxSVGBitmapEmbedHandler] spec.make_abstract 'wxSVGFileDC' spec.ignore 'wxSVGFileDC::wxSVGFileDC' @@ -272,7 +273,7 @@ def setup 'wxSVGFileDC::EndDoc', 'wxSVGFileDC::StartPage', 'wxSVGFileDC::EndPage' - elsif spec.module_name == 'wxGCDC' + when 'wxGCDC' spec.make_abstract 'wxGCDC' spec.ignore 'wxGCDC::wxGCDC' # like all DC this should best always be a temporary stack object @@ -357,7 +358,7 @@ def setup } __HEREDOC spec.ignore 'wxGCDC::wxGCDC(const wxEnhMetaFileDC &)' - elsif spec.module_name == 'wxScaledDC' + when 'wxScaledDC' spec.items.clear # wxRuby extension; no XML docs spec.override_inheritance_chain('wxScaledDC', %w[wxDC wxObject]) # as there are no dependencies parsed from XML make sure we're initialized after Wx::DC @@ -398,7 +399,7 @@ class wxScaledDC : public wxDC wxScaledDC(wxDC& target, double scale); }; __HEREDOC - elsif spec.module_name == 'wxPrinterDC' + when 'wxPrinterDC' spec.make_abstract 'wxPrinterDC' spec.ignore 'wxPrinterDC::wxPrinterDC' # as a PrinterDC should best always be a temporary stack object @@ -420,7 +421,7 @@ class wxScaledDC : public wxDC return rc; } __HEREDOC - elsif spec.module_name == 'wxPostScriptDC' + when 'wxPostScriptDC' spec.make_abstract 'wxPostScriptDC' spec.ignore 'wxPostScriptDC::wxPostScriptDC' # as a PostScriptDC should best always be a temporary stack object @@ -442,6 +443,40 @@ class wxScaledDC : public wxDC return rc; } __HEREDOC + when 'wxDCOverlay' + spec.items << 'wxOverlay' + spec.make_abstract 'wxDCOverlay' + spec.ignore 'wxDCOverlay::wxDCOverlay' + spec.add_extend_code 'wxDCOverlay', <<~__HEREDOC + static VALUE draw_on(wxOverlay &overlay, wxDC *dc) + { + if (!wxRuby_IsAppRunning()) + rb_raise(rb_eRuntimeError, "A running Wx::App is required."); + VALUE rc = Qnil; + if (rb_block_given_p ()) + { + wxDCOverlay ovl_dc(overlay, dc); + wxDCOverlay* ovl_dc_ptr = &ovl_dc; + VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0); + rc = rb_yield(rb_dc); + } + return rc; + } + static VALUE draw_on(wxOverlay &overlay, wxDC *dc, int x, int y, int width, int height) + { + if (!wxRuby_IsAppRunning()) + rb_raise(rb_eRuntimeError, "A running Wx::App is required."); + VALUE rc = Qnil; + if (rb_block_given_p ()) + { + wxDCOverlay ovl_dc(overlay, dc, x, y, width, height); + wxDCOverlay* ovl_dc_ptr = &ovl_dc; + VALUE rb_dc = SWIG_NewPointerObj(SWIG_as_voidptr(ovl_dc_ptr), SWIGTYPE_p_wxDCOverlay, 0); + rc = rb_yield(rb_dc); + } + return rc; + } + __HEREDOC else # ctors of all other derived DC require a running App spec.require_app spec.module_name diff --git a/rakelib/lib/specs/interfaces.rb b/rakelib/lib/specs/interfaces.rb index e56ba944..fac2ef7b 100644 --- a/rakelib/lib/specs/interfaces.rb +++ b/rakelib/lib/specs/interfaces.rb @@ -234,6 +234,7 @@ module WXRuby3 Director.Spec(pkg, 'wxPersistentObject', requirements: %w[USE_CONFIG]) Director.Spec(pkg, 'wxPersistentWindow', requirements: %w[USE_CONFIG]) Director.Spec(pkg, 'wxSecretStore', requirements: %w[USE_SECRETSTORE]) + Director.Spec(pkg, 'wxDCOverlay', director: Director::DerivedDC) } Director.Package('Wx::PRT', 'USE_PRINTING_ARCHITECTURE') do |pkg| From a016722617e9069dd0770dce0bbd093dd6f3816c Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Mon, 1 Apr 2024 18:40:27 +0200 Subject: [PATCH 4/4] bump version for next release --- lib/wx/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wx/version.rb b/lib/wx/version.rb index 6c4f707e..0ddad00b 100644 --- a/lib/wx/version.rb +++ b/lib/wx/version.rb @@ -3,5 +3,5 @@ # This software is released under the MIT license. module Wx - WXRUBY_VERSION = '0.9.8' + WXRUBY_VERSION = '1.0.0' end