Skip to content
Permalink
Browse files

Merge pull request #547 from jmoraleda/BitmapToggleButton

Added support for wxBitmapToggleButton
  • Loading branch information...
sodevel committed Nov 1, 2019
2 parents 91bc875 + a4de008 commit bef14969d5743bcdc9c27c9f763fa5cc5e004915
@@ -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."
};
@@ -76,6 +76,12 @@ Written by
<template name="evt_connect_OnToggleButton">$name->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, #handler, NULL, this );</template>
</templates>

<templates class="wxBitmapToggleButton">
<template name="declaration">#class* $name;</template>
<template name="construction">$name = new #class( #wxparent $name, $id, $bitmap, $pos, $size, $window_style #ifnotnull $window_name @{, wxDefaultValidator, $window_name @} );</template>
<template name="include">@#include &lt;wx/tglbtn.h&gt;</template>
</templates>

<templates class="wxColourPickerCtrl">
<template name="declaration">#class* $name;</template>
<template name="construction">
@@ -58,6 +58,10 @@ Lua code generation written by
<template name="evt_connect_OnToggleButton">#utbl$name:Connect( wx.wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, function(event)#nl --implements #handler#nl #skip #nl end )</template>
</templates>

<templates class="wxBitmapToggleButton">
<template name="construction">#utbl$name = #class( #utbl#wxparent $name, $id, $bitmap, $pos, $size, $window_style #ifnotnull $window_name @{, wx.DefaultValidator, $window_name @} )</template>
</templates>

