new stock buttons API

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-08-30 14:42:51 +00:00
parent 598ddd96f4
commit 5f7bcb48fd
40 changed files with 497 additions and 829 deletions

View File

@@ -12,10 +12,6 @@
#ifndef _WX_BUTTON_H_BASE_
#define _WX_BUTTON_H_BASE_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "buttonbase.h"
#endif
#include "wx/defs.h"
// ----------------------------------------------------------------------------
@@ -48,7 +44,6 @@
#define wxBU_EXACTFIT 0x0001
#include "wx/control.h"
#include "wx/stockitem.h"
class WXDLLEXPORT wxBitmap;
@@ -82,16 +77,6 @@ public:
static wxSize GetDefaultSize();
protected:
#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
// create stock button (generic implementation)
bool CreateStock(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
#endif
DECLARE_NO_COPY_CLASS(wxButtonBase)
};

View File

@@ -28,7 +28,7 @@ class WXDLLEXPORT wxButton : public wxButtonBase, protected wxCocoaNSButton
public:
wxButton() { }
wxButton(wxWindow *parent, wxWindowID winid,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
@@ -37,34 +37,14 @@ public:
Create(parent, winid, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent, wxWindowID winid, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, winid, stock, descriptiveLabel, pos, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID winid,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
bool Create(wxWindow *parent, wxWindowID winid, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, winid, stock, descriptiveLabel,
pos, style, validator, name);
}
virtual ~wxButton();
// ------------------------------------------------------------------------

View File

@@ -1490,7 +1490,7 @@ enum
wxID_FILE8,
wxID_FILE9,
/* Standard button IDs */
/* Standard button and menu IDs */
wxID_OK = 5100,
wxID_CANCEL,
wxID_APPLY,
@@ -1509,6 +1509,31 @@ enum
wxID_ABORT,
wxID_RETRY,
wxID_IGNORE,
wxID_ADD,
wxID_REMOVE,
wxID_UP,
wxID_DOWN,
wxID_HOME,
wxID_REFRESH,
wxID_STOP,
wxID_INDEX,
wxID_BOLD,
wxID_ITALIC,
wxID_JUSTIFY_CENTER,
wxID_JUSTIFY_FILL,
wxID_JUSTIFY_RIGHT,
wxID_JUSTIFY_LEFT,
wxID_UNDERLINE,
wxID_INDENT,
wxID_UNINDENT,
wxID_ZOOM_100,
wxID_ZOOM_FIT,
wxID_ZOOM_IN,
wxID_ZOOM_OUT,
wxID_UNDELETE,
wxID_REVERT_TO_SAVED,
/* System menu IDs (used by wxUniv): */
wxID_SYSTEM_MENU = 5200,

View File

@@ -39,7 +39,8 @@ class wxButton: public wxButtonBase
{
public:
wxButton();
wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
wxButton(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
@@ -47,31 +48,15 @@ public:
{
Create(parent, id, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
virtual ~wxButton();
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void SetDefault();
virtual void SetLabel( const wxString &label );

View File

@@ -39,7 +39,8 @@ class wxButton: public wxButtonBase
{
public:
wxButton();
wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
wxButton(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
@@ -47,31 +48,15 @@ public:
{
Create(parent, id, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
virtual ~wxButton();
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void SetDefault();
virtual void SetLabel( const wxString &label );

View File

@@ -27,7 +27,8 @@ class WXDLLEXPORT wxButton: public wxButtonBase
DECLARE_DYNAMIC_CLASS(wxButton)
public:
inline wxButton() {}
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
inline wxButton(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
@@ -35,34 +36,14 @@ class WXDLLEXPORT wxButton: public wxButtonBase
{
Create(parent, id, label, pos, size, style, validator, name);
}
inline wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, id, stock, descriptiveLabel,
pos, style, validator, name);
}
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
static wxSize GetDefaultSize();

View File

@@ -27,7 +27,8 @@ class WXDLLEXPORT wxButton: public wxButtonBase
DECLARE_DYNAMIC_CLASS(wxButton)
public:
inline wxButton() {}
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
inline wxButton(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
@@ -36,32 +37,12 @@ class WXDLLEXPORT wxButton: public wxButtonBase
Create(parent, id, label, pos, size, style, validator, name);
}
inline wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, id, stock, descriptiveLabel,
pos, style, validator, name);
}
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
static wxSize GetDefaultSize();

View File

@@ -25,7 +25,7 @@ public:
wxButton() { }
wxButton(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
@@ -34,33 +34,13 @@ public:
Create(parent, id, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, id, stock, descriptiveLabel,
pos, style, validator, name);
}
virtual void SetDefault();
virtual void Command(wxCommandEvent& event);

View File

@@ -26,7 +26,7 @@ public:
wxButton() { }
wxButton(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
@@ -36,30 +36,9 @@ public:
Create(parent, id, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, id, stock, descriptiveLabel,
pos, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,

View File

@@ -21,7 +21,7 @@ class WXDLLEXPORT wxButton: public wxButtonBase
inline wxButton() {}
inline wxButton( wxWindow* pParent
,wxWindowID vId
,const wxString& rsLabel
,const wxString& rsLabel = wxEmptyString
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
@@ -39,20 +39,10 @@ class WXDLLEXPORT wxButton: public wxButtonBase
,rsName
);
}
wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
bool Create( wxWindow* pParent
,wxWindowID vId
,const wxString& rsLabel
,const wxString& rsLabel = wxEmptyString
,const wxPoint& rPos = wxDefaultPosition
,const wxSize& rSize = wxDefaultSize
,long lStyle = 0
@@ -60,17 +50,6 @@ class WXDLLEXPORT wxButton: public wxButtonBase
,const wxString& rsName = wxButtonNameStr
);
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, id, stock, descriptiveLabel,
pos, style, validator, name);
}
virtual ~wxButton();
virtual void SetDefault(void);

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/stockitem.h
// Purpose: wxStockItemID enum
// Purpose: stock items helpers (privateh header)
// Author: Vaclav Slavik
// Modified by:
// Created: 2004-08-15
@@ -20,77 +20,23 @@
#include "wx/string.h"
// ----------------------------------------------------------------------------
// Stock item IDs for use with wxButton, wxMenu and wxToolBar:
// Helper functions for stock items handling:
// ----------------------------------------------------------------------------
enum wxStockItemID
{
wxSTOCK_NONE = 0,
wxSTOCK_ADD,
wxSTOCK_APPLY,
wxSTOCK_BOLD,
wxSTOCK_CANCEL,
wxSTOCK_CLEAR,
wxSTOCK_CLOSE,
wxSTOCK_COPY,
wxSTOCK_CUT,
wxSTOCK_DELETE,
wxSTOCK_FIND,
wxSTOCK_FIND_AND_REPLACE,
wxSTOCK_GO_BACK,
wxSTOCK_GO_DOWN,
wxSTOCK_GO_FORWARD,
wxSTOCK_GO_UP,
wxSTOCK_HELP,
wxSTOCK_HOME,
wxSTOCK_INDENT,
wxSTOCK_INDEX,
wxSTOCK_ITALIC,
wxSTOCK_JUSTIFY_CENTER,
wxSTOCK_JUSTIFY_FILL,
wxSTOCK_JUSTIFY_LEFT,
wxSTOCK_JUSTIFY_RIGHT,
wxSTOCK_NEW,
wxSTOCK_NO,
wxSTOCK_OK,
wxSTOCK_OPEN,
wxSTOCK_PASTE,
wxSTOCK_PREFERENCES,
wxSTOCK_PRINT,
wxSTOCK_PRINT_PREVIEW,
wxSTOCK_PROPERTIES,
wxSTOCK_QUIT,
wxSTOCK_REDO,
wxSTOCK_REFRESH,
wxSTOCK_REMOVE,
wxSTOCK_REVERT_TO_SAVED,
wxSTOCK_SAVE,
wxSTOCK_SAVE_AS,
wxSTOCK_STOP,
wxSTOCK_UNDELETE,
wxSTOCK_UNDERLINE,
wxSTOCK_UNDO,
wxSTOCK_UNINDENT,
wxSTOCK_YES,
wxSTOCK_ZOOM_100,
wxSTOCK_ZOOM_FIT,
wxSTOCK_ZOOM_IN,
wxSTOCK_ZOOM_OUT
// NB: when you add new item here, add it to stockitem.cpp and
// documentation as well
};
// Returns true if the ID is in the list of recognized stock actions
bool wxIsStockID(wxWindowID id);
// ----------------------------------------------------------------------------
// Helper functions:
// ----------------------------------------------------------------------------
// Returns true of the label is empty or label of a stock button with
// given ID
bool wxIsStockLabel(wxWindowID id, const wxString& label);
// Returns label that should be used for given stock UI element (e.g. "&OK"
// for wxSTOCK_OK):
wxString wxGetStockItemLabel(wxStockItemID item);
wxString wxGetStockLabel(wxWindowID id);
#ifdef __WXGTK20__
// Translates stock ID to GTK+'s stock item string indentifier:
const char *wxStockItemToGTK(wxStockItemID item);
const char *wxGetStockGtkID(wxWindowID id);
#endif
#endif // _WX_STOCKITEM_H_

View File

@@ -40,7 +40,7 @@ public:
wxButton(wxWindow *parent,
wxWindowID id,
const wxBitmap& bitmap,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
@@ -52,21 +52,9 @@ public:
Create(parent, id, bitmap, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
Init();
Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
}
wxButton(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
@@ -80,7 +68,7 @@ public:
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
@@ -91,21 +79,10 @@ public:
pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
const wxString& descriptiveLabel = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr)
{
return CreateStock(parent, id, stock, descriptiveLabel,
pos, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmap& bitmap,
const wxString& label,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,