../../src/common/sizer.cpp \
../../src/common/socket.cpp \
../../src/common/statbar.cpp \
+../../src/common/stockitem.cpp \
../../src/common/strconv.cpp \
../../src/common/stream.cpp \
../../src/common/string.cpp \
- native wxCheckBox implementation
- native wxSlider implementation
- native wxToggleButton implementation
+- native wxRadioButton implementation
2.5.3
// return default best size (doesn't really make any sense, override this)
virtual wxSize DoGetBestSize() const;
+ // getting and setting sizes
+ virtual void DoGetPosition( int *x, int *y ) const;
+ virtual void DoGetSize( int *width, int *height ) const;
+
// create the control of the given ControlStyleType: this is typically called
// from Create() method of the derived class passing its label, pos and
// size parameter (style parameter is not needed because m_windowStyle is
private:
- // Label stores label in case of wxButton, wxCheckBox, wxToggleButton etc.
+ virtual void DoGetBounds( RectangleType &rect ) const;
+
+ // m_label stores label in case of wxButton, wxCheckBox, wxToggleButton etc.
// We must ensure that it persists for as long as it is being displayed
// (that is, for as long as the control is displayed or until we call
// CtlSetLabel() with a new string), and we must free the string after
// Name: wx/palmos/radiobut.h
// Purpose: wxRadioButton class
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native wxRadioButton implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
virtual bool GetValue() const;
// implementation only from now on
- virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual void Command(wxCommandEvent& event);
virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
// common part of all ctors
void Init();
- // we need to store the state internally as the result of GetValue()
- // sometimes gets out of sync in WM_COMMAND handler
- bool m_isChecked;
-
DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton)
};
#define wxUSE_LISTBOX 0 // wxListBox
#define wxUSE_LISTCTRL 0 // wxListCtrl
#define wxUSE_RADIOBOX 0 // wxRadioBox
-#define wxUSE_RADIOBTN 0 // wxRadioButton
+#define wxUSE_RADIOBTN 1 // wxRadioButton
#define wxUSE_SCROLLBAR 0 // wxScrollBar
#define wxUSE_SLIDER 1 // wxSlider
#define wxUSE_SPINBTN 0 // wxSpinButton
wxWindow *GetLastFocus() const { return m_winLastFocused; }
// interface to native frame structure
- FormType *GetForm();
+ FormType *GetForm() const;
protected:
// common part of all ctors
void Init();
+ // getting and setting sizes
+ virtual void DoGetSize( int *width, int *height ) const;
+
// common part of Iconize(), Maximize() and Restore()
void DoShowWindow(int nShowCmd);
#include "wx/cocoa/radiobut.h"
#elif defined(__WXPM__)
#include "wx/os2/radiobut.h"
+#elif defined(__WXPALMOS__)
+ #include "wx/palmos/radiobut.h"
#endif
#endif // wxUSE_RADIOBTN
#include "wx/stockitem.h"
#include "wx/intl.h"
-
+#include "wx/utils.h" // for wxStripMenuCodes()
bool wxIsStockID(wxWindowID id)
{
wxString wxGetStockLabel(wxWindowID id)
{
-#ifdef __SMARTPHONE__
+#if defined(__SMARTPHONE__) || defined(__WXPALMOS__)
#define STOCKITEM(stockid, label) \
case stockid: \
return wxStripMenuCodes(label);
#include "wx/bmpbuttn.h"
#include "wx/settings.h"
#include "wx/dcscreen.h"
+ #include "wx/frame.h"
+ #include "wx/dialog.h"
+ #include "wx/stockitem.h"
#endif
// ----------------------------------------------------------------------------
const wxValidator& validator,
const wxString& name)
{
- wxControl::PalmCreateControl(buttonCtl, parent, id, label, pos, size);
+ // Default coordinates based on the knowledgebase recipe "Buttons"
+ wxSize palmSize(size.x==wxDefaultCoord?36:size.x,
+ size.y==wxDefaultCoord?12:size.y);
+
+ // Default placement depends on dialog vs. frame type of parent
+ wxPoint palmPos(pos);
+ if((palmPos.x==wxDefaultCoord)||(palmPos.y==wxDefaultCoord))
+ {
+ wxSize parentSize(parent->GetSize());
+ wxWindow* parentTLW = parent;
+ while ( parentTLW && !parentTLW->IsTopLevel() )
+ {
+ parentTLW = parentTLW->GetParent();
+ }
+
+ if(wxDynamicCast(parentTLW, wxFrame)!=NULL)
+ {
+ if(palmPos.x==wxDefaultCoord)
+ palmPos.x = 1;
+ if(palmPos.y==wxDefaultCoord)
+ palmPos.y = parentSize.y-palmSize.y;
+ }
+ else if(wxDynamicCast(parentTLW, wxDialog)!=NULL)
+ {
+ if(palmPos.x==wxDefaultCoord)
+ palmPos.x = 5;
+ if(palmPos.y==wxDefaultCoord)
+ palmPos.y = parentSize.y-palmSize.y-5;
+ }
+ else
+ {
+ // something seriously broken
+ return false;
+ }
+ }
+
+ // take the stock label
+ wxString palmLabel = label;
+ if( palmLabel.empty() && wxIsStockID(id) )
+ palmLabel = wxGetStockLabel(id);
+
+ wxControl::PalmCreateControl(buttonCtl, parent, id, palmLabel, palmPos, palmSize);
return true;
}
wxSize wxButton::DoGetBestSize() const
{
- return wxSize(0,0);
+ return wxSize(36,12);
}
/* static */
wxSize wxButtonBase::GetDefaultSize()
{
- return wxSize(0,0);
+ return wxSize(36,12);
}
void wxButton::SetDefault()
return false;
}
-void wxButton::Command(wxCommandEvent & event)
+void wxButton::Command(wxCommandEvent &event)
{
}
#include "wx/button.h"
#include "wx/checkbox.h"
#include "wx/tglbtn.h"
+#include "wx/radiobut.h"
// ----------------------------------------------------------------------------
// wxWin macros
( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
- boldFont,
+ stdFont,
0,
false
);
return wxSize(16, 16);
}
+void wxControl::DoGetBounds( RectangleType &rect ) const
+{
+ FormType* form = GetParentForm();
+ if(form==NULL)
+ return;
+ uint16_t index = FrmGetObjectIndex(form,GetId());
+ if(index==frmInvalidObjectId)
+ return;
+ FrmGetObjectBounds(form,index,&rect);
+}
+
+void wxControl::DoGetPosition( int *x, int *y ) const
+{
+ RectangleType rect;
+ DoGetBounds(rect);
+ if(x)
+ *x = rect.topLeft.x;
+ if(y)
+ *y = rect.topLeft.y;
+}
+
+void wxControl::DoGetSize( int *width, int *height ) const
+{
+ RectangleType rect;
+ DoGetBounds(rect);
+ if(width)
+ *width = rect.extent.x;
+ if(height)
+ *height = rect.extent.y;
+}
+
bool wxControl::Enable(bool enable)
{
if( m_control == NULL )
// 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;
// setting in wrong control causes crash
if ( wxDynamicCast(this,wxButton) ||
wxDynamicCast(this,wxCheckBox) ||
+ wxDynamicCast(this,wxRadioButton) ||
wxDynamicCast(this,wxToggleButton) )
{
return m_label;
}
WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
-#if wxUSE_CTL3D
- WXUINT message,
- WXWPARAM wParam,
- WXLPARAM lParam
-#else
WXUINT WXUNUSED(message),
WXWPARAM WXUNUSED(wParam),
WXLPARAM WXUNUSED(lParam)
-#endif
)
{
return (WXHBRUSH)0;
{
return false;
}
-
-#if wxUSE_CTL3D
-
-// Define for each class of dialog and control
-WXHBRUSH wxDialog::OnCtlColor(WXHDC WXUNUSED(pDC),
- WXHWND WXUNUSED(pWnd),
- WXUINT WXUNUSED(nCtlColor),
- WXUINT message,
- WXWPARAM wParam,
- WXLPARAM lParam)
-{
- return (WXHBRUSH)Ctl3dCtlColorEx(message, wParam, lParam);
-}
-
-#endif // wxUSE_CTL3D
-
}
WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
-#if wxUSE_CTL3D
- WXUINT message,
- WXWPARAM wParam,
- WXLPARAM lParam
-#else
WXUINT WXUNUSED(message),
WXWPARAM WXUNUSED(wParam),
WXLPARAM WXUNUSED(lParam)
-#endif
)
{
return (WXHBRUSH)0;
// Name: src/palmos/radiobut.cpp
// Purpose: wxRadioButton
// Author: William Osborne - minimal working wxPalmOS port
-// Modified by:
+// Modified by: Wlodzimierz ABX Skiba - native wxRadioButton implementation
// Created: 10/13/04
// RCS-ID: $Id$
-// Copyright: (c) William Osborne
+// Copyright: (c) William Osborne, Wlodzimierz Skiba
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/dcscreen.h"
#endif
-#include "wx/palmos/private.h"
-
// ============================================================================
// wxRadioButton implementation
// ============================================================================
const wxValidator& validator,
const wxString& name)
{
- return false;
+ wxControl::PalmCreateControl(pushButtonCtl, parent, id, label, pos, size);
+ return true;
}
// ----------------------------------------------------------------------------
void wxRadioButton::SetValue(bool value)
{
+ SetBoolValue(value);
}
bool wxRadioButton::GetValue() const
{
- return false;
+ return GetBoolValue();
}
// ----------------------------------------------------------------------------
{
}
-bool wxRadioButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
-{
- return false;
-}
-
// ----------------------------------------------------------------------------
// wxRadioButton geometry
// ----------------------------------------------------------------------------
}
WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
-#if wxUSE_CTL3D
- WXUINT message,
- WXWPARAM wParam,
- WXLPARAM lParam
-#else
WXUINT WXUNUSED(message),
WXWPARAM WXUNUSED(wParam),
WXLPARAM WXUNUSED(lParam)
-#endif
)
{
return (WXHBRUSH) 0;
{
}
+void wxTopLevelWindowPalm::DoGetSize( int *width, int *height ) const
+{
+ RectangleType rect;
+ FrmGetFormBounds( GetForm() , &rect );
+ if(width)
+ *width = rect.extent.x;
+ if(height)
+ *height = rect.extent.y;
+}
+
// ----------------------------------------------------------------------------
// wxTopLevelWindowPalm fullscreen
// ----------------------------------------------------------------------------
return false;
}
-FormType *wxTopLevelWindowPalm::GetForm()
+FormType *wxTopLevelWindowPalm::GetForm() const
{
- return FrmGetActiveForm ();
+ return FrmGetActiveForm();
}
#ifndef __WXWINCE__