<templates class="wxColourPickerCtrl">
<template name="construction">
#utbl$name = #class( #utbl#wxparent $name, $id,
@@ -58,6 +58,10 @@ PHP code generation written by
<template name="evt_connect_OnToggleButton">@$this->$name->Connect( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, #handler ;)</template>
</templates>

<templates class="wxBitmapToggleButton">
<template name="construction">@$this->$name = new #class( #wxparent $name, $id, $bitmap, $pos, $size, $window_style #ifnotnull $window_name @{, wxDefaultValidator, $window_name @} );</template>
</templates>

<templates class="wxColourPickerCtrl">
<template name="construction">
@$this->$name = new #class( #wxparent $name, $id,
@@ -58,6 +58,10 @@ Python code generation written by
<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>

<templates class="wxColourPickerCtrl">
<template name="construction">
self.$name = #class( #wxparent $name, $id,
@@ -82,15 +82,21 @@ Written by
</objectinfo>

<objectinfo class="wxToggleButton" startgroup="1" icon="toggle_button.xpm" type="widget">
<inherits class="wxAnyButton"/>
<inherits class="wxWindow"/>
<inherits class="AUI"/>
<inherits class="Validator"/>
<property name="name" type="text">m_toggleBtn</property>
<property name="label" type="wxString_i18n">Toggle me!</property>
<property name="value" type="bool">0</property>
<event name="OnToggleButton" class="wxCommandEvent" help="Handles a wxEVT_TOGGLEBUTTON event."/>
</objectinfo>

<objectinfo class="wxBitmapToggleButton" icon="bitmap_toggle_button.xpm" type="widget">
<inherits class="wxToggleButton">
<property name="name">m_bmToggleBtn</property>
</inherits>
</objectinfo>

<objectinfo class="wxSearchCtrl" icon="search.xpm" type="widget">
<inherits class="wxWindow"/>
<inherits class="AUI"/>
@@ -26,34 +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">
#ifequal $markup "1"
@{ $name->SetLabelMarkup( $label ); @}

#ifnotequal $default "0"
@{ #nl $name->SetDefault(); @}

#ifnotnull $bitmap
@{ #nl $name->SetBitmap( $bitmap ); @}

#ifnotnull $disabled
@{ #nl $name->SetBitmapDisabled( $disabled ); @}

#ifnotnull $pressed
@{ #nl $name->SetBitmapPressed( $pressed ); @}

#ifnotnull $focus
@{ #nl $name->SetBitmapFocus( $focus ); @}

#ifnotnull $current
@{ #nl $name->SetBitmapCurrent( $current ); @}

#ifnotnull $position
@{ #nl $name->SetBitmapPosition( $position ); @}

#ifnotnull $margins
@{ #nl $name->SetBitmapMargins( $margins ); @}
</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,34 +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">
#ifequal $markup "1"
@{ #utbl$name:SetLabelMarkup( $label ) @}

#ifnotequal $default "0"
@{ #nl #utbl$name:SetDefault() @}

#ifnotnull $bitmap
@{ #nl #utbl$name:SetBitmap( $bitmap ) @}

#ifnotnull $disabled
@{ #nl #utbl$name:SetBitmapDisabled( $disabled ) @}

#ifnotnull $pressed
@{ #nl #utbl$name:SetBitmapPressed( $pressed ) @}

#ifnotnull $focus
@{ #nl #utbl$name:SetBitmapFocus( $focus ) @}

#ifnotnull $current
@{ #nl #utbl$name:SetBitmapCurrent( $current ) @}

#ifnotnull $position
@{ #nl #utbl$name:SetBitmapPosition( $position ) @}

#ifnotnull $margins
@{ #nl #utbl$name:SetBitmapMargins( $margins ) @}
</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,34 +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">
#ifequal $markup "1"
@{ @$this->$name->SetLabelMarkup( $label ); @}

#ifnotequal $default "0"
@{ #nl @$this->$name->SetDefault(); @}

#ifnotnull $bitmap
@{ #nl @$this->$name->SetBitmap( $bitmap ); @}

#ifnotnull $disabled
@{ #nl @$this->$name->SetBitmapDisabled( $disabled ); @}

#ifnotnull $pressed
@{ #nl @$this->$name->SetBitmapSelected( $pressed ); @}

#ifnotnull $focus
@{ #nl @$this->$name->SetBitmapFocus( $focus ); @}

#ifnotnull $current
@{ #nl @$this->$name->SetBitmapCurrent( $current ); @}

#ifnotnull $position
@{ #nl @$this->$name->SetBitmapPosition( $position ); @}

#ifnotnull $margins
@{ #nl @$this->$name->SetBitmapMargins( $margins ); @}
</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,34 +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">
#ifequal $markup "1"
@{ self.$name.SetLabelMarkup( $label ) @}

#ifnotequal $default "0"
@{ #nl self.$name.SetDefault() @}

#ifnotnull $bitmap
@{ #nl self.$name.SetBitmap( $bitmap ) @}

#ifnotnull $disabled
@{ #nl self.$name.SetBitmapDisabled( $disabled ) @}

#ifnotnull $pressed
@{ #nl self.$name.SetBitmapPressed( $pressed ) @}

#ifnotnull $focus
@{ #nl self.$name.SetBitmapFocus( $focus ) @}

#ifnotnull $current
@{ #nl self.$name.SetBitmapCurrent( $current ) @}

#ifnotnull $position
@{ #nl self.$name.SetBitmapPosition( $position ) @}

#ifnotnull $margins
@{ #nl self.$name.SetBitmapMargins( $margins ) @}
</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>

@@ -24,6 +24,7 @@ Written by
<package name="Common" lib="libcommon" icon="button16x16.xpm" desc="wxWidgets common controls">

<objectinfo class="wxButton" icon="button.xpm" type="widget">
<inherits class="wxAnyButton"/>
<inherits class="wxWindow"/>
<inherits class="AUI"/>
<inherits class="Validator"/>
@@ -37,22 +38,7 @@ Written by
<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="label" type="wxString_i18n">MyButton</property>
<property name="markup" type="bool" help="Simple markup can be used to apply different fonts or colours to different parts of the control label when supported. If markup is not supported by the control or platform, it is simply stripped and SetLabel() is used with the resulting string.&#x0A;Since 2.9.2.">0</property>
<property name="default" type="bool">0</property>
<property name="bitmap" type="bitmap" help="This is the bitmap shown in the default state, it must be always valid while all the other bitmaps are optional and don't have to be set."/>
<property name="disabled" type="bitmap" help="Bitmap shown when the button is disabled."/>
<property name="pressed" type="bitmap" help="Bitmap shown when the button is pushed (e.g. while the user keeps the mouse button pressed on it)."/>
<property name="focus" type="bitmap" help="Bitmap shown when the button has keyboard focus but is not pressed."/>
<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="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."/>
<event name="OnButtonClick" class="wxCommandEvent" help="Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked"/>
</objectinfo>

0 comments on commit bef1496

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