wxWindow split into wxWindowBase and wxWindow (wxGTK part)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#ifndef _WX_CONTROL_H_BASE_
|
||||
#define _WX_CONTROL_H_BASE_
|
||||
|
||||
// all classes derived from wxControl need the validators
|
||||
#include "wx/validate.h"
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/control.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
|
@@ -1106,7 +1106,8 @@ typedef int (__stdcall *WXFARPROC)();
|
||||
typedef int (*WXFARPROC)();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
typedef WXHWND WXWidget;
|
||||
#endif // MSW
|
||||
|
||||
#ifdef __WXMOTIF__
|
||||
/* Stand-ins for X/Xt/Motif types */
|
||||
@@ -1125,7 +1126,7 @@ typedef void* WXFont;
|
||||
typedef void* WXImage;
|
||||
typedef void* WXCursor;
|
||||
typedef void* WXFontList;
|
||||
#endif
|
||||
#endif // Motif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
/* Stand-ins for GLIB types */
|
||||
@@ -1160,7 +1161,8 @@ typedef struct _GtkAccelGroup GtkAccelGroup;
|
||||
typedef struct _GtkItemFactory GtkItemFactory;
|
||||
typedef struct _GtkSelectionData GtkSelectionData;
|
||||
|
||||
#endif
|
||||
typedef GtkWidget *WXWidget;
|
||||
#endif // GTK
|
||||
|
||||
// This is required because of clashing macros in windows.h, which may be
|
||||
// included before or after wxWindows classes, and therefore must be
|
||||
|
@@ -6,14 +6,18 @@
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GDICMNH__
|
||||
#define _WX_GDICMNH__
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "gdicmn.h"
|
||||
#pragma interface "gdicmn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
@@ -23,340 +27,309 @@
|
||||
#include "wx/setup.h"
|
||||
#include "wx/colour.h"
|
||||
|
||||
// Standard cursors
|
||||
typedef enum {
|
||||
wxCURSOR_NONE = 0,
|
||||
wxCURSOR_ARROW = 1,
|
||||
wxCURSOR_BULLSEYE,
|
||||
wxCURSOR_CHAR,
|
||||
wxCURSOR_CROSS,
|
||||
wxCURSOR_HAND,
|
||||
wxCURSOR_IBEAM,
|
||||
wxCURSOR_LEFT_BUTTON,
|
||||
wxCURSOR_MAGNIFIER,
|
||||
wxCURSOR_MIDDLE_BUTTON,
|
||||
wxCURSOR_NO_ENTRY,
|
||||
wxCURSOR_PAINT_BRUSH,
|
||||
wxCURSOR_PENCIL,
|
||||
wxCURSOR_POINT_LEFT,
|
||||
wxCURSOR_POINT_RIGHT,
|
||||
wxCURSOR_QUESTION_ARROW,
|
||||
wxCURSOR_RIGHT_BUTTON,
|
||||
wxCURSOR_SIZENESW,
|
||||
wxCURSOR_SIZENS,
|
||||
wxCURSOR_SIZENWSE,
|
||||
wxCURSOR_SIZEWE,
|
||||
wxCURSOR_SIZING,
|
||||
wxCURSOR_SPRAYCAN,
|
||||
wxCURSOR_WAIT,
|
||||
wxCURSOR_WATCH,
|
||||
wxCURSOR_BLANK
|
||||
#ifdef __X__
|
||||
/* Not yet implemented for Windows */
|
||||
, wxCURSOR_CROSS_REVERSE,
|
||||
wxCURSOR_DOUBLE_ARROW,
|
||||
wxCURSOR_BASED_ARROW_UP,
|
||||
wxCURSOR_BASED_ARROW_DOWN
|
||||
#endif
|
||||
} wxStockCursor;
|
||||
// ---------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
class WXDLLEXPORT wxBrush;
|
||||
class WXDLLEXPORT wxColour;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxFont;
|
||||
class WXDLLEXPORT wxIcon;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
class WXDLLEXPORT wxPen;
|
||||
class WXDLLEXPORT wxRegion;
|
||||
class WXDLLEXPORT wxString;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Bitmap flags
|
||||
enum
|
||||
{
|
||||
wxBITMAP_TYPE_BMP = 1,
|
||||
wxBITMAP_TYPE_BMP_RESOURCE,
|
||||
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
|
||||
wxBITMAP_TYPE_ICO,
|
||||
wxBITMAP_TYPE_ICO_RESOURCE,
|
||||
wxBITMAP_TYPE_CUR,
|
||||
wxBITMAP_TYPE_CUR_RESOURCE,
|
||||
wxBITMAP_TYPE_XBM,
|
||||
wxBITMAP_TYPE_XBM_DATA,
|
||||
wxBITMAP_TYPE_XPM,
|
||||
wxBITMAP_TYPE_XPM_DATA,
|
||||
wxBITMAP_TYPE_TIF,
|
||||
wxBITMAP_TYPE_TIF_RESOURCE,
|
||||
wxBITMAP_TYPE_GIF,
|
||||
wxBITMAP_TYPE_GIF_RESOURCE,
|
||||
wxBITMAP_TYPE_PNG,
|
||||
wxBITMAP_TYPE_PNG_RESOURCE,
|
||||
wxBITMAP_TYPE_JPEG,
|
||||
wxBITMAP_TYPE_JPEG_RESOURCE,
|
||||
wxBITMAP_TYPE_ANY = 50
|
||||
};
|
||||
|
||||
// Standard cursors
|
||||
enum wxStockCursor
|
||||
{
|
||||
wxCURSOR_NONE, // should be 0
|
||||
wxCURSOR_ARROW,
|
||||
wxCURSOR_BULLSEYE,
|
||||
wxCURSOR_CHAR,
|
||||
wxCURSOR_CROSS,
|
||||
wxCURSOR_HAND,
|
||||
wxCURSOR_IBEAM,
|
||||
wxCURSOR_LEFT_BUTTON,
|
||||
wxCURSOR_MAGNIFIER,
|
||||
wxCURSOR_MIDDLE_BUTTON,
|
||||
wxCURSOR_NO_ENTRY,
|
||||
wxCURSOR_PAINT_BRUSH,
|
||||
wxCURSOR_PENCIL,
|
||||
wxCURSOR_POINT_LEFT,
|
||||
wxCURSOR_POINT_RIGHT,
|
||||
wxCURSOR_QUESTION_ARROW,
|
||||
wxCURSOR_RIGHT_BUTTON,
|
||||
wxCURSOR_SIZENESW,
|
||||
wxCURSOR_SIZENS,
|
||||
wxCURSOR_SIZENWSE,
|
||||
wxCURSOR_SIZEWE,
|
||||
wxCURSOR_SIZING,
|
||||
wxCURSOR_SPRAYCAN,
|
||||
wxCURSOR_WAIT,
|
||||
wxCURSOR_WATCH,
|
||||
wxCURSOR_BLANK,
|
||||
#ifdef __X__
|
||||
// Not yet implemented for Windows
|
||||
wxCURSOR_CROSS_REVERSE,
|
||||
wxCURSOR_DOUBLE_ARROW,
|
||||
wxCURSOR_BASED_ARROW_UP,
|
||||
wxCURSOR_BASED_ARROW_DOWN
|
||||
#endif // X11
|
||||
|
||||
wxCURSOR_MAX
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Useful macro for creating icons portably, for example:
|
||||
|
||||
wxIcon *icon = new wxICON(mondrian);
|
||||
|
||||
expands into:
|
||||
|
||||
wxIcon *icon = new wxIcon("mondrian"); // On wxMSW
|
||||
wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK
|
||||
*/
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Load from a resource
|
||||
#define wxICON(X) wxIcon("" #X "")
|
||||
#elif defined(__WXGTK__)
|
||||
// Initialize from an included XPM
|
||||
#define wxICON(X) wxIcon( (const char**) X##_xpm )
|
||||
#elif defined(__WXMOTIF__)
|
||||
// Initialize from an included XPM
|
||||
#define wxICON(X) wxIcon( X##_xpm )
|
||||
#else
|
||||
// This will usually mean something on any platform
|
||||
#define wxICON(X) wxIcon("" #X "")
|
||||
#endif // platform
|
||||
|
||||
// ===========================================================================
|
||||
// classes
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxSize
|
||||
// ---------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxSize
|
||||
{
|
||||
public:
|
||||
long x;
|
||||
long y;
|
||||
inline wxSize() { x = 0; y = 0; }
|
||||
inline wxSize(long xx, long yy) { x = xx; y = yy; }
|
||||
inline wxSize(const wxSize& sz) { x = sz.x; y = sz.y; }
|
||||
inline void operator = (const wxSize& sz) { x = sz.x; y = sz.y; }
|
||||
inline bool operator == (const wxSize& sz) const { return (x == sz.x && y == sz.y); }
|
||||
inline wxSize operator + (const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
|
||||
inline wxSize operator - (const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
|
||||
inline void Set(long xx, long yy) { x = xx; y = yy; }
|
||||
inline long GetX() const { return x; }
|
||||
inline long GetY() const { return y; }
|
||||
// members are public for compatibility
|
||||
long x;
|
||||
long y;
|
||||
|
||||
// constructors
|
||||
wxSize() { x = y = 0; }
|
||||
wxSize(long xx, long yy) { Set(xx, yy); }
|
||||
|
||||
// no copy ctor or assignment operator - the defaults are ok
|
||||
|
||||
bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; }
|
||||
|
||||
// FIXME are these really useful? If they're, we should have += &c as well
|
||||
wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
|
||||
wxSize operator-(const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
|
||||
|
||||
void Set(long xx, long yy) { x = xx; y = yy; }
|
||||
|
||||
long GetX() const { return x; }
|
||||
long GetY() const { return y; }
|
||||
};
|
||||
|
||||
// Point
|
||||
// ---------------------------------------------------------------------------
|
||||
// Point classes: with real or integer coordinates
|
||||
// ---------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxRealPoint
|
||||
{
|
||||
public:
|
||||
double x;
|
||||
double y;
|
||||
inline wxRealPoint() { x = 0.0; y = 0.0; };
|
||||
inline wxRealPoint(double _x, double _y) { x = _x; y = _y; };
|
||||
inline wxRealPoint operator + (const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); }
|
||||
inline wxRealPoint operator - (const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); }
|
||||
public:
|
||||
double x;
|
||||
double y;
|
||||
|
||||
inline void operator = (const wxRealPoint& pt) { x = pt.x; y = pt.y; }
|
||||
inline bool operator == (const wxRealPoint& pt) const { return (x == pt.x && y == pt.y); }
|
||||
wxRealPoint() { x = y = 0.0; };
|
||||
wxRealPoint(double xx, double yy) { x = xx; y = yy; };
|
||||
|
||||
wxRealPoint operator+(const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); }
|
||||
wxRealPoint operator-(const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); }
|
||||
|
||||
bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; }
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPoint
|
||||
{
|
||||
public:
|
||||
public:
|
||||
#if defined(__WXMSW__) && !defined(__WIN32__)
|
||||
int x;
|
||||
int y;
|
||||
int x;
|
||||
int y;
|
||||
#else
|
||||
long x;
|
||||
long y;
|
||||
long x;
|
||||
long y;
|
||||
#endif
|
||||
|
||||
inline wxPoint() { x = 0; y = 0; };
|
||||
wxPoint(long the_x, long the_y) { x = the_x; y = the_y; };
|
||||
wxPoint(const wxPoint& pt) { x = pt.x; y = pt.y; };
|
||||
wxPoint() { x = y = 0; };
|
||||
wxPoint(long xx, long yy) { x = xx; y = yy; };
|
||||
|
||||
inline void operator = (const wxPoint& pt) { x = pt.x; y = pt.y; }
|
||||
inline bool operator == (const wxPoint& pt) const { return (x == pt.x && y == pt.y); }
|
||||
inline wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); }
|
||||
inline wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); }
|
||||
// no copy ctor or assignment operator - the defaults are ok
|
||||
|
||||
bool operator==(const wxPoint& pt) const { return x == pt.x && y == pt.y; }
|
||||
|
||||
wxPoint operator + (const wxPoint& pt) { return wxPoint(x + pt.x, y + pt.y); }
|
||||
wxPoint operator - (const wxPoint& pt) { return wxPoint(x - pt.x, y - pt.y); }
|
||||
};
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
#define wxIntPoint wxPoint
|
||||
#define wxRectangle wxRect
|
||||
#endif
|
||||
#define wxIntPoint wxPoint
|
||||
#define wxRectangle wxRect
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxRect
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRect
|
||||
{
|
||||
public:
|
||||
wxRect() ;
|
||||
wxRect(long x, long y, long w, long h);
|
||||
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRect(const wxPoint& pos, const wxSize& size);
|
||||
wxRect(const wxRect& rect);
|
||||
wxRect();
|
||||
wxRect(long x, long y, long w, long h);
|
||||
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRect(const wxPoint& pos, const wxSize& size);
|
||||
wxRect(const wxRect& rect);
|
||||
|
||||
inline long GetX() const { return x; }
|
||||
inline void SetX(long X) { x = X; }
|
||||
inline long GetY() const { return y; }
|
||||
inline void SetY(long Y) { y = Y; }
|
||||
inline long GetWidth() const { return width; }
|
||||
inline void SetWidth(long w) { width = w; }
|
||||
inline long GetHeight() const { return height; }
|
||||
inline void SetHeight(long h) { height = h; }
|
||||
long GetX() const { return x; }
|
||||
void SetX(long xx) { x = xx; }
|
||||
|
||||
inline wxPoint GetPosition() { return wxPoint(x, y); }
|
||||
inline wxSize GetSize() { return wxSize(width, height); }
|
||||
long GetY() const { return y; }
|
||||
void SetY(long yy) { y = yy; }
|
||||
|
||||
inline long GetLeft() const { return x; }
|
||||
inline long GetTop() const { return y; }
|
||||
inline long GetBottom() const { return y + height; }
|
||||
inline long GetRight() const { return x + width; }
|
||||
long GetWidth() const { return width; }
|
||||
void SetWidth(long w) { width = w; }
|
||||
|
||||
long GetHeight() const { return height; }
|
||||
void SetHeight(long h) { height = h; }
|
||||
|
||||
wxPoint GetPosition() { return wxPoint(x, y); }
|
||||
wxSize GetSize() { return wxSize(width, height); }
|
||||
|
||||
long GetLeft() const { return x; }
|
||||
long GetTop() const { return y; }
|
||||
long GetBottom() const { return y + height; }
|
||||
long GetRight() const { return x + width; }
|
||||
|
||||
wxRect& operator = (const wxRect& rect);
|
||||
bool operator == (const wxRect& rect);
|
||||
bool operator != (const wxRect& rect);
|
||||
|
||||
wxRect& operator = (const wxRect& rect);
|
||||
bool operator == (const wxRect& rect);
|
||||
bool operator != (const wxRect& rect);
|
||||
public:
|
||||
long x, y, width, height;
|
||||
long x, y, width, height;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBrush;
|
||||
class WXDLLEXPORT wxPen;
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
class WXDLLEXPORT wxIcon;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxFont;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
class WXDLLEXPORT wxRegion;
|
||||
|
||||
/*
|
||||
* Bitmap flags
|
||||
*/
|
||||
|
||||
// Hint to indicate filetype
|
||||
#define wxBITMAP_TYPE_BMP 1
|
||||
#define wxBITMAP_TYPE_BMP_RESOURCE 2
|
||||
#define wxBITMAP_TYPE_ICO 3
|
||||
#define wxBITMAP_TYPE_ICO_RESOURCE 4
|
||||
#define wxBITMAP_TYPE_CUR 5
|
||||
#define wxBITMAP_TYPE_CUR_RESOURCE 6
|
||||
#define wxBITMAP_TYPE_XBM 7
|
||||
#define wxBITMAP_TYPE_XBM_DATA 8
|
||||
#define wxBITMAP_TYPE_XPM 9
|
||||
#define wxBITMAP_TYPE_XPM_DATA 10
|
||||
#define wxBITMAP_TYPE_TIF 11
|
||||
#define wxBITMAP_TYPE_TIF_RESOURCE 12
|
||||
#define wxBITMAP_TYPE_GIF 13
|
||||
#define wxBITMAP_TYPE_GIF_RESOURCE 14
|
||||
#define wxBITMAP_TYPE_PNG 15
|
||||
#define wxBITMAP_TYPE_PNG_RESOURCE 16
|
||||
#define wxBITMAP_TYPE_JPEG 17
|
||||
#define wxBITMAP_TYPE_JPEG_RESOURCE 18
|
||||
#define wxBITMAP_TYPE_ANY 50
|
||||
|
||||
#define wxBITMAP_TYPE_RESOURCE wxBITMAP_TYPE_BMP_RESOURCE
|
||||
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxIcon;
|
||||
class WXDLLEXPORT wxColour;
|
||||
class WXDLLEXPORT wxString;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Management of pens, brushes and fonts
|
||||
class WXDLLEXPORT wxPenList: public wxList
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPenList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPenList)
|
||||
public:
|
||||
inline wxPenList()
|
||||
{ }
|
||||
~wxPenList();
|
||||
void AddPen(wxPen *pen);
|
||||
void RemovePen(wxPen *pen);
|
||||
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
|
||||
DECLARE_DYNAMIC_CLASS(wxPenList)
|
||||
|
||||
public:
|
||||
wxPenList() { }
|
||||
~wxPenList();
|
||||
|
||||
void AddPen(wxPen *pen);
|
||||
void RemovePen(wxPen *pen);
|
||||
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBrushList: public wxList
|
||||
class WXDLLEXPORT wxBrushList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBrushList)
|
||||
public:
|
||||
inline wxBrushList()
|
||||
{ }
|
||||
~wxBrushList();
|
||||
void AddBrush(wxBrush *brush);
|
||||
void RemoveBrush(wxBrush *brush);
|
||||
wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
|
||||
DECLARE_DYNAMIC_CLASS(wxBrushList)
|
||||
|
||||
public:
|
||||
wxBrushList() { }
|
||||
~wxBrushList();
|
||||
|
||||
void AddBrush(wxBrush *brush);
|
||||
void RemoveBrush(wxBrush *brush);
|
||||
wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
class WXDLLEXPORT wxFontList: public wxList
|
||||
class WXDLLEXPORT wxFontList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFontList)
|
||||
public:
|
||||
inline wxFontList()
|
||||
{ }
|
||||
~wxFontList();
|
||||
void AddFont(wxFont *font);
|
||||
void RemoveFont(wxFont *font);
|
||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||
bool underline = FALSE, const wxString& face = wxEmptyString);
|
||||
DECLARE_DYNAMIC_CLASS(wxFontList)
|
||||
|
||||
public:
|
||||
wxFontList() { }
|
||||
~wxFontList();
|
||||
|
||||
void AddFont(wxFont *font);
|
||||
void RemoveFont(wxFont *font);
|
||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||
bool underline = FALSE,
|
||||
const wxString& face = wxEmptyString);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxColourDatabase: public wxList
|
||||
class WXDLLEXPORT wxColourDatabase : public wxList
|
||||
{
|
||||
DECLARE_CLASS(wxColourDatabase)
|
||||
public:
|
||||
wxColourDatabase(int type);
|
||||
~wxColourDatabase() ;
|
||||
// Not const because it may add a name to the database
|
||||
wxColour *FindColour(const wxString& colour) ;
|
||||
wxString FindName(const wxColour& colour) const;
|
||||
void Initialize();
|
||||
DECLARE_CLASS(wxColourDatabase)
|
||||
|
||||
public:
|
||||
wxColourDatabase(int type);
|
||||
~wxColourDatabase() ;
|
||||
|
||||
// Not const because it may add a name to the database
|
||||
wxColour *FindColour(const wxString& colour) ;
|
||||
wxString FindName(const wxColour& colour) const;
|
||||
void Initialize();
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmapList: public wxList
|
||||
class WXDLLEXPORT wxBitmapList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapList)
|
||||
public:
|
||||
wxBitmapList();
|
||||
~wxBitmapList();
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapList)
|
||||
|
||||
void AddBitmap(wxBitmap *bitmap);
|
||||
void RemoveBitmap(wxBitmap *bitmap);
|
||||
public:
|
||||
wxBitmapList();
|
||||
~wxBitmapList();
|
||||
|
||||
void AddBitmap(wxBitmap *bitmap);
|
||||
void RemoveBitmap(wxBitmap *bitmap);
|
||||
};
|
||||
|
||||
// Lists of GDI objects
|
||||
WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList;
|
||||
WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList;
|
||||
WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList;
|
||||
WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList;
|
||||
|
||||
// Stock objects
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxBLACK;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxWHITE;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxRED;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxBLUE;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxGREEN;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxCYAN;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY;
|
||||
|
||||
// 'Null' objects
|
||||
WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap;
|
||||
WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon;
|
||||
WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor;
|
||||
WXDLLEXPORT_DATA(extern wxPen) wxNullPen;
|
||||
WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush;
|
||||
WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette;
|
||||
WXDLLEXPORT_DATA(extern wxFont) wxNullFont;
|
||||
WXDLLEXPORT_DATA(extern wxColour) wxNullColour;
|
||||
|
||||
// Stock cursors types
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR;
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR;
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
|
||||
extern void WXDLLEXPORT wxInitializeStockObjects();
|
||||
extern void WXDLLEXPORT wxInitializeStockLists();
|
||||
extern void WXDLLEXPORT wxDeleteStockObjects();
|
||||
extern void WXDLLEXPORT wxDeleteStockLists();
|
||||
|
||||
extern bool WXDLLEXPORT wxColourDisplay();
|
||||
|
||||
// Returns depth of screen
|
||||
extern int WXDLLEXPORT wxDisplayDepth();
|
||||
#define wxGetDisplayDepth wxDisplayDepth
|
||||
|
||||
extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
|
||||
extern wxSize WXDLLEXPORT wxGetDisplaySize();
|
||||
|
||||
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
||||
|
||||
// Useful macro for creating icons portably
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Load from a resource
|
||||
# define wxICON(X) wxIcon("" #X "")
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
// Initialize from an included XPM
|
||||
# define wxICON(X) wxIcon( (const char**) X##_xpm )
|
||||
#elif defined(__WXMOTIF__)
|
||||
// Initialize from an included XPM
|
||||
# define wxICON(X) wxIcon( X##_xpm )
|
||||
#else
|
||||
|
||||
// This will usually mean something on any platform
|
||||
# define wxICON(X) wxIcon("" #X "")
|
||||
#endif
|
||||
|
||||
/*
|
||||
Example:
|
||||
wxIcon *icon = new wxICON(mondrian);
|
||||
expands into:
|
||||
wxIcon *icon = new wxIcon("mondrian"); // On wxMSW
|
||||
wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxResourceCache: public wxList
|
||||
{
|
||||
public:
|
||||
@@ -368,5 +341,100 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Lists of GDI objects
|
||||
WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList;
|
||||
WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList;
|
||||
WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList;
|
||||
WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList;
|
||||
|
||||
// Stock objects
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxBLACK;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxWHITE;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxRED;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxBLUE;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxGREEN;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxCYAN;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY;
|
||||
|
||||
// 'Null' objects
|
||||
WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap;
|
||||
WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon;
|
||||
WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor;
|
||||
WXDLLEXPORT_DATA(extern wxPen) wxNullPen;
|
||||
WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush;
|
||||
WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette;
|
||||
WXDLLEXPORT_DATA(extern wxFont) wxNullFont;
|
||||
WXDLLEXPORT_DATA(extern wxColour) wxNullColour;
|
||||
|
||||
// Stock cursors types
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR;
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR;
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
|
||||
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
|
||||
|
||||
// The list of objects which should be deleted
|
||||
WXDLLEXPORT_DATA(extern wxList) wxPendingDelete;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// resource management
|
||||
extern void WXDLLEXPORT wxInitializeStockObjects();
|
||||
extern void WXDLLEXPORT wxInitializeStockLists();
|
||||
extern void WXDLLEXPORT wxDeleteStockObjects();
|
||||
extern void WXDLLEXPORT wxDeleteStockLists();
|
||||
|
||||
// is the display colour (or monochrome)?
|
||||
extern bool WXDLLEXPORT wxColourDisplay();
|
||||
|
||||
// Returns depth of screen
|
||||
extern int WXDLLEXPORT wxDisplayDepth();
|
||||
#define wxGetDisplayDepth wxDisplayDepth
|
||||
|
||||
// get the diaplay size
|
||||
extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
|
||||
extern wxSize WXDLLEXPORT wxGetDisplaySize();
|
||||
|
||||
// set global cursor
|
||||
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
||||
|
||||
#endif
|
||||
// _WX_GDICMNH__
|
||||
|
@@ -611,9 +611,9 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
|
||||
// We have to hand down a few functions
|
||||
|
||||
void SetBackgroundColour( const wxColour &colour );
|
||||
void SetForegroundColour( const wxColour &colour );
|
||||
void SetFont( const wxFont &font );
|
||||
bool SetBackgroundColour( const wxColour &colour );
|
||||
bool SetForegroundColour( const wxColour &colour );
|
||||
bool SetFont( const wxFont &font );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
void SetDropTarget( wxDropTarget *dropTarget )
|
||||
@@ -622,14 +622,12 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
{ return m_mainWin->GetDropTarget(); }
|
||||
#endif
|
||||
|
||||
void SetCursor( const wxCursor &cursor )
|
||||
{ if (m_mainWin) m_mainWin->wxWindow::SetCursor( cursor); }
|
||||
bool SetCursor( const wxCursor &cursor )
|
||||
{ return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE; }
|
||||
wxColour GetBackgroundColour() const
|
||||
{ if (m_mainWin) return m_mainWin->GetBackgroundColour();
|
||||
else return wxColour(); }
|
||||
{ return m_mainWin ? m_mainWin->GetBackgroundColour() : wxColour(); }
|
||||
wxColour GetForegroundColour() const
|
||||
{ if (m_mainWin) return m_mainWin->GetForegroundColour();
|
||||
else return wxColour(); }
|
||||
{ return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour(); }
|
||||
bool PopupMenu( wxMenu *menu, int x, int y )
|
||||
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
||||
void SetFocus()
|
||||
|
@@ -120,7 +120,7 @@ public:
|
||||
wxString GetTabText(int id) const;
|
||||
|
||||
// Layout tabs (optional, e.g. if resizing window)
|
||||
void Layout(void);
|
||||
void LayoutTabs();
|
||||
|
||||
// Draw all tabs
|
||||
virtual void Draw(wxDC& dc);
|
||||
|
@@ -72,7 +72,7 @@ public:
|
||||
void SetBitmapLabel( const wxBitmap& bitmap );
|
||||
void SetBitmapSelected( const wxBitmap& bitmap );
|
||||
|
||||
virtual void Enable(const bool);
|
||||
virtual bool Enable(const bool);
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class wxButton: public wxControl
|
||||
const wxString& name = wxButtonNameStr);
|
||||
void SetDefault();
|
||||
void SetLabel( const wxString &label );
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
bool GetValue() const;
|
||||
|
||||
void SetLabel( const wxString& label );
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
void ApplyWidgetStyle();
|
||||
|
@@ -87,6 +87,9 @@ public:
|
||||
virtual void Maximize() { }
|
||||
virtual void Restore() { }
|
||||
|
||||
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||
int GetReturnCode() const { return m_returnCode; }
|
||||
|
||||
// implementation
|
||||
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
@@ -105,6 +108,8 @@ protected:
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
private:
|
||||
int m_returnCode;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -58,8 +58,8 @@ public:
|
||||
wxFont( const wxFont& font );
|
||||
~wxFont();
|
||||
wxFont& operator = ( const wxFont& font );
|
||||
bool operator == ( const wxFont& font );
|
||||
bool operator != ( const wxFont& font );
|
||||
bool operator == ( const wxFont& font ) const;
|
||||
bool operator != ( const wxFont& font ) const;
|
||||
bool Ok() const;
|
||||
|
||||
int GetPointSize() const;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class wxRadioBox: public wxControl
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
int majorDim = 1, long style = wxRA_HORIZONTAL,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr )
|
||||
const wxString& name = wxRadioBoxNameStr )
|
||||
{
|
||||
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class wxRadioBox: public wxControl
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr );
|
||||
const wxString& name = wxRadioBoxNameStr );
|
||||
int FindString( const wxString& s) const;
|
||||
void SetSelection( int n );
|
||||
int GetSelection(void) const;
|
||||
@@ -70,7 +70,7 @@ class wxRadioBox: public wxControl
|
||||
void SetLabel( int item, wxBitmap *bitmap );
|
||||
wxString GetLabel( int item ) const;
|
||||
bool Show( bool show );
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
void Enable( int item, bool enable );
|
||||
void Show( int item, bool show );
|
||||
virtual wxString GetStringSelection(void) const;
|
||||
|
@@ -60,7 +60,7 @@ class wxRadioButton: public wxControl
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue(void) const;
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -143,9 +143,9 @@ class wxTextCtrl: public wxControl
|
||||
wxTextCtrl& operator<<(const char c);
|
||||
#endif
|
||||
|
||||
void SetFont( const wxFont &font );
|
||||
void SetForegroundColour(const wxColour &colour);
|
||||
void SetBackgroundColour(const wxColour &colour);
|
||||
bool SetFont( const wxFont &font );
|
||||
bool SetForegroundColour(const wxColour &colour);
|
||||
bool SetBackgroundColour(const wxColour &colour);
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -15,94 +15,17 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/validate.h"
|
||||
#include "wx/cursor.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/region.h"
|
||||
#include "wx/accel.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern const wxChar *wxFrameNameStr;
|
||||
extern wxWindowList wxTopLevelWindows;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global function
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern wxWindow* wxGetActiveWindow();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxLayoutConstraints;
|
||||
class wxSizer;
|
||||
class wxDC;
|
||||
class wxClientData;
|
||||
class wxVoidClientData;
|
||||
class wxWindow;
|
||||
#if wxUSE_WX_RESOURCES
|
||||
class wxResourceTable;
|
||||
class wxItemResource;
|
||||
#endif
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
class wxDropTarget;
|
||||
#endif
|
||||
class wxToolTip;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern const wxChar *wxPanelNameStr;
|
||||
extern const wxSize wxDefaultSize;
|
||||
extern const wxPoint wxDefaultPosition;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxClientData
|
||||
{
|
||||
public:
|
||||
wxClientData() { }
|
||||
virtual ~wxClientData() { }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxStringClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxStringClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
wxStringClientData() { }
|
||||
wxStringClientData( wxString &data ) { m_data = data; }
|
||||
void SetData( wxString &data ) { m_data = data; }
|
||||
wxString GetData() const { return m_data; }
|
||||
|
||||
private:
|
||||
wxString m_data;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxWindow : public wxEvtHandler
|
||||
class wxWindow : public wxWindowBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxWindow)
|
||||
|
||||
@@ -110,300 +33,111 @@ public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindow();
|
||||
wxWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
wxWindow(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindow();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
virtual bool LoadFromResource(wxWindow *parent,
|
||||
const wxString& resourceName,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
virtual wxControl *CreateItem(const wxItemResource* childResource,
|
||||
const wxItemResource* parentResource,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
#endif // wxUSE_WX_RESOURCES
|
||||
|
||||
// closing the window
|
||||
// ------------------
|
||||
bool Close( bool force = FALSE );
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
virtual bool Destroy();
|
||||
virtual bool DestroyChildren();
|
||||
|
||||
bool IsBeingDeleted();
|
||||
|
||||
// moving/resizing
|
||||
// ---------------
|
||||
|
||||
// set the window size and/or position
|
||||
void SetSize( int x, int y, int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO )
|
||||
{ DoSetSize(x, y, width, height, sizeFlags); }
|
||||
|
||||
void SetSize( int width, int height )
|
||||
{ DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); }
|
||||
|
||||
void SetSize( const wxSize& size )
|
||||
{ SetSize( size.x, size.y); }
|
||||
|
||||
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
|
||||
{ DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
|
||||
|
||||
void Move( int x, int y )
|
||||
{ DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); }
|
||||
|
||||
void Move(const wxPoint& pt)
|
||||
{ Move(pt.x, pt.y); }
|
||||
|
||||
// client size is the size of area available for subwindows
|
||||
void SetClientSize( int width, int height )
|
||||
{ DoSetClientSize(width, height); }
|
||||
|
||||
void SetClientSize( const wxSize& size )
|
||||
{ DoSetClientSize(size.x, size.y); }
|
||||
|
||||
void SetClientSize(const wxRect& rect)
|
||||
{ SetClientSize( rect.width, rect.height ); }
|
||||
|
||||
// get the window position and/or size
|
||||
virtual void GetPosition( int *x, int *y ) const;
|
||||
wxPoint GetPosition() const
|
||||
{
|
||||
int w, h;
|
||||
GetPosition(& w, & h);
|
||||
|
||||
return wxPoint(w, h);
|
||||
}
|
||||
|
||||
virtual void GetSize( int *width, int *height ) const;
|
||||
|
||||
wxSize GetSize() const
|
||||
{
|
||||
int w, h;
|
||||
GetSize(& w, & h);
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
wxRect GetRect() const
|
||||
{
|
||||
int x, y, w, h;
|
||||
GetPosition(& x, & y);
|
||||
GetSize(& w, & h);
|
||||
|
||||
return wxRect(x, y, w, h);
|
||||
}
|
||||
|
||||
virtual void GetClientSize( int *width, int *height ) const;
|
||||
wxSize GetClientSize() const
|
||||
{
|
||||
int w, h;
|
||||
GetClientSize(& w, & h);
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// position with respect to the the parent window
|
||||
virtual void Centre( int direction = wxHORIZONTAL );
|
||||
void Center(int direction = wxHORIZONTAL) { Centre(direction); }
|
||||
virtual void Fit();
|
||||
|
||||
// set min/max size of the window
|
||||
virtual void SetSizeHints( int minW, int minH,
|
||||
int maxW = -1, int maxH = -1,
|
||||
int incW = -1, int incH = -1 );
|
||||
|
||||
// Dialog units translations. Implemented in wincmn.cpp.
|
||||
// -----------------------------------------------------
|
||||
|
||||
wxPoint ConvertPixelsToDialog( const wxPoint& pt );
|
||||
wxPoint ConvertDialogToPixels( const wxPoint& pt );
|
||||
wxSize ConvertPixelsToDialog( const wxSize& sz )
|
||||
{
|
||||
wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y)));
|
||||
|
||||
return wxSize(pt.x, pt.y);
|
||||
}
|
||||
|
||||
wxSize ConvertDialogToPixels( const wxSize& sz )
|
||||
{
|
||||
wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y)));
|
||||
|
||||
return wxSize(pt.x, pt.y);
|
||||
}
|
||||
|
||||
void OnSize( wxSizeEvent &event );
|
||||
|
||||
// window state
|
||||
// ------------
|
||||
|
||||
virtual bool Show( bool show );
|
||||
virtual void Enable( bool enable );
|
||||
virtual void MakeModal( bool modal );
|
||||
virtual bool IsEnabled() const { return m_isEnabled; }
|
||||
inline bool Enabled() const { return IsEnabled(); }
|
||||
|
||||
virtual void SetFocus();
|
||||
static wxWindow *FindFocus();
|
||||
|
||||
void SetReturnCode( int retCode );
|
||||
int GetReturnCode();
|
||||
|
||||
// parent/children relations
|
||||
// -------------------------
|
||||
|
||||
virtual void AddChild( wxWindow *child );
|
||||
wxList& GetChildren() { return m_children; }
|
||||
|
||||
virtual void RemoveChild( wxWindow *child );
|
||||
|
||||
wxWindow *GetParent() const
|
||||
{ return m_parent; }
|
||||
wxWindow *GetGrandParent() const
|
||||
{ return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
|
||||
void SetParent( wxWindow *parent )
|
||||
{ m_parent = parent; }
|
||||
virtual wxWindow *ReParent( wxWindow *newParent );
|
||||
|
||||
// event handler stuff
|
||||
// -------------------
|
||||
|
||||
wxEvtHandler *GetEventHandler() const;
|
||||
void SetEventHandler( wxEvtHandler *handler );
|
||||
void PushEventHandler( wxEvtHandler *handler );
|
||||
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
|
||||
|
||||
// validators and client data
|
||||
// --------------------------
|
||||
|
||||
virtual void SetValidator( const wxValidator &validator );
|
||||
virtual wxValidator *GetValidator();
|
||||
|
||||
virtual void SetClientObject( wxClientData *data );
|
||||
virtual wxClientData *GetClientObject();
|
||||
|
||||
virtual void SetClientData( void *data );
|
||||
virtual void *GetClientData();
|
||||
|
||||
// accelerators
|
||||
// ------------
|
||||
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
|
||||
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
|
||||
|
||||
void SetId( wxWindowID id );
|
||||
wxWindowID GetId() const;
|
||||
|
||||
void SetCursor( const wxCursor &cursor );
|
||||
|
||||
virtual void PrepareDC( wxDC &dc );
|
||||
|
||||
void WarpPointer(int x, int y);
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
void SetToolTip( const wxString &tip );
|
||||
virtual void SetToolTip( wxToolTip *tip );
|
||||
wxToolTip* GetToolTip() const { return m_toolTip; }
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Clear();
|
||||
|
||||
virtual wxRegion GetUpdateRegion() const;
|
||||
virtual bool IsExposed( int x, int y ) 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;
|
||||
|
||||
// colours
|
||||
// -------
|
||||
|
||||
virtual wxColour GetBackgroundColour() const;
|
||||
virtual void SetBackgroundColour( const wxColour &colour );
|
||||
virtual wxColour GetForegroundColour() const;
|
||||
virtual void SetForegroundColour( const wxColour &colour );
|
||||
|
||||
// fonts
|
||||
// -----
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent( const wxString& string, int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const;
|
||||
|
||||
virtual void SetFont( const wxFont &font );
|
||||
virtual wxFont& GetFont() { return m_font; }
|
||||
|
||||
// For backward compatibility
|
||||
virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||
virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
|
||||
virtual wxFont& GetLabelFont() { return GetFont(); };
|
||||
virtual wxFont& GetButtonFont() { return GetFont(); };
|
||||
|
||||
virtual void SetWindowStyleFlag( long flag );
|
||||
virtual long GetWindowStyleFlag() const;
|
||||
|
||||
virtual void CaptureMouse();
|
||||
virtual void ReleaseMouse();
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle() const;
|
||||
virtual void SetName( const wxString &name );
|
||||
virtual wxString GetName() const;
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { }
|
||||
void OnKeyDown( wxKeyEvent &event );
|
||||
|
||||
virtual bool IsShown() const;
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool IsRetained();
|
||||
virtual wxWindow *FindWindow( long id );
|
||||
virtual wxWindow *FindWindow( const wxString& name );
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
void AllowDoubleClick( bool WXUNUSED(allow) ) { }
|
||||
void SetDoubleClick( bool WXUNUSED(allow) ) { }
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void ClientToScreen( int *x, int *y );
|
||||
virtual void ScreenToClient( int *x, int *y );
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Validate();
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
void OnInitDialog( wxInitDialogEvent &event );
|
||||
virtual void InitDialog();
|
||||
virtual bool Reparent( wxWindow *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
virtual void CaptureMouse();
|
||||
virtual void ReleaseMouse();
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Clear();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
virtual void ClientToScreen( int *x, int *y ) const;
|
||||
virtual void ScreenToClient( int *x, int *y ) const;
|
||||
|
||||
virtual bool PopupMenu( wxMenu *menu, int x, int y );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
virtual wxDropTarget *GetDropTarget() const;
|
||||
#endif
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL );
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
void UpdateWindowUI();
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
bool HasVMT();
|
||||
// wxWindows callbacks
|
||||
void OnKeyDown( wxKeyEvent &event );
|
||||
|
||||
// simple accessors
|
||||
bool HasVMT() const { return m_hasVMT; }
|
||||
|
||||
int GetX() const { return m_x; }
|
||||
int GetY() const { return m_y; }
|
||||
int GetWidth() const { return m_width; }
|
||||
int GetHeight() const { return m_height; }
|
||||
|
||||
GtkWidget *GetWxWindow() const { return m_wxwindow; }
|
||||
GtkWidget *GetWidget() const { return GetHandle(); }
|
||||
|
||||
GtkAdjustment *GetHAdjust() const { return m_hAdjust; }
|
||||
GtkAdjustment *GetVAdjust() const { return m_vAdjust; }
|
||||
|
||||
float GetOldHorizontalPos() const { return m_oldHorizontalPos; }
|
||||
float GetOldVerticalPos() const { return m_oldVerticalPos; }
|
||||
|
||||
void SetOldHorizontalPos(float fpos) { m_oldHorizontalPos = fpos; }
|
||||
void SetOldVerticalPos(float fpos) { m_oldVerticalPos = fpos; }
|
||||
|
||||
bool IsSizeSet() const { return m_sizeSet; }
|
||||
|
||||
// also sets the global flag
|
||||
void SetScrolling(bool scroll);
|
||||
|
||||
bool HasScrolling() const { return m_hasScrolling; }
|
||||
bool IsScrolling() const { return m_isScrolling; }
|
||||
bool IsStaticBox() const { return m_isStaticBox; }
|
||||
|
||||
/* I don't want users to override what's done in idle so everything that
|
||||
has to be done in idle time in order for wxGTK to work is done in
|
||||
@@ -418,6 +152,9 @@ public:
|
||||
const wxSize &size, long style, const wxString &name );
|
||||
void PostCreation();
|
||||
|
||||
void InsertChild(wxWindow *child) { (*m_insertCallback)(this, child); }
|
||||
void DoAddChild(wxWindow *child) { AddChild(child); InsertChild(child); }
|
||||
|
||||
/* the methods below are required because many native widgets
|
||||
are composed of several subwidgets and setting a style for
|
||||
the widget means setting it for all subwidgets as well.
|
||||
@@ -437,107 +174,57 @@ public:
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
/* private member variables */
|
||||
// called from GTK signales handlers
|
||||
void UpdateSize() { m_sizeSet = FALSE; }
|
||||
void InternalSetPosition(int x, int y) { m_x = x; m_y = y; }
|
||||
void InternalSetSize(int w, int h)
|
||||
{ m_width = w; m_height = h; UpdateSize(); }
|
||||
|
||||
wxWindow *m_parent;
|
||||
wxList m_children;
|
||||
int m_x,m_y;
|
||||
int m_width,m_height;
|
||||
int m_minWidth,m_minHeight;
|
||||
int m_maxWidth,m_maxHeight;
|
||||
int m_retCode;
|
||||
wxEvtHandler *m_eventHandler;
|
||||
wxValidator *m_windowValidator;
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
wxDropTarget *m_dropTarget;
|
||||
#endif
|
||||
wxWindowID m_windowId;
|
||||
wxCursor m_cursor;
|
||||
wxFont m_font;
|
||||
wxColour m_backgroundColour;
|
||||
wxColour m_foregroundColour;
|
||||
wxRegion m_updateRegion;
|
||||
long m_windowStyle;
|
||||
bool m_isShown;
|
||||
bool m_isEnabled;
|
||||
wxString m_windowName;
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
protected:
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
wxToolTip *m_toolTip;
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
GtkWidget *m_widget;
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_wxwindow;
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
bool m_needParent; /* ! wxFrame, wxDialog, wxNotebookPage ? */
|
||||
bool m_hasScrolling;
|
||||
bool m_isScrolling;
|
||||
bool m_hasVMT;
|
||||
bool m_sizeSet;
|
||||
bool m_resizing;
|
||||
float m_oldHorizontalPos,
|
||||
m_oldVerticalPos;
|
||||
GdkGC *m_scrollGC;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; /* ! wxFrame, wxDialog, wxNotebookPage ? */
|
||||
bool m_hasScrolling:1;
|
||||
bool m_isScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_isStaticBox:1; /* faster than IS_KIND_OF */
|
||||
bool m_isFrame:1; /* faster than IS_KIND_OF */
|
||||
bool m_acceptsFocus:1; /* ! wxStaticBox etc. */
|
||||
|
||||
GtkStyle *m_widgetStyle;
|
||||
bool m_isStaticBox; /* faster than IS_KIND_OF */
|
||||
bool m_isFrame; /* faster than IS_KIND_OF */
|
||||
bool m_acceptsFocus; /* ! wxStaticBox etc. */
|
||||
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
public:
|
||||
|
||||
wxLayoutConstraints *m_constraints;
|
||||
wxList *m_constraintsInvolvedIn;
|
||||
wxSizer *m_windowSizer;
|
||||
wxWindow *m_sizerParent;
|
||||
bool m_autoLayout;
|
||||
|
||||
wxLayoutConstraints *GetConstraints() const;
|
||||
void SetConstraints( wxLayoutConstraints *constraints );
|
||||
void SetAutoLayout( bool autoLayout );
|
||||
bool GetAutoLayout() const;
|
||||
bool Layout();
|
||||
void SetSizer( wxSizer *sizer );
|
||||
wxSizer *GetSizer() const;
|
||||
void SetSizerParent( wxWindow *win );
|
||||
wxWindow *GetSizerParent() const;
|
||||
void UnsetConstraints(wxLayoutConstraints *c);
|
||||
inline wxList *GetConstraintsInvolvedIn() const ;
|
||||
void AddConstraintReference(wxWindow *otherWin);
|
||||
void RemoveConstraintReference(wxWindow *otherWin);
|
||||
void DeleteRelatedConstraints();
|
||||
virtual void ResetConstraints();
|
||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||
virtual bool LayoutPhase1(int *noChanges);
|
||||
virtual bool LayoutPhase2(int *noChanges);
|
||||
virtual bool DoPhase(int);
|
||||
virtual void TransformSizerToActual(int *x, int *y) const ;
|
||||
virtual void SizerSetSize(int x, int y, int w, int h);
|
||||
virtual void SizerMove(int x, int y);
|
||||
virtual void SetSizeConstraint(int x, int y, int w, int h);
|
||||
virtual void MoveConstraint(int x, int y);
|
||||
virtual void GetSizeConstraint(int *w, int *h) const ;
|
||||
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
||||
virtual void GetPositionConstraint(int *x, int *y) const ;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// this is the virtual function to be overriden in any derived class which
|
||||
// wants to change how SetSize() or Move() works - it is called by all
|
||||
// versions of these functions in the base class
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// same as DoSetSize() for the client size
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// common part of all ctors (can't be virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@@ -72,7 +72,7 @@ public:
|
||||
void SetBitmapLabel( const wxBitmap& bitmap );
|
||||
void SetBitmapSelected( const wxBitmap& bitmap );
|
||||
|
||||
virtual void Enable(const bool);
|
||||
virtual bool Enable(const bool);
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class wxButton: public wxControl
|
||||
const wxString& name = wxButtonNameStr);
|
||||
void SetDefault();
|
||||
void SetLabel( const wxString &label );
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
bool GetValue() const;
|
||||
|
||||
void SetLabel( const wxString& label );
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
void ApplyWidgetStyle();
|
||||
|
@@ -87,6 +87,9 @@ public:
|
||||
virtual void Maximize() { }
|
||||
virtual void Restore() { }
|
||||
|
||||
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||
int GetReturnCode() const { return m_returnCode; }
|
||||
|
||||
// implementation
|
||||
|
||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||
@@ -105,6 +108,8 @@ protected:
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
private:
|
||||
int m_returnCode;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -58,8 +58,8 @@ public:
|
||||
wxFont( const wxFont& font );
|
||||
~wxFont();
|
||||
wxFont& operator = ( const wxFont& font );
|
||||
bool operator == ( const wxFont& font );
|
||||
bool operator != ( const wxFont& font );
|
||||
bool operator == ( const wxFont& font ) const;
|
||||
bool operator != ( const wxFont& font ) const;
|
||||
bool Ok() const;
|
||||
|
||||
int GetPointSize() const;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class wxRadioBox: public wxControl
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
int majorDim = 1, long style = wxRA_HORIZONTAL,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr )
|
||||
const wxString& name = wxRadioBoxNameStr )
|
||||
{
|
||||
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class wxRadioBox: public wxControl
|
||||
int n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||
const wxValidator& val = wxDefaultValidator,
|
||||
const wxString& name = wxRadioBoxNameStr );
|
||||
const wxString& name = wxRadioBoxNameStr );
|
||||
int FindString( const wxString& s) const;
|
||||
void SetSelection( int n );
|
||||
int GetSelection(void) const;
|
||||
@@ -70,7 +70,7 @@ class wxRadioBox: public wxControl
|
||||
void SetLabel( int item, wxBitmap *bitmap );
|
||||
wxString GetLabel( int item ) const;
|
||||
bool Show( bool show );
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
void Enable( int item, bool enable );
|
||||
void Show( int item, bool show );
|
||||
virtual wxString GetStringSelection(void) const;
|
||||
|
@@ -60,7 +60,7 @@ class wxRadioButton: public wxControl
|
||||
virtual void SetLabel(const wxString& label);
|
||||
virtual void SetValue(bool val);
|
||||
virtual bool GetValue(void) const;
|
||||
void Enable( bool enable );
|
||||
bool Enable( bool enable );
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -143,9 +143,9 @@ class wxTextCtrl: public wxControl
|
||||
wxTextCtrl& operator<<(const char c);
|
||||
#endif
|
||||
|
||||
void SetFont( const wxFont &font );
|
||||
void SetForegroundColour(const wxColour &colour);
|
||||
void SetBackgroundColour(const wxColour &colour);
|
||||
bool SetFont( const wxFont &font );
|
||||
bool SetForegroundColour(const wxColour &colour);
|
||||
bool SetBackgroundColour(const wxColour &colour);
|
||||
|
||||
// implementation
|
||||
|
||||
|
@@ -15,94 +15,17 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/validate.h"
|
||||
#include "wx/cursor.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/region.h"
|
||||
#include "wx/accel.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern const wxChar *wxFrameNameStr;
|
||||
extern wxWindowList wxTopLevelWindows;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global function
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern wxWindow* wxGetActiveWindow();
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxLayoutConstraints;
|
||||
class wxSizer;
|
||||
class wxDC;
|
||||
class wxClientData;
|
||||
class wxVoidClientData;
|
||||
class wxWindow;
|
||||
#if wxUSE_WX_RESOURCES
|
||||
class wxResourceTable;
|
||||
class wxItemResource;
|
||||
#endif
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
class wxDropTarget;
|
||||
#endif
|
||||
class wxToolTip;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern const wxChar *wxPanelNameStr;
|
||||
extern const wxSize wxDefaultSize;
|
||||
extern const wxPoint wxDefaultPosition;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxClientData
|
||||
{
|
||||
public:
|
||||
wxClientData() { }
|
||||
virtual ~wxClientData() { }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxStringClientData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxStringClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
wxStringClientData() { }
|
||||
wxStringClientData( wxString &data ) { m_data = data; }
|
||||
void SetData( wxString &data ) { m_data = data; }
|
||||
wxString GetData() const { return m_data; }
|
||||
|
||||
private:
|
||||
wxString m_data;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxWindow : public wxEvtHandler
|
||||
class wxWindow : public wxWindowBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxWindow)
|
||||
|
||||
@@ -110,300 +33,111 @@ public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindow();
|
||||
wxWindow(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
wxWindow(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindow();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
virtual bool LoadFromResource(wxWindow *parent,
|
||||
const wxString& resourceName,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
virtual wxControl *CreateItem(const wxItemResource* childResource,
|
||||
const wxItemResource* parentResource,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
#endif // wxUSE_WX_RESOURCES
|
||||
|
||||
// closing the window
|
||||
// ------------------
|
||||
bool Close( bool force = FALSE );
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
virtual bool Destroy();
|
||||
virtual bool DestroyChildren();
|
||||
|
||||
bool IsBeingDeleted();
|
||||
|
||||
// moving/resizing
|
||||
// ---------------
|
||||
|
||||
// set the window size and/or position
|
||||
void SetSize( int x, int y, int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO )
|
||||
{ DoSetSize(x, y, width, height, sizeFlags); }
|
||||
|
||||
void SetSize( int width, int height )
|
||||
{ DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); }
|
||||
|
||||
void SetSize( const wxSize& size )
|
||||
{ SetSize( size.x, size.y); }
|
||||
|
||||
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
|
||||
{ DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
|
||||
|
||||
void Move( int x, int y )
|
||||
{ DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); }
|
||||
|
||||
void Move(const wxPoint& pt)
|
||||
{ Move(pt.x, pt.y); }
|
||||
|
||||
// client size is the size of area available for subwindows
|
||||
void SetClientSize( int width, int height )
|
||||
{ DoSetClientSize(width, height); }
|
||||
|
||||
void SetClientSize( const wxSize& size )
|
||||
{ DoSetClientSize(size.x, size.y); }
|
||||
|
||||
void SetClientSize(const wxRect& rect)
|
||||
{ SetClientSize( rect.width, rect.height ); }
|
||||
|
||||
// get the window position and/or size
|
||||
virtual void GetPosition( int *x, int *y ) const;
|
||||
wxPoint GetPosition() const
|
||||
{
|
||||
int w, h;
|
||||
GetPosition(& w, & h);
|
||||
|
||||
return wxPoint(w, h);
|
||||
}
|
||||
|
||||
virtual void GetSize( int *width, int *height ) const;
|
||||
|
||||
wxSize GetSize() const
|
||||
{
|
||||
int w, h;
|
||||
GetSize(& w, & h);
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
wxRect GetRect() const
|
||||
{
|
||||
int x, y, w, h;
|
||||
GetPosition(& x, & y);
|
||||
GetSize(& w, & h);
|
||||
|
||||
return wxRect(x, y, w, h);
|
||||
}
|
||||
|
||||
virtual void GetClientSize( int *width, int *height ) const;
|
||||
wxSize GetClientSize() const
|
||||
{
|
||||
int w, h;
|
||||
GetClientSize(& w, & h);
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// position with respect to the the parent window
|
||||
virtual void Centre( int direction = wxHORIZONTAL );
|
||||
void Center(int direction = wxHORIZONTAL) { Centre(direction); }
|
||||
virtual void Fit();
|
||||
|
||||
// set min/max size of the window
|
||||
virtual void SetSizeHints( int minW, int minH,
|
||||
int maxW = -1, int maxH = -1,
|
||||
int incW = -1, int incH = -1 );
|
||||
|
||||
// Dialog units translations. Implemented in wincmn.cpp.
|
||||
// -----------------------------------------------------
|
||||
|
||||
wxPoint ConvertPixelsToDialog( const wxPoint& pt );
|
||||
wxPoint ConvertDialogToPixels( const wxPoint& pt );
|
||||
wxSize ConvertPixelsToDialog( const wxSize& sz )
|
||||
{
|
||||
wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y)));
|
||||
|
||||
return wxSize(pt.x, pt.y);
|
||||
}
|
||||
|
||||
wxSize ConvertDialogToPixels( const wxSize& sz )
|
||||
{
|
||||
wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y)));
|
||||
|
||||
return wxSize(pt.x, pt.y);
|
||||
}
|
||||
|
||||
void OnSize( wxSizeEvent &event );
|
||||
|
||||
// window state
|
||||
// ------------
|
||||
|
||||
virtual bool Show( bool show );
|
||||
virtual void Enable( bool enable );
|
||||
virtual void MakeModal( bool modal );
|
||||
virtual bool IsEnabled() const { return m_isEnabled; }
|
||||
inline bool Enabled() const { return IsEnabled(); }
|
||||
|
||||
virtual void SetFocus();
|
||||
static wxWindow *FindFocus();
|
||||
|
||||
void SetReturnCode( int retCode );
|
||||
int GetReturnCode();
|
||||
|
||||
// parent/children relations
|
||||
// -------------------------
|
||||
|
||||
virtual void AddChild( wxWindow *child );
|
||||
wxList& GetChildren() { return m_children; }
|
||||
|
||||
virtual void RemoveChild( wxWindow *child );
|
||||
|
||||
wxWindow *GetParent() const
|
||||
{ return m_parent; }
|
||||
wxWindow *GetGrandParent() const
|
||||
{ return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
|
||||
void SetParent( wxWindow *parent )
|
||||
{ m_parent = parent; }
|
||||
virtual wxWindow *ReParent( wxWindow *newParent );
|
||||
|
||||
// event handler stuff
|
||||
// -------------------
|
||||
|
||||
wxEvtHandler *GetEventHandler() const;
|
||||
void SetEventHandler( wxEvtHandler *handler );
|
||||
void PushEventHandler( wxEvtHandler *handler );
|
||||
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
|
||||
|
||||
// validators and client data
|
||||
// --------------------------
|
||||
|
||||
virtual void SetValidator( const wxValidator &validator );
|
||||
virtual wxValidator *GetValidator();
|
||||
|
||||
virtual void SetClientObject( wxClientData *data );
|
||||
virtual wxClientData *GetClientObject();
|
||||
|
||||
virtual void SetClientData( void *data );
|
||||
virtual void *GetClientData();
|
||||
|
||||
// accelerators
|
||||
// ------------
|
||||
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
|
||||
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
|
||||
|
||||
void SetId( wxWindowID id );
|
||||
wxWindowID GetId() const;
|
||||
|
||||
void SetCursor( const wxCursor &cursor );
|
||||
|
||||
virtual void PrepareDC( wxDC &dc );
|
||||
|
||||
void WarpPointer(int x, int y);
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
void SetToolTip( const wxString &tip );
|
||||
virtual void SetToolTip( wxToolTip *tip );
|
||||
wxToolTip* GetToolTip() const { return m_toolTip; }
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Clear();
|
||||
|
||||
virtual wxRegion GetUpdateRegion() const;
|
||||
virtual bool IsExposed( int x, int y ) 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;
|
||||
|
||||
// colours
|
||||
// -------
|
||||
|
||||
virtual wxColour GetBackgroundColour() const;
|
||||
virtual void SetBackgroundColour( const wxColour &colour );
|
||||
virtual wxColour GetForegroundColour() const;
|
||||
virtual void SetForegroundColour( const wxColour &colour );
|
||||
|
||||
// fonts
|
||||
// -----
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent( const wxString& string, int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const;
|
||||
|
||||
virtual void SetFont( const wxFont &font );
|
||||
virtual wxFont& GetFont() { return m_font; }
|
||||
|
||||
// For backward compatibility
|
||||
virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||
virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
|
||||
virtual wxFont& GetLabelFont() { return GetFont(); };
|
||||
virtual wxFont& GetButtonFont() { return GetFont(); };
|
||||
|
||||
virtual void SetWindowStyleFlag( long flag );
|
||||
virtual long GetWindowStyleFlag() const;
|
||||
|
||||
virtual void CaptureMouse();
|
||||
virtual void ReleaseMouse();
|
||||
|
||||
virtual void SetTitle( const wxString &title );
|
||||
virtual wxString GetTitle() const;
|
||||
virtual void SetName( const wxString &name );
|
||||
virtual wxString GetName() const;
|
||||
virtual wxString GetLabel() const;
|
||||
|
||||
void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) { }
|
||||
void OnKeyDown( wxKeyEvent &event );
|
||||
|
||||
virtual bool IsShown() const;
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool IsRetained();
|
||||
virtual wxWindow *FindWindow( long id );
|
||||
virtual wxWindow *FindWindow( const wxString& name );
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
void AllowDoubleClick( bool WXUNUSED(allow) ) { }
|
||||
void SetDoubleClick( bool WXUNUSED(allow) ) { }
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void ClientToScreen( int *x, int *y );
|
||||
virtual void ScreenToClient( int *x, int *y );
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Validate();
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
void OnInitDialog( wxInitDialogEvent &event );
|
||||
virtual void InitDialog();
|
||||
virtual bool Reparent( wxWindow *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
virtual void CaptureMouse();
|
||||
virtual void ReleaseMouse();
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Clear();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
virtual void ClientToScreen( int *x, int *y ) const;
|
||||
virtual void ScreenToClient( int *x, int *y ) const;
|
||||
|
||||
virtual bool PopupMenu( wxMenu *menu, int x, int y );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
virtual wxDropTarget *GetDropTarget() const;
|
||||
#endif
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL );
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
void UpdateWindowUI();
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
bool HasVMT();
|
||||
// wxWindows callbacks
|
||||
void OnKeyDown( wxKeyEvent &event );
|
||||
|
||||
// simple accessors
|
||||
bool HasVMT() const { return m_hasVMT; }
|
||||
|
||||
int GetX() const { return m_x; }
|
||||
int GetY() const { return m_y; }
|
||||
int GetWidth() const { return m_width; }
|
||||
int GetHeight() const { return m_height; }
|
||||
|
||||
GtkWidget *GetWxWindow() const { return m_wxwindow; }
|
||||
GtkWidget *GetWidget() const { return GetHandle(); }
|
||||
|
||||
GtkAdjustment *GetHAdjust() const { return m_hAdjust; }
|
||||
GtkAdjustment *GetVAdjust() const { return m_vAdjust; }
|
||||
|
||||
float GetOldHorizontalPos() const { return m_oldHorizontalPos; }
|
||||
float GetOldVerticalPos() const { return m_oldVerticalPos; }
|
||||
|
||||
void SetOldHorizontalPos(float fpos) { m_oldHorizontalPos = fpos; }
|
||||
void SetOldVerticalPos(float fpos) { m_oldVerticalPos = fpos; }
|
||||
|
||||
bool IsSizeSet() const { return m_sizeSet; }
|
||||
|
||||
// also sets the global flag
|
||||
void SetScrolling(bool scroll);
|
||||
|
||||
bool HasScrolling() const { return m_hasScrolling; }
|
||||
bool IsScrolling() const { return m_isScrolling; }
|
||||
bool IsStaticBox() const { return m_isStaticBox; }
|
||||
|
||||
/* I don't want users to override what's done in idle so everything that
|
||||
has to be done in idle time in order for wxGTK to work is done in
|
||||
@@ -418,6 +152,9 @@ public:
|
||||
const wxSize &size, long style, const wxString &name );
|
||||
void PostCreation();
|
||||
|
||||
void InsertChild(wxWindow *child) { (*m_insertCallback)(this, child); }
|
||||
void DoAddChild(wxWindow *child) { AddChild(child); InsertChild(child); }
|
||||
|
||||
/* the methods below are required because many native widgets
|
||||
are composed of several subwidgets and setting a style for
|
||||
the widget means setting it for all subwidgets as well.
|
||||
@@ -437,107 +174,57 @@ public:
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
/* private member variables */
|
||||
// called from GTK signales handlers
|
||||
void UpdateSize() { m_sizeSet = FALSE; }
|
||||
void InternalSetPosition(int x, int y) { m_x = x; m_y = y; }
|
||||
void InternalSetSize(int w, int h)
|
||||
{ m_width = w; m_height = h; UpdateSize(); }
|
||||
|
||||
wxWindow *m_parent;
|
||||
wxList m_children;
|
||||
int m_x,m_y;
|
||||
int m_width,m_height;
|
||||
int m_minWidth,m_minHeight;
|
||||
int m_maxWidth,m_maxHeight;
|
||||
int m_retCode;
|
||||
wxEvtHandler *m_eventHandler;
|
||||
wxValidator *m_windowValidator;
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
wxDropTarget *m_dropTarget;
|
||||
#endif
|
||||
wxWindowID m_windowId;
|
||||
wxCursor m_cursor;
|
||||
wxFont m_font;
|
||||
wxColour m_backgroundColour;
|
||||
wxColour m_foregroundColour;
|
||||
wxRegion m_updateRegion;
|
||||
long m_windowStyle;
|
||||
bool m_isShown;
|
||||
bool m_isEnabled;
|
||||
wxString m_windowName;
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
protected:
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
wxToolTip *m_toolTip;
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
GtkWidget *m_widget;
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_wxwindow;
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
bool m_needParent; /* ! wxFrame, wxDialog, wxNotebookPage ? */
|
||||
bool m_hasScrolling;
|
||||
bool m_isScrolling;
|
||||
bool m_hasVMT;
|
||||
bool m_sizeSet;
|
||||
bool m_resizing;
|
||||
float m_oldHorizontalPos,
|
||||
m_oldVerticalPos;
|
||||
GdkGC *m_scrollGC;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; /* ! wxFrame, wxDialog, wxNotebookPage ? */
|
||||
bool m_hasScrolling:1;
|
||||
bool m_isScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_isStaticBox:1; /* faster than IS_KIND_OF */
|
||||
bool m_isFrame:1; /* faster than IS_KIND_OF */
|
||||
bool m_acceptsFocus:1; /* ! wxStaticBox etc. */
|
||||
|
||||
GtkStyle *m_widgetStyle;
|
||||
bool m_isStaticBox; /* faster than IS_KIND_OF */
|
||||
bool m_isFrame; /* faster than IS_KIND_OF */
|
||||
bool m_acceptsFocus; /* ! wxStaticBox etc. */
|
||||
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
public:
|
||||
|
||||
wxLayoutConstraints *m_constraints;
|
||||
wxList *m_constraintsInvolvedIn;
|
||||
wxSizer *m_windowSizer;
|
||||
wxWindow *m_sizerParent;
|
||||
bool m_autoLayout;
|
||||
|
||||
wxLayoutConstraints *GetConstraints() const;
|
||||
void SetConstraints( wxLayoutConstraints *constraints );
|
||||
void SetAutoLayout( bool autoLayout );
|
||||
bool GetAutoLayout() const;
|
||||
bool Layout();
|
||||
void SetSizer( wxSizer *sizer );
|
||||
wxSizer *GetSizer() const;
|
||||
void SetSizerParent( wxWindow *win );
|
||||
wxWindow *GetSizerParent() const;
|
||||
void UnsetConstraints(wxLayoutConstraints *c);
|
||||
inline wxList *GetConstraintsInvolvedIn() const ;
|
||||
void AddConstraintReference(wxWindow *otherWin);
|
||||
void RemoveConstraintReference(wxWindow *otherWin);
|
||||
void DeleteRelatedConstraints();
|
||||
virtual void ResetConstraints();
|
||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||
virtual bool LayoutPhase1(int *noChanges);
|
||||
virtual bool LayoutPhase2(int *noChanges);
|
||||
virtual bool DoPhase(int);
|
||||
virtual void TransformSizerToActual(int *x, int *y) const ;
|
||||
virtual void SizerSetSize(int x, int y, int w, int h);
|
||||
virtual void SizerMove(int x, int y);
|
||||
virtual void SetSizeConstraint(int x, int y, int w, int h);
|
||||
virtual void MoveConstraint(int x, int y);
|
||||
virtual void GetSizeConstraint(int *w, int *h) const ;
|
||||
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
||||
virtual void GetPositionConstraint(int *x, int *y) const ;
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// this is the virtual function to be overriden in any derived class which
|
||||
// wants to change how SetSize() or Move() works - it is called by all
|
||||
// versions of these functions in the base class
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
// same as DoSetSize() for the client size
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// common part of all ctors (can't be virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@@ -12,150 +12,192 @@
|
||||
#ifndef _WX_LAYOUTH__
|
||||
#define _WX_LAYOUTH__
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "layout.h"
|
||||
#pragma interface "layout.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
// X stupidly defines these in X.h
|
||||
#ifdef Above
|
||||
#undef Above
|
||||
#undef Above
|
||||
#endif
|
||||
#ifdef Below
|
||||
#undef Below
|
||||
#undef Below
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declrations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxWindowBase;
|
||||
class WXDLLEXPORT wxLayoutConstraints;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxLAYOUT_DEFAULT_MARGIN 0
|
||||
|
||||
enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
|
||||
wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
|
||||
enum wxRelationship { wxUnconstrained = 0,
|
||||
wxAsIs,
|
||||
wxPercentOf,
|
||||
wxAbove,
|
||||
wxBelow,
|
||||
wxLeftOf,
|
||||
wxRightOf,
|
||||
wxSameAs,
|
||||
wxAbsolute };
|
||||
|
||||
class WXDLLEXPORT wxLayoutConstraints;
|
||||
class WXDLLEXPORT wxIndividualLayoutConstraint: public wxObject
|
||||
enum wxEdge
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint)
|
||||
|
||||
protected:
|
||||
// To be allowed to modify the internal variables
|
||||
friend class wxIndividualLayoutConstraint_Serialize;
|
||||
|
||||
// 'This' window is the parent or sibling of otherWin
|
||||
wxWindow *otherWin;
|
||||
|
||||
wxEdge myEdge;
|
||||
wxRelationship relationship;
|
||||
int margin;
|
||||
int value;
|
||||
int percent;
|
||||
wxEdge otherEdge;
|
||||
bool done;
|
||||
|
||||
public:
|
||||
wxIndividualLayoutConstraint();
|
||||
~wxIndividualLayoutConstraint();
|
||||
|
||||
void Set(wxRelationship rel, wxWindow *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
|
||||
//
|
||||
// Sibling relationships
|
||||
//
|
||||
void LeftOf(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
void RightOf(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
void Above(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
void Below(wxWindow *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
|
||||
//
|
||||
// 'Same edge' alignment
|
||||
//
|
||||
void SameAs(wxWindow *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
|
||||
// The edge is a percentage of the other window's edge
|
||||
void PercentOf(wxWindow *otherW, wxEdge wh, int per);
|
||||
|
||||
//
|
||||
// Edge has absolute value
|
||||
//
|
||||
void Absolute(int val);
|
||||
|
||||
//
|
||||
// Dimension is unconstrained
|
||||
//
|
||||
inline void Unconstrained() { relationship = wxUnconstrained; }
|
||||
|
||||
//
|
||||
// Dimension is 'as is' (use current size settings)
|
||||
//
|
||||
inline void AsIs() { relationship = wxAsIs; }
|
||||
|
||||
//
|
||||
// Accessors
|
||||
//
|
||||
inline wxWindow *GetOtherWindow() { return otherWin; }
|
||||
inline wxEdge GetMyEdge() const { return myEdge; }
|
||||
inline void SetEdge(wxEdge which) { myEdge = which; }
|
||||
inline void SetValue(int v) { value = v; }
|
||||
inline int GetMargin() { return margin; }
|
||||
inline void SetMargin(int m) { margin = m; }
|
||||
inline int GetValue() const { return value; }
|
||||
inline int GetPercent() const { return percent; }
|
||||
inline int GetOtherEdge() const { return otherEdge; }
|
||||
inline bool GetDone() const { return done; }
|
||||
inline void SetDone(bool d) { done = d; }
|
||||
inline wxRelationship GetRelationship() { return relationship; }
|
||||
inline void SetRelationship(wxRelationship r) { relationship = r; }
|
||||
|
||||
// Reset constraint if it mentions otherWin
|
||||
bool ResetIfWin(wxWindow *otherW);
|
||||
|
||||
// Try to satisfy constraint
|
||||
bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindow *win);
|
||||
|
||||
// Get the value of this edge or dimension, or if this
|
||||
// is not determinable, -1.
|
||||
int GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other) const;
|
||||
wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
|
||||
wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxLayoutConstraints: public wxObject
|
||||
enum wxRelationship
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxLayoutConstraints)
|
||||
|
||||
public:
|
||||
// Edge constraints
|
||||
wxIndividualLayoutConstraint left;
|
||||
wxIndividualLayoutConstraint top;
|
||||
wxIndividualLayoutConstraint right;
|
||||
wxIndividualLayoutConstraint bottom;
|
||||
// Size constraints
|
||||
wxIndividualLayoutConstraint width;
|
||||
wxIndividualLayoutConstraint height;
|
||||
// Centre constraints
|
||||
wxIndividualLayoutConstraint centreX;
|
||||
wxIndividualLayoutConstraint centreY;
|
||||
|
||||
wxLayoutConstraints();
|
||||
~wxLayoutConstraints();
|
||||
|
||||
bool SatisfyConstraints(wxWindow *win, int *noChanges);
|
||||
bool AreSatisfied() const
|
||||
{
|
||||
return left.GetDone() && top.GetDone() && right.GetDone() &&
|
||||
bottom.GetDone() && centreX.GetDone() && centreY.GetDone();
|
||||
}
|
||||
wxUnconstrained = 0,
|
||||
wxAsIs,
|
||||
wxPercentOf,
|
||||
wxAbove,
|
||||
wxBelow,
|
||||
wxLeftOf,
|
||||
wxRightOf,
|
||||
wxSameAs,
|
||||
wxAbsolute
|
||||
};
|
||||
|
||||
bool WXDLLEXPORT wxOldDoLayout(wxWindow *win);
|
||||
enum wxSizerBehaviour
|
||||
{
|
||||
wxSizerShrink,
|
||||
wxSizerExpand,
|
||||
wxSizerNone
|
||||
};
|
||||
|
||||
#define wxTYPE_SIZER 90
|
||||
|
||||
// =============================================================================
|
||||
// classes
|
||||
// =============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxIndividualLayoutConstraint: a constraint on window position
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxIndividualLayoutConstraint : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint)
|
||||
|
||||
protected:
|
||||
// To be allowed to modify the internal variables
|
||||
friend class wxIndividualLayoutConstraint_Serialize;
|
||||
|
||||
// 'This' window is the parent or sibling of otherWin
|
||||
wxWindowBase *otherWin;
|
||||
|
||||
wxEdge myEdge;
|
||||
wxRelationship relationship;
|
||||
int margin;
|
||||
int value;
|
||||
int percent;
|
||||
wxEdge otherEdge;
|
||||
bool done;
|
||||
|
||||
public:
|
||||
wxIndividualLayoutConstraint();
|
||||
~wxIndividualLayoutConstraint();
|
||||
|
||||
void Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val = 0, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
|
||||
//
|
||||
// Sibling relationships
|
||||
//
|
||||
void LeftOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
void RightOf(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
void Above(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
void Below(wxWindowBase *sibling, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
|
||||
//
|
||||
// 'Same edge' alignment
|
||||
//
|
||||
void SameAs(wxWindowBase *otherW, wxEdge edge, int marg = wxLAYOUT_DEFAULT_MARGIN);
|
||||
|
||||
// The edge is a percentage of the other window's edge
|
||||
void PercentOf(wxWindowBase *otherW, wxEdge wh, int per);
|
||||
|
||||
//
|
||||
// Edge has absolute value
|
||||
//
|
||||
void Absolute(int val);
|
||||
|
||||
//
|
||||
// Dimension is unconstrained
|
||||
//
|
||||
void Unconstrained() { relationship = wxUnconstrained; }
|
||||
|
||||
//
|
||||
// Dimension is 'as is' (use current size settings)
|
||||
//
|
||||
void AsIs() { relationship = wxAsIs; }
|
||||
|
||||
//
|
||||
// Accessors
|
||||
//
|
||||
wxWindowBase *GetOtherWindow() { return otherWin; }
|
||||
wxEdge GetMyEdge() const { return myEdge; }
|
||||
void SetEdge(wxEdge which) { myEdge = which; }
|
||||
void SetValue(int v) { value = v; }
|
||||
int GetMargin() { return margin; }
|
||||
void SetMargin(int m) { margin = m; }
|
||||
int GetValue() const { return value; }
|
||||
int GetPercent() const { return percent; }
|
||||
int GetOtherEdge() const { return otherEdge; }
|
||||
bool GetDone() const { return done; }
|
||||
void SetDone(bool d) { done = d; }
|
||||
wxRelationship GetRelationship() { return relationship; }
|
||||
void SetRelationship(wxRelationship r) { relationship = r; }
|
||||
|
||||
// Reset constraint if it mentions otherWin
|
||||
bool ResetIfWin(wxWindowBase *otherW);
|
||||
|
||||
// Try to satisfy constraint
|
||||
bool SatisfyConstraint(wxLayoutConstraints *constraints, wxWindowBase *win);
|
||||
|
||||
// Get the value of this edge or dimension, or if this
|
||||
// is not determinable, -1.
|
||||
int GetEdge(wxEdge which, wxWindowBase *thisWin, wxWindowBase *other) const;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLayoutConstraints: the complete set of constraints for a window
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxLayoutConstraints : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxLayoutConstraints)
|
||||
|
||||
public:
|
||||
// Edge constraints
|
||||
wxIndividualLayoutConstraint left;
|
||||
wxIndividualLayoutConstraint top;
|
||||
wxIndividualLayoutConstraint right;
|
||||
wxIndividualLayoutConstraint bottom;
|
||||
// Size constraints
|
||||
wxIndividualLayoutConstraint width;
|
||||
wxIndividualLayoutConstraint height;
|
||||
// Centre constraints
|
||||
wxIndividualLayoutConstraint centreX;
|
||||
wxIndividualLayoutConstraint centreY;
|
||||
|
||||
wxLayoutConstraints();
|
||||
~wxLayoutConstraints();
|
||||
|
||||
bool SatisfyConstraints(wxWindowBase *win, int *noChanges);
|
||||
bool AreSatisfied() const
|
||||
{
|
||||
return left.GetDone() && top.GetDone() && right.GetDone() &&
|
||||
bottom.GetDone() && centreX.GetDone() && centreY.GetDone();
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// sizers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
||||
@@ -203,18 +245,9 @@ to the top of the hierarchy and call Layout() again.
|
||||
|
||||
*/
|
||||
|
||||
enum wxSizerBehaviour
|
||||
{
|
||||
wxSizerShrink,
|
||||
wxSizerExpand,
|
||||
wxSizerNone
|
||||
};
|
||||
|
||||
#define wxTYPE_SIZER 90
|
||||
|
||||
class WXDLLEXPORT wxSizer : public wxWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSizer)
|
||||
DECLARE_DYNAMIC_CLASS(wxSizer)
|
||||
|
||||
protected:
|
||||
wxSizerBehaviour sizerBehaviour;
|
||||
@@ -227,10 +260,10 @@ protected:
|
||||
|
||||
public:
|
||||
wxSizer();
|
||||
wxSizer(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
|
||||
wxSizer(wxWindowBase *parent, wxSizerBehaviour behav = wxSizerNone);
|
||||
~wxSizer();
|
||||
|
||||
bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
|
||||
bool Create(wxWindowBase *parent, wxSizerBehaviour behav = wxSizerNone);
|
||||
|
||||
virtual void GetSize(int *w, int *h) const;
|
||||
|
||||
@@ -245,8 +278,8 @@ public:
|
||||
int GetBorderX() { return borderX ; }
|
||||
int GetBorderY() { return borderY ; }
|
||||
|
||||
virtual void AddSizerChild(wxWindow *child);
|
||||
virtual void RemoveSizerChild(wxWindow *child);
|
||||
virtual void AddSizerChild(wxWindowBase *child);
|
||||
virtual void RemoveSizerChild(wxWindowBase *child);
|
||||
|
||||
virtual void SetBehaviour(wxSizerBehaviour b) { sizerBehaviour = b; }
|
||||
virtual wxSizerBehaviour GetBehaviour() { return sizerBehaviour; }
|
||||
@@ -265,7 +298,7 @@ protected:
|
||||
|
||||
class WXDLLEXPORT wxRowColSizer : public wxSizer
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRowColSizer)
|
||||
DECLARE_DYNAMIC_CLASS(wxRowColSizer)
|
||||
|
||||
protected:
|
||||
bool rowOrCol;
|
||||
@@ -276,11 +309,11 @@ protected:
|
||||
public:
|
||||
// rowOrCol = TRUE to be laid out in rows, otherwise in columns.
|
||||
wxRowColSizer();
|
||||
wxRowColSizer(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS,
|
||||
wxRowColSizer(wxWindowBase *parent, bool rowOrCol = wxSIZER_ROWS,
|
||||
int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
|
||||
~wxRowColSizer();
|
||||
|
||||
bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS,
|
||||
bool Create(wxWindowBase *parent, bool rowOrCol = wxSIZER_ROWS,
|
||||
int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
|
||||
|
||||
virtual void SetRowOrCol(bool rc) { rowOrCol = rc; }
|
||||
@@ -296,17 +329,25 @@ public:
|
||||
|
||||
class WXDLLEXPORT wxSpacingSizer : public wxSizer
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSpacingSizer)
|
||||
DECLARE_DYNAMIC_CLASS(wxSpacingSizer)
|
||||
|
||||
public:
|
||||
wxSpacingSizer();
|
||||
wxSpacingSizer(wxWindow *parent, wxRelationship rel, wxWindow *other, int spacing);
|
||||
wxSpacingSizer(wxWindow *parent);
|
||||
wxSpacingSizer(wxWindowBase *parent, wxRelationship rel, wxWindowBase *other, int spacing);
|
||||
wxSpacingSizer(wxWindowBase *parent);
|
||||
~wxSpacingSizer();
|
||||
|
||||
bool Create(wxWindow *parent, wxRelationship rel, wxWindow *other, int sp);
|
||||
bool Create(wxWindow *parent);
|
||||
bool Create(wxWindowBase *parent, wxRelationship rel, wxWindowBase *other, int sp);
|
||||
bool Create(wxWindowBase *parent);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
extern bool WXDLLEXPORT wxOldDoLayout(wxWindowBase *win);
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
#endif
|
||||
// _WX_LAYOUTH__
|
||||
|
@@ -142,7 +142,7 @@ public:
|
||||
|
||||
virtual ~wxNodeBase();
|
||||
|
||||
// @@ no check is done that the list is really keyed on strings
|
||||
// FIXME no check is done that the list is really keyed on strings
|
||||
const wxChar *GetKeyString() const { return m_key.string; }
|
||||
long GetKeyInteger() const { return m_key.integer; }
|
||||
|
||||
@@ -339,8 +339,16 @@ private:
|
||||
// 2. We redefine all non-type-safe wxList functions with type-safe versions
|
||||
// which don't take any space (everything is inline), but bring compile
|
||||
// time error checking.
|
||||
//
|
||||
// 3. The macro which is usually used (WX_DECLARE_LIST) is defined in terms of
|
||||
// a more generic WX_DECLARE_LIST_2 macro which, in turn, uses the most
|
||||
// generic WX_DECLARE_LIST_3 one. The last macro adds a sometimes
|
||||
// interesting capability to store polymorphic objects in the list and is
|
||||
// particularly useful with, for example, "wxWindow *" list where the
|
||||
// wxWindowBase pointers are put into the list, but wxWindow pointers are
|
||||
// retrieved from it.
|
||||
|
||||
#define WX_DECLARE_LIST_2(T, name, nodetype) \
|
||||
#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype) \
|
||||
typedef int (*wxSortFuncFor_##name)(const T *, const T *); \
|
||||
\
|
||||
class WXDLLEXPORT nodetype : public wxNodeBase \
|
||||
@@ -390,11 +398,11 @@ private:
|
||||
return node ? (T*)(node->GetData()) : (T*)NULL; \
|
||||
} \
|
||||
\
|
||||
nodetype *Append(T *object) \
|
||||
nodetype *Append(Tbase *object) \
|
||||
{ return (nodetype *)wxListBase::Append(object); } \
|
||||
nodetype *Insert(T *object) \
|
||||
nodetype *Insert(Tbase *object) \
|
||||
{ return (nodetype *)Insert((nodetype*)NULL, object); } \
|
||||
nodetype *Insert(nodetype *prev, T *object) \
|
||||
nodetype *Insert(nodetype *prev, Tbase *object) \
|
||||
{ return (nodetype *)wxListBase::Insert(prev, object); } \
|
||||
\
|
||||
nodetype *Append(long key, void *object) \
|
||||
@@ -406,16 +414,16 @@ private:
|
||||
{ return (nodetype *)wxListBase::DetachNode(node); } \
|
||||
bool DeleteNode(nodetype *node) \
|
||||
{ return wxListBase::DeleteNode(node); } \
|
||||
bool DeleteObject(T *object) \
|
||||
bool DeleteObject(Tbase *object) \
|
||||
{ return wxListBase::DeleteObject(object); } \
|
||||
\
|
||||
nodetype *Find(T *object) const \
|
||||
nodetype *Find(Tbase *object) const \
|
||||
{ return (nodetype *)wxListBase::Find(object); } \
|
||||
\
|
||||
virtual nodetype *Find(const wxListKey& key) const \
|
||||
{ return (nodetype *)wxListBase::Find(key); } \
|
||||
\
|
||||
int IndexOf( T *object ) const \
|
||||
int IndexOf(Tbase *object) const \
|
||||
{ return wxListBase::IndexOf(object); } \
|
||||
\
|
||||
void Sort(wxSortFuncFor_##name func) \
|
||||
@@ -432,6 +440,9 @@ private:
|
||||
} \
|
||||
}
|
||||
|
||||
#define WX_DECLARE_LIST_2(elementtype, listname, nodename) \
|
||||
WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename)
|
||||
|
||||
#define WX_DECLARE_LIST(elementtype, listname) \
|
||||
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
|
||||
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node)
|
||||
@@ -445,12 +456,9 @@ private:
|
||||
// =============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// commonly used string classes
|
||||
// commonly used list classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxWindow;
|
||||
WX_DECLARE_LIST(wxWindow, wxWindowList);
|
||||
|
||||
#ifdef wxLIST_COMPATIBILITY
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@@ -158,7 +158,7 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
#endif
|
||||
|
||||
// Lay the tools out
|
||||
virtual void Layout(void);
|
||||
virtual void LayoutTools();
|
||||
|
||||
// Add all the buttons: required for Win95.
|
||||
virtual bool CreateTools(void) { return TRUE; }
|
||||
|
@@ -62,10 +62,10 @@ class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
|
||||
|
||||
virtual void SpringUpButton(int index);
|
||||
|
||||
void Layout(void);
|
||||
virtual void LayoutTools();
|
||||
|
||||
// The post-tool-addition call
|
||||
bool Realize() { Layout(); return TRUE; };
|
||||
virtual bool Realize() { LayoutTools(); return TRUE; };
|
||||
|
||||
protected:
|
||||
int m_currentRowsOrColumns;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "wx/event.h"
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
class WXDLLEXPORT wxWindowBase;
|
||||
|
||||
/*
|
||||
A validator has up to three purposes:
|
||||
@@ -36,7 +36,7 @@ class WXDLLEXPORT wxValidator : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
wxValidator();
|
||||
~wxValidator();
|
||||
virtual ~wxValidator();
|
||||
|
||||
// Make a clone of this validator (or return NULL) - currently necessary
|
||||
// if you're passing a reference to a validator.
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
// Called when the value in the window must be validated.
|
||||
// This function can pop up an error message.
|
||||
virtual bool Validate(wxWindow *WXUNUSED(parent)) { return FALSE; };
|
||||
virtual bool Validate(wxWindowBase *WXUNUSED(parent)) { return FALSE; };
|
||||
|
||||
// Called to transfer data to the window
|
||||
virtual bool TransferToWindow() { return FALSE; }
|
||||
@@ -58,8 +58,8 @@ public:
|
||||
virtual bool TransferFromWindow() { return FALSE; };
|
||||
|
||||
// accessors
|
||||
wxWindow *GetWindow() const { return m_validatorWindow; }
|
||||
void SetWindow(wxWindow *win) { m_validatorWindow = win; }
|
||||
wxWindowBase *GetWindow() const { return m_validatorWindow; }
|
||||
void SetWindow(wxWindowBase *win) { m_validatorWindow = win; }
|
||||
|
||||
// validators beep by default if invalid key is pressed, these functions
|
||||
// allow to change it
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
static void SetBellOnError(bool doIt = TRUE) { ms_isSilent = doIt; }
|
||||
|
||||
protected:
|
||||
wxWindow *m_validatorWindow;
|
||||
wxWindowBase *m_validatorWindow;
|
||||
|
||||
private:
|
||||
static bool ms_isSilent;
|
||||
|
@@ -1,19 +1,758 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: window.h
|
||||
// Purpose: wxWindowBase class - the interface of wxWindowBase
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_WINDOW_H_BASE_
|
||||
#define _WX_WINDOW_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers which we must include here
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/event.h" // the base class
|
||||
|
||||
#include "wx/list.h" // defines wxWindowList
|
||||
|
||||
#include "wx/cursor.h" // we have member variables of these classes
|
||||
#include "wx/font.h" // so we can't do without them
|
||||
#include "wx/colour.h"
|
||||
#include "wx/region.h"
|
||||
#include "wx/accel.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxClientData;
|
||||
class WXDLLEXPORT wxControl;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxDc;
|
||||
class WXDLLEXPORT wxDropTarget;
|
||||
class WXDLLEXPORT wxItemResource;
|
||||
class WXDLLEXPORT wxLayoutConstraints;
|
||||
class WXDLLEXPORT wxResourceTable;
|
||||
class WXDLLEXPORT wxSizer;
|
||||
class WXDLLEXPORT wxToolTip;
|
||||
class WXDLLEXPORT wxValidator;
|
||||
class WXDLLEXPORT wxWindowBase;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// (pseudo)template list classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST_3(wxWindow, wxWindowBase, wxWindowList, wxWindowListNode);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxWindowList) wxTopLevelWindows;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// helper classes used by [SG]etClientObject/Data
|
||||
//
|
||||
// TODO move into a separate header?
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxClientData
|
||||
{
|
||||
public:
|
||||
wxClientData() { }
|
||||
virtual ~wxClientData() { }
|
||||
};
|
||||
|
||||
class wxStringClientData : public wxClientData
|
||||
{
|
||||
public:
|
||||
wxStringClientData() { }
|
||||
wxStringClientData( const wxString &data ) : m_data(data) { }
|
||||
void SetData( const wxString &data ) { m_data = data; }
|
||||
const wxString& GetData() const { return m_data; }
|
||||
|
||||
private:
|
||||
wxString m_data;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxWindowBase is the base class for all GUI controls/widgets, this is the public
|
||||
// interface of this class.
|
||||
//
|
||||
// Event handler: windows have themselves as their event handlers by default,
|
||||
// but their event handlers could be set to another object entirely. This
|
||||
// separation can reduce the amount of derivation required, and allow
|
||||
// alteration of a window's functionality (e.g. by a resource editor that
|
||||
// temporarily switches event handlers).
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxWindowBase : public wxEvtHandler
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxWindowBase);
|
||||
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
|
||||
// default ctor
|
||||
wxWindowBase() { InitBase(); }
|
||||
|
||||
// pseudo ctor (can't be virtual, called from ctor)
|
||||
bool CreateBase(wxWindowBase *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual ~wxWindowBase();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
// these functions are implemented in resource.cpp and resourc2.cpp
|
||||
virtual bool LoadFromResource(wxWindow *parent,
|
||||
const wxString& resourceName,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
virtual wxControl *CreateItem(const wxItemResource* childResource,
|
||||
const wxItemResource* parentResource,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
#endif // wxUSE_WX_RESOURCES
|
||||
|
||||
// deleting the window
|
||||
// -------------------
|
||||
|
||||
// ask the window to close itself, return TRUE if the event handler
|
||||
// honoured our request
|
||||
bool Close( bool force = FALSE );
|
||||
|
||||
// the following functions delete the C++ objects (the window itself
|
||||
// or its children) as well as the GUI windows and normally should
|
||||
// never be used directly
|
||||
|
||||
// delete window unconditionally (dangerous!), returns TRUE if ok
|
||||
virtual bool Destroy();
|
||||
// delete all children of this window, returns TRUE if ok
|
||||
bool DestroyChildren();
|
||||
|
||||
// is the window being deleted?
|
||||
bool IsBeingDeleted() const { return m_isBeingDeleted; }
|
||||
|
||||
// window attributes
|
||||
// -----------------
|
||||
|
||||
// the title (or label, see below) of the window: the text which the
|
||||
// window shows
|
||||
virtual void SetTitle( const wxString & WXUNUSED(title) ) { }
|
||||
virtual wxString GetTitle() const { return ""; }
|
||||
|
||||
// label is just the same as the title (but for, e.g., buttons it
|
||||
// makes more sense to speak about labels)
|
||||
wxString GetLabel() const { return GetTitle(); }
|
||||
|
||||
// the window name is used for ressource setting in X, it is not the
|
||||
// same as the window title/label
|
||||
virtual void SetName( const wxString &name ) { m_windowName = name; }
|
||||
virtual wxString GetName() const { return m_windowName; }
|
||||
|
||||
// window id uniquely identifies the window among its siblings unless
|
||||
// it is -1 which means "don't care"
|
||||
void SetId( wxWindowID id ) { m_windowId = id; }
|
||||
wxWindowID GetId() const { return m_windowId; }
|
||||
|
||||
// generate a control id for the controls which were not given one by
|
||||
// user
|
||||
static int NewControlId() { return ++ms_lastControlId; }
|
||||
|
||||
// moving/resizing
|
||||
// ---------------
|
||||
|
||||
// set the window size and/or position
|
||||
void SetSize( int x, int y, int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO )
|
||||
{ DoSetSize(x, y, width, height, sizeFlags); }
|
||||
|
||||
void SetSize( int width, int height )
|
||||
{ DoSetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); }
|
||||
|
||||
void SetSize( const wxSize& size )
|
||||
{ SetSize( size.x, size.y); }
|
||||
|
||||
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
|
||||
{ DoSetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
|
||||
|
||||
void Move( int x, int y )
|
||||
{ DoSetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); }
|
||||
|
||||
void Move(const wxPoint& pt)
|
||||
{ Move(pt.x, pt.y); }
|
||||
|
||||
// Z-order
|
||||
virtual void Raise() = 0;
|
||||
virtual void Lower() = 0;
|
||||
|
||||
// client size is the size of area available for subwindows
|
||||
void SetClientSize( int width, int height )
|
||||
{ DoSetClientSize(width, height); }
|
||||
|
||||
void SetClientSize( const wxSize& size )
|
||||
{ DoSetClientSize(size.x, size.y); }
|
||||
|
||||
void SetClientSize(const wxRect& rect)
|
||||
{ SetClientSize( rect.width, rect.height ); }
|
||||
|
||||
// get the window position and/or size (pointers may be NULL)
|
||||
void GetPosition( int *x, int *y ) const { DoGetPosition(x, y); }
|
||||
wxPoint GetPosition() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetPosition(&w, &h);
|
||||
|
||||
return wxPoint(w, h);
|
||||
}
|
||||
|
||||
void GetSize( int *w, int *h ) const { DoGetSize(w, h); }
|
||||
wxSize GetSize() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSize(& w, & h);
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
wxRect GetRect() const
|
||||
{
|
||||
int x, y, w, h;
|
||||
GetPosition(& x, & y);
|
||||
GetSize(& w, & h);
|
||||
|
||||
return wxRect(x, y, w, h);
|
||||
}
|
||||
|
||||
void GetClientSize( int *w, int *h ) const { DoGetClientSize(w, h); }
|
||||
wxSize GetClientSize() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetClientSize(& w, & h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// centre with respect to the the parent window
|
||||
void Centre( int direction = wxHORIZONTAL );
|
||||
void Center( int direction = wxHORIZONTAL ) { Centre(direction); }
|
||||
|
||||
// set window size to wrap around its children
|
||||
virtual void Fit();
|
||||
|
||||
// set min/max size of the window
|
||||
virtual void SetSizeHints( int minW, int minH,
|
||||
int maxW = -1, int maxH = -1,
|
||||
int incW = -1, int incH = -1 );
|
||||
|
||||
// window state
|
||||
// ------------
|
||||
|
||||
// returns TRUE if window was shown/hidden, FALSE if the nothing was
|
||||
// done (window was already shown/hidden)
|
||||
virtual bool Show( bool show = TRUE );
|
||||
bool Hide() { return Show(FALSE); }
|
||||
|
||||
// returns TRUE if window was enabled/disabled, FALSE if nothing done
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
bool Disable() { return Enable(FALSE); }
|
||||
|
||||
bool IsShown() const { return m_isShown; }
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
|
||||
// get/set window style (setting style won't update the window and so
|
||||
// is only useful for internal usage)
|
||||
virtual void SetWindowStyleFlag( long style ) { m_windowStyle = style; }
|
||||
virtual long GetWindowStyleFlag() const { return m_windowStyle; }
|
||||
|
||||
// just some (somewhat shorter) synonims
|
||||
void SetWindowStyle( long style ) { SetWindowStyleFlag(style); }
|
||||
long GetWindowStyle() const { return GetWindowStyleFlag(); }
|
||||
|
||||
bool HasFlag(int flag) const { return (m_windowStyle & flag) != 0; }
|
||||
|
||||
virtual bool IsRetained() const
|
||||
{ return (m_windowStyle & wxRETAINED) != 0; }
|
||||
|
||||
// make the window modal (all other windows unresponsive)
|
||||
virtual void MakeModal(bool modal = TRUE);
|
||||
|
||||
// focus handling
|
||||
// --------------
|
||||
|
||||
// set focus to this window
|
||||
virtual void SetFocus() = 0;
|
||||
|
||||
// return the window which currently has the focus or NULL
|
||||
static wxWindow *FindFocus() /* = 0: implement in derived classes */;
|
||||
|
||||
// can this window have focus?
|
||||
virtual bool AcceptsFocus() const { return IsShown() && IsEnabled(); }
|
||||
|
||||
// parent/children relations
|
||||
// -------------------------
|
||||
|
||||
// get the list of children
|
||||
const wxWindowList& GetChildren() const { return m_children; }
|
||||
wxWindowList& GetChildren() { return m_children; }
|
||||
|
||||
// get the parent or the parent of the parent
|
||||
wxWindow *GetParent() const { return m_parent; }
|
||||
inline wxWindow *GetGrandParent() const;
|
||||
|
||||
// is this window a top level one?
|
||||
bool IsTopLevel() const { return m_parent != 0; }
|
||||
|
||||
// it doesn't really change parent, use ReParent() instead
|
||||
void SetParent( wxWindowBase *parent ) { m_parent = (wxWindow *)parent; }
|
||||
// change the real parent of this window, return TRUE if the parent
|
||||
// was changed, FALSE otherwise (error or newParent == oldParent)
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
// find window among the descendants of this one either by id or by
|
||||
// name (return NULL if not found)
|
||||
wxWindow *FindWindow( long id );
|
||||
wxWindow *FindWindow( const wxString& name );
|
||||
|
||||
// implementation mostly
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
|
||||
// event handler stuff
|
||||
// -------------------
|
||||
|
||||
// get the current event handler
|
||||
wxEvtHandler *GetEventHandler() const { return m_eventHandler; }
|
||||
|
||||
// replace the event handler (allows to completely subclass the
|
||||
// window)
|
||||
void SetEventHandler( wxEvtHandler *handler ) { m_eventHandler = handler; }
|
||||
|
||||
// push/pop event handler: allows to chain a custom event handler to
|
||||
// alreasy existing ones
|
||||
void PushEventHandler( wxEvtHandler *handler );
|
||||
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
|
||||
|
||||
// validators and client data
|
||||
// --------------------------
|
||||
|
||||
// a window may have an associated validator which is used to control
|
||||
// user input
|
||||
virtual void SetValidator( const wxValidator &validator );
|
||||
virtual wxValidator *GetValidator() { return m_windowValidator; }
|
||||
|
||||
// each window may have associated client data: either a pointer to
|
||||
// wxClientData object in which case it is managed by the window (i.e.
|
||||
// it will delete the data when it's destroyed) or an untyped pointer
|
||||
// which won't be deleted by the window
|
||||
virtual void SetClientObject( wxClientData *data )
|
||||
{
|
||||
if ( m_clientObject )
|
||||
delete m_clientObject;
|
||||
|
||||
m_clientObject = data;
|
||||
}
|
||||
virtual wxClientData *GetClientObject() const { return m_clientObject; }
|
||||
|
||||
virtual void SetClientData( void *data ) { m_clientData = data; }
|
||||
virtual void *GetClientData() const { return m_clientData; }
|
||||
|
||||
// dialog oriented functions
|
||||
// -------------------------
|
||||
|
||||
// validate the correctness of input, return TRUE if ok
|
||||
virtual bool Validate();
|
||||
|
||||
// transfer data between internal and GUI representations
|
||||
virtual bool TransferDataToWindow();
|
||||
virtual bool TransferDataFromWindow();
|
||||
|
||||
virtual void InitDialog();
|
||||
|
||||
// accelerators
|
||||
// ------------
|
||||
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel )
|
||||
{ m_acceleratorTable = accel; }
|
||||
wxAcceleratorTable *GetAcceleratorTable()
|
||||
{ return &m_acceleratorTable; }
|
||||
|
||||
// dialog units translations
|
||||
// -------------------------
|
||||
|
||||
wxPoint ConvertPixelsToDialog( const wxPoint& pt );
|
||||
wxPoint ConvertDialogToPixels( const wxPoint& pt );
|
||||
wxSize ConvertPixelsToDialog( const wxSize& sz )
|
||||
{
|
||||
wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y)));
|
||||
|
||||
return wxSize(pt.x, pt.y);
|
||||
}
|
||||
|
||||
wxSize ConvertDialogToPixels( const wxSize& sz )
|
||||
{
|
||||
wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y)));
|
||||
|
||||
return wxSize(pt.x, pt.y);
|
||||
}
|
||||
|
||||
// mouse functions
|
||||
// ---------------
|
||||
|
||||
// move the mouse to the specified position
|
||||
virtual void WarpPointer(int x, int y) = 0;
|
||||
|
||||
// start or end mouse capture
|
||||
virtual void CaptureMouse() = 0;
|
||||
virtual void ReleaseMouse() = 0;
|
||||
|
||||
// painting the window
|
||||
// -------------------
|
||||
|
||||
// mark the specified rectangle (or the whole window) as "dirty" so it
|
||||
// will be repainted
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL ) = 0;
|
||||
// clear the window entirely
|
||||
virtual void Clear() = 0;
|
||||
|
||||
// adjust DC for drawing on this window
|
||||
virtual void PrepareDC( wxDC &dc ) { }
|
||||
|
||||
// the update region of the window contains the areas which must be
|
||||
// repainted by the program
|
||||
const wxRegion& GetUpdateRegion() const { return m_updateRegion; }
|
||||
wxRegion& GetUpdateRegion() { return m_updateRegion; }
|
||||
|
||||
// these functions verify whether the given point/rectangle belongs to
|
||||
// (or at least intersects with) the update region
|
||||
bool IsExposed( int x, int y ) const;
|
||||
bool IsExposed( int x, int y, int w, int h ) const;
|
||||
|
||||
bool IsExposed( const wxPoint& pt ) const
|
||||
{ return IsExposed(pt.x, pt.y); }
|
||||
bool IsExposed( const wxRect& rect ) const
|
||||
{ return IsExposed(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
// colours, fonts and cursors
|
||||
// --------------------------
|
||||
|
||||
// set/retrieve the window colours (system defaults are used by
|
||||
// default): Set functions return TRUE if colour was changed
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
|
||||
wxColour GetBackgroundColour() const { return m_backgroundColour; }
|
||||
wxColour GetForegroundColour() const { return m_foregroundColour; }
|
||||
|
||||
// set/retrieve the cursor for this window (SetCursor() returns TRUE
|
||||
// if the cursor was really changed)
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
const wxCursor& GetCursor() const { return m_cursor; }
|
||||
wxCursor& GetCursor() { return m_cursor; }
|
||||
|
||||
// set/retrieve the font for the window (SetFont() returns TRUE if the
|
||||
// font really changed)
|
||||
virtual bool SetFont( const wxFont &font ) = 0;
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
wxFont& GetFont() { return m_font; }
|
||||
|
||||
// get the (average) character size for the current font
|
||||
virtual int GetCharHeight() const = 0;
|
||||
virtual int GetCharWidth() const = 0;
|
||||
|
||||
// get the width/height/... of the text using current or specified
|
||||
// font
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const = 0;
|
||||
|
||||
// translate to/from screen/client coordinates (pointers may be NULL)
|
||||
virtual void ClientToScreen( int *x, int *y ) const = 0;
|
||||
virtual void ScreenToClient( int *x, int *y ) const = 0;
|
||||
|
||||
// misc
|
||||
// ----
|
||||
|
||||
void UpdateWindowUI();
|
||||
|
||||
virtual bool PopupMenu( wxMenu *menu, int x, int y ) = 0;
|
||||
|
||||
// scrollbars
|
||||
// ----------
|
||||
|
||||
// configure the window scrollbars
|
||||
virtual void SetScrollbar( int orient,
|
||||
int pos,
|
||||
int thumbVisible,
|
||||
int range,
|
||||
bool refresh = TRUE ) = 0;
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ) = 0;
|
||||
virtual int GetScrollPos( int orient ) const = 0;
|
||||
virtual int GetScrollThumb( int orient ) const = 0;
|
||||
virtual int GetScrollRange( int orient ) const = 0;
|
||||
|
||||
// scroll window to the specified position
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL ) = 0;
|
||||
|
||||
// tooltips
|
||||
// --------
|
||||
#if wxUSE_TOOLTIPS
|
||||
// the easiest way to set a tooltip for a window is to use this method
|
||||
void SetToolTip( const wxString &tip );
|
||||
// attach a tooltip to the window
|
||||
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
|
||||
// get the associated tooltip or NULL if none
|
||||
wxToolTip* GetToolTip() const { return m_tooltip; }
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// drag and drop
|
||||
// -------------
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
// set/retrieve the drop target associated with this window (may be
|
||||
// NULL; it's owned by the window and will be deleted by it)
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
|
||||
virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
// constraints and sizers
|
||||
// ----------------------
|
||||
#if wxUSE_CONSTRAINTS
|
||||
// set the constraints for this window or retrieve them (may be NULL)
|
||||
void SetConstraints( wxLayoutConstraints *constraints );
|
||||
wxLayoutConstraints *GetConstraints() const { return m_constraints; }
|
||||
|
||||
// when using constraints, it makes sense to update children positions
|
||||
// automatically whenever the window is resized - this is done if
|
||||
// autoLayout is on
|
||||
void SetAutoLayout( bool autoLayout ) { m_autoLayout = autoLayout; }
|
||||
bool GetAutoLayout() const { return m_autoLayout; }
|
||||
|
||||
// do layout the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// implementation only
|
||||
void UnsetConstraints(wxLayoutConstraints *c);
|
||||
wxWindowList *GetConstraintsInvolvedIn() const
|
||||
{ return m_constraintsInvolvedIn; }
|
||||
void AddConstraintReference(wxWindowBase *otherWin);
|
||||
void RemoveConstraintReference(wxWindowBase *otherWin);
|
||||
void DeleteRelatedConstraints();
|
||||
void ResetConstraints();
|
||||
|
||||
// these methods may be overriden for special layout algorithms
|
||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||
virtual bool LayoutPhase1(int *noChanges);
|
||||
virtual bool LayoutPhase2(int *noChanges);
|
||||
virtual bool DoPhase(int);
|
||||
|
||||
// these methods are virtual but normally won't be overridden
|
||||
virtual void TransformSizerToActual(int *x, int *y) const ;
|
||||
virtual void SetSizeConstraint(int x, int y, int w, int h);
|
||||
virtual void MoveConstraint(int x, int y);
|
||||
virtual void GetSizeConstraint(int *w, int *h) const ;
|
||||
virtual void GetClientSizeConstraint(int *w, int *h) const ;
|
||||
virtual void GetPositionConstraint(int *x, int *y) const ;
|
||||
|
||||
// sizers
|
||||
// TODO: what are they and how do they work??
|
||||
void SetSizer( wxSizer *sizer );
|
||||
wxSizer *GetSizer() const { return m_windowSizer; }
|
||||
|
||||
void SetSizerParent( wxWindowBase *win ) { m_sizerParent = win; }
|
||||
wxWindowBase *GetSizerParent() const { return m_sizerParent; }
|
||||
|
||||
virtual void SizerSetSize(int x, int y, int w, int h);
|
||||
virtual void SizerMove(int x, int y);
|
||||
#endif // wxUSE_CONSTRAINTS
|
||||
|
||||
// backward compatibility
|
||||
// ----------------------
|
||||
#if WXWIN_COMPATIBILITY
|
||||
bool Enabled() const { return IsEnabled(); }
|
||||
|
||||
void SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||
void SetLabelFont(const wxFont& font) { SetFont(font); }
|
||||
wxFont& GetLabelFont() { return GetFont(); };
|
||||
wxFont& GetButtonFont() { return GetFont(); };
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
// event handlers
|
||||
void OnSysColourChanged( wxSysColourChangedEvent& event );
|
||||
void OnInitDialog( wxInitDialogEvent &event );
|
||||
|
||||
// accessors
|
||||
WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
protected:
|
||||
// the window handle (for the underlying windowing system) and the window
|
||||
// id - a number which uniquely identifies a window among its siblings
|
||||
// unless it is -1
|
||||
WXWidget m_widget;
|
||||
wxWindowID m_windowId;
|
||||
|
||||
// the parent window of this window (or NULL) and the list of the children
|
||||
// of this window
|
||||
wxWindow *m_parent;
|
||||
wxWindowList m_children;
|
||||
|
||||
// the minimal allowed size for the window (no minimal size if variable(s)
|
||||
// contain(s) -1)
|
||||
int m_minWidth, m_minHeight, m_maxWidth, m_maxHeight;
|
||||
|
||||
// event handler for this window: usually is just 'this' but may be
|
||||
// changed with SetEventHandler()
|
||||
wxEvtHandler *m_eventHandler;
|
||||
|
||||
// associated validator or NULL if none
|
||||
wxValidator *m_windowValidator;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
wxDropTarget *m_dropTarget;
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
// visual window attributes
|
||||
wxCursor m_cursor;
|
||||
wxFont m_font;
|
||||
wxColour m_backgroundColour, m_foregroundColour;
|
||||
|
||||
// the region which should be repainted in response to paint event
|
||||
wxRegion m_updateRegion;
|
||||
|
||||
// the accelerator table for the window which translates key strokes into
|
||||
// command events
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
|
||||
// user data associated with the window: either an object which will be
|
||||
// deleted by the window when it's deleted or some raw pointer which we do
|
||||
// nothing with
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
|
||||
// the tooltip for this window (may be NULL)
|
||||
#if wxUSE_TOOLTIPS
|
||||
wxToolTip *m_tooltip;
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// constraints and sizers
|
||||
#if wxUSE_CONSTRAINTS
|
||||
// the constraints for this window or NULL
|
||||
wxLayoutConstraints *m_constraints;
|
||||
|
||||
// constraints this window is involved in
|
||||
wxWindowList *m_constraintsInvolvedIn;
|
||||
|
||||
// top level and the parent sizers
|
||||
// TODO what's this and how does it work?)
|
||||
wxSizer *m_windowSizer;
|
||||
wxWindowBase *m_sizerParent;
|
||||
|
||||
// Layout() window automatically when its size changes?
|
||||
bool m_autoLayout:1;
|
||||
#endif // wxUSE_CONSTRAINTS
|
||||
|
||||
// window state
|
||||
bool m_isShown:1;
|
||||
bool m_isEnabled:1;
|
||||
bool m_isBeingDeleted:1;
|
||||
|
||||
// window attributes
|
||||
long m_windowStyle;
|
||||
wxString m_windowName;
|
||||
|
||||
protected:
|
||||
// common part of all ctors: it is not virtual because it is called from
|
||||
// ctor
|
||||
void InitBase();
|
||||
|
||||
// get the default size for the new window if no explicit size given
|
||||
// FIXME why 20 and not 30, 10 or ...?
|
||||
static int WidthDefault(int w) { return w == -1 ? 20 : w; }
|
||||
static int HeightDefault(int h) { return h == -1 ? 20 : h; }
|
||||
|
||||
// more pure virtual functions
|
||||
// ---------------------------
|
||||
|
||||
// NB: we must have DoSomething() function when Something() is an overloaded
|
||||
// method: indeed, we can't just have "virtual Something()" in case when
|
||||
// the function is overloaded because then we'd have to make virtual all
|
||||
// the variants (otherwise only the virtual function may be called on a
|
||||
// pointer to derived class according to C++ rules) which is, in
|
||||
// general, absolutely not needed. So instead we implement all
|
||||
// overloaded Something()s in terms of DoSomething() which will be the
|
||||
// only one to be virtual.
|
||||
|
||||
// retrieve the position/size of the window
|
||||
virtual void DoGetPosition( int *x, int *y ) const = 0;
|
||||
virtual void DoGetSize( int *width, int *height ) const = 0;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const = 0;
|
||||
|
||||
// this is the virtual function to be overriden in any derived class which
|
||||
// wants to change how SetSize() or Move() works - it is called by all
|
||||
// versions of these functions in the base class
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO) = 0;
|
||||
|
||||
// same as DoSetSize() for the client size
|
||||
virtual void DoSetClientSize(int width, int height) = 0;
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
private:
|
||||
// contains the last id generated by NewControlId
|
||||
static int ms_lastControlId;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// now include the declaration of wxWindow class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/window.h"
|
||||
#include "wx/msw/window.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/window.h"
|
||||
#include "wx/motif/window.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/window.h"
|
||||
#include "wx/gtk/window.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/window.h"
|
||||
#include "wx/qt/window.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/window.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/window.h"
|
||||
#include "wx/mac/window.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// inline functions which couldn't be declared in the class body because of
|
||||
// forward dependencies
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxWindow *wxWindowBase::GetGrandParent() const
|
||||
{
|
||||
return m_parent ? m_parent->GetParent() : (wxWindow *)NULL;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global function
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
extern wxWindow* WXDLLEXPORT wxGetActiveWindow();
|
||||
|
||||
#endif
|
||||
// _WX_WINDOW_H_BASE_
|
||||
|
Reference in New Issue
Block a user