- native wxSlider implementation
- native wxToggleButton implementation
- native wxRadioButton implementation
+- native wxStaticText implementation
2.5.3
// implementation from now on
virtual void Command(wxCommandEvent& event);
+ // send a notification event, return true if processed
+ bool SendClickEvent();
+
virtual void ApplyParentThemeBackground(const wxColour& bg)
{
// avoide switching into owner-drawn mode
}
protected:
- // send a notification event, return true if processed
- bool SendClickEvent();
// default button handling
void SetTmpDefault();
virtual void Command(wxCommandEvent& event);
+ // send a notification event, return true if processed
+ bool SendClickEvent();
+
protected:
virtual wxSize DoGetBestSize() const;
class WXDLLEXPORT wxControl : public wxControlBase
{
public:
- wxControl() { }
+ wxControl() { Init(); }
wxControl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr)
{
+ Init();
Create(parent, id, pos, size, style, validator, name);
}
protected:
// regardless how deeply we are in wxWidgets hierarchy always get correct form
FormType* GetParentForm() const;
+ uint16_t GetObjectIndex() const;
+ void* GetObjectPtr() const;
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const;
bool GetBoolValue() const;
void SetIntValue(int val);
+ // native labels access
+ void SetFieldLabel(const wxString& label);
+ void SetControlLabel(const wxString& label);
+ wxString GetFieldLabel();
+ wxString GetControlLabel();
+
// return default best size (doesn't really make any sense, override this)
virtual wxSize DoGetBestSize() const;
// supposed to had been already set and so is used instead when this
// function is called)
bool PalmCreateControl(ControlStyleType style,
- wxWindow *parent,
- wxWindowID id,
const wxString& label,
const wxPoint& pos,
- const wxSize& size);
+ const wxSize& size,
+ int groupID = 0);
+ inline bool IsPalmControl() const { return m_palmControl; }
+
+ bool PalmCreateField(const wxString& label,
+ const wxPoint& pos,
+ const wxSize& size,
+ bool editable,
+ bool underlined,
+ JustificationType justification);
+ inline bool IsPalmField() const { return m_palmField; }
// this is a helper for the derived class GetClassDefaultAttributes()
// implementation: it returns the right colours for the classes which
// holds the ids (not HWNDs!) of the sub controls
wxArrayLong m_subControls;
- ControlType *m_control;
-
private:
+ bool m_palmControl:1;
+ bool m_palmField:1;
+
+ // common part of all ctors
+ void Init();
+
virtual void DoGetBounds( RectangleType &rect ) const;
// m_label stores label in case of wxButton, wxCheckBox, wxToggleButton etc.
#if wxUSE_MENUS_NATIVE
bool HandleMenuOpen();
- bool HandleMenuSelect(int ItemID);
+ bool HandleMenuSelect(EventType* event);
#endif // wxUSE_MENUS_NATIVE
protected:
// handle WM_INITMENUPOPUP message
bool HandleInitMenuPopup(WXHMENU hMenu);
- virtual bool IsMDIChild() const { return FALSE; }
+ virtual bool IsMDIChild() const { return false; }
// get default (wxWidgets) icon for the frame
virtual WXHICON GetDefaultIcon() const;
// Name: wx/palmos/radiobox.h
// Purpose: wxRadioBox class
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
virtual int GetCount() const;
virtual wxString GetString(int n) const;
virtual void SetString(int n, const wxString& label);
- virtual void Enable(int n, bool enable = TRUE);
- virtual void Show(int n, bool show = TRUE);
+ virtual void Enable(int n, bool enable = true);
+ virtual void Show(int n, bool show = true);
virtual int GetColumnCount() const;
virtual int GetRowCount() const;
- virtual bool Show(bool show = TRUE);
+ virtual bool Show(bool show = true);
void SetFocus();
- virtual bool Enable(bool enable = TRUE);
+ virtual bool Enable(bool enable = true);
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
void SetButtonFont(const wxFont& font) { SetFont(font); }
// implementation only from now on
// -------------------------------
- virtual bool MSWCommand(WXUINT param, WXWORD id);
-
// FIXME: are they used? missing "Do" prefix?
void GetSize(int *x, int *y) const;
void GetPosition(int *x, int *y) const;
virtual bool SetFont(const wxFont& font);
- WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message,
WXWPARAM wParam, WXLPARAM lParam);
// implementation only from now on
virtual void Command(wxCommandEvent& event);
+
+ // send a notification event, return true if processed
+ bool SendClickEvent();
+
virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
// common part of all ctors
void Init();
+ // pushButtonCtl or checkboxCtl
+ ControlStyleType m_radioStyle;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton)
};
#define wxUSE_SPINCTRL 0 // wxSpinCtrl
#define wxUSE_STATBOX 0 // wxStaticBox
#define wxUSE_STATLINE 0 // wxStaticLine
-#define wxUSE_STATTEXT 0 // wxStaticText
+#define wxUSE_STATTEXT 1 // wxStaticText
#define wxUSE_STATBMP 0 // wxStaticBitmap
#define wxUSE_TEXTCTRL 0 // wxTextCtrl
#define wxUSE_TOGGLEBTN 1 // requires wxButton
virtual int GetValue() const;
virtual void SetValue(int);
- void GetPosition(int *x, int *y) const;
-
void SetRange(int minValue, int maxValue);
int GetMin() const;
void Command(wxCommandEvent& event);
protected:
- virtual void DoGetSize(int *width, int *height) const;
-
- virtual void DoSetSize(int x, int y,
- int width, int height,
- int sizeFlags = wxSIZE_AUTO);
-
virtual wxSize DoGetBestSize() const;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider)
// Name: wx/palmos/stattext.h
// Purpose: wxStaticText class
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native wxStaticText implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
const wxString& name = wxStaticTextNameStr);
// override some methods to resize the window properly
- virtual void SetLabel(const wxString& label);
virtual bool SetFont( const wxFont &font );
protected:
// implement/override some base class virtuals
virtual wxBorder GetDefaultBorder() const;
- virtual void DoSetSize(int x, int y, int w, int h,
- int sizeFlags = wxSIZE_AUTO);
virtual wxSize DoGetBestSize() const;
- virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText)
};
virtual void Command(wxCommandEvent& event);
+ // send a notification event, return true if processed
+ bool SendClickEvent();
+
protected:
virtual wxSize DoGetBestSize() const;
virtual wxBorder GetDefaultBorder() const;
// interface to native frame structure
FormType *GetForm() const;
+ // handle controls
+ bool HandleControlSelect(EventType* event);
+
protected:
// common part of all ctors
void Init();
#include "wx/cocoa/radiobox.h"
#elif defined(__WXPM__)
#include "wx/os2/radiobox.h"
+#elif defined(__WXPALMOS__)
+ #include "wx/palmos/radiobox.h"
#endif
#endif // wxUSE_RADIOBOX
#include "wx/cocoa/stattext.h"
#elif defined(__WXPM__)
#include "wx/os2/stattext.h"
+#elif defined(__WXPALMOS__)
+ #include "wx/palmos/stattext.h"
#endif
#endif // wxUSE_STATTEXT
// ----------------------------------------------------------------------------
#if defined(__WXPALMOS__)
-int wxWindowBase::ms_lastControlId = 65535;
+int wxWindowBase::ms_lastControlId = 32767;
#elif defined(__WXPM__)
int wxWindowBase::ms_lastControlId = 2000;
#else
if( palmLabel.empty() && wxIsStockID(id) )
palmLabel = wxGetStockLabel(id);
- 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()
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
const wxValidator& validator,
const wxString& name)
{
- wxControl::PalmCreateControl(checkboxCtl, parent, id, label, pos, size);
- return true;
+ if(!wxControl::Create(parent, id, pos, size, style, validator, name))
+ return false;
+
+ return wxControl::PalmCreateControl(checkboxCtl, label, pos, size);
}
wxSize wxCheckBox::DoGetBestSize() const
return GetBoolValue();
}
+bool wxCheckBox::SendClickEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId());
+ event.SetInt(GetValue());
+ event.SetEventObject(this);
+ return ProcessCommand(event);
+}
+
void wxCheckBox::Command(wxCommandEvent& event)
{
}
#include "wx/checkbox.h"
#include "wx/tglbtn.h"
#include "wx/radiobut.h"
+#include "wx/slider.h"
// ----------------------------------------------------------------------------
// wxWin macros
// wxControl ctor/dtor
// ----------------------------------------------------------------------------
+void wxControl::Init()
+{
+ m_palmControl = false;
+ m_palmField = false;
+}
+
wxControl::~wxControl()
{
m_isBeingDeleted = true;
}
bool wxControl::PalmCreateControl(ControlStyleType style,
- wxWindow *parent,
- wxWindowID id,
const wxString& label,
const wxPoint& pos,
- const wxSize& size)
+ const wxSize& size,
+ int groupID)
{
- SetParent(parent);
- SetId( id == wxID_ANY ? NewControlId() : id );
FormType* form = GetParentForm();
if(form==NULL)
return false;
m_label = label;
- m_control = CtlNewControl(
- (void **)&form,
- GetId(),
- style,
- m_label.c_str(),
- ( pos.x == wxDefaultCoord ) ? winUndefConstraint : pos.x,
- ( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
- ( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
- ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
- stdFont,
- 0,
- false
- );
-
- if(m_control==NULL)
+ ControlType *control = CtlNewControl(
+ (void **)&form,
+ GetId(),
+ style,
+ m_label.c_str(),
+ ( pos.x == wxDefaultCoord ) ? winUndefConstraint : pos.x,
+ ( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
+ ( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
+ ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
+ stdFont,
+ groupID,
+ false
+ );
+
+ if(control==NULL)
return false;
+ m_palmControl = true;
+
Show();
return true;
}
+bool wxControl::PalmCreateField(const wxString& label,
+ const wxPoint& pos,
+ const wxSize& size,
+ bool editable,
+ bool underlined,
+ JustificationType justification)
+{
+ FormType* form = GetParentForm();
+ if(form==NULL)
+ return false;
+
+ m_label = label;
+
+ FieldType *field = FldNewField(
+ (void **)&form,
+ GetId(),
+ ( pos.x == wxDefaultCoord ) ? winUndefConstraint : pos.x,
+ ( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
+ ( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
+ ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
+ stdFont,
+ 10,
+ editable,
+ underlined,
+ false,
+ false,
+ justification,
+ false,
+ false,
+ false
+ );
+
+ if(field==NULL)
+ return false;
+
+ m_palmField = true;
+
+ Show();
+ SetLabel(label);
+ return true;
+}
+
// ----------------------------------------------------------------------------
// various accessors
// ----------------------------------------------------------------------------
return tlw->GetForm();
}
+uint16_t wxControl::GetObjectIndex() const
+{
+ FormType* form = GetParentForm();
+ if(form==NULL)return frmInvalidObjectId;
+ return FrmGetObjectIndex(form, GetId());
+}
+
+void* wxControl::GetObjectPtr() const
+{
+ FormType* form = GetParentForm();
+ if(form==NULL)return NULL;
+ uint16_t index = FrmGetObjectIndex(form, GetId());
+ if(index==frmInvalidObjectId)return NULL;
+ return FrmGetObjectPtr(form,index);
+}
+
wxBorder wxControl::GetDefaultBorder() const
{
// we want to automatically give controls a sunken style (confusingly,
bool wxControl::Enable(bool enable)
{
- if( m_control == NULL )
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if( (IsPalmControl()) || (control == NULL))
return false;
- if( IsEnabled() == enable)
+ if( CtlEnabled(control) == enable)
return false;
- CtlSetEnabled( m_control, enable);
+ CtlSetEnabled( control, enable);
return true;
}
bool wxControl::IsEnabled() const
{
- if( m_control == NULL )
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if( (IsPalmControl()) || (control == NULL))
return false;
- return CtlEnabled(m_control);
+ return CtlEnabled(control);
}
bool wxControl::IsShown() const
return true;
}
-void wxControl::SetLabel(const wxString& label)
+void wxControl::SetFieldLabel(const wxString& label)
{
- // setting in wrong control causes crash
- if ( ( wxDynamicCast(this,wxButton) != NULL ) ||
- ( wxDynamicCast(this,wxCheckBox) != NULL ) ||
- ( wxDynamicCast(this,wxRadioButton) != NULL ) ||
- ( wxDynamicCast(this,wxToggleButton) != NULL ) )
+ FieldType* field = (FieldType*)GetObjectPtr();
+ if(field==NULL)
+ return;
+
+ uint16_t newSize = label.Length() + 1;
+ MemHandle strHandle = FldGetTextHandle(field);
+ FldSetTextHandle(field, NULL );
+ if (strHandle)
{
- m_label = label;
- // TODO: as manual states, it crashes here
- // needs own manipulation on used string pointers
- // CtlSetLabel(m_control,m_label);
+ if(MemHandleResize(strHandle, newSize)!=errNone)
+ strHandle = 0;
}
+ else
+ {
+ strHandle = MemHandleNew( newSize );
+ }
+ if(!strHandle)
+ return;
+
+ char* str = (char*) MemHandleLock( strHandle );
+ if(str==NULL)
+ return;
+
+ strcpy(str, label.c_str());
+ MemHandleUnlock(strHandle);
+ FldSetTextHandle(field, strHandle);
+ FldRecalculateField(field, true);
+}
+
+void wxControl::SetControlLabel(const wxString& label)
+{
+}
+
+void wxControl::SetLabel(const wxString& label)
+{
+ if(IsPalmField())
+ SetFieldLabel(label);
+
+ // unlike other native controls, slider has no label
+ if(IsPalmControl() && !wxDynamicCast(this,wxSlider))
+ SetControlLabel(label);
+}
+
+wxString wxControl::GetFieldLabel()
+{
+ FieldType* field = (FieldType*)GetObjectPtr();
+ if(field==NULL)
+ return wxEmptyString;
+ return FldGetTextPtr(field);
+}
+
+wxString wxControl::GetControlLabel()
+{
+ ControlType* control = (ControlType*)GetObjectPtr();
+ if(control==NULL)
+ return wxEmptyString;
+ return CtlGetLabel(control);
}
wxString wxControl::GetLabel()
{
- // setting in wrong control causes crash
- if ( wxDynamicCast(this,wxButton) ||
- wxDynamicCast(this,wxCheckBox) ||
- wxDynamicCast(this,wxRadioButton) ||
- wxDynamicCast(this,wxToggleButton) )
- {
- return m_label;
- }
+ if(IsPalmField())
+ return GetFieldLabel();
+
+ // unlike other native controls, slider has no label
+ if(IsPalmControl() && !wxDynamicCast(this,wxSlider))
+ return GetControlLabel();
return wxEmptyString;
}
return true;
}
-bool wxFrame::HandleMenuSelect(int ItemID)
+bool wxFrame::HandleMenuSelect(EventType* event)
{
+ int ItemID = event->data.menu.itemID;
+
if (!m_frameMenuBar)
return false;
// Name: src/palmos/radiobox.cpp
// Purpose: wxRadioBox implementation
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
return 0;
}
-bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
-{
- return FALSE;
-}
-
// Radio box item
wxRadioBox::wxRadioBox()
{
// our window proc
// ----------------------------------------------------------------------------
-WXLRESULT wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
-{
- return 0;
-}
-
WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
WXUINT WXUNUSED(message),
WXWPARAM WXUNUSED(wParam),
void wxRadioButton::Init()
{
+ m_radioStyle = pushButtonCtl;
}
bool wxRadioButton::Create(wxWindow *parent,
const wxValidator& validator,
const wxString& name)
{
- wxControl::PalmCreateControl(pushButtonCtl, parent, id, label, pos, size);
- return true;
+ if(!wxControl::Create(parent, id, pos, size, style, validator, name))
+ return false;
+
+ return wxControl::PalmCreateControl(
+ // be sure only one of two possibilities was taken
+ m_radioStyle == checkboxCtl ? checkboxCtl : pushButtonCtl,
+ label,
+ pos,
+ size
+ );
}
// ----------------------------------------------------------------------------
// wxRadioButton event processing
// ----------------------------------------------------------------------------
+bool wxRadioButton::SendClickEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, GetId());
+ event.SetInt(GetValue());
+ event.SetEventObject(this);
+ return ProcessCommand(event);
+}
+
void wxRadioButton::Command (wxCommandEvent& event)
{
}
const wxValidator& validator,
const wxString& name)
{
- SetParent(parent);
- SetId( id == wxID_ANY ? NewControlId() : id );
+ if(!wxControl::Create(parent, id, pos, size, style, validator, name))
+ return false;
+
FormType* form = GetParentForm();
if(form==NULL)
return false;
int wxSlider::GetMin() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
uint16_t ret;
- CtlGetSliderValues(m_control, &ret, NULL, NULL, NULL);
+ CtlGetSliderValues(control, &ret, NULL, NULL, NULL);
return ret;
}
int wxSlider::GetMax() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
uint16_t ret;
- CtlGetSliderValues(m_control, NULL, &ret, NULL, NULL);
+ CtlGetSliderValues(control, NULL, &ret, NULL, NULL);
return ret;
}
int wxSlider::GetPageSize() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
uint16_t ret;
- CtlGetSliderValues(m_control, NULL, NULL, &ret, NULL);
+ CtlGetSliderValues(control, NULL, NULL, &ret, NULL);
return ret;
}
int wxSlider::GetValue() const
{
+ ControlType *control = (ControlType *)GetObjectPtr();
+ if(control==NULL)
+ return 0;
uint16_t ret;
- CtlGetSliderValues(m_control, NULL, NULL, NULL, &ret);
+ CtlGetSliderValues(control, NULL, NULL, NULL, &ret);
return ret;
}
SetIntValue(value);
}
-void wxSlider::DoGetSize(int *width, int *height) const
-{
-}
-
-void wxSlider::GetPosition(int *x, int *y) const
-{
-}
-
-void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
-{
-}
-
-
wxSize wxSlider::DoGetBestSize() const
{
return wxSize(0,0);
// Name: src/palmos/stattext.cpp
// Purpose: wxStaticText
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native wxStaticText implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#endif
#include "wx/stattext.h"
-#include "wx/palmos/private.h"
#if wxUSE_EXTENDED_RTTI
WX_DEFINE_FLAGS( wxStaticTextStyle )
long style,
const wxString& name)
{
- return false;
+ if(!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name))
+ return false;
+
+ return wxControl::PalmCreateField(label, pos, size, false, false, leftAlign);
}
wxBorder wxStaticText::GetDefaultBorder() const
return wxBORDER_NONE;
}
-WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
-{
- return 0;
-}
-
wxSize wxStaticText::DoGetBestSize() const
{
return wxSize(0,0);
}
-void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)
-{
-}
-
-void wxStaticText::SetLabel(const wxString& label)
-{
-}
-
-
bool wxStaticText::SetFont(const wxFont& font)
{
return false;
const wxValidator& validator,
const wxString& name)
{
- wxControl::PalmCreateControl(pushButtonCtl, parent, id, label, pos, size);
- return true;
+ if(!wxControl::Create(parent, id, pos, size, style, validator, name))
+ return false;
+
+ return wxControl::PalmCreateControl(pushButtonCtl, label, pos, size);
}
wxBorder wxToggleButton::GetDefaultBorder() const
return GetBoolValue();
}
+bool wxToggleButton::SendClickEvent()
+{
+ wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId());
+ event.SetInt(GetValue());
+ event.SetEventObject(this);
+ return ProcessCommand(event);
+}
+
void wxToggleButton::Command(wxCommandEvent & event)
{
}
#endif //WX_PRECOMP
#include "wx/module.h"
-
#include "wx/display.h"
+// controls for sending select event
+#include "wx/button.h"
+#include "wx/checkbox.h"
+#include "wx/radiobut.h"
+#include "wx/tglbtn.h"
+
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
// wxTopLevelWindow event handling
// ----------------------------------------------------------------------------
+bool wxTopLevelWindowPalm::HandleControlSelect(EventType* event)
+{
+ int id = event->data.ctlSelect.controlID;
+ wxWindow* win = FindWindowById(id,this);
+ if(win==NULL)
+ return false;
+
+ wxButton* button = wxDynamicCast(win,wxButton);
+ if(button)
+ return button->SendClickEvent();
+
+ wxCheckBox* checkbox = wxDynamicCast(win,wxCheckBox);
+ if(checkbox)
+ return checkbox->SendClickEvent();
+
+ wxToggleButton* toggle = wxDynamicCast(win,wxToggleButton);
+ if(toggle)
+ return toggle->SendClickEvent();
+
+ wxRadioButton* radio = wxDynamicCast(win,wxRadioButton);
+ if(radio)
+ return radio->SendClickEvent();
+
+ return false;
+}
+
void wxTopLevelWindowPalm::OnActivate(wxActivateEvent& event)
{
}
* finds a better solution, please let me know. My email address is
* wbo@freeshell.org
*/
-static Boolean FrameFormHandleEvent(EventType* pEvent)
+static Boolean FrameFormHandleEvent(EventType* event)
{
wxFrame* frame = wxDynamicCast(ActiveParentFrame,wxFrame);
- Boolean fHandled = false;
- FormType* pForm;
- WinHandle hWindow;
- int ItemID=0;
+ Boolean handled = false;
- switch (pEvent->eType) {
+ switch (event->eType) {
case ctlSelectEvent:
+ handled = frame->HandleControlSelect(event);
break;
#if wxUSE_MENUS_NATIVE
case menuOpenEvent:
- fHandled = frame->HandleMenuOpen();
+ handled = frame->HandleMenuOpen();
break;
case menuEvent:
- ItemID = pEvent->data.menu.itemID;
- fHandled = frame->HandleMenuSelect(ItemID);
+ handled = frame->HandleMenuSelect(event);
break;
#endif
default:
break;
}
- return fHandled;
+ return handled;
}
long style,
const wxString& name)
{
- return false;
+ wxCHECK_MSG( parent, false, wxT("can't create wxWindow without parent") );
+
+ if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
+ return false;
+
+ parent->AddChild(this);
+
+ InheritAttributes();
+
+ return true;
}
FormType *wxWindowPalm::GetFormPtr()