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:
Włodzimierz Skiba
2005-01-31 08:04:44 +00:00
parent 9cc311d32c
commit a152561c76
26 changed files with 345 additions and 149 deletions

View File

@@ -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();

View File

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

View File

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

View File

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

View File

@@ -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);

View File

@@ -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)
};

View File

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

View File

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

View File

@@ -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)
};

View File

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

View File

@@ -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();

View File

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

View File

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