Use stock labels. Native wxRadioButton. Getting position and size for the controls. Getting size for wxTLW. Default size and position for wxButton according to l&f guidelines. Removed wxUSE_CTL3D from wxPalmOS port. Better font for controls.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -151,6 +151,7 @@ SOURCES = ../../samples/minimal/minimal.cpp \
|
||||
../../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 \
|
||||
|
@@ -118,6 +118,7 @@ wxPalmOS:
|
||||
- native wxCheckBox implementation
|
||||
- native wxSlider implementation
|
||||
- native wxToggleButton implementation
|
||||
- native wxRadioButton implementation
|
||||
|
||||
|
||||
2.5.3
|
||||
|
@@ -89,6 +89,10 @@ protected:
|
||||
// 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
|
||||
@@ -117,7 +121,9 @@ protected:
|
||||
|
||||
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
|
||||
|
@@ -2,10 +2,10 @@
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -50,7 +50,6 @@ public:
|
||||
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); }
|
||||
@@ -63,10 +62,6 @@ private:
|
||||
// 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)
|
||||
};
|
||||
|
||||
|
@@ -521,7 +521,7 @@
|
||||
#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
|
||||
|
@@ -82,12 +82,15 @@ public:
|
||||
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);
|
||||
|
||||
|
@@ -47,6 +47,8 @@ extern WXDLLEXPORT_DATA(const wxChar*) wxRadioButtonNameStr;
|
||||
#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
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "wx/stockitem.h"
|
||||
#include "wx/intl.h"
|
||||
|
||||
#include "wx/utils.h" // for wxStripMenuCodes()
|
||||
|
||||
bool wxIsStockID(wxWindowID id)
|
||||
{
|
||||
@@ -95,7 +95,7 @@ bool wxIsStockID(wxWindowID id)
|
||||
|
||||
wxString wxGetStockLabel(wxWindowID id)
|
||||
{
|
||||
#ifdef __SMARTPHONE__
|
||||
#if defined(__SMARTPHONE__) || defined(__WXPALMOS__)
|
||||
#define STOCKITEM(stockid, label) \
|
||||
case stockid: \
|
||||
return wxStripMenuCodes(label);
|
||||
|
@@ -38,6 +38,9 @@
|
||||
#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
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -126,7 +129,48 @@ bool wxButton::Create(wxWindow *parent,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -140,13 +184,13 @@ wxButton::~wxButton()
|
||||
|
||||
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()
|
||||
@@ -180,7 +224,7 @@ bool wxButton::SendClickEvent()
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxButton::Command(wxCommandEvent & event)
|
||||
void wxButton::Command(wxCommandEvent &event)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "wx/button.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/tglbtn.h"
|
||||
#include "wx/radiobut.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWin macros
|
||||
@@ -113,7 +114,7 @@ bool wxControl::PalmCreateControl(ControlStyleType style,
|
||||
( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
|
||||
( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
|
||||
( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
|
||||
boldFont,
|
||||
stdFont,
|
||||
0,
|
||||
false
|
||||
);
|
||||
@@ -182,6 +183,37 @@ wxSize wxControl::DoGetBestSize() const
|
||||
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 )
|
||||
@@ -224,6 +256,7 @@ 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;
|
||||
@@ -238,6 +271,7 @@ 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;
|
||||
@@ -290,15 +324,9 @@ void wxControl::OnEraseBackground(wxEraseEvent& event)
|
||||
}
|
||||
|
||||
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;
|
||||
|
@@ -247,19 +247,3 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar
|
||||
{
|
||||
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
|
||||
|
||||
|
@@ -304,15 +304,9 @@ WXLRESULT wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
|
||||
}
|
||||
|
||||
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;
|
||||
|
@@ -2,10 +2,10 @@
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "wx/dcscreen.h"
|
||||
#endif
|
||||
|
||||
#include "wx/palmos/private.h"
|
||||
|
||||
// ============================================================================
|
||||
// wxRadioButton implementation
|
||||
// ============================================================================
|
||||
@@ -115,7 +113,8 @@ bool wxRadioButton::Create(wxWindow *parent,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
return false;
|
||||
wxControl::PalmCreateControl(pushButtonCtl, parent, id, label, pos, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -124,11 +123,12 @@ bool wxRadioButton::Create(wxWindow *parent,
|
||||
|
||||
void wxRadioButton::SetValue(bool value)
|
||||
{
|
||||
SetBoolValue(value);
|
||||
}
|
||||
|
||||
bool wxRadioButton::GetValue() const
|
||||
{
|
||||
return false;
|
||||
return GetBoolValue();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -139,11 +139,6 @@ void wxRadioButton::Command (wxCommandEvent& event)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxRadioButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxRadioButton geometry
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -568,15 +568,9 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
}
|
||||
|
||||
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;
|
||||
|
@@ -186,6 +186,16 @@ void wxTopLevelWindowPalm::Restore()
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -212,9 +222,9 @@ bool wxTopLevelWindowPalm::EnableCloseButton(bool enable)
|
||||
return false;
|
||||
}
|
||||
|
||||
FormType *wxTopLevelWindowPalm::GetForm()
|
||||
FormType *wxTopLevelWindowPalm::GetForm() const
|
||||
{
|
||||
return FrmGetActiveForm ();
|
||||
return FrmGetActiveForm();
|
||||
}
|
||||
|
||||
#ifndef __WXWINCE__
|
||||
|
Reference in New Issue
Block a user