Skip to content
Permalink
Browse files

Addressed issues mentioned in pull request at #547

  • Loading branch information...
jmoraleda committed Oct 31, 2019
1 parent f68291d commit a4de008faac7f553534f7255b4fb9671ddcb4738
@@ -0,0 +1,155 @@
/* XPM */
static char *bitmap_button_xpm[] = {
/* columns rows colors chars-per-pixel */
"22 22 127 2",
" c #006600",
". c #036D01",
"X c #056B02",
"o c #0A7005",
"O c #0E7407",
"+ c #17751E",
"@ c #003399",
"# c #0C9106",
"$ c #15840B",
"% c #1FA810",
"& c #288F14",
"* c #2B9116",
"= c #3C871C",
"- c #30863F",
"; c #28AA14",
": c #2FB018",
"> c #3BA81D",
", c #3BB71D",
"< c #3EB81F",
"1 c #378B48",
"2 c #388B48",
"3 c #3E8E48",
"4 c #43AE22",
"5 c #44B522",
"6 c #47BC23",
"7 c #49B225",
"8 c #4ABE25",
"9 c #768300",
"0 c #788400",
"q c #6FA22E",
"w c #64A678",
"e c #54C32B",
"r c #57C42B",
"t c #5BC62E",
"y c #9C0E0F",
"u c #9D0E0F",
"i c #9E0F0F",
"p c #AF0B00",
"a c #AF1407",
"s c #AB575F",
"d c #AF595F",
"f c #B55B5F",
"g c #BA5D5F",
"h c #D92000",
"j c #D92B08",
"k c #F93000",
"l c #FF3300",
"z c #D94C21",
"x c #FF440C",
"c c #FF440D",
"v c #FF5C1F",
"b c #FF5D1F",
"n c #FF7935",
"m c magenta",
"M c #A5BE43",
"N c #CC9900",
"B c #D18A1A",
"V c #F99048",
"C c #FFCC00",
"Z c #FFCC01",
"A c #FFCF08",
"S c #FFD00A",
"D c #FFD00B",
"F c #FFD212",
"G c #FFD314",
"H c #FFD317",
"J c #FFD519",
"K c #FFD61E",
"L c #FFD721",
"P c #FFD824",
"I c #FFD926",
"U c #FFDA29",
"Y c #FFDB2D",
"T c #FFDC30",
"R c #FFDD32",
"E c #FFDE35",
"W c #FFDE38",
"Q c #FFE03B",
"! c #FFE13E",
"~ c #DFC269",
"^ c #FFE241",
"/ c #FFE345",
"( c #FFE448",
") c #FFE54B",
"_ c #FFE851",
"` c #FFE854",
"' c #FCE85A",
"] c #FFE958",
"[ c #FFED64",
"{ c #80BBA8",
"} c #BEB6C7",
"| c #87C0B1",
" . c #8FC2B1",
".. c #9EC9B1",
"X. c #BFE4F3",
"o. c #C3B8C7",
"O. c #D9C1C7",
"+. c #DEC2C7",
"@. c #D6DEEF",
"#. c #C2E7FF",
"$. c #C3E7FF",
"%. c #C2E8FF",
"&. c #C3E8FF",
"*. c #C8E9FF",
"=. c #C8EAFF",
"-. c #CEEBFF",
";. c #CEECFF",
":. c #D2E8E4",
">. c #D5EEFF",
",. c #D5EFFF",
"<. c #DCF1FF",
"1. c #DDF1FF",
"2. c #DCF2FF",
"3. c #DDF2FF",
"4. c #E4F4FF",
"5. c #E4F5FF",
"6. c #EBF7FF",
"7. c #EAF8FF",
"8. c #EBF8FF",
"9. c #F1F9FF",
"0. c #F1FAFF",
"q. c #F6FBFF",
"w. c #F7FBFF",
"e. c #F6FCFF",
"r. c #F7FCFF",
"t. c #FAFDFF",
"y. c None",
/* pixels */
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"@.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @.",
"@ t.t.t.t.t.t.~ N N N N N N ~ t.t.t.t.t.t.@ ",
"@ q.t.q.e.w.e.N C C D H Y Q N e.q.q.q.q.e.@ ",
"@ 0.0.0.+.g y N C D H P W ) N 0.0.0.0.0.0.@ ",
"@ 6.8.O.p h k N A G P E ) ' 9 :.7.6.7.6.6.@ ",
"@ 4.4.f h l c N F L R / ` q * o ..4.4.4.4.@ ",
"@ 1.1.y k x b N K R ^ ` M O t > 3 1.1.1.1.@ ",
"@ >.>.d j b n N Y ! _ [ = 7 e 6 $ w >.>.>.@ ",
"@ ;.-.o.a z V B N N N 0 * e 8 , ; . .;.;.@ ",
"@ =.=.=.} s y s } =.X.X 4 5 < : % # 1 =.=.@ ",
"@ $.&.$.$.&.$.$.&.&.$.{ - + 1 | $.$.@ ",
"@.@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.",
"y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y."
};
@@ -57,7 +57,7 @@ Python code generation written by
<template name="settings">#ifnotequal $value "0" @{ self.$name.SetValue( True ) @}</template>
<template name="evt_connect_OnToggleButton">self.$name.Bind( wx.EVT_TOGGLEBUTTON, #handler )</template>
</templates>

<templates class="wxBitmapToggleButton">
<template name="construction">self.$name = #class( #wxparent $name, $id, $bitmap, $pos, $size, $window_style #ifnotnull $window_name @{, wx.DefaultValidator, $window_name @} )</template>
</templates>
@@ -81,8 +81,7 @@ Written by
<property name="tab_width" type="text" help="The number of spaces per tab character.">4</property>
</objectinfo>


<objectinfo class="wxToggleButton" icon="toggle_button.xpm" type="widget">
<objectinfo class="wxToggleButton" startgroup="1" icon="toggle_button.xpm" type="widget">
<inherits class="wxAnyButton"/>
<inherits class="wxWindow"/>
<inherits class="AUI"/>
@@ -26,7 +26,7 @@ Written by
<templates class="wxButton">
<template name="declaration">#class* $name;</template>
<template name="construction">$name = new #class( #wxparent $name, $id, $label, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, wxDefaultValidator, $window_name @} );</template>
<template name="settings"> #ifnotequal $default "0" @{ #nl $name->SetDefault(); @} </template>
<template name="settings">#ifnotequal $default "0" @{ #nl $name->SetDefault(); @}</template>
<template name="include">@#include &lt;wx/button.h&gt;</template>
<template name="evt_entry_OnButtonClick">EVT_BUTTON( $id, #handler )</template>
<template name="evt_connect_OnButtonClick">$name->Connect( wxEVT_COMMAND_BUTTON_CLICKED, #handler, NULL, this );</template>
@@ -30,7 +30,7 @@ Lua code generation written by
<template name="construction">
#utbl$name = #class( #utbl#wxparent $name, $id, $label, $pos, $size, $style #ifnotnull $window_style @{ +$window_style @} #ifnotnull $window_name @{, wx.wxDefaultValidator, $window_name @} )
</template>
<template name="settings"> #ifnotequal $default "0" @{ #nl #utbl$name:SetDefault() @} </template>
<template name="settings">#ifnotequal $default "0" @{ #nl #utbl$name:SetDefault() @}</template>
<template name="evt_connect_OnButtonClick">#utbl$name:Connect( wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event)#nl --implements #handler#nl #skip #nl end )
</template>
</templates>
@@ -30,7 +30,7 @@ PHP code generation written by
<template name="construction">
@$this->$name = new #class( #wxparent $name, $id, $label, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, wxDefaultValidator, $window_name @} );
</template>
<template name="settings"> #ifnotequal $default "0" @{ #nl @$this->$name->SetDefault(); @} </template>
<template name="settings">#ifnotequal $default "0" @{ #nl @$this->$name->SetDefault(); @}</template>
<template name="evt_connect_OnButtonClick">@$this->$name->Connect( wxEVT_COMMAND_BUTTON_CLICKED, #handler );</template>
</templates>

@@ -30,7 +30,7 @@ Python code generation written by
<template name="construction">
self.$name = #class( #wxparent $name, $id, $label, $pos, $size, $style #ifnotnull $window_style @{ |$window_style @} #ifnotnull $window_name @{, wx.DefaultValidator, $window_name @} )
</template>
<template name="settings"> #ifnotequal $default "0" @{ #nl self.$name.SetDefault() @} </template>
<template name="settings">#ifnotequal $default "0" @{ #nl self.$name.SetDefault() @}</template>
<template name="evt_connect_OnButtonClick">self.$name.Bind( wx.EVT_BUTTON, #handler )</template>
</templates>

@@ -30,13 +30,13 @@ Written by
<inherits class="Validator"/>
<property name="name" type="text">m_button</property>
<property name="style" type="bitlist">
<option name="wxBU_LEFT" help="Left-justifies the label. Windows and GTK+ only."/>
<option name="wxBU_TOP" help="Aligns the label to the top of the button. Windows and GTK+ only."/>
<option name="wxBU_RIGHT" help="Right-justifies the bitmap label. Windows and GTK+ only."/>
<option name="wxBU_BOTTOM" help="Aligns the label to the bottom of the button. Windows and GTK+ only."/>
<option name="wxBU_EXACTFIT" help="By default, all buttons are made of at least the standard button size, even if their contents is small enough to fit into a smaller size. This is done for consistency as most platforms use buttons of the same size in the native dialogs, but can be overridden by specifying this flag. If it is given, the button will be made just big enough for its contents. Notice that under MSW the button will still have at least the standard height, even with this style, if it has a non-empty label."/>
<option name="wxBU_NOTEXT" help="Disables the display of the text label in the button even if it has one or its id is one of the standard stock ids with an associated label: without using this style a button which is only supposed to show a bitmap but uses a standard id would display a label too."/>
<option name="wxBORDER_NONE" help="Creates a button without border. This is currently implemented in MSW, GTK2 and OSX/Cocoa and OSX/Carbon ports but in the latter only applies to buttons with bitmaps and using bitmap of one of the standard sizes only, namely 128*128, 48*48, 24*24 or 16*16. In all the other cases wxBORDER_NONE is ignored under OSX/Carbon (these restrictions don't exist in OSX/Cocoa however)."/>
<option name="wxBU_LEFT" help="Left-justifies the label. Windows and GTK+ only."/>
<option name="wxBU_TOP" help="Aligns the label to the top of the button. Windows and GTK+ only."/>
<option name="wxBU_RIGHT" help="Right-justifies the bitmap label. Windows and GTK+ only."/>
<option name="wxBU_BOTTOM" help="Aligns the label to the bottom of the button. Windows and GTK+ only."/>
<option name="wxBU_EXACTFIT" help="By default, all buttons are made of at least the standard button size, even if their contents is small enough to fit into a smaller size. This is done for consistency as most platforms use buttons of the same size in the native dialogs, but can be overridden by specifying this flag. If it is given, the button will be made just big enough for its contents. Notice that under MSW the button will still have at least the standard height, even with this style, if it has a non-empty label."/>
<option name="wxBU_NOTEXT" help="Disables the display of the text label in the button even if it has one or its id is one of the standard stock ids with an associated label: without using this style a button which is only supposed to show a bitmap but uses a standard id would display a label too."/>
<option name="wxBORDER_NONE" help="Creates a button without border. This is currently implemented in MSW, GTK2 and OSX/Cocoa and OSX/Carbon ports but in the latter only applies to buttons with bitmaps and using bitmap of one of the standard sizes only, namely 128*128, 48*48, 24*24 or 16*16. In all the other cases wxBORDER_NONE is ignored under OSX/Carbon (these restrictions don't exist in OSX/Cocoa however)."/>
</property>
<property name="default" type="bool">0</property>
<event name="OnButtonClick" class="wxCommandEvent" help="Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked"/>
@@ -283,7 +283,7 @@

<templates class="wxAnyButton">
<template name="settings">
#ifequal $markup "1" @{ $name->SetLabelMarkup( $label ); @}
#ifequal $markup "1" @{ $name->SetLabelMarkup( $label ); @}
#ifnotnull $bitmap @{ #nl $name->SetBitmap( $bitmap ); @}
#ifnotnull $disabled @{ #nl $name->SetBitmapDisabled( $disabled ); @}
#ifnotnull $pressed @{ #nl $name->SetBitmapPressed( $pressed ); @}
@@ -199,7 +199,7 @@
#ifnotnull $margins @{ #nl @$this->$name->SetBitmapMargins( $margins ); @}
</template>
</templates>

<templates class="UserClasses">
<template name="file_comment">
/*Subclass of $basename, which is generated by wxFormBuilder.*/
@@ -213,9 +213,9 @@
<property name="current" type="bitmap" help="Bitmap shown when the mouse is over the button (but it is not pressed). Notice that if hover bitmap is not specified but the current platform UI uses hover images for the buttons (such as Windows XP or GTK+), then the focus bitmap is used for hover state as well. This makes it possible to set focus bitmap only to get reasonably good behaviour on all platforms."/>
<property name="position" type="option">
<option name=""/>
<option name="wxLEFT" help="Positions the bitmap at the left"/>
<option name="wxRIGHT" help="Positions the bitmap at the right"/>
<option name="wxTOP" help="Positions the bitmap at the top"/>
<option name="wxLEFT" help="Positions the bitmap at the left"/>
<option name="wxRIGHT" help="Positions the bitmap at the right"/>
<option name="wxTOP" help="Positions the bitmap at the top"/>
<option name="wxBOTTOM" help="Positions the bitmap at the bottom"/>
</property>
<property name="margins" type="wxSize" help="The margins between the bitmap and the text of the button. This is currently only implemented under MSW. If it is not specified, default margin is used around the bitmap."/>
@@ -416,7 +416,7 @@ class HtmlWindowComponent : public ComponentBase



class ToggleButtonComponent : public ComponentBase
class ToggleButtonComponent : public ComponentBase, public wxEvtHandler
{
public:
wxObject* Create(IObject* obj, wxObject* parent) override {
@@ -462,7 +462,8 @@ class ToggleButtonComponent : public ComponentBase
button->SetBitmapMargins(obj->GetPropertyAsSize(_("margins")));
}

button->SetValue( ( obj->GetPropertyAsInteger(_("value")) != 0 ) );
button->SetValue((obj->GetPropertyAsInteger(_("value")) != 0));
button->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( ToggleButtonComponent::OnToggle ), NULL, this );
return button;
}

@@ -541,7 +542,7 @@ class BitmapToggleButtonComponent : public ComponentBase, public wxEvtHandler
}
#endif

if ( !obj->IsNull( _("disabled") ) )
if (!obj->IsNull(_("disabled")))
{
button->SetBitmapDisabled( obj->GetPropertyAsBitmap( _("disabled") ) );
}
@@ -550,7 +551,7 @@ class BitmapToggleButtonComponent : public ComponentBase, public wxEvtHandler
button->SetBitmapPressed(obj->GetPropertyAsBitmap(_("pressed")));
}

if ( !obj->IsNull( _("focus") ) )
if (!obj->IsNull(_("focus")))
{
button->SetBitmapFocus( obj->GetPropertyAsBitmap( _("focus") ) );
}
@@ -569,11 +570,12 @@ class BitmapToggleButtonComponent : public ComponentBase, public wxEvtHandler
}

button->SetValue( ( obj->GetPropertyAsInteger(_("value")) != 0 ) );
button->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler( ToggleButtonComponent::OnToggle ), NULL, this );

return button;
}

void OnToggle( wxCommandEvent& event )
void OnToggle(wxCommandEvent& event)
{
wxBitmapToggleButton* window = dynamic_cast< wxBitmapToggleButton* >( event.GetEventObject() );
if ( 0 != window )

0 comments on commit a4de008

Please sign in to comment.
You can’t perform that action at this time.