wxToolBar API changes; now frames manage their toolbar & statusbar properly;
client area position is used in SetSize; changes for BC++ & VC++ 1.5; wxWindow::GetUpdateRegion added; removed wxUpdateIterator; some missing functions added to process.cpp; bad navigation key event cast fixed; MDI and toolbar samples updated; new wxMSW wxRegion constructor (WXHRGN) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -161,7 +161,14 @@ public:
|
||||
void SetExpandEnvVars(bool bDoIt = TRUE) { m_bExpandEnvVars = bDoIt; }
|
||||
// does expansion only if needed
|
||||
wxString ExpandEnvVars(const wxString& str) const
|
||||
{ return IsExpandingEnvVars() ? wxExpandEnvVars(str) : str; }
|
||||
{
|
||||
wxString tmp; // Required for BC++
|
||||
if (IsExpandingEnvVars())
|
||||
tmp = wxExpandEnvVars(str);
|
||||
else
|
||||
tmp = str;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
protected:
|
||||
static bool IsImmutable(const char *szKey)
|
||||
|
@@ -367,8 +367,10 @@ typedef void (*wxFunction) (wxObject&, wxEvent&);
|
||||
*/
|
||||
|
||||
#define wxTB_3DBUTTONS 0x8000
|
||||
#define wxTB_HORIZONTAL 0x0002
|
||||
#define wxTB_VERTICAL 0x0004
|
||||
// Flatbar/Coolbar under Win98
|
||||
#define wxTB_FLAT 0x0002
|
||||
#define wxTB_FLAT 0x0008
|
||||
|
||||
/*
|
||||
* Apply to all panel items
|
||||
@@ -665,16 +667,18 @@ typedef enum {
|
||||
// Possible SetSize flags
|
||||
|
||||
// Use internally-calculated width if -1
|
||||
#define wxSIZE_AUTO_WIDTH 1
|
||||
#define wxSIZE_AUTO_WIDTH 0x0001
|
||||
// Use internally-calculated height if -1
|
||||
#define wxSIZE_AUTO_HEIGHT 2
|
||||
#define wxSIZE_AUTO_HEIGHT 0x0002
|
||||
// Use internally-calculated width and height if each is -1
|
||||
#define wxSIZE_AUTO 3
|
||||
#define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT)
|
||||
// Ignore missing (-1) dimensions (use existing).
|
||||
// For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code.
|
||||
#define wxSIZE_USE_EXISTING 0
|
||||
#define wxSIZE_USE_EXISTING 0x0000
|
||||
// Allow -1 as a valid position
|
||||
#define wxSIZE_ALLOW_MINUS_ONE 4
|
||||
#define wxSIZE_ALLOW_MINUS_ONE 0x0004
|
||||
// Don't do parent client adjustments (for implementation only)
|
||||
#define wxSIZE_NO_ADJUSTMENTS 0x0008
|
||||
|
||||
// Clipboard formats
|
||||
// Numbers as per winuser.h
|
||||
@@ -858,7 +862,6 @@ typedef unsigned short WXWORD;
|
||||
typedef unsigned int WXWPARAM;
|
||||
typedef long WXLPARAM;
|
||||
typedef unsigned long WXCOLORREF;
|
||||
typedef void * WXRGN;
|
||||
typedef void * WXRGNDATA;
|
||||
typedef void * WXMSG;
|
||||
typedef unsigned long WXHCONV;
|
||||
|
@@ -1047,6 +1047,7 @@ typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
|
||||
typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
|
||||
typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxShowEvent&);
|
||||
typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&);
|
||||
typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
|
||||
|
||||
// N.B. In GNU-WIN32, you *have* to take the address of a member function
|
||||
// (use &) or the compiler crashes...
|
||||
@@ -1097,7 +1098,7 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
||||
#define EVT_SHOW(func) { wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, NULL },
|
||||
#define EVT_MAXIMIZE(func) { wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, NULL },
|
||||
#define EVT_ICONIZE(func) { wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, NULL },
|
||||
#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & func, NULL },
|
||||
#define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, NULL },
|
||||
|
||||
// Mouse events
|
||||
#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
|
||||
@@ -1190,7 +1191,6 @@ const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
|
||||
#define EVT_TOOL_RCLICKED(id, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
||||
#define EVT_TOOL_RCLICKED_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
||||
#define EVT_TOOL_ENTER(id, fn) { wxEVT_COMMAND_TOOL_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
||||
#define EVT_TOOL_ENTER_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_ENTER, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
||||
#define EVT_CHECKLISTBOX(id, fn) { wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
|
||||
|
||||
// Generic command events
|
||||
|
@@ -17,8 +17,10 @@
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/toolbar.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
|
||||
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
|
||||
|
||||
class WXDLLEXPORT wxMenuBar;
|
||||
class WXDLLEXPORT wxStatusBar;
|
||||
@@ -58,10 +60,6 @@ public:
|
||||
void GetPosition(int *x, int *y) const ;
|
||||
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// Toolbar: if made known to the frame, the frame will manage it automatically.
|
||||
virtual inline void SetToolBar(wxWindow *toolbar) { m_frameToolBar = toolbar; }
|
||||
virtual inline wxWindow *GetToolBar(void) const { return m_frameToolBar; }
|
||||
|
||||
virtual bool OnClose(void);
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
@@ -90,8 +88,20 @@ public:
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
|
||||
// Create status line
|
||||
virtual bool CreateStatusBar(int number=1);
|
||||
virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0,
|
||||
const wxString& name = "statusBar");
|
||||
inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; }
|
||||
virtual void PositionStatusBar(void);
|
||||
virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
|
||||
const wxString& name);
|
||||
|
||||
// Create toolbar
|
||||
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
|
||||
virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
|
||||
// If made known to the frame, the frame will manage it automatically.
|
||||
virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
|
||||
virtual inline wxToolBar *GetToolBar(void) const { return m_frameToolBar; }
|
||||
virtual void PositionToolBar(void);
|
||||
|
||||
// Set status line text
|
||||
virtual void SetStatusText(const wxString& text, int number = 0);
|
||||
@@ -118,8 +128,8 @@ public:
|
||||
virtual void Maximize(bool maximize);
|
||||
virtual bool LoadAccelerators(const wxString& table);
|
||||
|
||||
virtual void PositionStatusBar(void);
|
||||
virtual wxStatusBar *OnCreateStatusBar(int number);
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
// Query app for menu item updates (called from OnIdle)
|
||||
void DoMenuUpdates(void);
|
||||
@@ -127,8 +137,8 @@ public:
|
||||
|
||||
WXHMENU GetWinMenu(void) const ;
|
||||
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
||||
// Handlers
|
||||
bool MSWOnPaint(void);
|
||||
@@ -148,7 +158,7 @@ protected:
|
||||
bool m_iconized;
|
||||
WXHICON m_defaultIcon;
|
||||
static bool m_useNativeStatusBar;
|
||||
wxWindow * m_frameToolBar ;
|
||||
wxToolBar * m_frameToolBar ;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@@ -43,8 +43,12 @@ wxFont WXDLLEXPORT wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNe
|
||||
# ifdef __BORLANDC__
|
||||
# define CASTWNDPROC
|
||||
# else
|
||||
typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long);
|
||||
# define CASTWNDPROC (WndProcCast)
|
||||
# ifdef __WIN32__
|
||||
typedef long (_stdcall * WndProcCast) (HWND, unsigned int, unsigned int, long);
|
||||
# define CASTWNDPROC (WndProcCast)
|
||||
# else
|
||||
# define CASTWNDPROC
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@@ -42,6 +42,7 @@ public:
|
||||
wxRegion(long x, long y, long w, long h);
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion(WXHRGN hRegion); // Hangs on to this region
|
||||
|
||||
wxRegion(void);
|
||||
~wxRegion(void);
|
||||
|
@@ -21,12 +21,6 @@
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
|
||||
|
||||
#define DEFAULTBITMAPX 16
|
||||
#define DEFAULTBITMAPY 15
|
||||
#define DEFAULTBUTTONX 24
|
||||
#define DEFAULTBUTTONY 24
|
||||
#define DEFAULTBARHEIGHT 27
|
||||
|
||||
class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar95)
|
||||
@@ -37,25 +31,17 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
||||
|
||||
wxToolBar95(void);
|
||||
|
||||
#if WXWIN_COMPATIBILITY > 0
|
||||
inline wxToolBar95(wxWindow *parent, int x, int y, int w, int h,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 2,
|
||||
const char *name = wxToolBarNameStr)
|
||||
{
|
||||
Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
|
||||
}
|
||||
#endif
|
||||
inline wxToolBar95(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL,
|
||||
int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr)
|
||||
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
||||
const wxString& name = wxToolBarNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
~wxToolBar95(void);
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL,
|
||||
int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
||||
const wxString& name = wxToolBarNameStr);
|
||||
|
||||
// Call default behaviour
|
||||
void OnPaint(wxPaintEvent& event) { Default() ; }
|
||||
@@ -72,15 +58,14 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
||||
bool toggle = FALSE, long xPos = -1, long yPos = -1, wxObject *clientData = NULL,
|
||||
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
||||
|
||||
// New members
|
||||
// Set default bitmap size
|
||||
void SetDefaultSize(const wxSize& size);
|
||||
void SetToolBitmapSize(const wxSize& size);
|
||||
void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
|
||||
void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
|
||||
void ClearTools(void);
|
||||
|
||||
// The button size is bigger than the bitmap size
|
||||
wxSize GetDefaultButtonSize(void) const;
|
||||
wxSize GetToolSize(void) const;
|
||||
|
||||
wxSize GetMaxSize(void) const;
|
||||
void GetSize(int *w, int *y) const;
|
||||
@@ -90,6 +75,9 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
||||
virtual void SetRows(int nRows);
|
||||
virtual void Layout(void) {}
|
||||
|
||||
// The post-tool-addition call
|
||||
bool Realize() { return CreateTools(); };
|
||||
|
||||
// IMPLEMENTATION
|
||||
bool MSWCommand(WXUINT param, WXWORD id);
|
||||
bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
@@ -21,6 +21,8 @@
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxButtonBarNameStr;
|
||||
|
||||
class WXDLLEXPORT wxMemoryDC;
|
||||
|
||||
// Non-Win95 (WIN32, WIN16, UNIX) version
|
||||
|
||||
class WXDLLEXPORT wxToolBarMSW: public wxToolBarBase
|
||||
@@ -32,23 +34,13 @@ public:
|
||||
*/
|
||||
wxToolBarMSW(void);
|
||||
|
||||
#if WXWIN_COMPATIBILITY > 0
|
||||
inline wxToolBarMSW(wxWindow *parent, int x, int y, int w, int h,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 2,
|
||||
const char *name = wxButtonBarNameStr)
|
||||
{
|
||||
Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
|
||||
}
|
||||
#endif
|
||||
inline wxToolBarMSW(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL,
|
||||
int RowsOrColumns = 2, const wxString& name = wxButtonBarNameStr)
|
||||
long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL,
|
||||
int RowsOrColumns = 2, const wxString& name = wxButtonBarNameStr);
|
||||
long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxButtonBarNameStr);
|
||||
|
||||
~wxToolBarMSW(void);
|
||||
|
||||
@@ -66,13 +58,18 @@ public:
|
||||
|
||||
void DrawTool(wxDC& dc, wxMemoryDC& memDc, wxToolBarTool *tool);
|
||||
|
||||
// New members
|
||||
// Set default bitmap size
|
||||
virtual void SetDefaultSize(const wxSize& size);
|
||||
virtual void SetToolBitmapSize(const wxSize& size);
|
||||
void EnableTool(int toolIndex, bool enable); // additional drawing on enabling
|
||||
|
||||
// The button size is bigger than the bitmap size
|
||||
wxSize GetDefaultButtonSize(void) const;
|
||||
wxSize GetToolSize(void) const;
|
||||
|
||||
void Layout(void);
|
||||
|
||||
// The post-tool-addition call
|
||||
bool Realize() { Layout(); return TRUE; };
|
||||
|
||||
protected:
|
||||
void DrawTool(wxDC& dc, wxToolBarTool *tool, int state);
|
||||
|
||||
@@ -89,7 +86,9 @@ public:
|
||||
WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, void *lpBitmapInfo);
|
||||
WXHBITMAP CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
int m_currentRowsOrColumns;
|
||||
long m_lastX, m_lastY;
|
||||
|
||||
WXHBRUSH m_hbrDither;
|
||||
WXDWORD m_rgbFace;
|
||||
@@ -110,12 +109,6 @@ public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define DEFAULTBITMAPX 16
|
||||
#define DEFAULTBITMAPY 15
|
||||
#define DEFAULTBUTTONX 24
|
||||
#define DEFAULTBUTTONY 22
|
||||
#define DEFAULTBARHEIGHT 27
|
||||
|
||||
//
|
||||
// States (not all of them currently used)
|
||||
//
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "wx/event.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/region.h"
|
||||
|
||||
#define wxKEY_SHIFT 1
|
||||
#define wxKEY_CTRL 2
|
||||
@@ -202,6 +203,12 @@ public:
|
||||
// Accept files for dragging
|
||||
virtual void DragAcceptFiles(bool accept);
|
||||
|
||||
// Update region access
|
||||
virtual wxRegion GetUpdateRegion() const;
|
||||
virtual bool IsExposed(int x, int y, int w, int h) const;
|
||||
virtual bool IsExposed(const wxPoint& pt) const;
|
||||
virtual bool IsExposed(const wxRect& rect) const;
|
||||
|
||||
// Set/get the window title
|
||||
virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
|
||||
inline virtual wxString GetTitle(void) const { return wxString(""); };
|
||||
@@ -398,6 +405,14 @@ public:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//// IMPLEMENTATION
|
||||
|
||||
// For implementation purposes - sometimes decorations make the client area
|
||||
// smaller
|
||||
virtual wxPoint GetClientAreaOrigin() const;
|
||||
|
||||
// Makes an adjustment to the window position (for example, a frame that has
|
||||
// a toolbar that it manages itself).
|
||||
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
|
||||
|
||||
// Windows subclassing
|
||||
void SubclassWin(WXHWND hWnd);
|
||||
void UnsubclassWin(void);
|
||||
@@ -639,10 +654,15 @@ public:
|
||||
WXUINT m_lastMsg;
|
||||
WXWPARAM m_lastWParam;
|
||||
WXLPARAM m_lastLParam;
|
||||
|
||||
wxRegion m_updateRegion;
|
||||
/*
|
||||
wxRectangle m_updateRect; // Bounding box for screen damage area
|
||||
#ifdef __WIN32__
|
||||
WXHRGN m_updateRgn; // NT allows access to the rectangle list
|
||||
#endif
|
||||
*/
|
||||
|
||||
WXHANDLE m_acceleratorTable;
|
||||
WXHMENU m_hMenu; // Menu, if any
|
||||
wxList * m_children; // Window's children
|
||||
@@ -706,6 +726,8 @@ inline bool wxWindow::IsBeingDeleted(void) { return m_isBeingDeleted; }
|
||||
// Window specific (so far)
|
||||
wxWindow* WXDLLEXPORT wxGetActiveWindow(void);
|
||||
|
||||
// OBSOLETE
|
||||
#if 0
|
||||
// Allows iteration through damaged rectangles in OnPaint
|
||||
class WXDLLEXPORT wxUpdateIterator
|
||||
{
|
||||
@@ -728,6 +750,7 @@ class WXDLLEXPORT wxUpdateIterator
|
||||
int GetW();
|
||||
int GetH();
|
||||
};
|
||||
#endif
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
|
||||
|
||||
|
@@ -47,10 +47,10 @@ public:
|
||||
int m_toolStyle;
|
||||
wxObject * m_clientData;
|
||||
int m_index;
|
||||
long m_x;
|
||||
long m_y;
|
||||
long m_width;
|
||||
long m_height;
|
||||
long m_x;
|
||||
long m_y;
|
||||
long m_width;
|
||||
long m_height;
|
||||
bool m_toggleState;
|
||||
bool m_isToggle;
|
||||
bool m_deleteSecondBitmap;
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBarBase)
|
||||
DECLARE_ABSTRACT_CLASS(wxToolBarBase)
|
||||
public:
|
||||
|
||||
wxToolBarBase(void);
|
||||
@@ -114,7 +114,7 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
virtual wxString GetToolLongHelp(int toolIndex) const;
|
||||
|
||||
virtual void SetMargins(int x, int y);
|
||||
inline void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }
|
||||
inline void SetMargins(const wxSize& size) { SetMargins((int) size.x, (int) size.y); }
|
||||
virtual void SetToolPacking(int packing);
|
||||
virtual void SetToolSeparation(int separation);
|
||||
|
||||
@@ -122,29 +122,35 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
inline virtual int GetToolPacking(void) { return m_toolPacking; }
|
||||
inline virtual int GetToolSeparation(void) { return m_toolSeparation; }
|
||||
|
||||
virtual void SetDefaultSize(const wxSize& size) { m_defaultWidth = size.x; m_defaultHeight = size.y; };
|
||||
virtual wxSize GetDefaultSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); }
|
||||
virtual void SetToolBitmapSize(const wxSize& size) { m_defaultWidth = size.x; m_defaultHeight = size.y; };
|
||||
virtual wxSize GetToolBitmapSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); }
|
||||
|
||||
// The button size (in some implementations) is bigger than the bitmap size: this returns
|
||||
// the total button size.
|
||||
virtual wxSize GetDefaultButtonSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); } ;
|
||||
virtual wxSize GetToolSize(void) const { return wxSize(m_defaultWidth, m_defaultHeight); } ;
|
||||
|
||||
// Compatibility
|
||||
#if WXWIN_COMPATIBILITY
|
||||
inline void SetDefaultSize(int w, int h) { SetDefaultSize(wxSize(w, h)); }
|
||||
inline long GetDefaultWidth(void) const { return m_defaultWidth; }
|
||||
inline long GetDefaultHeight(void) const { return m_defaultHeight; }
|
||||
inline int GetDefaultButtonWidth(void) const { return GetDefaultButtonSize().x; };
|
||||
inline int GetDefaultButtonHeight(void) const { return GetDefaultButtonSize().y; };
|
||||
inline int GetDefaultButtonWidth(void) const { return (int) GetDefaultButtonSize().x; };
|
||||
inline int GetDefaultButtonHeight(void) const { return (int) GetDefaultButtonSize().y; };
|
||||
virtual void SetDefaultSize(const wxSize& size) { SetToolBitmapSize(size); }
|
||||
virtual wxSize GetDefaultSize(void) const { return GetToolBitmapSize(); }
|
||||
virtual wxSize GetDefaultButtonSize(void) const { return GetToolSize(); }
|
||||
#endif
|
||||
|
||||
// Lay the tools out
|
||||
virtual void Layout(void);
|
||||
|
||||
// Add all the buttons: required for Win95.
|
||||
// TODO: unify API so there's no ambiguity
|
||||
virtual bool CreateTools(void) { return TRUE; }
|
||||
|
||||
// Calls the appropriate function after tools have been created.
|
||||
// E.g. Layout, or CreateTools.
|
||||
virtual bool Realize() = 0;
|
||||
|
||||
void Command(wxCommandEvent& event);
|
||||
|
||||
// SCROLLING: this has to be copied from wxScrolledWindow since wxToolBarBase
|
||||
@@ -178,10 +184,9 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
|
||||
virtual void DoToolbarUpdates(void);
|
||||
|
||||
/*
|
||||
virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const ;
|
||||
virtual void CalcUnscrolledPosition(int x, int y, long *xx, long *yy) const ;
|
||||
*/
|
||||
inline void SetMaxRowsCols(int rows, int cols) { m_maxRows = rows; m_maxCols = cols; }
|
||||
inline int GetMaxRows() const { return m_maxRows; }
|
||||
inline int GetMaxCols() const { return m_maxCols; }
|
||||
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
@@ -194,10 +199,10 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
|
||||
protected:
|
||||
wxList m_tools;
|
||||
int m_tilingDirection;
|
||||
int m_rowsOrColumns;
|
||||
int m_currentRowsOrColumns;
|
||||
long m_lastX, m_lastY;
|
||||
// int m_tilingDirection;
|
||||
// int m_rowsOrColumns;
|
||||
int m_maxRows;
|
||||
int m_maxCols;
|
||||
long m_maxWidth, m_maxHeight;
|
||||
int m_currentTool; // Tool where mouse currently is
|
||||
int m_pressedTool; // Tool where mouse pressed
|
||||
|
@@ -37,24 +37,16 @@ class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
|
||||
public:
|
||||
|
||||
wxToolBarSimple(void);
|
||||
#if WXWIN_COMPATIBILITY > 0
|
||||
inline wxToolBarSimple(wxWindow *parent, int x, int y, int w, int h,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 1,
|
||||
const char *name = wxToolBarNameStr)
|
||||
{
|
||||
Create(parent, -1, wxPoint(x, y), wxSize(w, h), style, orientation, RowsOrColumns, name);
|
||||
}
|
||||
#endif
|
||||
inline wxToolBarSimple(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL,
|
||||
int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr)
|
||||
long style = wxNO_BORDER|wxTB_HORIZONTAL,
|
||||
const wxString& name = wxToolBarNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, orientation, RowsOrColumns, name);
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
~wxToolBarSimple(void);
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxNO_BORDER, int orientation = wxVERTICAL, int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
long style = wxNO_BORDER|wxTB_HORIZONTAL, const wxString& name = wxToolBarNameStr);
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
@@ -68,7 +60,17 @@ class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
|
||||
|
||||
virtual void SpringUpButton(int index);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
void Layout(void);
|
||||
|
||||
// The post-tool-addition call
|
||||
bool Realize() { Layout(); return TRUE; };
|
||||
|
||||
protected:
|
||||
int m_currentRowsOrColumns;
|
||||
long m_lastX, m_lastY;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
|
||||
#endif // USE_TOOLBAR
|
||||
|
@@ -4,11 +4,11 @@
|
||||
// the application code should use only wxToolBar which is #define'd to be the
|
||||
// native implementation for each platform
|
||||
#if defined(__WXMSW__) && defined(__WIN95__)
|
||||
# include "wx/tbar95.h"
|
||||
# include "wx/msw/tbar95.h"
|
||||
# define wxToolBar wxToolBar95
|
||||
# define classwxToolBar classwxToolBar95
|
||||
#elif defined(__WXMSW__)
|
||||
# include "wx/tbarmsw.h"
|
||||
# include "wx/msw/tbarmsw.h"
|
||||
# define wxToolBar wxToolBarMSW
|
||||
# define classwxToolBar classwxToolBarMSW
|
||||
#elif defined(__WXGTK__)
|
||||
|
Reference in New Issue
Block a user