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:
@@ -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