X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/808e3bce622d9ec7ae8c43581472ae699ed47221..815f65bd0f673965230ed915d794497a8818dd35:/src/palmos/button.cpp?ds=sidebyside diff --git a/src/palmos/button.cpp b/src/palmos/button.cpp index 17baee2123..c395130b80 100644 --- a/src/palmos/button.cpp +++ b/src/palmos/button.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "button.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -30,9 +26,10 @@ #if wxUSE_BUTTON +#include "wx/button.h" + #ifndef WX_PRECOMP #include "wx/app.h" - #include "wx/button.h" #include "wx/brush.h" #include "wx/panel.h" #include "wx/bmpbuttn.h" @@ -40,74 +37,17 @@ #include "wx/dcscreen.h" #include "wx/frame.h" #include "wx/dialog.h" - #include "wx/stockitem.h" #endif +#include "wx/stockitem.h" + +#include +#include + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- -#if wxUSE_EXTENDED_RTTI - -WX_DEFINE_FLAGS( wxButtonStyle ) - -wxBEGIN_FLAGS( wxButtonStyle ) - // new style border flags, we put them first to - // use them for streaming out - wxFLAGS_MEMBER(wxBORDER_SIMPLE) - wxFLAGS_MEMBER(wxBORDER_SUNKEN) - wxFLAGS_MEMBER(wxBORDER_DOUBLE) - wxFLAGS_MEMBER(wxBORDER_RAISED) - wxFLAGS_MEMBER(wxBORDER_STATIC) - wxFLAGS_MEMBER(wxBORDER_NONE) - - // old style border flags - wxFLAGS_MEMBER(wxSIMPLE_BORDER) - wxFLAGS_MEMBER(wxSUNKEN_BORDER) - wxFLAGS_MEMBER(wxDOUBLE_BORDER) - wxFLAGS_MEMBER(wxRAISED_BORDER) - wxFLAGS_MEMBER(wxSTATIC_BORDER) - wxFLAGS_MEMBER(wxBORDER) - - // standard window styles - wxFLAGS_MEMBER(wxTAB_TRAVERSAL) - wxFLAGS_MEMBER(wxCLIP_CHILDREN) - wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) - wxFLAGS_MEMBER(wxWANTS_CHARS) - wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) - wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) - wxFLAGS_MEMBER(wxVSCROLL) - wxFLAGS_MEMBER(wxHSCROLL) - - wxFLAGS_MEMBER(wxBU_LEFT) - wxFLAGS_MEMBER(wxBU_RIGHT) - wxFLAGS_MEMBER(wxBU_TOP) - wxFLAGS_MEMBER(wxBU_BOTTOM) - wxFLAGS_MEMBER(wxBU_EXACTFIT) -wxEND_FLAGS( wxButtonStyle ) - -IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h") - -wxBEGIN_PROPERTIES_TABLE(wxButton) - wxEVENT_PROPERTY( Click , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent) - - wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) - wxPROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) - - wxPROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style - -wxEND_PROPERTIES_TABLE() - -wxBEGIN_HANDLERS_TABLE(wxButton) -wxEND_HANDLERS_TABLE() - -wxCONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) - - -#else -IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) -#endif - // this macro tries to adjust the default button height to a reasonable value // using the char height as the base #define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) @@ -137,7 +77,7 @@ bool wxButton::Create(wxWindow *parent, wxPoint palmPos(pos); if((palmPos.x==wxDefaultCoord)||(palmPos.y==wxDefaultCoord)) { - wxSize parentSize(parent->GetSize()); + wxSize parentSize(parent->GetClientSize()); wxWindow* parentTLW = parent; while ( parentTLW && !parentTLW->IsTopLevel() ) { @@ -147,14 +87,14 @@ bool wxButton::Create(wxWindow *parent, if(wxDynamicCast(parentTLW, wxFrame)!=NULL) { if(palmPos.x==wxDefaultCoord) - palmPos.x = 1; + palmPos.x = 0; if(palmPos.y==wxDefaultCoord) palmPos.y = parentSize.y-palmSize.y; } else if(wxDynamicCast(parentTLW, wxDialog)!=NULL) { if(palmPos.x==wxDefaultCoord) - palmPos.x = 5; + palmPos.x = 4; if(palmPos.y==wxDefaultCoord) palmPos.y = parentSize.y-palmSize.y-5; } @@ -168,10 +108,12 @@ bool wxButton::Create(wxWindow *parent, // take the stock label wxString palmLabel = label; if( palmLabel.empty() && wxIsStockID(id) ) - palmLabel = wxGetStockLabel(id); + palmLabel = wxGetStockLabel(id, wxSTOCK_NOFLAGS); - wxControl::PalmCreateControl(buttonCtl, parent, id, palmLabel, palmPos, palmSize); - return true; + if(!wxControl::Create(parent, id, palmPos, palmSize, style, validator, name)) + return false; + + return wxControl::PalmCreateControl(buttonCtl, palmLabel, palmPos, palmSize); } wxButton::~wxButton() @@ -193,12 +135,16 @@ wxSize wxButtonBase::GetDefaultSize() return wxSize(36,12); } -void wxButton::SetDefault() +wxWindow *wxButton::SetDefault() { - FormType* form = GetParentForm(); + FormType* form = (FormType* )GetParentForm(); if(form==NULL) - return; + return NULL; +#ifdef __WXPALMOS6__ FrmSetDefaultButtonID(form,GetId()); +#endif // __WXPALMOS6__ + + return wxButtonBase::SetDefault(); } void wxButton::SetTmpDefault() @@ -221,12 +167,14 @@ wxButton::SetDefaultStyle(wxButton *btn, bool on) bool wxButton::SendClickEvent() { - return false; + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId()); + event.SetEventObject(this); + return ProcessCommand(event); } void wxButton::Command(wxCommandEvent &event) { + ProcessCommand(event); } #endif // wxUSE_BUTTON -