Native wxStaticText. Cleaning of wxRadioBox code before native implementation. Events for wxButton, wxCheckBox, wxToggleButton, wxRadioButton sended from within wxTLW. Internal improvements in structure of wxControl. Pass full palm event to handlers (instead of ID only). Last palm control ID with value which allow portable IDs with wxMSW (according to comment in msw code).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -119,6 +119,7 @@ wxPalmOS:
|
||||
- native wxSlider implementation
|
||||
- native wxToggleButton implementation
|
||||
- native wxRadioButton implementation
|
||||
- native wxStaticText implementation
|
||||
|
||||
|
||||
2.5.3
|
||||
|
@@ -52,6 +52,9 @@ public:
|
||||
// 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
|
||||
@@ -59,8 +62,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
// send a notification event, return true if processed
|
||||
bool SendClickEvent();
|
||||
|
||||
// default button handling
|
||||
void SetTmpDefault();
|
||||
|
@@ -47,6 +47,9 @@ public:
|
||||
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
||||
// send a notification event, return true if processed
|
||||
bool SendClickEvent();
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
class WXDLLEXPORT wxControl : public wxControlBase
|
||||
{
|
||||
public:
|
||||
wxControl() { }
|
||||
wxControl() { Init(); }
|
||||
|
||||
wxControl(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxControlNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
@@ -77,6 +78,8 @@ public:
|
||||
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;
|
||||
@@ -86,6 +89,12 @@ protected:
|
||||
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;
|
||||
|
||||
@@ -99,11 +108,19 @@ protected:
|
||||
// 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
|
||||
@@ -117,10 +134,14 @@ protected:
|
||||
// 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.
|
||||
|
@@ -86,7 +86,7 @@ public:
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
bool HandleMenuOpen();
|
||||
bool HandleMenuSelect(int ItemID);
|
||||
bool HandleMenuSelect(EventType* event);
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
protected:
|
||||
@@ -118,7 +118,7 @@ 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;
|
||||
|
@@ -2,10 +2,10 @@
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -85,14 +85,14 @@ public:
|
||||
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); }
|
||||
|
||||
@@ -104,15 +104,12 @@ public:
|
||||
// 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);
|
||||
|
@@ -51,6 +51,10 @@ public:
|
||||
|
||||
// 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); }
|
||||
|
||||
@@ -62,6 +66,8 @@ private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// pushButtonCtl or checkboxCtl
|
||||
ControlStyleType m_radioStyle;
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton)
|
||||
};
|
||||
|
||||
|
@@ -528,7 +528,7 @@
|
||||
#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
|
||||
|
@@ -46,8 +46,6 @@ public:
|
||||
virtual int GetValue() const;
|
||||
virtual void SetValue(int);
|
||||
|
||||
void GetPosition(int *x, int *y) const;
|
||||
|
||||
void SetRange(int minValue, int maxValue);
|
||||
|
||||
int GetMin() const;
|
||||
@@ -73,12 +71,6 @@ public:
|
||||
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)
|
||||
|
@@ -2,10 +2,10 @@
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -41,16 +41,12 @@ public:
|
||||
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)
|
||||
};
|
||||
|
@@ -46,6 +46,9 @@ public:
|
||||
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
|
||||
// send a notification event, return true if processed
|
||||
bool SendClickEvent();
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
virtual wxBorder GetDefaultBorder() const;
|
||||
|
@@ -84,6 +84,9 @@ public:
|
||||
// interface to native frame structure
|
||||
FormType *GetForm() const;
|
||||
|
||||
// handle controls
|
||||
bool HandleControlSelect(EventType* event);
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
@@ -117,6 +117,8 @@ public:
|
||||
#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
|
||||
|
@@ -34,6 +34,8 @@ private:
|
||||
#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
|
||||
|
@@ -86,7 +86,7 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXPALMOS__)
|
||||
int wxWindowBase::ms_lastControlId = 65535;
|
||||
int wxWindowBase::ms_lastControlId = 32767;
|
||||
#elif defined(__WXPM__)
|
||||
int wxWindowBase::ms_lastControlId = 2000;
|
||||
#else
|
||||
|
@@ -170,8 +170,10 @@ bool wxButton::Create(wxWindow *parent,
|
||||
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()
|
||||
@@ -221,11 +223,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
|
||||
|
@@ -106,8 +106,10 @@ bool wxCheckBox::Create(wxWindow *parent,
|
||||
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
|
||||
@@ -125,6 +127,14 @@ bool wxCheckBox::GetValue() 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)
|
||||
{
|
||||
}
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/tglbtn.h"
|
||||
#include "wx/radiobut.h"
|
||||
#include "wx/slider.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWin macros
|
||||
@@ -63,6 +64,12 @@ END_EVENT_TABLE()
|
||||
// wxControl ctor/dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxControl::Init()
|
||||
{
|
||||
m_palmControl = false;
|
||||
m_palmField = false;
|
||||
}
|
||||
|
||||
wxControl::~wxControl()
|
||||
{
|
||||
m_isBeingDeleted = true;
|
||||
@@ -91,41 +98,82 @@ bool wxControl::Create(wxWindow *parent,
|
||||
}
|
||||
|
||||
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
|
||||
);
|
||||
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(m_control==NULL)
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -143,6 +191,22 @@ FormType* wxControl::GetParentForm() const
|
||||
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,
|
||||
@@ -216,19 +280,21 @@ void wxControl::DoGetSize( int *width, int *height ) const
|
||||
|
||||
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
|
||||
@@ -251,31 +317,75 @@ bool wxControl::Show( bool show )
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxControl::SetFieldLabel(const wxString& label)
|
||||
{
|
||||
FieldType* field = (FieldType*)GetObjectPtr();
|
||||
if(field==NULL)
|
||||
return;
|
||||
|
||||
uint16_t newSize = label.Length() + 1;
|
||||
MemHandle strHandle = FldGetTextHandle(field);
|
||||
FldSetTextHandle(field, NULL );
|
||||
if (strHandle)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// setting in wrong control causes crash
|
||||
if ( ( wxDynamicCast(this,wxButton) != NULL ) ||
|
||||
( wxDynamicCast(this,wxCheckBox) != NULL ) ||
|
||||
( wxDynamicCast(this,wxRadioButton) != NULL ) ||
|
||||
( wxDynamicCast(this,wxToggleButton) != NULL ) )
|
||||
{
|
||||
m_label = label;
|
||||
// TODO: as manual states, it crashes here
|
||||
// needs own manipulation on used string pointers
|
||||
// CtlSetLabel(m_control,m_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;
|
||||
}
|
||||
|
@@ -224,8 +224,10 @@ bool wxFrame::HandleMenuOpen()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxFrame::HandleMenuSelect(int ItemID)
|
||||
bool wxFrame::HandleMenuSelect(EventType* event)
|
||||
{
|
||||
int ItemID = event->data.menu.itemID;
|
||||
|
||||
if (!m_frameMenuBar)
|
||||
return false;
|
||||
|
||||
|
@@ -2,10 +2,10 @@
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -150,11 +150,6 @@ int wxRadioBox::GetNumHor() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Radio box item
|
||||
wxRadioBox::wxRadioBox()
|
||||
{
|
||||
@@ -298,11 +293,6 @@ bool wxRadioBox::SetFont(const wxFont& font)
|
||||
// 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),
|
||||
|
@@ -102,6 +102,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||
|
||||
void wxRadioButton::Init()
|
||||
{
|
||||
m_radioStyle = pushButtonCtl;
|
||||
}
|
||||
|
||||
bool wxRadioButton::Create(wxWindow *parent,
|
||||
@@ -113,8 +114,16 @@ 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
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -135,6 +144,14 @@ bool wxRadioButton::GetValue() const
|
||||
// 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)
|
||||
{
|
||||
}
|
||||
|
@@ -109,8 +109,9 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
||||
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;
|
||||
@@ -145,29 +146,41 @@ wxSlider::~wxSlider()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -176,19 +189,6 @@ void wxSlider::SetValue(int value)
|
||||
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);
|
||||
|
@@ -2,10 +2,10 @@
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#endif
|
||||
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/palmos/private.h"
|
||||
|
||||
#if wxUSE_EXTENDED_RTTI
|
||||
WX_DEFINE_FLAGS( wxStaticTextStyle )
|
||||
@@ -92,7 +91,10 @@ bool wxStaticText::Create(wxWindow *parent,
|
||||
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
|
||||
@@ -100,25 +102,11 @@ 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;
|
||||
|
@@ -60,8 +60,10 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id,
|
||||
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
|
||||
@@ -84,6 +86,14 @@ bool wxToggleButton::GetValue() 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)
|
||||
{
|
||||
}
|
||||
|
@@ -40,9 +40,14 @@
|
||||
#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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -240,6 +245,32 @@ bool wxTopLevelWindowPalm::SetShape(const wxRegion& region)
|
||||
// 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)
|
||||
{
|
||||
}
|
||||
@@ -258,29 +289,26 @@ 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;
|
||||
}
|
||||
|
@@ -269,7 +269,16 @@ bool wxWindowPalm::Create(wxWindow *parent,
|
||||
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()
|
||||
|
Reference in New Issue
Block a user