Skip to content
Permalink
Browse files

Add auth_needed property for buttons

  • Loading branch information
sodevel committed Nov 11, 2019
1 parent 6f2fa93 commit ad39a0cb96cf53aeb98326fd9da7dc88cfd7471f
@@ -26,7 +26,10 @@ 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(); @}
#ifnotequal $auth_needed "0" @{ #nl $name->SetAuthNeeded(); @}
</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,10 @@ 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() @}
#ifnotequal $auth_needed "0" @{ #nl #utbl$name:SetAuthNeeded() @}
</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,10 @@ 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(); @}
#ifnotequal $auth_needed "0" @{ #nl @$this->$name->SetAuthNeeded(); @}
</template>
<template name="evt_connect_OnButtonClick">@$this->$name->Connect( wxEVT_COMMAND_BUTTON_CLICKED, #handler );</template>
</templates>

@@ -30,7 +30,10 @@ 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() @}
#ifnotequal $auth_needed "0" @{ #nl self.$name.SetAuthNeeded() @}
</template>
<template name="evt_connect_OnButtonClick">self.$name.Bind( wx.EVT_BUTTON, #handler )</template>
</templates>

@@ -39,6 +39,7 @@ Written by
<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>
<property name="auth_needed" type="bool" help="Sets whether an authentication needed symbol should be displayed on the button. This method doesn't do anything if the platform is not Windows Vista or newer.">0</property>
<event name="OnButtonClick" class="wxCommandEvent" help="Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked"/>
</objectinfo>

@@ -198,6 +198,10 @@ class ButtonComponent : public ComponentBase
button->SetDefault();
}

if (obj->GetPropertyAsInteger(_("auth_needed")) != 0) {
button->SetAuthNeeded();
}

if (!obj->IsNull(_("bitmap"))) {
button->SetBitmap(obj->GetPropertyAsBitmap(_("bitmap")));
}
@@ -236,6 +240,7 @@ class ButtonComponent : public ComponentBase
xrc.AddWindowProperties();
xrc.AddProperty(_("label"),_("label"),XRC_TYPE_TEXT);
xrc.AddProperty(_("default"),_("default"),XRC_TYPE_BOOL);
xrc.AddProperty(_("auth_needed"), _("auth_needed"), XRC_TYPE_BOOL);
xrc.AddProperty(_("markup"), _("markup"), XRC_TYPE_BOOL);
xrc.AddProperty(_("bitmap"), _("bitmap"), XRC_TYPE_BITMAP);
if (!obj->IsNull(_("disabled"))) {
@@ -264,6 +269,7 @@ class ButtonComponent : public ComponentBase
filter.AddWindowProperties();
filter.AddProperty(_("label"),_("label"),XRC_TYPE_TEXT);
filter.AddProperty(_("default"),_("default"),XRC_TYPE_BOOL);
filter.AddProperty(_("auth_needed"), _("auth_needed"), XRC_TYPE_BOOL);
filter.AddProperty(_("markup"), _("markup"), XRC_TYPE_BOOL);
filter.AddProperty(_("bitmap"), _("bitmap"), XRC_TYPE_BITMAP);
filter.AddProperty(_("disabled"), _("disabled"), XRC_TYPE_BITMAP);
@@ -298,7 +304,11 @@ class BitmapButtonComponent : public ComponentBase
button->SetDefault();
}

if ( !obj->IsNull( _("disabled") ) )
if (obj->GetPropertyAsInteger(_("auth_needed")) != 0) {
button->SetAuthNeeded();
}

if (!obj->IsNull(_("disabled")))
{
button->SetBitmapDisabled( obj->GetPropertyAsBitmap( _("disabled") ) );
}
@@ -354,6 +364,7 @@ class BitmapButtonComponent : public ComponentBase
xrc.AddProperty(_("margins"), _("margins"), XRC_TYPE_SIZE);
}
xrc.AddProperty(_("default"),_("default"),XRC_TYPE_BOOL);
xrc.AddProperty(_("auth_needed"), _("auth_needed"), XRC_TYPE_BOOL);
return xrc.GetXrcObject();
}

@@ -368,6 +379,7 @@ class BitmapButtonComponent : public ComponentBase
filter.AddProperty(_("position"), _("position"), XRC_TYPE_TEXT);
filter.AddProperty(_("margins"), _("margins"), XRC_TYPE_SIZE);
filter.AddProperty(_("default"),_("default"),XRC_TYPE_BOOL);
filter.AddProperty(_("auth_needed"), _("auth_needed"), XRC_TYPE_BOOL);
return filter.GetXfbObject();
}
};

0 comments on commit ad39a0c

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