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_
|
#ifndef _WX_CONTROL_H_BASE_
|
||||||
#define _WX_CONTROL_H_BASE_
|
#define _WX_CONTROL_H_BASE_
|
||||||
|
|
||||||
|
// all classes derived from wxControl need the validators
|
||||||
|
#include "wx/validate.h"
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/control.h"
|
#include "wx/msw/control.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
|
@@ -1106,7 +1106,8 @@ typedef int (__stdcall *WXFARPROC)();
|
|||||||
typedef int (*WXFARPROC)();
|
typedef int (*WXFARPROC)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
typedef WXHWND WXWidget;
|
||||||
|
#endif // MSW
|
||||||
|
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
/* Stand-ins for X/Xt/Motif types */
|
/* Stand-ins for X/Xt/Motif types */
|
||||||
@@ -1125,7 +1126,7 @@ typedef void* WXFont;
|
|||||||
typedef void* WXImage;
|
typedef void* WXImage;
|
||||||
typedef void* WXCursor;
|
typedef void* WXCursor;
|
||||||
typedef void* WXFontList;
|
typedef void* WXFontList;
|
||||||
#endif
|
#endif // Motif
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
/* Stand-ins for GLIB types */
|
/* Stand-ins for GLIB types */
|
||||||
@@ -1160,7 +1161,8 @@ typedef struct _GtkAccelGroup GtkAccelGroup;
|
|||||||
typedef struct _GtkItemFactory GtkItemFactory;
|
typedef struct _GtkItemFactory GtkItemFactory;
|
||||||
typedef struct _GtkSelectionData GtkSelectionData;
|
typedef struct _GtkSelectionData GtkSelectionData;
|
||||||
|
|
||||||
#endif
|
typedef GtkWidget *WXWidget;
|
||||||
|
#endif // GTK
|
||||||
|
|
||||||
// This is required because of clashing macros in windows.h, which may be
|
// This is required because of clashing macros in windows.h, which may be
|
||||||
// included before or after wxWindows classes, and therefore must be
|
// included before or after wxWindows classes, and therefore must be
|
||||||
|
@@ -6,14 +6,18 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_GDICMNH__
|
#ifndef _WX_GDICMNH__
|
||||||
#define _WX_GDICMNH__
|
#define _WX_GDICMNH__
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "gdicmn.h"
|
#pragma interface "gdicmn.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
@@ -23,340 +27,309 @@
|
|||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/colour.h"
|
#include "wx/colour.h"
|
||||||
|
|
||||||
// Standard cursors
|
// ---------------------------------------------------------------------------
|
||||||
typedef enum {
|
// forward declarations
|
||||||
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;
|
|
||||||
|
|
||||||
|
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
|
class WXDLLEXPORT wxSize
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
long x;
|
// members are public for compatibility
|
||||||
long y;
|
long x;
|
||||||
inline wxSize() { x = 0; y = 0; }
|
long y;
|
||||||
inline wxSize(long xx, long yy) { x = xx; y = yy; }
|
|
||||||
inline wxSize(const wxSize& sz) { x = sz.x; y = sz.y; }
|
// constructors
|
||||||
inline void operator = (const wxSize& sz) { x = sz.x; y = sz.y; }
|
wxSize() { x = y = 0; }
|
||||||
inline bool operator == (const wxSize& sz) const { return (x == sz.x && y == sz.y); }
|
wxSize(long xx, long yy) { Set(xx, yy); }
|
||||||
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); }
|
// no copy ctor or assignment operator - the defaults are ok
|
||||||
inline void Set(long xx, long yy) { x = xx; y = yy; }
|
|
||||||
inline long GetX() const { return x; }
|
bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; }
|
||||||
inline long GetY() const { return 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
|
class WXDLLEXPORT wxRealPoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double x;
|
double x;
|
||||||
double y;
|
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); }
|
|
||||||
|
|
||||||
inline void operator = (const wxRealPoint& pt) { x = pt.x; y = pt.y; }
|
wxRealPoint() { x = y = 0.0; };
|
||||||
inline bool operator == (const wxRealPoint& pt) const { return (x == pt.x && y == pt.y); }
|
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
|
class WXDLLEXPORT wxPoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#if defined(__WXMSW__) && !defined(__WIN32__)
|
#if defined(__WXMSW__) && !defined(__WIN32__)
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
#else
|
#else
|
||||||
long x;
|
long x;
|
||||||
long y;
|
long y;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline wxPoint() { x = 0; y = 0; };
|
wxPoint() { x = y = 0; };
|
||||||
wxPoint(long the_x, long the_y) { x = the_x; y = the_y; };
|
wxPoint(long xx, long yy) { x = xx; y = yy; };
|
||||||
wxPoint(const wxPoint& pt) { x = pt.x; y = pt.y; };
|
|
||||||
|
|
||||||
inline void operator = (const wxPoint& pt) { x = pt.x; y = pt.y; }
|
// no copy ctor or assignment operator - the defaults are ok
|
||||||
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); }
|
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); }
|
|
||||||
|
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
|
#if WXWIN_COMPATIBILITY
|
||||||
#define wxIntPoint wxPoint
|
#define wxIntPoint wxPoint
|
||||||
#define wxRectangle wxRect
|
#define wxRectangle wxRect
|
||||||
#endif
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// wxRect
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxRect
|
class WXDLLEXPORT wxRect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRect() ;
|
wxRect();
|
||||||
wxRect(long x, long y, long w, long h);
|
wxRect(long x, long y, long w, long h);
|
||||||
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||||
wxRect(const wxPoint& pos, const wxSize& size);
|
wxRect(const wxPoint& pos, const wxSize& size);
|
||||||
wxRect(const wxRect& rect);
|
wxRect(const wxRect& rect);
|
||||||
|
|
||||||
inline long GetX() const { return x; }
|
long GetX() const { return x; }
|
||||||
inline void SetX(long X) { x = X; }
|
void SetX(long xx) { x = xx; }
|
||||||
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; }
|
|
||||||
|
|
||||||
inline wxPoint GetPosition() { return wxPoint(x, y); }
|
long GetY() const { return y; }
|
||||||
inline wxSize GetSize() { return wxSize(width, height); }
|
void SetY(long yy) { y = yy; }
|
||||||
|
|
||||||
inline long GetLeft() const { return x; }
|
long GetWidth() const { return width; }
|
||||||
inline long GetTop() const { return y; }
|
void SetWidth(long w) { width = w; }
|
||||||
inline long GetBottom() const { return y + height; }
|
|
||||||
inline long GetRight() const { return x + width; }
|
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:
|
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
|
// Management of pens, brushes and fonts
|
||||||
class WXDLLEXPORT wxPenList: public wxList
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxPenList : public wxList
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxPenList)
|
DECLARE_DYNAMIC_CLASS(wxPenList)
|
||||||
public:
|
|
||||||
inline wxPenList()
|
public:
|
||||||
{ }
|
wxPenList() { }
|
||||||
~wxPenList();
|
~wxPenList();
|
||||||
void AddPen(wxPen *pen);
|
|
||||||
void RemovePen(wxPen *pen);
|
void AddPen(wxPen *pen);
|
||||||
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
|
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)
|
DECLARE_DYNAMIC_CLASS(wxBrushList)
|
||||||
public:
|
|
||||||
inline wxBrushList()
|
public:
|
||||||
{ }
|
wxBrushList() { }
|
||||||
~wxBrushList();
|
~wxBrushList();
|
||||||
void AddBrush(wxBrush *brush);
|
|
||||||
void RemoveBrush(wxBrush *brush);
|
void AddBrush(wxBrush *brush);
|
||||||
wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
|
void RemoveBrush(wxBrush *brush);
|
||||||
|
wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
|
||||||
};
|
};
|
||||||
|
|
||||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||||
|
|
||||||
class WXDLLEXPORT wxFontList: public wxList
|
class WXDLLEXPORT wxFontList : public wxList
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxFontList)
|
DECLARE_DYNAMIC_CLASS(wxFontList)
|
||||||
public:
|
|
||||||
inline wxFontList()
|
public:
|
||||||
{ }
|
wxFontList() { }
|
||||||
~wxFontList();
|
~wxFontList();
|
||||||
void AddFont(wxFont *font);
|
|
||||||
void RemoveFont(wxFont *font);
|
void AddFont(wxFont *font);
|
||||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
void RemoveFont(wxFont *font);
|
||||||
bool underline = FALSE, const wxString& face = wxEmptyString);
|
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)
|
DECLARE_CLASS(wxColourDatabase)
|
||||||
public:
|
|
||||||
wxColourDatabase(int type);
|
public:
|
||||||
~wxColourDatabase() ;
|
wxColourDatabase(int type);
|
||||||
// Not const because it may add a name to the database
|
~wxColourDatabase() ;
|
||||||
wxColour *FindColour(const wxString& colour) ;
|
|
||||||
wxString FindName(const wxColour& colour) const;
|
// Not const because it may add a name to the database
|
||||||
void Initialize();
|
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)
|
DECLARE_DYNAMIC_CLASS(wxBitmapList)
|
||||||
public:
|
|
||||||
wxBitmapList();
|
|
||||||
~wxBitmapList();
|
|
||||||
|
|
||||||
void AddBitmap(wxBitmap *bitmap);
|
public:
|
||||||
void RemoveBitmap(wxBitmap *bitmap);
|
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
|
class WXDLLEXPORT wxResourceCache: public wxList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -368,5 +341,100 @@ private:
|
|||||||
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
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
|
#endif
|
||||||
// _WX_GDICMNH__
|
// _WX_GDICMNH__
|
||||||
|
@@ -611,9 +611,9 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
|||||||
|
|
||||||
// We have to hand down a few functions
|
// We have to hand down a few functions
|
||||||
|
|
||||||
void SetBackgroundColour( const wxColour &colour );
|
bool SetBackgroundColour( const wxColour &colour );
|
||||||
void SetForegroundColour( const wxColour &colour );
|
bool SetForegroundColour( const wxColour &colour );
|
||||||
void SetFont( const wxFont &font );
|
bool SetFont( const wxFont &font );
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
void SetDropTarget( wxDropTarget *dropTarget )
|
void SetDropTarget( wxDropTarget *dropTarget )
|
||||||
@@ -622,14 +622,12 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
|||||||
{ return m_mainWin->GetDropTarget(); }
|
{ return m_mainWin->GetDropTarget(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SetCursor( const wxCursor &cursor )
|
bool SetCursor( const wxCursor &cursor )
|
||||||
{ if (m_mainWin) m_mainWin->wxWindow::SetCursor( cursor); }
|
{ return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE; }
|
||||||
wxColour GetBackgroundColour() const
|
wxColour GetBackgroundColour() const
|
||||||
{ if (m_mainWin) return m_mainWin->GetBackgroundColour();
|
{ return m_mainWin ? m_mainWin->GetBackgroundColour() : wxColour(); }
|
||||||
else return wxColour(); }
|
|
||||||
wxColour GetForegroundColour() const
|
wxColour GetForegroundColour() const
|
||||||
{ if (m_mainWin) return m_mainWin->GetForegroundColour();
|
{ return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour(); }
|
||||||
else return wxColour(); }
|
|
||||||
bool PopupMenu( wxMenu *menu, int x, int y )
|
bool PopupMenu( wxMenu *menu, int x, int y )
|
||||||
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
||||||
void SetFocus()
|
void SetFocus()
|
||||||
|
@@ -120,7 +120,7 @@ public:
|
|||||||
wxString GetTabText(int id) const;
|
wxString GetTabText(int id) const;
|
||||||
|
|
||||||
// Layout tabs (optional, e.g. if resizing window)
|
// Layout tabs (optional, e.g. if resizing window)
|
||||||
void Layout(void);
|
void LayoutTabs();
|
||||||
|
|
||||||
// Draw all tabs
|
// Draw all tabs
|
||||||
virtual void Draw(wxDC& dc);
|
virtual void Draw(wxDC& dc);
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
void SetBitmapLabel( const wxBitmap& bitmap );
|
void SetBitmapLabel( const wxBitmap& bitmap );
|
||||||
void SetBitmapSelected( const wxBitmap& bitmap );
|
void SetBitmapSelected( const wxBitmap& bitmap );
|
||||||
|
|
||||||
virtual void Enable(const bool);
|
virtual bool Enable(const bool);
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ class wxButton: public wxControl
|
|||||||
const wxString& name = wxButtonNameStr);
|
const wxString& name = wxButtonNameStr);
|
||||||
void SetDefault();
|
void SetDefault();
|
||||||
void SetLabel( const wxString &label );
|
void SetLabel( const wxString &label );
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ public:
|
|||||||
bool GetValue() const;
|
bool GetValue() const;
|
||||||
|
|
||||||
void SetLabel( const wxString& label );
|
void SetLabel( const wxString& label );
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
@@ -87,6 +87,9 @@ public:
|
|||||||
virtual void Maximize() { }
|
virtual void Maximize() { }
|
||||||
virtual void Restore() { }
|
virtual void Restore() { }
|
||||||
|
|
||||||
|
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||||
|
int GetReturnCode() const { return m_returnCode; }
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||||
@@ -105,6 +108,8 @@ protected:
|
|||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int m_returnCode;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -58,8 +58,8 @@ public:
|
|||||||
wxFont( const wxFont& font );
|
wxFont( const wxFont& font );
|
||||||
~wxFont();
|
~wxFont();
|
||||||
wxFont& operator = ( const wxFont& font );
|
wxFont& operator = ( const wxFont& font );
|
||||||
bool operator == ( const wxFont& font );
|
bool operator == ( const wxFont& font ) const;
|
||||||
bool operator != ( const wxFont& font );
|
bool operator != ( const wxFont& font ) const;
|
||||||
bool Ok() const;
|
bool Ok() const;
|
||||||
|
|
||||||
int GetPointSize() const;
|
int GetPointSize() const;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// 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 n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||||
int majorDim = 1, long style = wxRA_HORIZONTAL,
|
int majorDim = 1, long style = wxRA_HORIZONTAL,
|
||||||
const wxValidator& val = wxDefaultValidator,
|
const wxValidator& val = wxDefaultValidator,
|
||||||
const wxString& name = wxRadioBoxNameStr )
|
const wxString& name = wxRadioBoxNameStr )
|
||||||
{
|
{
|
||||||
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
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 n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||||
const wxValidator& val = wxDefaultValidator,
|
const wxValidator& val = wxDefaultValidator,
|
||||||
const wxString& name = wxRadioBoxNameStr );
|
const wxString& name = wxRadioBoxNameStr );
|
||||||
int FindString( const wxString& s) const;
|
int FindString( const wxString& s) const;
|
||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
int GetSelection(void) const;
|
int GetSelection(void) const;
|
||||||
@@ -70,7 +70,7 @@ class wxRadioBox: public wxControl
|
|||||||
void SetLabel( int item, wxBitmap *bitmap );
|
void SetLabel( int item, wxBitmap *bitmap );
|
||||||
wxString GetLabel( int item ) const;
|
wxString GetLabel( int item ) const;
|
||||||
bool Show( bool show );
|
bool Show( bool show );
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
void Enable( int item, bool enable );
|
void Enable( int item, bool enable );
|
||||||
void Show( int item, bool show );
|
void Show( int item, bool show );
|
||||||
virtual wxString GetStringSelection(void) const;
|
virtual wxString GetStringSelection(void) const;
|
||||||
|
@@ -60,7 +60,7 @@ class wxRadioButton: public wxControl
|
|||||||
virtual void SetLabel(const wxString& label);
|
virtual void SetLabel(const wxString& label);
|
||||||
virtual void SetValue(bool val);
|
virtual void SetValue(bool val);
|
||||||
virtual bool GetValue(void) const;
|
virtual bool GetValue(void) const;
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -143,9 +143,9 @@ class wxTextCtrl: public wxControl
|
|||||||
wxTextCtrl& operator<<(const char c);
|
wxTextCtrl& operator<<(const char c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SetFont( const wxFont &font );
|
bool SetFont( const wxFont &font );
|
||||||
void SetForegroundColour(const wxColour &colour);
|
bool SetForegroundColour(const wxColour &colour);
|
||||||
void SetBackgroundColour(const wxColour &colour);
|
bool SetBackgroundColour(const wxColour &colour);
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -15,94 +15,17 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#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)
|
// callback definition for inserting a window (internal)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
|
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
|
// wxWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxWindow : public wxEvtHandler
|
class wxWindow : public wxWindowBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxWindow)
|
DECLARE_DYNAMIC_CLASS(wxWindow)
|
||||||
|
|
||||||
@@ -110,300 +33,111 @@ public:
|
|||||||
// creating the window
|
// creating the window
|
||||||
// -------------------
|
// -------------------
|
||||||
wxWindow();
|
wxWindow();
|
||||||
wxWindow(wxWindow *parent, wxWindowID id,
|
wxWindow(wxWindow *parent,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
wxWindowID id,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
long style = 0,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxString& name = wxPanelNameStr);
|
long style = 0,
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
const wxString& name = wxPanelNameStr);
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
bool Create(wxWindow *parent,
|
||||||
const wxSize& size = wxDefaultSize,
|
wxWindowID id,
|
||||||
long style = 0,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxString& name = wxPanelNameStr);
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPanelNameStr);
|
||||||
virtual ~wxWindow();
|
virtual ~wxWindow();
|
||||||
|
|
||||||
#if wxUSE_WX_RESOURCES
|
// implement base class (pure) virtual methods
|
||||||
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 );
|
|
||||||
virtual bool Destroy();
|
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 Raise();
|
||||||
virtual void Lower();
|
virtual void Lower();
|
||||||
|
|
||||||
virtual bool IsRetained();
|
virtual bool Show( bool show = TRUE );
|
||||||
virtual wxWindow *FindWindow( long id );
|
virtual bool Enable( bool enable = TRUE );
|
||||||
virtual wxWindow *FindWindow( const wxString& name );
|
|
||||||
|
|
||||||
void AllowDoubleClick( bool WXUNUSED(allow) ) { }
|
virtual bool IsRetained() const;
|
||||||
void SetDoubleClick( bool WXUNUSED(allow) ) { }
|
|
||||||
|
|
||||||
virtual void ClientToScreen( int *x, int *y );
|
virtual void SetFocus();
|
||||||
virtual void ScreenToClient( int *x, int *y );
|
virtual bool AcceptsFocus() const;
|
||||||
|
|
||||||
virtual bool Validate();
|
virtual bool Reparent( wxWindow *newParent );
|
||||||
virtual bool TransferDataToWindow();
|
|
||||||
virtual bool TransferDataFromWindow();
|
virtual void WarpPointer(int x, int y);
|
||||||
void OnInitDialog( wxInitDialogEvent &event );
|
virtual void CaptureMouse();
|
||||||
virtual void InitDialog();
|
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 );
|
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,
|
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 void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||||
virtual int GetScrollPos( int orient ) const;
|
virtual int GetScrollPos( int orient ) const;
|
||||||
virtual int GetScrollThumb( int orient ) const;
|
virtual int GetScrollThumb( int orient ) const;
|
||||||
virtual int GetScrollRange( 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;
|
#if wxUSE_DRAG_AND_DROP
|
||||||
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
void UpdateWindowUI();
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
// implementation
|
// 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
|
/* 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
|
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 );
|
const wxSize &size, long style, const wxString &name );
|
||||||
void PostCreation();
|
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
|
/* the methods below are required because many native widgets
|
||||||
are composed of several subwidgets and setting a style for
|
are composed of several subwidgets and setting a style for
|
||||||
the widget means setting it for all subwidgets as well.
|
the widget means setting it for all subwidgets as well.
|
||||||
@@ -437,107 +174,57 @@ public:
|
|||||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#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;
|
protected:
|
||||||
wxList m_children;
|
// position and size of the window
|
||||||
int m_x,m_y;
|
int m_x, m_y;
|
||||||
int m_width,m_height;
|
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;
|
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
// see the docs in src/gtk/window.cpp
|
||||||
wxToolTip *m_toolTip;
|
|
||||||
#endif // wxUSE_TOOLTIPS
|
|
||||||
|
|
||||||
GtkWidget *m_widget;
|
|
||||||
GtkWidget *m_wxwindow;
|
GtkWidget *m_wxwindow;
|
||||||
|
|
||||||
|
// scrolling stuff
|
||||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||||
float m_oldHorizontalPos;
|
float m_oldHorizontalPos,
|
||||||
float m_oldVerticalPos;
|
m_oldVerticalPos;
|
||||||
bool m_needParent; /* ! wxFrame, wxDialog, wxNotebookPage ? */
|
|
||||||
bool m_hasScrolling;
|
|
||||||
bool m_isScrolling;
|
|
||||||
bool m_hasVMT;
|
|
||||||
bool m_sizeSet;
|
|
||||||
bool m_resizing;
|
|
||||||
GdkGC *m_scrollGC;
|
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;
|
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;
|
wxInsertChildFunction m_insertCallback;
|
||||||
|
|
||||||
public:
|
// implement the base class pure virtuals
|
||||||
|
virtual void DoGetPosition( int *x, int *y ) const;
|
||||||
wxLayoutConstraints *m_constraints;
|
virtual void DoGetSize( int *width, int *height ) const;
|
||||||
wxList *m_constraintsInvolvedIn;
|
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||||
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
|
|
||||||
virtual void DoSetSize(int x, int y,
|
virtual void DoSetSize(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
// same as DoSetSize() for the client size
|
|
||||||
virtual void DoSetClientSize(int width, int height);
|
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:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
void SetBitmapLabel( const wxBitmap& bitmap );
|
void SetBitmapLabel( const wxBitmap& bitmap );
|
||||||
void SetBitmapSelected( const wxBitmap& bitmap );
|
void SetBitmapSelected( const wxBitmap& bitmap );
|
||||||
|
|
||||||
virtual void Enable(const bool);
|
virtual bool Enable(const bool);
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ class wxButton: public wxControl
|
|||||||
const wxString& name = wxButtonNameStr);
|
const wxString& name = wxButtonNameStr);
|
||||||
void SetDefault();
|
void SetDefault();
|
||||||
void SetLabel( const wxString &label );
|
void SetLabel( const wxString &label );
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ public:
|
|||||||
bool GetValue() const;
|
bool GetValue() const;
|
||||||
|
|
||||||
void SetLabel( const wxString& label );
|
void SetLabel( const wxString& label );
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
void ApplyWidgetStyle();
|
void ApplyWidgetStyle();
|
||||||
|
@@ -87,6 +87,9 @@ public:
|
|||||||
virtual void Maximize() { }
|
virtual void Maximize() { }
|
||||||
virtual void Restore() { }
|
virtual void Restore() { }
|
||||||
|
|
||||||
|
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
|
||||||
|
int GetReturnCode() const { return m_returnCode; }
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
virtual void GtkOnSize( int x, int y, int width, int height );
|
virtual void GtkOnSize( int x, int y, int width, int height );
|
||||||
@@ -105,6 +108,8 @@ protected:
|
|||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int m_returnCode;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -58,8 +58,8 @@ public:
|
|||||||
wxFont( const wxFont& font );
|
wxFont( const wxFont& font );
|
||||||
~wxFont();
|
~wxFont();
|
||||||
wxFont& operator = ( const wxFont& font );
|
wxFont& operator = ( const wxFont& font );
|
||||||
bool operator == ( const wxFont& font );
|
bool operator == ( const wxFont& font ) const;
|
||||||
bool operator != ( const wxFont& font );
|
bool operator != ( const wxFont& font ) const;
|
||||||
bool Ok() const;
|
bool Ok() const;
|
||||||
|
|
||||||
int GetPointSize() const;
|
int GetPointSize() const;
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// 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 n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||||
int majorDim = 1, long style = wxRA_HORIZONTAL,
|
int majorDim = 1, long style = wxRA_HORIZONTAL,
|
||||||
const wxValidator& val = wxDefaultValidator,
|
const wxValidator& val = wxDefaultValidator,
|
||||||
const wxString& name = wxRadioBoxNameStr )
|
const wxString& name = wxRadioBoxNameStr )
|
||||||
{
|
{
|
||||||
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
|
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 n = 0, const wxString choices[] = (const wxString *) NULL,
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||||
const wxValidator& val = wxDefaultValidator,
|
const wxValidator& val = wxDefaultValidator,
|
||||||
const wxString& name = wxRadioBoxNameStr );
|
const wxString& name = wxRadioBoxNameStr );
|
||||||
int FindString( const wxString& s) const;
|
int FindString( const wxString& s) const;
|
||||||
void SetSelection( int n );
|
void SetSelection( int n );
|
||||||
int GetSelection(void) const;
|
int GetSelection(void) const;
|
||||||
@@ -70,7 +70,7 @@ class wxRadioBox: public wxControl
|
|||||||
void SetLabel( int item, wxBitmap *bitmap );
|
void SetLabel( int item, wxBitmap *bitmap );
|
||||||
wxString GetLabel( int item ) const;
|
wxString GetLabel( int item ) const;
|
||||||
bool Show( bool show );
|
bool Show( bool show );
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
void Enable( int item, bool enable );
|
void Enable( int item, bool enable );
|
||||||
void Show( int item, bool show );
|
void Show( int item, bool show );
|
||||||
virtual wxString GetStringSelection(void) const;
|
virtual wxString GetStringSelection(void) const;
|
||||||
|
@@ -60,7 +60,7 @@ class wxRadioButton: public wxControl
|
|||||||
virtual void SetLabel(const wxString& label);
|
virtual void SetLabel(const wxString& label);
|
||||||
virtual void SetValue(bool val);
|
virtual void SetValue(bool val);
|
||||||
virtual bool GetValue(void) const;
|
virtual bool GetValue(void) const;
|
||||||
void Enable( bool enable );
|
bool Enable( bool enable );
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -143,9 +143,9 @@ class wxTextCtrl: public wxControl
|
|||||||
wxTextCtrl& operator<<(const char c);
|
wxTextCtrl& operator<<(const char c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SetFont( const wxFont &font );
|
bool SetFont( const wxFont &font );
|
||||||
void SetForegroundColour(const wxColour &colour);
|
bool SetForegroundColour(const wxColour &colour);
|
||||||
void SetBackgroundColour(const wxColour &colour);
|
bool SetBackgroundColour(const wxColour &colour);
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
|
@@ -15,94 +15,17 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#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)
|
// callback definition for inserting a window (internal)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
|
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
|
// wxWindow
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxWindow : public wxEvtHandler
|
class wxWindow : public wxWindowBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxWindow)
|
DECLARE_DYNAMIC_CLASS(wxWindow)
|
||||||
|
|
||||||
@@ -110,300 +33,111 @@ public:
|
|||||||
// creating the window
|
// creating the window
|
||||||
// -------------------
|
// -------------------
|
||||||
wxWindow();
|
wxWindow();
|
||||||
wxWindow(wxWindow *parent, wxWindowID id,
|
wxWindow(wxWindow *parent,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
wxWindowID id,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
long style = 0,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxString& name = wxPanelNameStr);
|
long style = 0,
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
const wxString& name = wxPanelNameStr);
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
bool Create(wxWindow *parent,
|
||||||
const wxSize& size = wxDefaultSize,
|
wxWindowID id,
|
||||||
long style = 0,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxString& name = wxPanelNameStr);
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& name = wxPanelNameStr);
|
||||||
virtual ~wxWindow();
|
virtual ~wxWindow();
|
||||||
|
|
||||||
#if wxUSE_WX_RESOURCES
|
// implement base class (pure) virtual methods
|
||||||
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 );
|
|
||||||
virtual bool Destroy();
|
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 Raise();
|
||||||
virtual void Lower();
|
virtual void Lower();
|
||||||
|
|
||||||
virtual bool IsRetained();
|
virtual bool Show( bool show = TRUE );
|
||||||
virtual wxWindow *FindWindow( long id );
|
virtual bool Enable( bool enable = TRUE );
|
||||||
virtual wxWindow *FindWindow( const wxString& name );
|
|
||||||
|
|
||||||
void AllowDoubleClick( bool WXUNUSED(allow) ) { }
|
virtual bool IsRetained() const;
|
||||||
void SetDoubleClick( bool WXUNUSED(allow) ) { }
|
|
||||||
|
|
||||||
virtual void ClientToScreen( int *x, int *y );
|
virtual void SetFocus();
|
||||||
virtual void ScreenToClient( int *x, int *y );
|
virtual bool AcceptsFocus() const;
|
||||||
|
|
||||||
virtual bool Validate();
|
virtual bool Reparent( wxWindow *newParent );
|
||||||
virtual bool TransferDataToWindow();
|
|
||||||
virtual bool TransferDataFromWindow();
|
virtual void WarpPointer(int x, int y);
|
||||||
void OnInitDialog( wxInitDialogEvent &event );
|
virtual void CaptureMouse();
|
||||||
virtual void InitDialog();
|
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 );
|
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,
|
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 void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||||
virtual int GetScrollPos( int orient ) const;
|
virtual int GetScrollPos( int orient ) const;
|
||||||
virtual int GetScrollThumb( int orient ) const;
|
virtual int GetScrollThumb( int orient ) const;
|
||||||
virtual int GetScrollRange( 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;
|
#if wxUSE_DRAG_AND_DROP
|
||||||
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
void UpdateWindowUI();
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
// implementation
|
// 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
|
/* 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
|
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 );
|
const wxSize &size, long style, const wxString &name );
|
||||||
void PostCreation();
|
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
|
/* the methods below are required because many native widgets
|
||||||
are composed of several subwidgets and setting a style for
|
are composed of several subwidgets and setting a style for
|
||||||
the widget means setting it for all subwidgets as well.
|
the widget means setting it for all subwidgets as well.
|
||||||
@@ -437,107 +174,57 @@ public:
|
|||||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#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;
|
protected:
|
||||||
wxList m_children;
|
// position and size of the window
|
||||||
int m_x,m_y;
|
int m_x, m_y;
|
||||||
int m_width,m_height;
|
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;
|
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
// see the docs in src/gtk/window.cpp
|
||||||
wxToolTip *m_toolTip;
|
|
||||||
#endif // wxUSE_TOOLTIPS
|
|
||||||
|
|
||||||
GtkWidget *m_widget;
|
|
||||||
GtkWidget *m_wxwindow;
|
GtkWidget *m_wxwindow;
|
||||||
|
|
||||||
|
// scrolling stuff
|
||||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||||
float m_oldHorizontalPos;
|
float m_oldHorizontalPos,
|
||||||
float m_oldVerticalPos;
|
m_oldVerticalPos;
|
||||||
bool m_needParent; /* ! wxFrame, wxDialog, wxNotebookPage ? */
|
|
||||||
bool m_hasScrolling;
|
|
||||||
bool m_isScrolling;
|
|
||||||
bool m_hasVMT;
|
|
||||||
bool m_sizeSet;
|
|
||||||
bool m_resizing;
|
|
||||||
GdkGC *m_scrollGC;
|
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;
|
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;
|
wxInsertChildFunction m_insertCallback;
|
||||||
|
|
||||||
public:
|
// implement the base class pure virtuals
|
||||||
|
virtual void DoGetPosition( int *x, int *y ) const;
|
||||||
wxLayoutConstraints *m_constraints;
|
virtual void DoGetSize( int *width, int *height ) const;
|
||||||
wxList *m_constraintsInvolvedIn;
|
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||||
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
|
|
||||||
virtual void DoSetSize(int x, int y,
|
virtual void DoSetSize(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
// same as DoSetSize() for the client size
|
|
||||||
virtual void DoSetClientSize(int width, int height);
|
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:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -12,150 +12,192 @@
|
|||||||
#ifndef _WX_LAYOUTH__
|
#ifndef _WX_LAYOUTH__
|
||||||
#define _WX_LAYOUTH__
|
#define _WX_LAYOUTH__
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "layout.h"
|
#pragma interface "layout.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxWindow;
|
|
||||||
|
|
||||||
// X stupidly defines these in X.h
|
// X stupidly defines these in X.h
|
||||||
#ifdef Above
|
#ifdef Above
|
||||||
#undef Above
|
#undef Above
|
||||||
#endif
|
#endif
|
||||||
#ifdef Below
|
#ifdef Below
|
||||||
#undef Below
|
#undef Below
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// forward declrations
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxWindowBase;
|
||||||
|
class WXDLLEXPORT wxLayoutConstraints;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define wxLAYOUT_DEFAULT_MARGIN 0
|
#define wxLAYOUT_DEFAULT_MARGIN 0
|
||||||
|
|
||||||
enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
|
enum wxEdge
|
||||||
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
|
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxIndividualLayoutConstraint)
|
wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
|
||||||
|
wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxLayoutConstraints: public wxObject
|
enum wxRelationship
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxLayoutConstraints)
|
wxUnconstrained = 0,
|
||||||
|
wxAsIs,
|
||||||
public:
|
wxPercentOf,
|
||||||
// Edge constraints
|
wxAbove,
|
||||||
wxIndividualLayoutConstraint left;
|
wxBelow,
|
||||||
wxIndividualLayoutConstraint top;
|
wxLeftOf,
|
||||||
wxIndividualLayoutConstraint right;
|
wxRightOf,
|
||||||
wxIndividualLayoutConstraint bottom;
|
wxSameAs,
|
||||||
// Size constraints
|
wxAbsolute
|
||||||
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();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
class WXDLLEXPORT wxSizer : public wxWindow
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSizer)
|
DECLARE_DYNAMIC_CLASS(wxSizer)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxSizerBehaviour sizerBehaviour;
|
wxSizerBehaviour sizerBehaviour;
|
||||||
@@ -227,10 +260,10 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
wxSizer();
|
wxSizer();
|
||||||
wxSizer(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
|
wxSizer(wxWindowBase *parent, wxSizerBehaviour behav = wxSizerNone);
|
||||||
~wxSizer();
|
~wxSizer();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxSizerBehaviour behav = wxSizerNone);
|
bool Create(wxWindowBase *parent, wxSizerBehaviour behav = wxSizerNone);
|
||||||
|
|
||||||
virtual void GetSize(int *w, int *h) const;
|
virtual void GetSize(int *w, int *h) const;
|
||||||
|
|
||||||
@@ -245,8 +278,8 @@ public:
|
|||||||
int GetBorderX() { return borderX ; }
|
int GetBorderX() { return borderX ; }
|
||||||
int GetBorderY() { return borderY ; }
|
int GetBorderY() { return borderY ; }
|
||||||
|
|
||||||
virtual void AddSizerChild(wxWindow *child);
|
virtual void AddSizerChild(wxWindowBase *child);
|
||||||
virtual void RemoveSizerChild(wxWindow *child);
|
virtual void RemoveSizerChild(wxWindowBase *child);
|
||||||
|
|
||||||
virtual void SetBehaviour(wxSizerBehaviour b) { sizerBehaviour = b; }
|
virtual void SetBehaviour(wxSizerBehaviour b) { sizerBehaviour = b; }
|
||||||
virtual wxSizerBehaviour GetBehaviour() { return sizerBehaviour; }
|
virtual wxSizerBehaviour GetBehaviour() { return sizerBehaviour; }
|
||||||
@@ -265,7 +298,7 @@ protected:
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRowColSizer : public wxSizer
|
class WXDLLEXPORT wxRowColSizer : public wxSizer
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRowColSizer)
|
DECLARE_DYNAMIC_CLASS(wxRowColSizer)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool rowOrCol;
|
bool rowOrCol;
|
||||||
@@ -276,11 +309,11 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// rowOrCol = TRUE to be laid out in rows, otherwise in columns.
|
// rowOrCol = TRUE to be laid out in rows, otherwise in columns.
|
||||||
wxRowColSizer();
|
wxRowColSizer();
|
||||||
wxRowColSizer(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS,
|
wxRowColSizer(wxWindowBase *parent, bool rowOrCol = wxSIZER_ROWS,
|
||||||
int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
|
int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
|
||||||
~wxRowColSizer();
|
~wxRowColSizer();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, bool rowOrCol = wxSIZER_ROWS,
|
bool Create(wxWindowBase *parent, bool rowOrCol = wxSIZER_ROWS,
|
||||||
int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
|
int rowsOrColSize = 20, wxSizerBehaviour = wxSizerShrink);
|
||||||
|
|
||||||
virtual void SetRowOrCol(bool rc) { rowOrCol = rc; }
|
virtual void SetRowOrCol(bool rc) { rowOrCol = rc; }
|
||||||
@@ -296,17 +329,25 @@ public:
|
|||||||
|
|
||||||
class WXDLLEXPORT wxSpacingSizer : public wxSizer
|
class WXDLLEXPORT wxSpacingSizer : public wxSizer
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpacingSizer)
|
DECLARE_DYNAMIC_CLASS(wxSpacingSizer)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSpacingSizer();
|
wxSpacingSizer();
|
||||||
wxSpacingSizer(wxWindow *parent, wxRelationship rel, wxWindow *other, int spacing);
|
wxSpacingSizer(wxWindowBase *parent, wxRelationship rel, wxWindowBase *other, int spacing);
|
||||||
wxSpacingSizer(wxWindow *parent);
|
wxSpacingSizer(wxWindowBase *parent);
|
||||||
~wxSpacingSizer();
|
~wxSpacingSizer();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxRelationship rel, wxWindow *other, int sp);
|
bool Create(wxWindowBase *parent, wxRelationship rel, wxWindowBase *other, int sp);
|
||||||
bool Create(wxWindow *parent);
|
bool Create(wxWindowBase *parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// global functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY
|
||||||
|
extern bool WXDLLEXPORT wxOldDoLayout(wxWindowBase *win);
|
||||||
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_LAYOUTH__
|
// _WX_LAYOUTH__
|
||||||
|
@@ -142,7 +142,7 @@ public:
|
|||||||
|
|
||||||
virtual ~wxNodeBase();
|
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; }
|
const wxChar *GetKeyString() const { return m_key.string; }
|
||||||
long GetKeyInteger() const { return m_key.integer; }
|
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
|
// 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
|
// which don't take any space (everything is inline), but bring compile
|
||||||
// time error checking.
|
// 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 *); \
|
typedef int (*wxSortFuncFor_##name)(const T *, const T *); \
|
||||||
\
|
\
|
||||||
class WXDLLEXPORT nodetype : public wxNodeBase \
|
class WXDLLEXPORT nodetype : public wxNodeBase \
|
||||||
@@ -390,11 +398,11 @@ private:
|
|||||||
return node ? (T*)(node->GetData()) : (T*)NULL; \
|
return node ? (T*)(node->GetData()) : (T*)NULL; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
nodetype *Append(T *object) \
|
nodetype *Append(Tbase *object) \
|
||||||
{ return (nodetype *)wxListBase::Append(object); } \
|
{ return (nodetype *)wxListBase::Append(object); } \
|
||||||
nodetype *Insert(T *object) \
|
nodetype *Insert(Tbase *object) \
|
||||||
{ return (nodetype *)Insert((nodetype*)NULL, 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); } \
|
{ return (nodetype *)wxListBase::Insert(prev, object); } \
|
||||||
\
|
\
|
||||||
nodetype *Append(long key, void *object) \
|
nodetype *Append(long key, void *object) \
|
||||||
@@ -406,16 +414,16 @@ private:
|
|||||||
{ return (nodetype *)wxListBase::DetachNode(node); } \
|
{ return (nodetype *)wxListBase::DetachNode(node); } \
|
||||||
bool DeleteNode(nodetype *node) \
|
bool DeleteNode(nodetype *node) \
|
||||||
{ return wxListBase::DeleteNode(node); } \
|
{ return wxListBase::DeleteNode(node); } \
|
||||||
bool DeleteObject(T *object) \
|
bool DeleteObject(Tbase *object) \
|
||||||
{ return wxListBase::DeleteObject(object); } \
|
{ return wxListBase::DeleteObject(object); } \
|
||||||
\
|
\
|
||||||
nodetype *Find(T *object) const \
|
nodetype *Find(Tbase *object) const \
|
||||||
{ return (nodetype *)wxListBase::Find(object); } \
|
{ return (nodetype *)wxListBase::Find(object); } \
|
||||||
\
|
\
|
||||||
virtual nodetype *Find(const wxListKey& key) const \
|
virtual nodetype *Find(const wxListKey& key) const \
|
||||||
{ return (nodetype *)wxListBase::Find(key); } \
|
{ return (nodetype *)wxListBase::Find(key); } \
|
||||||
\
|
\
|
||||||
int IndexOf( T *object ) const \
|
int IndexOf(Tbase *object) const \
|
||||||
{ return wxListBase::IndexOf(object); } \
|
{ return wxListBase::IndexOf(object); } \
|
||||||
\
|
\
|
||||||
void Sort(wxSortFuncFor_##name func) \
|
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) \
|
#define WX_DECLARE_LIST(elementtype, listname) \
|
||||||
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
|
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
|
||||||
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node)
|
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
|
#ifdef wxLIST_COMPATIBILITY
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@@ -158,7 +158,7 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Lay the tools out
|
// Lay the tools out
|
||||||
virtual void Layout(void);
|
virtual void LayoutTools();
|
||||||
|
|
||||||
// Add all the buttons: required for Win95.
|
// Add all the buttons: required for Win95.
|
||||||
virtual bool CreateTools(void) { return TRUE; }
|
virtual bool CreateTools(void) { return TRUE; }
|
||||||
|
@@ -62,10 +62,10 @@ class WXDLLEXPORT wxToolBarSimple : public wxToolBarBase
|
|||||||
|
|
||||||
virtual void SpringUpButton(int index);
|
virtual void SpringUpButton(int index);
|
||||||
|
|
||||||
void Layout(void);
|
virtual void LayoutTools();
|
||||||
|
|
||||||
// The post-tool-addition call
|
// The post-tool-addition call
|
||||||
bool Realize() { Layout(); return TRUE; };
|
virtual bool Realize() { LayoutTools(); return TRUE; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_currentRowsOrColumns;
|
int m_currentRowsOrColumns;
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "wx/event.h"
|
#include "wx/event.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxWindow;
|
class WXDLLEXPORT wxWindowBase;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A validator has up to three purposes:
|
A validator has up to three purposes:
|
||||||
@@ -36,7 +36,7 @@ class WXDLLEXPORT wxValidator : public wxEvtHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxValidator();
|
wxValidator();
|
||||||
~wxValidator();
|
virtual ~wxValidator();
|
||||||
|
|
||||||
// Make a clone of this validator (or return NULL) - currently necessary
|
// Make a clone of this validator (or return NULL) - currently necessary
|
||||||
// if you're passing a reference to a validator.
|
// if you're passing a reference to a validator.
|
||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
// Called when the value in the window must be validated.
|
// Called when the value in the window must be validated.
|
||||||
// This function can pop up an error message.
|
// 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
|
// Called to transfer data to the window
|
||||||
virtual bool TransferToWindow() { return FALSE; }
|
virtual bool TransferToWindow() { return FALSE; }
|
||||||
@@ -58,8 +58,8 @@ public:
|
|||||||
virtual bool TransferFromWindow() { return FALSE; };
|
virtual bool TransferFromWindow() { return FALSE; };
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
wxWindow *GetWindow() const { return m_validatorWindow; }
|
wxWindowBase *GetWindow() const { return m_validatorWindow; }
|
||||||
void SetWindow(wxWindow *win) { m_validatorWindow = win; }
|
void SetWindow(wxWindowBase *win) { m_validatorWindow = win; }
|
||||||
|
|
||||||
// validators beep by default if invalid key is pressed, these functions
|
// validators beep by default if invalid key is pressed, these functions
|
||||||
// allow to change it
|
// allow to change it
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
static void SetBellOnError(bool doIt = TRUE) { ms_isSilent = doIt; }
|
static void SetBellOnError(bool doIt = TRUE) { ms_isSilent = doIt; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxWindow *m_validatorWindow;
|
wxWindowBase *m_validatorWindow;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool ms_isSilent;
|
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_
|
#ifndef _WX_WINDOW_H_BASE_
|
||||||
#define _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__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/window.h"
|
#include "wx/msw/window.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/motif/window.h"
|
#include "wx/motif/window.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk/window.h"
|
#include "wx/gtk/window.h"
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
#include "wx/qt/window.h"
|
#include "wx/qt/window.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/mac/window.h"
|
#include "wx/mac/window.h"
|
||||||
#elif defined(__WXSTUBS__)
|
|
||||||
#include "wx/stubs/window.h"
|
|
||||||
#endif
|
#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
|
#endif
|
||||||
// _WX_WINDOW_H_BASE_
|
// _WX_WINDOW_H_BASE_
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -37,13 +37,6 @@
|
|||||||
#include "wx/utils.h" // for copystring() (beurk...)
|
#include "wx/utils.h" // for copystring() (beurk...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// implementation of standard lists
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#include "wx/listimpl.cpp"
|
|
||||||
WX_DEFINE_LIST(wxWindowList);
|
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
@@ -2846,7 +2846,7 @@ bool wxResourceParseString(char *s, wxResourceTable *table)
|
|||||||
* resource loading facility
|
* resource loading facility
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table)
|
bool wxWindowBase::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table)
|
||||||
{
|
{
|
||||||
if (!table)
|
if (!table)
|
||||||
table = wxDefaultResourceTable;
|
table = wxDefaultResourceTable;
|
||||||
@@ -2885,7 +2885,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!this->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
|
if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2932,7 +2932,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table)
|
wxControl *wxWindowBase::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table)
|
||||||
{
|
{
|
||||||
if (!table)
|
if (!table)
|
||||||
table = wxDefaultResourceTable;
|
table = wxDefaultResourceTable;
|
||||||
|
@@ -398,7 +398,7 @@ void wxToolBarBase::Command(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBarBase::Layout()
|
void wxToolBarBase::LayoutTools()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -364,7 +364,7 @@ void wxToolBarSimple::SpringUpButton(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBarSimple::Layout(void)
|
void wxToolBarSimple::LayoutTools(void)
|
||||||
{
|
{
|
||||||
m_currentRowsOrColumns = 0;
|
m_currentRowsOrColumns = 0;
|
||||||
m_lastX = m_xMargin;
|
m_lastX = m_xMargin;
|
||||||
|
@@ -459,7 +459,7 @@ wxFindWindowByLabel1 (const wxString& title, wxWindow * parent)
|
|||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
{
|
||||||
for ( wxNode * node = parent->GetChildren().GetFirst();
|
for ( wxWindowList::Node * node = parent->GetChildren().GetFirst();
|
||||||
node;
|
node;
|
||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
|
@@ -129,7 +129,7 @@ bool wxTextValidator::Validate(wxWindow *parent)
|
|||||||
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
|
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
|
||||||
|
|
||||||
// If window is disabled, simply return
|
// If window is disabled, simply return
|
||||||
if ( !control->Enabled() )
|
if ( !control->IsEnabled() )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
wxString val(control->GetValue());
|
wxString val(control->GetValue());
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2330,7 +2330,7 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
|
m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s );
|
||||||
|
|
||||||
if (GetWindowStyleFlag() & wxLC_REPORT)
|
if (HasFlag(wxLC_REPORT))
|
||||||
m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23), wxTAB_TRAVERSAL );
|
m_headerWin = new wxListHeaderWindow( this, -1, m_mainWin, wxPoint(0,0), wxSize(size.x,23), wxTAB_TRAVERSAL );
|
||||||
else
|
else
|
||||||
m_headerWin = (wxListHeaderWindow *) NULL;
|
m_headerWin = (wxListHeaderWindow *) NULL;
|
||||||
@@ -2349,7 +2349,7 @@ void wxListCtrl::OnSize( wxSizeEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
void wxListCtrl::SetSingleStyle( long style, bool add )
|
void wxListCtrl::SetSingleStyle( long style, bool add )
|
||||||
{
|
{
|
||||||
long flag = GetWindowStyleFlag();
|
long flag = GetWindowStyle();
|
||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
{
|
{
|
||||||
@@ -2382,7 +2382,7 @@ void wxListCtrl::SetWindowStyleFlag( long flag )
|
|||||||
|
|
||||||
if (flag & wxLC_REPORT)
|
if (flag & wxLC_REPORT)
|
||||||
{
|
{
|
||||||
if (!(GetWindowStyleFlag() & wxLC_REPORT))
|
if (!HasFlag(wxLC_REPORT))
|
||||||
{
|
{
|
||||||
// m_mainWin->SetSize( 0, 24, width, height-24 );
|
// m_mainWin->SetSize( 0, 24, width, height-24 );
|
||||||
if (!m_headerWin)
|
if (!m_headerWin)
|
||||||
@@ -2398,7 +2398,7 @@ void wxListCtrl::SetWindowStyleFlag( long flag )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetWindowStyleFlag() & wxLC_REPORT)
|
if (HasFlag(wxLC_REPORT))
|
||||||
{
|
{
|
||||||
// m_mainWin->SetSize( 0, 0, width, height );
|
// m_mainWin->SetSize( 0, 0, width, height );
|
||||||
m_headerWin->Show( FALSE );
|
m_headerWin->Show( FALSE );
|
||||||
@@ -2769,7 +2769,7 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
|||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
|
|
||||||
if (GetWindowStyleFlag() & wxLC_REPORT)
|
if (HasFlag(wxLC_REPORT))
|
||||||
{
|
{
|
||||||
m_headerWin->GetPosition( &x, &y );
|
m_headerWin->GetPosition( &x, &y );
|
||||||
m_headerWin->GetSize( &w, &h );
|
m_headerWin->GetSize( &w, &h );
|
||||||
@@ -2795,9 +2795,10 @@ void wxListCtrl::OnIdle( wxIdleEvent &WXUNUSED(event) )
|
|||||||
m_mainWin->Refresh();
|
m_mainWin->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
bool wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxWindow::SetBackgroundColour( colour );
|
if ( !wxWindow::SetBackgroundColour( colour ) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (m_mainWin)
|
if (m_mainWin)
|
||||||
{
|
{
|
||||||
@@ -2809,11 +2810,14 @@ void wxListCtrl::SetBackgroundColour( const wxColour &colour )
|
|||||||
{
|
{
|
||||||
m_headerWin->SetBackgroundColour( colour );
|
m_headerWin->SetBackgroundColour( colour );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
bool wxListCtrl::SetForegroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxWindow::SetForegroundColour( colour );
|
if ( !wxWindow::SetForegroundColour( colour ) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (m_mainWin)
|
if (m_mainWin)
|
||||||
{
|
{
|
||||||
@@ -2825,11 +2829,14 @@ void wxListCtrl::SetForegroundColour( const wxColour &colour )
|
|||||||
{
|
{
|
||||||
m_headerWin->SetForegroundColour( colour );
|
m_headerWin->SetForegroundColour( colour );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListCtrl::SetFont( const wxFont &font )
|
bool wxListCtrl::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxWindow::SetFont( font );
|
if ( !wxWindow::SetFont( font ) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (m_mainWin)
|
if (m_mainWin)
|
||||||
{
|
{
|
||||||
@@ -2841,5 +2848,7 @@ void wxListCtrl::SetFont( const wxFont &font )
|
|||||||
{
|
{
|
||||||
m_headerWin->SetFont( font );
|
m_headerWin->SetFont( font );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart, Markus Holzem, Robert Roebling
|
// Copyright: (c) Julian Smart, Markus Holzem, Robert Roebling
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -51,27 +51,27 @@ wxSize wxSplitMessage2( const wxString &message, wxWindow *parent )
|
|||||||
for (uint pos = 0; pos < message.Len(); pos++)
|
for (uint pos = 0; pos < message.Len(); pos++)
|
||||||
{
|
{
|
||||||
if (message[pos] == _T('\n'))
|
if (message[pos] == _T('\n'))
|
||||||
{
|
{
|
||||||
if (!line.IsEmpty())
|
if (!line.IsEmpty())
|
||||||
{
|
{
|
||||||
wxStaticText *s1 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
|
wxStaticText *s1 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
|
||||||
wxSize size1( s1->GetSize() );
|
wxSize size1( s1->GetSize() );
|
||||||
if (size1.x > w) w = size1.x;
|
if (size1.x > w) w = size1.x;
|
||||||
line = _T("");
|
line = _T("");
|
||||||
}
|
}
|
||||||
y += 18;
|
y += 18;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
line += message[pos];
|
line += message[pos];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!line.IsEmpty())
|
if (!line.IsEmpty())
|
||||||
{
|
{
|
||||||
wxStaticText *s2 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
|
wxStaticText *s2 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
|
||||||
wxSize size2( s2->GetSize() );
|
wxSize size2( s2->GetSize() );
|
||||||
if (size2.x > w) w = size2.x;
|
if (size2.x > w) w = size2.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
y += 18;
|
y += 18;
|
||||||
@@ -81,9 +81,9 @@ wxSize wxSplitMessage2( const wxString &message, wxWindow *parent )
|
|||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
|
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
|
||||||
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
|
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
|
||||||
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
|
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
|
||||||
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
|
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog)
|
IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog)
|
||||||
@@ -107,21 +107,21 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString
|
|||||||
if (style & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
{
|
{
|
||||||
yes = new wxButton( this, wxID_YES, _("Yes"), wxPoint(-1,y), wxSize(80,-1) );
|
yes = new wxButton( this, wxID_YES, _("Yes"), wxPoint(-1,y), wxSize(80,-1) );
|
||||||
m_buttons.Append( yes );
|
m_buttons.Append( yes );
|
||||||
no = new wxButton( this, wxID_NO, _("No"), wxPoint(-1,y), wxSize(80,-1) );
|
no = new wxButton( this, wxID_NO, _("No"), wxPoint(-1,y), wxSize(80,-1) );
|
||||||
m_buttons.Append( no );
|
m_buttons.Append( no );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & wxOK)
|
if (style & wxOK)
|
||||||
{
|
{
|
||||||
ok = new wxButton( this, wxID_OK, _("OK"), wxPoint(-1,y), wxSize(80,-1) );
|
ok = new wxButton( this, wxID_OK, _("OK"), wxPoint(-1,y), wxSize(80,-1) );
|
||||||
m_buttons.Append( ok );
|
m_buttons.Append( ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style & wxCANCEL)
|
if (style & wxCANCEL)
|
||||||
{
|
{
|
||||||
cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) );
|
cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) );
|
||||||
m_buttons.Append( cancel );
|
m_buttons.Append( cancel );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
@@ -144,10 +144,10 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent, const wxString
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxWindow *win = (wxWindow*)node->Data();
|
wxWindow *win = (wxWindow*)node->Data();
|
||||||
int x = (n*2+1)*space - 40 + 15;
|
int x = (n*2+1)*space - 40 + 15;
|
||||||
win->Move( x, -1 );
|
win->Move( x, -1 );
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
@@ -109,24 +109,24 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *start_node = GetChildren().Find( winFocus );
|
wxWindowList::Node *start_node = GetChildren().Find( winFocus );
|
||||||
if (!start_node)
|
if (!start_node)
|
||||||
start_node = GetChildren().First();
|
start_node = GetChildren().GetFirst();
|
||||||
|
|
||||||
wxNode *node = event.GetDirection() ? start_node->Next()
|
wxWindowList::Node *node = event.GetDirection() ? start_node->GetNext()
|
||||||
: start_node->Previous();
|
: start_node->GetPrevious();
|
||||||
|
|
||||||
while (node != start_node)
|
while (node != start_node)
|
||||||
{
|
{
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
node = event.GetDirection() ? GetChildren().First()
|
node = event.GetDirection() ? GetChildren().GetFirst()
|
||||||
: GetChildren().Last();
|
: GetChildren().GetLast();
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow *child = (wxWindow *)node->Data();
|
wxWindow *child = node->GetData();
|
||||||
|
|
||||||
if (child->AcceptsFocus())
|
if (child->AcceptsFocus())
|
||||||
{
|
{
|
||||||
@@ -135,7 +135,7 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = event.GetDirection() ? node->Next() : node->Previous();
|
node = event.GetDirection() ? node->GetNext() : node->GetPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we cycled through all of our children and none of them wanted to accept
|
// we cycled through all of our children and none of them wanted to accept
|
||||||
|
@@ -623,7 +623,7 @@ bool wxTabView::RemoveTab(int id)
|
|||||||
m_noTabs --;
|
m_noTabs --;
|
||||||
|
|
||||||
// The layout has changed
|
// The layout has changed
|
||||||
Layout();
|
LayoutTabs();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
tabNode = tabNode->Next();
|
tabNode = tabNode->Next();
|
||||||
@@ -703,7 +703,7 @@ void wxTabView::ClearTabs(bool deleteTabs)
|
|||||||
|
|
||||||
|
|
||||||
// Layout tabs (optional, e.g. if resizing window)
|
// Layout tabs (optional, e.g. if resizing window)
|
||||||
void wxTabView::Layout(void)
|
void wxTabView::LayoutTabs(void)
|
||||||
{
|
{
|
||||||
// Make a list of the tab controls, deleting the wxTabLayers.
|
// Make a list of the tab controls, deleting the wxTabLayers.
|
||||||
wxList controls;
|
wxList controls;
|
||||||
|
@@ -45,7 +45,6 @@
|
|||||||
wxApp *wxTheApp = (wxApp *) NULL;
|
wxApp *wxTheApp = (wxApp *) NULL;
|
||||||
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
||||||
|
|
||||||
extern wxList wxPendingDelete;
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
extern wxList *wxPendingEvents;
|
extern wxList *wxPendingEvents;
|
||||||
extern wxCriticalSection *wxPendingEventsLocker;
|
extern wxCriticalSection *wxPendingEventsLocker;
|
||||||
@@ -277,8 +276,8 @@ bool wxApp::OnInitGui()
|
|||||||
|
|
||||||
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
|
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
|
||||||
|
|
||||||
for (int r = 0; r < 32; r++)
|
for (int r = 0; r < 32; r++)
|
||||||
{
|
{
|
||||||
for (int g = 0; g < 32; g++)
|
for (int g = 0; g < 32; g++)
|
||||||
{
|
{
|
||||||
for (int b = 0; b < 32; b++)
|
for (int b = 0; b < 32; b++)
|
||||||
@@ -287,21 +286,26 @@ bool wxApp::OnInitGui()
|
|||||||
int gg = (g << 3) | (g >> 2);
|
int gg = (g << 3) | (g >> 2);
|
||||||
int bb = (b << 3) | (b >> 2);
|
int bb = (b << 3) | (b >> 2);
|
||||||
|
|
||||||
GdkColor *colors = cmap->colors;
|
int index = -1;
|
||||||
if(colors)
|
|
||||||
{
|
|
||||||
int max = 3 * 65536;
|
|
||||||
int index = -1;
|
|
||||||
|
|
||||||
for (int i = 0; i < cmap->size; i++)
|
GdkColor *colors = cmap->colors;
|
||||||
{
|
if(colors)
|
||||||
int rdiff = ((rr << 8) - colors[i].red);
|
{
|
||||||
int gdiff = ((gg << 8) - colors[i].green);
|
int max = 3 * 65536;
|
||||||
int bdiff = ((bb << 8) - colors[i].blue);
|
|
||||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
for (int i = 0; i < cmap->size; i++)
|
||||||
if (sum < max) { index = i; max = sum; }
|
{
|
||||||
|
int rdiff = ((rr << 8) - colors[i].red);
|
||||||
|
int gdiff = ((gg << 8) - colors[i].green);
|
||||||
|
int bdiff = ((bb << 8) - colors[i].blue);
|
||||||
|
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||||
|
if (sum < max)
|
||||||
|
{
|
||||||
|
index = i; max = sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -448,8 +452,8 @@ void wxApp::DeletePendingObjects()
|
|||||||
|
|
||||||
delete obj;
|
delete obj;
|
||||||
|
|
||||||
if (wxPendingDelete.Member(obj))
|
if (wxPendingDelete.Find(obj))
|
||||||
delete node;
|
delete node;
|
||||||
|
|
||||||
node = wxPendingDelete.First();
|
node = wxPendingDelete.First();
|
||||||
}
|
}
|
||||||
|
@@ -166,7 +166,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->AddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
m_parent->InsertChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -278,11 +278,14 @@ void wxBitmapButton::SetBitmapSelected( const wxBitmap& bitmap )
|
|||||||
SetBitmap();
|
SetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapButton::Enable( const bool enable )
|
bool wxBitmapButton::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxWindow::Enable(enable);
|
if ( !wxWindow::Enable(enable) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
SetBitmap();
|
SetBitmap();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapButton::HasFocus()
|
void wxBitmapButton::HasFocus()
|
||||||
|
@@ -96,9 +96,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -128,13 +126,14 @@ void wxButton::SetLabel( const wxString &label )
|
|||||||
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() );
|
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxButton::Enable( bool enable )
|
bool wxButton::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, _T("invalid button") );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
wxControl::Enable( enable );
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxButton::ApplyWidgetStyle()
|
void wxButton::ApplyWidgetStyle()
|
||||||
|
@@ -124,9 +124,7 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||||
(gpointer *)this );
|
(gpointer *)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -169,13 +167,14 @@ void wxCheckBox::SetLabel( const wxString& label )
|
|||||||
gtk_label_set( GTK_LABEL(m_widgetLabel), GetLabel().mbc_str() );
|
gtk_label_set( GTK_LABEL(m_widgetLabel), GetLabel().mbc_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::Enable( bool enable )
|
bool wxCheckBox::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widgetLabel != NULL, _T("invalid checkbox") );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
wxControl::Enable( enable );
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive( m_widgetLabel, enable );
|
gtk_widget_set_sensitive( m_widgetLabel, enable );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::ApplyWidgetStyle()
|
void wxCheckBox::ApplyWidgetStyle()
|
||||||
|
@@ -99,9 +99,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -134,9 +134,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -582,7 +580,7 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
|||||||
|
|
||||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
void wxComboBox::OnSize( wxSizeEvent &event )
|
||||||
{
|
{
|
||||||
wxControl::OnSize( event );
|
event.Skip();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -110,8 +110,9 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
|
|
||||||
if (!window) return;
|
if (!window) return;
|
||||||
|
|
||||||
GtkWidget *widget = window->m_wxwindow;
|
GtkWidget *widget = window->GetWxWindow();
|
||||||
if (!widget) return;
|
if (!widget)
|
||||||
|
return;
|
||||||
|
|
||||||
m_window = widget->window;
|
m_window = widget->window;
|
||||||
|
|
||||||
@@ -126,10 +127,10 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
/* still not realized ? */
|
/* still not realized ? */
|
||||||
if (!m_window) return;
|
if (!m_window) return;
|
||||||
|
|
||||||
if (window->m_wxwindow)
|
if (window->GetWxWindow())
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
m_cmap = gtk_widget_get_colormap( window->GetWxWindow() );
|
||||||
else
|
else
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
m_cmap = gtk_widget_get_colormap( window->GetHandle() );
|
||||||
|
|
||||||
m_isMemDC = FALSE;
|
m_isMemDC = FALSE;
|
||||||
|
|
||||||
|
@@ -69,11 +69,9 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation
|
|||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
|
if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
|
||||||
{
|
{
|
||||||
win->m_sizeSet = FALSE;
|
win->InternalSetSize( alloc->width, alloc->height );
|
||||||
win->m_width = alloc->width;
|
|
||||||
win->m_height = alloc->height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,10 +85,9 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
|
|||||||
|
|
||||||
if (!win->HasVMT()) return FALSE;
|
if (!win->HasVMT()) return FALSE;
|
||||||
|
|
||||||
win->m_x = event->x;
|
win->InternalSetPosition(event->x, event->y);
|
||||||
win->m_y = event->y;
|
|
||||||
|
|
||||||
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
|
wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
|
||||||
mevent.SetEventObject( win );
|
mevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( mevent );
|
win->GetEventHandler()->ProcessEvent( mevent );
|
||||||
|
|
||||||
@@ -114,7 +111,7 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
|
|||||||
{
|
{
|
||||||
wxIcon icon( win->m_icon );
|
wxIcon icon( win->m_icon );
|
||||||
win->m_icon = wxNullIcon;
|
win->m_icon = wxNullIcon;
|
||||||
win->SetIcon( icon );
|
win->SetIcon( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -129,43 +126,43 @@ gtk_dialog_map_callback( GtkWidget *widget, wxDialog *win )
|
|||||||
{
|
{
|
||||||
/* I haven''t been able to set the position of
|
/* I haven''t been able to set the position of
|
||||||
the dialog before it is shown, so I do it here */
|
the dialog before it is shown, so I do it here */
|
||||||
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
|
gtk_widget_set_uposition( widget, win->GetX(), win->GetY() );
|
||||||
|
|
||||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||||
recognized by other WM as well. not tested. */
|
recognized by other WM as well. not tested. */
|
||||||
long decor = (long) GDK_DECOR_BORDER;
|
long decor = (long) GDK_DECOR_BORDER;
|
||||||
long func = (long) GDK_FUNC_MOVE ;
|
long func = (long) GDK_FUNC_MOVE ;
|
||||||
|
|
||||||
if ((win->m_windowStyle & wxCAPTION) != 0)
|
if ((win->GetWindowStyle() & wxCAPTION) != 0)
|
||||||
decor |= GDK_DECOR_TITLE;
|
decor |= GDK_DECOR_TITLE;
|
||||||
if ((win->m_windowStyle & wxSYSTEM_MENU) != 0)
|
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
|
||||||
{
|
{
|
||||||
decor |= GDK_DECOR_MENU;
|
decor |= GDK_DECOR_MENU;
|
||||||
func |= GDK_FUNC_CLOSE;
|
func |= GDK_FUNC_CLOSE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
func |= GDK_FUNC_MAXIMIZE;
|
func |= GDK_FUNC_MAXIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) != 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_RESIZE;
|
func |= GDK_FUNC_RESIZE;
|
||||||
decor |= GDK_DECOR_RESIZEH;
|
decor |= GDK_DECOR_RESIZEH;
|
||||||
}
|
}
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
/* GTK's shrinking/growing policy */
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
|
||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -186,6 +183,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxPanel)
|
|||||||
|
|
||||||
void wxDialog::Init()
|
void wxDialog::Init()
|
||||||
{
|
{
|
||||||
|
m_returnCode = 0;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
}
|
}
|
||||||
@@ -236,12 +234,12 @@ bool wxDialog::Create( wxWindow *parent,
|
|||||||
/* we cannot set MWM hints before the widget has
|
/* we cannot set MWM hints before the widget has
|
||||||
been realized, so we do this directly after realization */
|
been realized, so we do this directly after realization */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
/* we set the position of the window after the map event. setting it
|
/* we set the position of the window after the map event. setting it
|
||||||
before has no effect (with KWM) */
|
before has no effect (with KWM) */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "map",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "map",
|
||||||
GTK_SIGNAL_FUNC(gtk_dialog_map_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_dialog_map_callback), (gpointer) this );
|
||||||
|
|
||||||
/* the user resized the frame by dragging etc. */
|
/* the user resized the frame by dragging etc. */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
@@ -434,17 +432,17 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
if ((m_x != -1) || (m_y != -1))
|
if ((m_x != -1) || (m_y != -1))
|
||||||
{
|
{
|
||||||
if ((m_x != old_x) || (m_y != old_y))
|
if ((m_x != old_x) || (m_y != old_y))
|
||||||
{
|
{
|
||||||
/* we set the position here and when showing the dialog
|
/* we set the position here and when showing the dialog
|
||||||
for the first time in idle time */
|
for the first time in idle time */
|
||||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_width != old_width) || (m_height != old_height))
|
if ((m_width != old_width) || (m_height != old_height))
|
||||||
{
|
{
|
||||||
/* actual resizing is deferred to GtkOnSize in idle time and
|
/* actual resizing is deferred to GtkOnSize in idle time and
|
||||||
when showing the dialog */
|
when showing the dialog */
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,9 +515,9 @@ bool wxDialog::Show( bool show )
|
|||||||
if (show != m_isShown)
|
if (show != m_isShown)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide( m_widget );
|
gtk_widget_hide( m_widget );
|
||||||
|
|
||||||
|
220
src/gtk/dnd.cpp
220
src/gtk/dnd.cpp
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -48,9 +48,9 @@ extern bool g_blockEventsOnDrag;
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char * gv_xpm[] = {
|
static char * gv_xpm[] = {
|
||||||
"40 34 3 1",
|
"40 34 3 1",
|
||||||
" s None c None",
|
" s None c None",
|
||||||
". c black",
|
". c black",
|
||||||
"X c white",
|
"X c white",
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
" ...... ",
|
" ...... ",
|
||||||
@@ -91,11 +91,11 @@ static char * page_xpm[] = {
|
|||||||
/* width height ncolors chars_per_pixel */
|
/* width height ncolors chars_per_pixel */
|
||||||
"32 32 5 1",
|
"32 32 5 1",
|
||||||
/* colors */
|
/* colors */
|
||||||
" s None c None",
|
" s None c None",
|
||||||
". c black",
|
". c black",
|
||||||
"X c wheat",
|
"X c wheat",
|
||||||
"o c tan",
|
"o c tan",
|
||||||
"O c #6699FF",
|
"O c #6699FF",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
" ................... ",
|
" ................... ",
|
||||||
" .XXXXXXXXXXXXXXXXX.. ",
|
" .XXXXXXXXXXXXXXXXX.. ",
|
||||||
@@ -137,9 +137,9 @@ static char * page_xpm[] = {
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
guint WXUNUSED(time),
|
guint WXUNUSED(time),
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -163,11 +163,11 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
guint time,
|
guint time,
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
|||||||
if (drop_target->m_firstMotion)
|
if (drop_target->m_firstMotion)
|
||||||
{
|
{
|
||||||
/* the first "drag_motion" event substitutes a "drag_enter" event */
|
/* the first "drag_motion" event substitutes a "drag_enter" event */
|
||||||
drop_target->OnEnter();
|
drop_target->OnEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* give program a chance to react (i.e. to say no by returning FALSE) */
|
/* give program a chance to react (i.e. to say no by returning FALSE) */
|
||||||
@@ -208,11 +208,11 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gboolean target_drag_drop( GtkWidget *widget,
|
static gboolean target_drag_drop( GtkWidget *widget,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
guint time,
|
guint time,
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -245,9 +245,9 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
/* cancel the whole thing */
|
/* cancel the whole thing */
|
||||||
gtk_drag_finish( context,
|
gtk_drag_finish( context,
|
||||||
FALSE, /* no success */
|
FALSE, /* no success */
|
||||||
FALSE, /* don't delete data on dropping side */
|
FALSE, /* don't delete data on dropping side */
|
||||||
time );
|
time );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* after this, invalidate the drop_target's GdkDragContext */
|
/* after this, invalidate the drop_target's GdkDragContext */
|
||||||
@@ -267,13 +267,13 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
GtkSelectionData *data,
|
GtkSelectionData *data,
|
||||||
guint WXUNUSED(info),
|
guint WXUNUSED(info),
|
||||||
guint time,
|
guint time,
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -288,9 +288,9 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
|||||||
qualifies for junk */
|
qualifies for junk */
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||||
|
|
||||||
// printf( "no data.\n" );
|
// printf( "no data.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inform the wxDropTarget about the current GtkSelectionData.
|
/* inform the wxDropTarget about the current GtkSelectionData.
|
||||||
@@ -299,12 +299,12 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
|||||||
|
|
||||||
if (drop_target->OnData( x, y ))
|
if (drop_target->OnData( x, y ))
|
||||||
{
|
{
|
||||||
/* tell GTK that data transfer was successfull */
|
/* tell GTK that data transfer was successfull */
|
||||||
gtk_drag_finish( context, TRUE, FALSE, time );
|
gtk_drag_finish( context, TRUE, FALSE, time );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* tell GTK that data transfer was not successfull */
|
/* tell GTK that data transfer was not successfull */
|
||||||
gtk_drag_finish( context, FALSE, FALSE, time );
|
gtk_drag_finish( context, FALSE, FALSE, time );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,9 +365,9 @@ bool wxDropTarget::RequestData( wxDataFormat format )
|
|||||||
|
|
||||||
/* this should trigger an "drag_data_received" event */
|
/* this should trigger an "drag_data_received" event */
|
||||||
gtk_drag_get_data( m_dragWidget,
|
gtk_drag_get_data( m_dragWidget,
|
||||||
m_dragContext,
|
m_dragContext,
|
||||||
format.GetAtom(),
|
format.GetAtom(),
|
||||||
m_dragTime );
|
m_dragTime );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -409,8 +409,8 @@ bool wxDropTarget::GetData( wxDataObject *data_object )
|
|||||||
|
|
||||||
if (data_object->GetFormat().GetType() == wxDF_PRIVATE)
|
if (data_object->GetFormat().GetType() == wxDF_PRIVATE)
|
||||||
{
|
{
|
||||||
wxPrivateDataObject *priv_object = (wxPrivateDataObject*)data_object;
|
wxPrivateDataObject *priv_object = (wxPrivateDataObject*)data_object;
|
||||||
priv_object->SetData( (const char*)m_dragData->data, (size_t)m_dragData->length );
|
priv_object->SetData( (const char*)m_dragData->data, (size_t)m_dragData->length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -423,16 +423,16 @@ void wxDropTarget::UnregisterWidget( GtkWidget *widget )
|
|||||||
gtk_drag_dest_unset( widget );
|
gtk_drag_dest_unset( widget );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDropTarget::RegisterWidget( GtkWidget *widget )
|
void wxDropTarget::RegisterWidget( GtkWidget *widget )
|
||||||
@@ -450,22 +450,22 @@ void wxDropTarget::RegisterWidget( GtkWidget *widget )
|
|||||||
seems to be broken without the other two. */
|
seems to be broken without the other two. */
|
||||||
|
|
||||||
gtk_drag_dest_set( widget,
|
gtk_drag_dest_set( widget,
|
||||||
(GtkDestDefaults) 0, /* no default behaviour */
|
(GtkDestDefaults) 0, /* no default behaviour */
|
||||||
(GtkTargetEntry*) NULL, /* we don't supply any formats here */
|
(GtkTargetEntry*) NULL, /* we don't supply any formats here */
|
||||||
0, /* number of targets = 0 */
|
0, /* number of targets = 0 */
|
||||||
(GdkDragAction) 0 ); /* we don't supply any actions here */
|
(GdkDragAction) 0 ); /* we don't supply any actions here */
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_leave",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_leave",
|
||||||
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_motion",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_motion",
|
||||||
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_drop",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_drop",
|
||||||
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_data_received",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_data_received",
|
||||||
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -482,7 +482,7 @@ bool wxTextDropTarget::OnDrop( int WXUNUSED(x), int WXUNUSED(y) )
|
|||||||
if (IsSupported( wxDF_TEXT ))
|
if (IsSupported( wxDF_TEXT ))
|
||||||
{
|
{
|
||||||
RequestData( wxDF_TEXT );
|
RequestData( wxDF_TEXT );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -554,7 +554,7 @@ bool wxFileDropTarget::OnDrop( int x, int y )
|
|||||||
if (IsSupported( wxDF_FILENAME ))
|
if (IsSupported( wxDF_FILENAME ))
|
||||||
{
|
{
|
||||||
RequestData( wxDF_FILENAME );
|
RequestData( wxDF_FILENAME );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -598,11 +598,11 @@ bool wxFileDropTarget::OnData( int x, int y )
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint WXUNUSED(info),
|
guint WXUNUSED(info),
|
||||||
guint WXUNUSED(time),
|
guint WXUNUSED(time),
|
||||||
wxDropSource *drop_source )
|
wxDropSource *drop_source )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -615,33 +615,33 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxDataObject *data_object = (wxDataObject*) node->Data();
|
wxDataObject *data_object = (wxDataObject*) node->Data();
|
||||||
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
||||||
{
|
{
|
||||||
// printf( "format found.\n" );
|
// printf( "format found.\n" );
|
||||||
|
|
||||||
size_t data_size = data_object->GetSize();
|
size_t data_size = data_object->GetSize();
|
||||||
|
|
||||||
if (data_size > 0)
|
if (data_size > 0)
|
||||||
{
|
{
|
||||||
// printf( "data size: %d.\n", (int)data_size );
|
// printf( "data size: %d.\n", (int)data_size );
|
||||||
|
|
||||||
guchar *buffer = new guchar[data_size];
|
guchar *buffer = new guchar[data_size];
|
||||||
data_object->WriteData( buffer );
|
data_object->WriteData( buffer );
|
||||||
|
|
||||||
gtk_selection_data_set( selection_data,
|
gtk_selection_data_set( selection_data,
|
||||||
selection_data->target,
|
selection_data->target,
|
||||||
8, // 8-bit
|
8, // 8-bit
|
||||||
buffer,
|
buffer,
|
||||||
data_size );
|
data_size );
|
||||||
|
|
||||||
free( buffer );
|
free( buffer );
|
||||||
|
|
||||||
/* so far only copy, no moves. TODO. */
|
/* so far only copy, no moves. TODO. */
|
||||||
drop_source->m_retValue = wxDragCopy;
|
drop_source->m_retValue = wxDragCopy;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -654,8 +654,8 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *WXUNUSED(context),
|
GdkDragContext *WXUNUSED(context),
|
||||||
wxDropSource *drop_source )
|
wxDropSource *drop_source )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -669,8 +669,8 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *WXUNUSED(context),
|
GdkDragContext *WXUNUSED(context),
|
||||||
wxDropSource *WXUNUSED(drop_source) )
|
wxDropSource *WXUNUSED(drop_source) )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -682,8 +682,8 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void source_drag_end( GtkWidget *WXUNUSED(widget),
|
static void source_drag_end( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *WXUNUSED(context),
|
GdkDragContext *WXUNUSED(context),
|
||||||
wxDropSource *drop_source )
|
wxDropSource *drop_source )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -702,8 +702,8 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop
|
|||||||
m_waiting = TRUE;
|
m_waiting = TRUE;
|
||||||
|
|
||||||
m_window = win;
|
m_window = win;
|
||||||
m_widget = win->m_widget;
|
m_widget = win->GetWidget();
|
||||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
|
||||||
|
|
||||||
m_data = (wxDataBroker*) NULL;
|
m_data = (wxDataBroker*) NULL;
|
||||||
m_retValue = wxDragCancel;
|
m_retValue = wxDragCancel;
|
||||||
@@ -722,14 +722,14 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
|
|||||||
m_waiting = TRUE;
|
m_waiting = TRUE;
|
||||||
|
|
||||||
m_window = win;
|
m_window = win;
|
||||||
m_widget = win->m_widget;
|
m_widget = win->GetWidget();
|
||||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
|
||||||
m_retValue = wxDragCancel;
|
m_retValue = wxDragCancel;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
m_data = new wxDataBroker();
|
m_data = new wxDataBroker();
|
||||||
m_data->Add( data );
|
m_data->Add( data );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -748,8 +748,8 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
|
|||||||
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
|
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
|
||||||
{
|
{
|
||||||
m_window = win;
|
m_window = win;
|
||||||
m_widget = win->m_widget;
|
m_widget = win->GetWidget();
|
||||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
|
||||||
m_retValue = wxDragCancel;
|
m_retValue = wxDragCancel;
|
||||||
|
|
||||||
m_data = data;
|
m_data = data;
|
||||||
@@ -765,7 +765,7 @@ void wxDropSource::SetData( wxDataObject *data )
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
m_data = new wxDataBroker();
|
m_data = new wxDataBroker();
|
||||||
m_data->Add( data );
|
m_data->Add( data );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -827,21 +827,21 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
{
|
{
|
||||||
GdkDragContext *context = gtk_drag_begin( m_widget,
|
GdkDragContext *context = gtk_drag_begin( m_widget,
|
||||||
target_list,
|
target_list,
|
||||||
GDK_ACTION_COPY,
|
GDK_ACTION_COPY,
|
||||||
button_number, /* number of mouse button which started drag */
|
button_number, /* number of mouse button which started drag */
|
||||||
(GdkEvent*) &event );
|
(GdkEvent*) &event );
|
||||||
|
|
||||||
wxMask *mask = m_goIcon.GetMask();
|
wxMask *mask = m_goIcon.GetMask();
|
||||||
GdkBitmap *bm = (GdkBitmap *) NULL;
|
GdkBitmap *bm = (GdkBitmap *) NULL;
|
||||||
if (mask) bm = mask->GetBitmap();
|
if (mask) bm = mask->GetBitmap();
|
||||||
GdkPixmap *pm = m_goIcon.GetPixmap();
|
GdkPixmap *pm = m_goIcon.GetPixmap();
|
||||||
|
|
||||||
gtk_drag_set_icon_pixmap( context,
|
gtk_drag_set_icon_pixmap( context,
|
||||||
gtk_widget_get_colormap( m_widget ),
|
gtk_widget_get_colormap( m_widget ),
|
||||||
pm,
|
pm,
|
||||||
bm,
|
bm,
|
||||||
0,
|
0,
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
while (m_waiting) gtk_main_iteration();;
|
while (m_waiting) gtk_main_iteration();;
|
||||||
}
|
}
|
||||||
@@ -858,13 +858,13 @@ void wxDropSource::RegisterWindow()
|
|||||||
if (!m_widget) return;
|
if (!m_widget) return;
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get",
|
||||||
GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this);
|
GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this);
|
||||||
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete",
|
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete",
|
||||||
GTK_SIGNAL_FUNC (source_drag_data_delete), (gpointer) this );
|
GTK_SIGNAL_FUNC (source_drag_data_delete), (gpointer) this );
|
||||||
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_begin",
|
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_begin",
|
||||||
GTK_SIGNAL_FUNC (source_drag_begin), (gpointer) this );
|
GTK_SIGNAL_FUNC (source_drag_begin), (gpointer) this );
|
||||||
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_end",
|
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_end",
|
||||||
GTK_SIGNAL_FUNC (source_drag_end), (gpointer) this );
|
GTK_SIGNAL_FUNC (source_drag_end), (gpointer) this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,13 +873,13 @@ void wxDropSource::UnregisterWindow()
|
|||||||
if (!m_widget) return;
|
if (!m_widget) return;
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this );
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this );
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this );
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,7 +57,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial
|
|||||||
|
|
||||||
int style = dialog->GetStyle();
|
int style = dialog->GetStyle();
|
||||||
|
|
||||||
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
|
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->GetHandle());
|
||||||
char *filename = gtk_file_selection_get_filename(filedlg);
|
char *filename = gtk_file_selection_get_filename(filedlg);
|
||||||
|
|
||||||
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )
|
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )
|
||||||
|
@@ -159,12 +159,12 @@ wxFont& wxFont::operator = ( const wxFont& font )
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::operator == ( const wxFont& font )
|
bool wxFont::operator == ( const wxFont& font ) const
|
||||||
{
|
{
|
||||||
return m_refData == font.m_refData;
|
return m_refData == font.m_refData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::operator != ( const wxFont& font )
|
bool wxFont::operator != ( const wxFont& font ) const
|
||||||
{
|
{
|
||||||
return m_refData != font.m_refData;
|
return m_refData != font.m_refData;
|
||||||
}
|
}
|
||||||
|
@@ -73,11 +73,9 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
|
if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
|
||||||
{
|
{
|
||||||
win->m_sizeSet = FALSE;
|
win->InternalSetSize( alloc->width, alloc->height );
|
||||||
win->m_width = alloc->width;
|
|
||||||
win->m_height = alloc->height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +110,7 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_menuBarDetached = FALSE;
|
win->m_menuBarDetached = FALSE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -126,7 +124,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_menuBarDetached = TRUE;
|
win->m_menuBarDetached = TRUE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -140,7 +138,7 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_toolBarDetached = FALSE;
|
win->m_toolBarDetached = FALSE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -154,7 +152,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_toolBarDetached = TRUE;
|
win->m_toolBarDetached = TRUE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -167,10 +165,9 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
|
|||||||
|
|
||||||
if (!win->HasVMT()) return FALSE;
|
if (!win->HasVMT()) return FALSE;
|
||||||
|
|
||||||
win->m_x = event->x;
|
win->InternalSetPosition(event->x, event->y);
|
||||||
win->m_y = event->y;
|
|
||||||
|
|
||||||
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
|
wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
|
||||||
mevent.SetEventObject( win );
|
mevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( mevent );
|
win->GetEventHandler()->ProcessEvent( mevent );
|
||||||
|
|
||||||
@@ -194,60 +191,60 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
|
|||||||
long decor = (long) GDK_DECOR_BORDER;
|
long decor = (long) GDK_DECOR_BORDER;
|
||||||
long func = (long) GDK_FUNC_MOVE;
|
long func = (long) GDK_FUNC_MOVE;
|
||||||
|
|
||||||
if ((win->m_windowStyle & wxCAPTION) != 0)
|
if ((win->GetWindowStyle() & wxCAPTION) != 0)
|
||||||
decor |= GDK_DECOR_TITLE;
|
decor |= GDK_DECOR_TITLE;
|
||||||
if ((win->m_windowStyle & wxSYSTEM_MENU) != 0)
|
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
|
||||||
{
|
{
|
||||||
decor |= GDK_DECOR_MENU;
|
decor |= GDK_DECOR_MENU;
|
||||||
func |= GDK_FUNC_CLOSE;
|
func |= GDK_FUNC_CLOSE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_MAXIMIZE;
|
func |= GDK_FUNC_MAXIMIZE;
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) != 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_RESIZE;
|
func |= GDK_FUNC_RESIZE;
|
||||||
decor |= GDK_DECOR_RESIZEH;
|
decor |= GDK_DECOR_RESIZEH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
/* GTK's shrinking/growing policy */
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
|
||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
|
||||||
|
|
||||||
/* reset the icon */
|
/* reset the icon */
|
||||||
if (win->m_icon != wxNullIcon)
|
if (win->m_icon != wxNullIcon)
|
||||||
{
|
{
|
||||||
wxIcon icon( win->m_icon );
|
wxIcon icon( win->m_icon );
|
||||||
win->m_icon = wxNullIcon;
|
win->m_icon = wxNullIcon;
|
||||||
win->SetIcon( icon );
|
win->SetIcon( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we set the focus to the child that accepts the focus. this
|
/* we set the focus to the child that accepts the focus. this
|
||||||
doesn't really have to be done in "realize" but why not? */
|
doesn't really have to be done in "realize" but why not? */
|
||||||
wxNode *node = win->m_children.First();
|
wxWindowList::Node *node = win->GetChildren().GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxWindow *child = (wxWindow*) node->Data();
|
wxWindow *child = node->GetData();
|
||||||
if (child->AcceptsFocus())
|
if (child->AcceptsFocus())
|
||||||
{
|
{
|
||||||
child->SetFocus();
|
child->SetFocus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -267,45 +264,45 @@ static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child )
|
|||||||
if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
|
if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
|
||||||
{
|
{
|
||||||
/* actually, menubars are never inserted here, but this
|
/* actually, menubars are never inserted here, but this
|
||||||
may change one day */
|
may change one day */
|
||||||
|
|
||||||
/* these are outside the client area */
|
/* these are outside the client area */
|
||||||
wxFrame* frame = (wxFrame*) parent;
|
wxFrame* frame = (wxFrame*) parent;
|
||||||
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
|
||||||
GTK_WIDGET(child->m_widget),
|
GTK_WIDGET(child->GetHandle()),
|
||||||
child->m_x,
|
child->GetX(),
|
||||||
child->m_y,
|
child->GetY(),
|
||||||
child->m_width,
|
child->GetWidth(),
|
||||||
child->m_height );
|
child->GetHeight() );
|
||||||
|
|
||||||
/* we connect to these events for recalculating the client area
|
/* we connect to these events for recalculating the client area
|
||||||
space when the toolbar is floating */
|
space when the toolbar is floating */
|
||||||
if (wxIS_KIND_OF(child,wxToolBar))
|
if (wxIS_KIND_OF(child,wxToolBar))
|
||||||
{
|
{
|
||||||
wxToolBar *toolBar = (wxToolBar*) child;
|
wxToolBar *toolBar = (wxToolBar*) child;
|
||||||
if (toolBar->m_windowStyle & wxTB_DOCKABLE)
|
if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
|
||||||
{
|
{
|
||||||
gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
|
gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_attached",
|
||||||
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
|
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
|
gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_detached",
|
||||||
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
|
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* these are inside the client area */
|
/* these are inside the client area */
|
||||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
|
||||||
GTK_WIDGET(child->m_widget),
|
GTK_WIDGET(child->GetHandle()),
|
||||||
child->m_x,
|
child->GetX(),
|
||||||
child->m_y,
|
child->GetY(),
|
||||||
child->m_width,
|
child->GetWidth(),
|
||||||
child->m_height );
|
child->GetHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resize on OnInternalIdle */
|
/* resize on OnInternalIdle */
|
||||||
parent->m_sizeSet = FALSE;
|
parent->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -413,7 +410,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
/* we cannot set MWM hints and icons before the widget has
|
/* we cannot set MWM hints and icons before the widget has
|
||||||
been realized, so we do this directly after realization */
|
been realized, so we do this directly after realization */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
/* the user resized the frame by dragging etc. */
|
/* the user resized the frame by dragging etc. */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
@@ -523,15 +520,15 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
if ((m_x != old_x) || (m_y != old_y))
|
if ((m_x != old_x) || (m_y != old_y))
|
||||||
{
|
{
|
||||||
/* we set the size here and in gtk_frame_map_callback */
|
/* we set the size here and in gtk_frame_map_callback */
|
||||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_width != old_width) || (m_height != old_height))
|
if ((m_width != old_width) || (m_height != old_height))
|
||||||
{
|
{
|
||||||
/* we set the size in GtkOnSize, i.e. mostly the actual resizing is
|
/* we set the size in GtkOnSize, i.e. mostly the actual resizing is
|
||||||
done either directly before the frame is shown or in idle time
|
done either directly before the frame is shown or in idle time
|
||||||
so that different calls to SetSize() don't lead to flicker. */
|
so that different calls to SetSize() don't lead to flicker. */
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,30 +557,30 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
|||||||
{
|
{
|
||||||
/* menu bar */
|
/* menu bar */
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
|
||||||
if (!m_menuBarDetached)
|
|
||||||
(*height) -= wxMENU_HEIGHT;
|
|
||||||
else
|
|
||||||
(*height) -= wxPLACE_HOLDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* status bar */
|
|
||||||
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
|
|
||||||
|
|
||||||
/* tool bar */
|
|
||||||
if (m_frameToolBar)
|
|
||||||
{
|
{
|
||||||
if (!m_toolBarDetached)
|
if (!m_menuBarDetached)
|
||||||
{
|
(*height) -= wxMENU_HEIGHT;
|
||||||
int y = 0;
|
else
|
||||||
m_frameToolBar->GetSize( (int *) NULL, &y );
|
|
||||||
(*height) -= y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
(*height) -= wxPLACE_HOLDER;
|
(*height) -= wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mini edge */
|
/* status bar */
|
||||||
|
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
|
||||||
|
|
||||||
|
/* tool bar */
|
||||||
|
if (m_frameToolBar)
|
||||||
|
{
|
||||||
|
if (!m_toolBarDetached)
|
||||||
|
{
|
||||||
|
int y = 0;
|
||||||
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
|
(*height) -= y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
(*height) -= wxPLACE_HOLDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mini edge */
|
||||||
(*height) -= m_miniEdge*2 + m_miniTitle;
|
(*height) -= m_miniEdge*2 + m_miniTitle;
|
||||||
}
|
}
|
||||||
if (width)
|
if (width)
|
||||||
@@ -598,26 +595,26 @@ void wxFrame::DoSetClientSize( int width, int height )
|
|||||||
|
|
||||||
/* menu bar */
|
/* menu bar */
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
if (!m_menuBarDetached)
|
if (!m_menuBarDetached)
|
||||||
height += wxMENU_HEIGHT;
|
height += wxMENU_HEIGHT;
|
||||||
else
|
else
|
||||||
height += wxPLACE_HOLDER;
|
height += wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* status bar */
|
/* status bar */
|
||||||
if (m_frameStatusBar) height += wxSTATUS_HEIGHT;
|
if (m_frameStatusBar) height += wxSTATUS_HEIGHT;
|
||||||
|
|
||||||
/* tool bar */
|
/* tool bar */
|
||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
if (!m_toolBarDetached)
|
if (!m_toolBarDetached)
|
||||||
{
|
{
|
||||||
int y = 0;
|
int y = 0;
|
||||||
m_frameToolBar->GetSize( (int *) NULL, &y );
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
height += y;
|
height += y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
height += wxPLACE_HOLDER;
|
height += wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,15 +667,13 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
int yy = m_miniEdge + m_miniTitle;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = wxMENU_HEIGHT;
|
int hh = wxMENU_HEIGHT;
|
||||||
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
|
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
|
||||||
m_frameMenuBar->m_x = xx;
|
m_frameMenuBar->InternalSetPosition(xx, yy);
|
||||||
m_frameMenuBar->m_y = yy;
|
m_frameMenuBar->InternalSetSize(ww, hh);
|
||||||
m_frameMenuBar->m_width = ww;
|
|
||||||
m_frameMenuBar->m_height = hh;
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
m_frameMenuBar->m_widget,
|
m_frameMenuBar->GetHandle(),
|
||||||
xx, yy, ww, hh );
|
xx, yy, ww, hh );
|
||||||
client_area_y_offset += hh;
|
client_area_y_offset += hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
@@ -686,37 +681,40 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
int xx = m_miniEdge;
|
int xx = m_miniEdge;
|
||||||
int yy = m_miniEdge + m_miniTitle;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
if (!m_menuBarDetached)
|
if (!m_menuBarDetached)
|
||||||
yy += wxMENU_HEIGHT;
|
yy += wxMENU_HEIGHT;
|
||||||
else
|
else
|
||||||
yy += wxPLACE_HOLDER;
|
yy += wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = m_frameToolBar->m_height;
|
int hh = m_frameToolBar->GetHeight();
|
||||||
if (m_toolBarDetached) hh = wxPLACE_HOLDER;
|
// VZ: according to earlier comments in this file, the tbar height
|
||||||
m_frameToolBar->m_x = xx;
|
// shouldn't be changed, so I comment out the next line
|
||||||
m_frameToolBar->m_y = yy;
|
// (09.05.99)
|
||||||
/* m_frameToolBar->m_height = hh; don't change the toolbar's height */
|
//if (m_toolBarDetached) hh = wxPLACE_HOLDER;
|
||||||
m_frameToolBar->m_width = ww;
|
|
||||||
|
m_frameToolBar->InternalSetPosition(xx, yy);
|
||||||
|
m_frameToolBar->InternalSetSize(ww, hh);
|
||||||
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
m_frameToolBar->m_widget,
|
m_frameToolBar->GetHandle(),
|
||||||
xx, yy, ww, hh );
|
xx, yy, ww, hh );
|
||||||
client_area_y_offset += hh;
|
client_area_y_offset += hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
int client_x = m_miniEdge;
|
int client_x = m_miniEdge;
|
||||||
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
|
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
|
||||||
int client_w = m_width - 2*m_miniEdge;
|
int client_w = m_width - 2*m_miniEdge;
|
||||||
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
|
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
m_wxwindow,
|
m_wxwindow,
|
||||||
client_x, client_y, client_w, client_h );
|
client_x, client_y, client_w, client_h );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* if there is no m_mainWidget between m_widget and m_wxwindow there
|
/* if there is no m_mainWidget between m_widget and m_wxwindow there
|
||||||
is no need to set the size or position of m_wxwindow. */
|
is no need to set the size or position of m_wxwindow. */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
@@ -725,13 +723,11 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
|
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = wxSTATUS_HEIGHT;
|
int hh = wxSTATUS_HEIGHT;
|
||||||
m_frameStatusBar->m_x = xx;
|
m_frameStatusBar->InternalSetPosition(xx, yy);
|
||||||
m_frameStatusBar->m_y = yy;
|
m_frameStatusBar->InternalSetSize(ww, hh);
|
||||||
m_frameStatusBar->m_width = ww;
|
|
||||||
m_frameStatusBar->m_height = hh;
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
|
||||||
m_frameStatusBar->m_widget,
|
m_frameStatusBar->GetHandle(),
|
||||||
xx, yy, ww, hh );
|
xx, yy, ww, hh );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we actually set the size of a frame here and no-where else */
|
/* we actually set the size of a frame here and no-where else */
|
||||||
@@ -747,7 +743,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
/* send size event to status bar */
|
/* send size event to status bar */
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
{
|
{
|
||||||
wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
|
wxSizeEvent event2( wxSize(m_frameStatusBar->GetWidth(),m_frameStatusBar->GetHeight()), m_frameStatusBar->GetId() );
|
||||||
event2.SetEventObject( m_frameStatusBar );
|
event2.SetEventObject( m_frameStatusBar );
|
||||||
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
|
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
|
||||||
}
|
}
|
||||||
@@ -812,7 +808,7 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
|||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
/* support for native hot keys */
|
/* support for native hot keys */
|
||||||
gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->m_widget));
|
gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->GetHandle()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxNode *node = menu->GetItems().First();
|
wxNode *node = menu->GetItems().First();
|
||||||
@@ -847,24 +843,24 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameMenuBar->m_parent != this)
|
if (m_frameMenuBar->GetParent() != this)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->m_parent = this;
|
m_frameMenuBar->SetParent(this);
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
||||||
m_frameMenuBar->m_widget,
|
m_frameMenuBar->GetHandle(),
|
||||||
m_frameMenuBar->m_x,
|
m_frameMenuBar->GetX(),
|
||||||
m_frameMenuBar->m_y,
|
m_frameMenuBar->GetY(),
|
||||||
m_frameMenuBar->m_width,
|
m_frameMenuBar->GetWidth(),
|
||||||
m_frameMenuBar->m_height );
|
m_frameMenuBar->GetHeight() );
|
||||||
|
|
||||||
if (menuBar->m_windowStyle & wxMB_DOCKABLE)
|
if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
|
||||||
{
|
{
|
||||||
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
|
gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_attached",
|
||||||
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
|
gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_detached",
|
||||||
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,9 +37,7 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
|
|||||||
|
|
||||||
m_widget = gtk_progress_bar_new();
|
m_widget = gtk_progress_bar_new();
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -282,9 +282,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -419,7 +417,7 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
if (GetWindowStyleFlag() & wxLB_MULTIPLE)
|
if (HasFlag(wxLB_MULTIPLE))
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
@@ -454,7 +452,7 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
if (m_toolTip) m_toolTip->Apply( this );
|
if (m_tooltip) m_tooltip->Apply( this );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -858,9 +856,12 @@ void wxListBox::ApplyWidgetStyle()
|
|||||||
if (m_backgroundColour.Ok())
|
if (m_backgroundColour.Ok())
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
if ( window )
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
{
|
||||||
gdk_window_clear( window );
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
|
gdk_window_clear( window );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
|
@@ -90,15 +90,13 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
|||||||
|
|
||||||
wxMenuBar *menu_bar = child_frame->m_menuBar;
|
wxMenuBar *menu_bar = child_frame->m_menuBar;
|
||||||
if (!menu_bar) return;
|
if (!menu_bar) return;
|
||||||
if (!menu_bar->m_widget) return;
|
if (!menu_bar->GetHandle()) return;
|
||||||
|
|
||||||
menu_bar->m_x = 0;
|
menu_bar->InternalSetPosition(0, 0);
|
||||||
menu_bar->m_y = 0;
|
menu_bar->InternalSetSize(m_width, wxMENU_HEIGHT);
|
||||||
menu_bar->m_width = m_width;
|
|
||||||
menu_bar->m_height = wxMENU_HEIGHT;
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
menu_bar->m_widget,
|
menu_bar->GetHandle(),
|
||||||
0, 0, m_width, wxMENU_HEIGHT );
|
0, 0, m_width, wxMENU_HEIGHT );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnInternalIdle()
|
void wxMDIParentFrame::OnInternalIdle()
|
||||||
@@ -110,7 +108,7 @@ void wxMDIParentFrame::OnInternalIdle()
|
|||||||
|
|
||||||
if (m_justInserted)
|
if (m_justInserted)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
|
||||||
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
|
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
|
||||||
|
|
||||||
m_justInserted = FALSE;
|
m_justInserted = FALSE;
|
||||||
@@ -122,19 +120,19 @@ void wxMDIParentFrame::OnInternalIdle()
|
|||||||
wxMDIChildFrame *active_child_frame = GetActiveChild();
|
wxMDIChildFrame *active_child_frame = GetActiveChild();
|
||||||
bool visible_child_menu = FALSE;
|
bool visible_child_menu = FALSE;
|
||||||
|
|
||||||
wxNode *node = m_clientWindow->m_children.First();
|
wxNode *node = m_clientWindow->GetChildren().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
||||||
if (child_frame->m_menuBar)
|
if (child_frame->m_menuBar)
|
||||||
{
|
{
|
||||||
if (child_frame == active_child_frame)
|
if (child_frame == active_child_frame)
|
||||||
{
|
{
|
||||||
gtk_widget_show( child_frame->m_menuBar->m_widget );
|
gtk_widget_show( child_frame->m_menuBar->GetHandle() );
|
||||||
visible_child_menu = TRUE;
|
visible_child_menu = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide( child_frame->m_menuBar->m_widget );
|
gtk_widget_hide( child_frame->m_menuBar->GetHandle() );
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -152,7 +150,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
{
|
{
|
||||||
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
|
||||||
if (!notebook) return (wxMDIChildFrame*) NULL;
|
if (!notebook) return (wxMDIChildFrame*) NULL;
|
||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
@@ -165,7 +163,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
|
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
|
||||||
if (!page) return (wxMDIChildFrame*) NULL;
|
if (!page) return (wxMDIChildFrame*) NULL;
|
||||||
|
|
||||||
wxNode *node = m_clientWindow->m_children.First();
|
wxNode *node = m_clientWindow->GetChildren().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
||||||
@@ -191,13 +189,13 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
|||||||
void wxMDIParentFrame::ActivateNext()
|
void wxMDIParentFrame::ActivateNext()
|
||||||
{
|
{
|
||||||
if (m_clientWindow)
|
if (m_clientWindow)
|
||||||
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ActivatePrevious()
|
void wxMDIParentFrame::ActivatePrevious()
|
||||||
{
|
{
|
||||||
if (m_clientWindow)
|
if (m_clientWindow)
|
||||||
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
||||||
@@ -279,9 +277,9 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
|||||||
|
|
||||||
if (m_menuBar)
|
if (m_menuBar)
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
|
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->GetParent();
|
||||||
|
|
||||||
if (m_menuBar->m_parent != this)
|
if (m_menuBar->GetParent() != this)
|
||||||
{
|
{
|
||||||
wxNode *node = m_menuBar->GetMenus().First();
|
wxNode *node = m_menuBar->GetMenus().First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -291,16 +289,16 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menuBar->m_parent = mdi_frame;
|
m_menuBar->SetParent( mdi_frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the menu bar of the child window is shown in idle time as needed */
|
/* the menu bar of the child window is shown in idle time as needed */
|
||||||
gtk_widget_hide( m_menuBar->m_widget );
|
gtk_widget_hide( m_menuBar->GetHandle() );
|
||||||
|
|
||||||
/* insert the invisible menu bar into the _parent_ mdi frame */
|
/* insert the invisible menu bar into the _parent_ mdi frame */
|
||||||
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
|
||||||
m_menuBar->m_widget,
|
m_menuBar->GetHandle(),
|
||||||
0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
|
0, 0, mdi_frame->GetWidth(), wxMENU_HEIGHT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,11 +323,11 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if ((win->m_x == alloc->x) &&
|
if ((win->GetX() == alloc->x) &&
|
||||||
(win->m_y == alloc->y) &&
|
(win->GetY() == alloc->y) &&
|
||||||
(win->m_width == alloc->width) &&
|
(win->GetWidth() == alloc->width) &&
|
||||||
(win->m_height == alloc->height) &&
|
(win->GetHeight() == alloc->height) &&
|
||||||
(win->m_sizeSet))
|
(win->IsSizeSet()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -349,16 +347,16 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil
|
|||||||
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
|
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
|
||||||
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
|
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(child->GetHandle()), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetHandle());
|
||||||
|
|
||||||
gtk_notebook_append_page( notebook, child->m_widget, label_widget );
|
gtk_notebook_append_page( notebook, child->GetHandle(), label_widget );
|
||||||
|
|
||||||
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
||||||
|
|
||||||
wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->m_parent;
|
wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->GetParent();
|
||||||
parent_frame->m_justInserted = TRUE;
|
parent_frame->m_justInserted = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,9 +391,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
|||||||
|
|
||||||
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -404,5 +400,3 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -70,33 +70,33 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
|
|
||||||
gtk_draw_shadow( widget->style,
|
gtk_draw_shadow( widget->style,
|
||||||
widget->window,
|
widget->window,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
GTK_SHADOW_OUT,
|
GTK_SHADOW_OUT,
|
||||||
0, 0,
|
0, 0,
|
||||||
win->m_width, win->m_height );
|
win->GetWidth(), win->GetHeight() );
|
||||||
|
|
||||||
if (!win->m_title.IsEmpty() &&
|
if (!win->m_title.IsEmpty() &&
|
||||||
((win->m_windowStyle & wxCAPTION) ||
|
((win->GetWindowStyle() & wxCAPTION) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( widget->window );
|
GdkGC *gc = gdk_gc_new( widget->window );
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
||||||
int x = 2;
|
int x = 2;
|
||||||
if (win->m_windowStyle & wxSYSTEM_MENU) x = 18;
|
if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 18;
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( widget->window, gc, TRUE,
|
gdk_draw_rectangle( widget->window, gc, TRUE,
|
||||||
x,
|
x,
|
||||||
3,
|
3,
|
||||||
win->m_width - 4 - x,
|
win->GetWidth() - 4 - x,
|
||||||
font->ascent + font->descent+1 );
|
font->ascent + font->descent+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->white );
|
gdk_gc_set_foreground( gc, &widget->style->white );
|
||||||
gdk_draw_string( widget->window, font, gc,
|
gdk_draw_string( widget->window, font, gc,
|
||||||
x+2,
|
x+2,
|
||||||
3+font->ascent,
|
3+font->ascent,
|
||||||
win->m_title.mb_str() );
|
win->m_title.mb_str() );
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
}
|
}
|
||||||
@@ -114,33 +114,33 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
|
|||||||
|
|
||||||
gtk_draw_shadow( widget->style,
|
gtk_draw_shadow( widget->style,
|
||||||
widget->window,
|
widget->window,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
GTK_SHADOW_OUT,
|
GTK_SHADOW_OUT,
|
||||||
0, 0,
|
0, 0,
|
||||||
win->m_width, win->m_height );
|
win->GetWidth(), win->GetHeight() );
|
||||||
|
|
||||||
if (!win->m_title.IsEmpty() &&
|
if (!win->m_title.IsEmpty() &&
|
||||||
((win->m_windowStyle & wxCAPTION) ||
|
((win->GetWindowStyle() & wxCAPTION) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( widget->window );
|
GdkGC *gc = gdk_gc_new( widget->window );
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
||||||
int x = 2;
|
int x = 2;
|
||||||
if (win->m_windowStyle & wxSYSTEM_MENU) x = 17;
|
if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 17;
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( widget->window, gc, TRUE,
|
gdk_draw_rectangle( widget->window, gc, TRUE,
|
||||||
x,
|
x,
|
||||||
3,
|
3,
|
||||||
win->m_width - 4 - x,
|
win->GetWidth() - 4 - x,
|
||||||
font->ascent + font->descent+1 );
|
font->ascent + font->descent+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->white );
|
gdk_gc_set_foreground( gc, &widget->style->white );
|
||||||
gdk_draw_string( widget->window, font, gc,
|
gdk_draw_string( widget->window, font, gc,
|
||||||
x+2,
|
x+2,
|
||||||
3+font->ascent,
|
3+font->ascent,
|
||||||
win->m_title.mb_str() );
|
win->m_title.mb_str() );
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
}
|
}
|
||||||
@@ -164,9 +164,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
(GdkEventMask)
|
(GdkEventMask)
|
||||||
(GDK_BUTTON_PRESS_MASK |
|
(GDK_BUTTON_PRESS_MASK |
|
||||||
GDK_BUTTON_RELEASE_MASK |
|
GDK_BUTTON_RELEASE_MASK |
|
||||||
GDK_POINTER_MOTION_MASK |
|
GDK_POINTER_MOTION_MASK |
|
||||||
GDK_POINTER_MOTION_HINT_MASK |
|
GDK_POINTER_MOTION_HINT_MASK |
|
||||||
GDK_BUTTON_MOTION_MASK |
|
GDK_BUTTON_MOTION_MASK |
|
||||||
GDK_BUTTON1_MOTION_MASK),
|
GDK_BUTTON1_MOTION_MASK),
|
||||||
(GdkWindow *) NULL,
|
(GdkWindow *) NULL,
|
||||||
(GdkCursor *) NULL,
|
(GdkCursor *) NULL,
|
||||||
@@ -174,7 +174,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
|
|
||||||
win->m_diffX = (int)gdk_event->x;
|
win->m_diffX = (int)gdk_event->x;
|
||||||
win->m_diffY = (int)gdk_event->y;
|
win->m_diffY = (int)gdk_event->y;
|
||||||
DrawFrame( widget, 0, 0, win->m_width, win->m_height );
|
DrawFrame( widget, 0, 0, win->GetWidth(), win->GetHeight() );
|
||||||
win->m_oldX = 0;
|
win->m_oldX = 0;
|
||||||
win->m_oldY = 0;
|
win->m_oldY = 0;
|
||||||
|
|
||||||
@@ -202,16 +202,15 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
int x = (int)gdk_event->x;
|
int x = (int)gdk_event->x;
|
||||||
int y = (int)gdk_event->y;
|
int y = (int)gdk_event->y;
|
||||||
|
|
||||||
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
|
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
|
||||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||||
int org_x = 0;
|
int org_x = 0;
|
||||||
int org_y = 0;
|
int org_y = 0;
|
||||||
gdk_window_get_origin( widget->window, &org_x, &org_y );
|
gdk_window_get_origin( widget->window, &org_x, &org_y );
|
||||||
x += org_x - win->m_diffX;
|
x += org_x - win->m_diffX;
|
||||||
y += org_y - win->m_diffY;
|
y += org_y - win->m_diffY;
|
||||||
win->m_x = x;
|
win->InternalSetPosition(x, y);
|
||||||
win->m_y = y;
|
gtk_widget_set_uposition( win->GetWidget(), x, y );
|
||||||
gtk_widget_set_uposition( win->m_widget, x, y );
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -241,10 +240,10 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
gdk_event->state = state;
|
gdk_event->state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
|
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
|
||||||
win->m_oldX = (int)gdk_event->x - win->m_diffX;
|
win->m_oldX = (int)gdk_event->x - win->m_diffX;
|
||||||
win->m_oldY = (int)gdk_event->y - win->m_diffY;
|
win->m_oldY = (int)gdk_event->y - win->m_diffY;
|
||||||
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
|
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -290,8 +289,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
GtkWidget *close_button = gtk_button_new_with_label( "x" );
|
GtkWidget *close_button = gtk_button_new_with_label( "x" );
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
||||||
close_button,
|
close_button,
|
||||||
4, 4, 12, 11 );
|
4, 4, 12, 11 );
|
||||||
|
|
||||||
gtk_widget_show( close_button );
|
gtk_widget_show( close_button );
|
||||||
|
|
||||||
|
@@ -125,10 +125,10 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if ((win->m_x == alloc->x) &&
|
if ((win->GetX() == alloc->x) &&
|
||||||
(win->m_y == alloc->y) &&
|
(win->GetY() == alloc->y) &&
|
||||||
(win->m_width == alloc->width) &&
|
(win->GetWidth() == alloc->width) &&
|
||||||
(win->m_height == alloc->height))
|
(win->GetHeight() == alloc->height))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -188,16 +188,16 @@ static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
|
|||||||
page->m_box = gtk_hbox_new (FALSE, 0);
|
page->m_box = gtk_hbox_new (FALSE, 0);
|
||||||
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
|
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetWidget());
|
||||||
|
|
||||||
page->m_client = child;
|
page->m_client = child;
|
||||||
gtk_notebook_append_page( notebook, child->m_widget, page->m_box );
|
gtk_notebook_append_page( notebook, child->GetWidget(), page->m_box );
|
||||||
|
|
||||||
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
||||||
|
|
||||||
page->m_parent = notebook;
|
page->m_parent = notebook;
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(child->GetWidget()), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
||||||
|
|
||||||
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
|
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
|
||||||
@@ -267,9 +267,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
|||||||
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
|
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
|
||||||
(gpointer)this );
|
(gpointer)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
|
||||||
|
@@ -68,7 +68,7 @@ BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
|
|||||||
EVT_SIZE(wxRadioBox::OnSize)
|
EVT_SIZE(wxRadioBox::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxRadioBox::wxRadioBox(void)
|
wxRadioBox::wxRadioBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,9 +108,9 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(m_parent->GetWxWindow()),
|
||||||
GTK_WIDGET(m_radio),
|
GTK_WIDGET(m_radio),
|
||||||
m_x+10, m_y+10+(i*24), 10, 10 );
|
m_x+10, m_y+10+(i*24), 10, 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize ls = LayoutItems();
|
wxSize ls = LayoutItems();
|
||||||
@@ -120,9 +120,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
if (newSize.y == -1) newSize.y = ls.y;
|
if (newSize.y == -1) newSize.y = ls.y;
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -137,7 +135,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRadioBox::~wxRadioBox(void)
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
wxNode *node = m_boxes.First();
|
wxNode *node = m_boxes.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -150,9 +148,9 @@ wxRadioBox::~wxRadioBox(void)
|
|||||||
|
|
||||||
void wxRadioBox::OnSize( wxSizeEvent &event )
|
void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||||
{
|
{
|
||||||
wxControl::OnSize( event );
|
|
||||||
|
|
||||||
LayoutItems();
|
LayoutItems();
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxRadioBox::LayoutItems()
|
wxSize wxRadioBox::LayoutItems()
|
||||||
@@ -181,7 +179,7 @@ wxSize wxRadioBox::LayoutItems()
|
|||||||
int len = 22+gdk_string_measure( font, label->label );
|
int len = 22+gdk_string_measure( font, label->label );
|
||||||
if (len > max_len) max_len = len;
|
if (len > max_len) max_len = len;
|
||||||
|
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
|
gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y );
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
@@ -195,7 +193,7 @@ wxSize wxRadioBox::LayoutItems()
|
|||||||
{
|
{
|
||||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||||
|
|
||||||
gtk_myfixed_resize( GTK_MYFIXED(m_parent->m_wxwindow), button, max_len, 20 );
|
gtk_myfixed_resize( GTK_MYFIXED(m_parent->GetWxWindow()), button, max_len, 20 );
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
if (!node) break;
|
if (!node) break;
|
||||||
@@ -231,7 +229,7 @@ wxSize wxRadioBox::LayoutItems()
|
|||||||
{
|
{
|
||||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||||
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, 20 );
|
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y, max, 20 );
|
||||||
x += max;
|
x += max;
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
@@ -389,9 +387,10 @@ void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
|
|||||||
wxFAIL_MSG(_T("wxRadioBox::SetLabel not implemented."));
|
wxFAIL_MSG(_T("wxRadioBox::SetLabel not implemented."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::Enable( bool enable )
|
bool wxRadioBox::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxControl::Enable( enable );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
wxNode *node = m_boxes.First();
|
wxNode *node = m_boxes.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -402,6 +401,8 @@ void wxRadioBox::Enable( bool enable )
|
|||||||
gtk_widget_set_sensitive( label, enable );
|
gtk_widget_set_sensitive( label, enable );
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::Enable( int item, bool enable )
|
void wxRadioBox::Enable( int item, bool enable )
|
||||||
|
@@ -91,9 +91,7 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -138,13 +136,14 @@ bool wxRadioButton::GetValue(void) const
|
|||||||
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::Enable( bool enable )
|
bool wxRadioButton::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
wxControl::Enable( enable );
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::ApplyWidgetStyle()
|
void wxRadioButton::ApplyWidgetStyle()
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
|
|||||||
float line_step = win->m_adjust->step_increment;
|
float line_step = win->m_adjust->step_increment;
|
||||||
float page_step = win->m_adjust->page_increment;
|
float page_step = win->m_adjust->page_increment;
|
||||||
|
|
||||||
if (win->m_isScrolling)
|
if (win->IsScrolling())
|
||||||
{
|
{
|
||||||
command = wxEVT_SCROLL_THUMBTRACK;
|
command = wxEVT_SCROLL_THUMBTRACK;
|
||||||
}
|
}
|
||||||
@@ -70,8 +70,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
|
|||||||
|
|
||||||
int value = (int)(win->m_adjust->value+0.5);
|
int value = (int)(win->m_adjust->value+0.5);
|
||||||
|
|
||||||
int orient = wxHORIZONTAL;
|
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
|
||||||
if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
|
|
||||||
|
|
||||||
wxScrollEvent event( command, win->GetId(), value, orient );
|
wxScrollEvent event( command, win->GetId(), value, orient );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
@@ -90,11 +89,11 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
|
|||||||
|
|
||||||
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
||||||
GdkEventButton *WXUNUSED(gdk_event),
|
GdkEventButton *WXUNUSED(gdk_event),
|
||||||
wxScrollBar *win )
|
wxScrollBar *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
win->m_isScrolling = TRUE;
|
win->SetScrolling(TRUE);
|
||||||
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
|
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -106,11 +105,11 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
|||||||
|
|
||||||
static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
||||||
GdkEventButton *WXUNUSED(gdk_event),
|
GdkEventButton *WXUNUSED(gdk_event),
|
||||||
wxScrollBar *win )
|
wxScrollBar *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
win->m_isScrolling = FALSE;
|
win->SetScrolling(FALSE);
|
||||||
// g_blockEventsOnScroll = FALSE;
|
// g_blockEventsOnScroll = FALSE;
|
||||||
|
|
||||||
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
|
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
|
||||||
@@ -150,22 +149,20 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
||||||
"value_changed",
|
"value_changed",
|
||||||
(GtkSignalFunc) gtk_scrollbar_callback,
|
(GtkSignalFunc) gtk_scrollbar_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget),
|
gtk_signal_connect( GTK_OBJECT(m_widget),
|
||||||
"button_press_event",
|
"button_press_event",
|
||||||
(GtkSignalFunc)gtk_scrollbar_button_press_callback,
|
(GtkSignalFunc)gtk_scrollbar_button_press_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget),
|
gtk_signal_connect( GTK_OBJECT(m_widget),
|
||||||
"button_release_event",
|
"button_release_event",
|
||||||
(GtkSignalFunc)gtk_scrollbar_button_release_callback,
|
(GtkSignalFunc)gtk_scrollbar_button_release_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -299,9 +296,9 @@ bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
GtkRange *range = GTK_RANGE(m_widget);
|
GtkRange *range = GTK_RANGE(m_widget);
|
||||||
return ( (window == GTK_WIDGET(range)->window) ||
|
return ( (window == GTK_WIDGET(range)->window) ||
|
||||||
(window == range->trough) ||
|
(window == range->trough) ||
|
||||||
(window == range->slider) ||
|
(window == range->slider) ||
|
||||||
(window == range->step_forw) ||
|
(window == range->step_forw) ||
|
||||||
(window == range->step_back) );
|
(window == range->step_back) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxScrollBar::ApplyWidgetStyle()
|
void wxScrollBar::ApplyWidgetStyle()
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -110,26 +110,26 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
|
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
|
||||||
|
|
||||||
/* labels need more space and too small window will
|
/* labels need more space and too small window will
|
||||||
cause junk to appear on the dialog */
|
cause junk to appear on the dialog */
|
||||||
if (style & wxSL_VERTICAL)
|
if (style & wxSL_VERTICAL)
|
||||||
{
|
{
|
||||||
wxSize sz( size );
|
wxSize sz( size );
|
||||||
if (sz.x < 35)
|
if (sz.x < 35)
|
||||||
{
|
{
|
||||||
sz.x = 35;
|
sz.x = 35;
|
||||||
SetSize( sz );
|
SetSize( sz );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxSize sz( size );
|
wxSize sz( size );
|
||||||
if (sz.y < 35)
|
if (sz.y < 35)
|
||||||
{
|
{
|
||||||
sz.y = 35;
|
sz.y = 35;
|
||||||
SetSize( sz );
|
SetSize( sz );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
|
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
|
||||||
@@ -138,15 +138,13 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
||||||
"value_changed",
|
"value_changed",
|
||||||
(GtkSignalFunc) gtk_slider_callback,
|
(GtkSignalFunc) gtk_slider_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
SetRange( minValue, maxValue );
|
SetRange( minValue, maxValue );
|
||||||
SetValue( value );
|
SetValue( value );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -281,9 +279,9 @@ bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
GtkRange *range = GTK_RANGE(m_widget);
|
GtkRange *range = GTK_RANGE(m_widget);
|
||||||
return ( (window == GTK_WIDGET(range)->window) ||
|
return ( (window == GTK_WIDGET(range)->window) ||
|
||||||
(window == range->trough) ||
|
(window == range->trough) ||
|
||||||
(window == range->slider) ||
|
(window == range->slider) ||
|
||||||
(window == range->step_forw) ||
|
(window == range->step_forw) ||
|
||||||
(window == range->step_back) );
|
(window == range->step_back) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::ApplyWidgetStyle()
|
void wxSlider::ApplyWidgetStyle()
|
||||||
|
@@ -111,9 +111,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
(GtkSignalFunc) gtk_spinbutt_callback,
|
(GtkSignalFunc) gtk_spinbutt_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -60,9 +60,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
m_widget = gtk_label_new( "Bitmap" );
|
m_widget = gtk_label_new( "Bitmap" );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -45,9 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
|
|||||||
|
|
||||||
m_widget = gtk_frame_new(m_label.mbc_str());
|
m_widget = gtk_frame_new(m_label.mbc_str());
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -46,9 +46,7 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
|
|||||||
else
|
else
|
||||||
m_widget = gtk_hseparator_new();
|
m_widget = gtk_hseparator_new();
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -76,9 +76,7 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
if (tool->m_enabled)
|
if (tool->m_enabled)
|
||||||
{
|
{
|
||||||
if (tb->m_fg->red != 0)
|
if (tb->m_fg->red != 0)
|
||||||
{
|
{
|
||||||
tb->m_fg->red = 0;
|
tb->m_fg->red = 0;
|
||||||
tb->m_fg->green = 0;
|
tb->m_fg->green = 0;
|
||||||
tb->m_fg->blue = 0;
|
tb->m_fg->blue = 0;
|
||||||
@@ -82,12 +82,12 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
#else
|
#else
|
||||||
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tb->m_fg->red == 0)
|
if (tb->m_fg->red == 0)
|
||||||
{
|
{
|
||||||
tb->m_fg->red = 33000;
|
tb->m_fg->red = 33000;
|
||||||
tb->m_fg->green = 33000;
|
tb->m_fg->green = 33000;
|
||||||
tb->m_fg->blue = 33000;
|
tb->m_fg->blue = 33000;
|
||||||
@@ -103,7 +103,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
#else
|
#else
|
||||||
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* emit the event */
|
/* emit the event */
|
||||||
@@ -160,11 +160,11 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
if (style & wxTB_DOCKABLE)
|
if (style & wxTB_DOCKABLE)
|
||||||
{
|
{
|
||||||
m_widget = gtk_handle_box_new();
|
m_widget = gtk_handle_box_new();
|
||||||
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
|
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
|
||||||
gtk_widget_show( GTK_WIDGET(m_toolbar) );
|
gtk_widget_show( GTK_WIDGET(m_toolbar) );
|
||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
if (style & wxTB_FLAT)
|
if (style & wxTB_FLAT)
|
||||||
gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
|
gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -209,9 +209,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
m_xMargin = 0;
|
m_xMargin = 0;
|
||||||
m_yMargin = 0;
|
m_yMargin = 0;
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -281,7 +279,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
|
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
|
||||||
toggle, clientData,
|
toggle, clientData,
|
||||||
helpString1, helpString2,
|
helpString1, helpString2,
|
||||||
tool_pixmap );
|
tool_pixmap );
|
||||||
|
|
||||||
GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
|
GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
|
||||||
: GTK_TOOLBAR_CHILD_BUTTON;
|
: GTK_TOOLBAR_CHILD_BUTTON;
|
||||||
@@ -359,8 +357,8 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
|
|||||||
/* we don't disable the tools for now as the bitmaps don't get
|
/* we don't disable the tools for now as the bitmaps don't get
|
||||||
greyed anyway and this also disables tooltips
|
greyed anyway and this also disables tooltips
|
||||||
|
|
||||||
if (tool->m_item)
|
if (tool->m_item)
|
||||||
gtk_widget_set_sensitive( tool->m_item, enable );
|
gtk_widget_set_sensitive( tool->m_item, enable );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -511,7 +509,7 @@ void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
|
|||||||
if (tool->m_index == toolIndex)
|
if (tool->m_index == toolIndex)
|
||||||
{
|
{
|
||||||
tool->m_longHelpString = helpString;
|
tool->m_longHelpString = helpString;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -530,7 +528,7 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
|
|||||||
if (tool->m_index == toolIndex)
|
if (tool->m_index == toolIndex)
|
||||||
{
|
{
|
||||||
tool->m_shortHelpString = helpString;
|
tool->m_shortHelpString = helpString;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
@@ -46,11 +46,11 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
|||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->SetModified();
|
win->SetModified();
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
||||||
event.SetString( win->GetValue() );
|
event.SetString( win->GetValue() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
@@ -67,7 +67,7 @@ gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
|||||||
|
|
||||||
win->CalculateScrollbar();
|
win->CalculateScrollbar();
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->HasVMT()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -152,7 +152,6 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
/* ... and put into the upper left hand corner of the table */
|
/* ... and put into the upper left hand corner of the table */
|
||||||
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
|
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
|
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
|
||||||
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
||||||
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
||||||
@@ -160,13 +159,11 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
|
|
||||||
/* always wrap words */
|
/* always wrap words */
|
||||||
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
|
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
|
||||||
|
|
||||||
/* put the horizontal scrollbar in the lower left hand corner */
|
/* put the horizontal scrollbar in the lower left hand corner */
|
||||||
if (bHasHScrollbar)
|
if (bHasHScrollbar)
|
||||||
{
|
{
|
||||||
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
|
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
|
||||||
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
|
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
|
||||||
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
|
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
|
||||||
GTK_FILL,
|
GTK_FILL,
|
||||||
@@ -178,11 +175,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
|
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally, put the vertical scrollbar in the upper right corner */
|
/* finally, put the vertical scrollbar in the upper right corner */
|
||||||
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
|
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
|
gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
|
||||||
GTK_FILL,
|
GTK_FILL,
|
||||||
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
|
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
|
||||||
@@ -200,9 +195,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
if (newSize.y == -1) newSize.y = 26;
|
if (newSize.y == -1) newSize.y = 26;
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -948,46 +941,53 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
return (window == GTK_ENTRY(m_text)->text_area);
|
return (window == GTK_ENTRY(m_text)->text_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
|
bool wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
|
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
|
||||||
|
|
||||||
// doesn't work
|
// doesn't work
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
|
bool wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
|
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
|
||||||
|
|
||||||
// doesn't work
|
// doesn't work
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
|
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
|
||||||
|
|
||||||
wxControl::SetBackgroundColour( colour );
|
wxControl::SetBackgroundColour( colour );
|
||||||
|
|
||||||
if (!m_widget->window) return;
|
if (!m_widget->window)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
sysbg.Blue() == colour.Blue())
|
sysbg.Blue() == colour.Blue())
|
||||||
{
|
{
|
||||||
return;
|
return FALSE; // FIXME or TRUE?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (m_windowStyle & wxTE_MULTILINE)
|
if (m_windowStyle & wxTE_MULTILINE)
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_TEXT(m_text)->text_area;
|
GdkWindow *window = GTK_TEXT(m_text)->text_area;
|
||||||
if (!window) return;
|
if (!window)
|
||||||
|
return FALSE;
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::ApplyWidgetStyle()
|
void wxTextCtrl::ApplyWidgetStyle()
|
||||||
|
@@ -133,9 +133,7 @@ printf("5\n");
|
|||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
|
|
||||||
printf("Robert's new insertion code :-)\n");
|
printf("Robert's new insertion code :-)\n");
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
printf("postcreate\n");
|
printf("postcreate\n");
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
1982
src/gtk/window.cpp
1982
src/gtk/window.cpp
File diff suppressed because it is too large
Load Diff
@@ -45,7 +45,6 @@
|
|||||||
wxApp *wxTheApp = (wxApp *) NULL;
|
wxApp *wxTheApp = (wxApp *) NULL;
|
||||||
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
||||||
|
|
||||||
extern wxList wxPendingDelete;
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
extern wxList *wxPendingEvents;
|
extern wxList *wxPendingEvents;
|
||||||
extern wxCriticalSection *wxPendingEventsLocker;
|
extern wxCriticalSection *wxPendingEventsLocker;
|
||||||
@@ -277,8 +276,8 @@ bool wxApp::OnInitGui()
|
|||||||
|
|
||||||
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
|
m_colorCube = (unsigned char*)malloc(32 * 32 * 32);
|
||||||
|
|
||||||
for (int r = 0; r < 32; r++)
|
for (int r = 0; r < 32; r++)
|
||||||
{
|
{
|
||||||
for (int g = 0; g < 32; g++)
|
for (int g = 0; g < 32; g++)
|
||||||
{
|
{
|
||||||
for (int b = 0; b < 32; b++)
|
for (int b = 0; b < 32; b++)
|
||||||
@@ -287,21 +286,26 @@ bool wxApp::OnInitGui()
|
|||||||
int gg = (g << 3) | (g >> 2);
|
int gg = (g << 3) | (g >> 2);
|
||||||
int bb = (b << 3) | (b >> 2);
|
int bb = (b << 3) | (b >> 2);
|
||||||
|
|
||||||
GdkColor *colors = cmap->colors;
|
int index = -1;
|
||||||
if(colors)
|
|
||||||
{
|
|
||||||
int max = 3 * 65536;
|
|
||||||
int index = -1;
|
|
||||||
|
|
||||||
for (int i = 0; i < cmap->size; i++)
|
GdkColor *colors = cmap->colors;
|
||||||
{
|
if(colors)
|
||||||
int rdiff = ((rr << 8) - colors[i].red);
|
{
|
||||||
int gdiff = ((gg << 8) - colors[i].green);
|
int max = 3 * 65536;
|
||||||
int bdiff = ((bb << 8) - colors[i].blue);
|
|
||||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
for (int i = 0; i < cmap->size; i++)
|
||||||
if (sum < max) { index = i; max = sum; }
|
{
|
||||||
|
int rdiff = ((rr << 8) - colors[i].red);
|
||||||
|
int gdiff = ((gg << 8) - colors[i].green);
|
||||||
|
int bdiff = ((bb << 8) - colors[i].blue);
|
||||||
|
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||||
|
if (sum < max)
|
||||||
|
{
|
||||||
|
index = i; max = sum;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -448,8 +452,8 @@ void wxApp::DeletePendingObjects()
|
|||||||
|
|
||||||
delete obj;
|
delete obj;
|
||||||
|
|
||||||
if (wxPendingDelete.Member(obj))
|
if (wxPendingDelete.Find(obj))
|
||||||
delete node;
|
delete node;
|
||||||
|
|
||||||
node = wxPendingDelete.First();
|
node = wxPendingDelete.First();
|
||||||
}
|
}
|
||||||
|
@@ -166,7 +166,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->AddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
m_parent->InsertChild( this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -278,11 +278,14 @@ void wxBitmapButton::SetBitmapSelected( const wxBitmap& bitmap )
|
|||||||
SetBitmap();
|
SetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapButton::Enable( const bool enable )
|
bool wxBitmapButton::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxWindow::Enable(enable);
|
if ( !wxWindow::Enable(enable) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
SetBitmap();
|
SetBitmap();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapButton::HasFocus()
|
void wxBitmapButton::HasFocus()
|
||||||
|
@@ -96,9 +96,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -128,13 +126,14 @@ void wxButton::SetLabel( const wxString &label )
|
|||||||
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() );
|
gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxButton::Enable( bool enable )
|
bool wxButton::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, _T("invalid button") );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
wxControl::Enable( enable );
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxButton::ApplyWidgetStyle()
|
void wxButton::ApplyWidgetStyle()
|
||||||
|
@@ -124,9 +124,7 @@ bool wxCheckBox::Create(wxWindow *parent,
|
|||||||
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback),
|
||||||
(gpointer *)this );
|
(gpointer *)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -169,13 +167,14 @@ void wxCheckBox::SetLabel( const wxString& label )
|
|||||||
gtk_label_set( GTK_LABEL(m_widgetLabel), GetLabel().mbc_str() );
|
gtk_label_set( GTK_LABEL(m_widgetLabel), GetLabel().mbc_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::Enable( bool enable )
|
bool wxCheckBox::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widgetLabel != NULL, _T("invalid checkbox") );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
wxControl::Enable( enable );
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive( m_widgetLabel, enable );
|
gtk_widget_set_sensitive( m_widgetLabel, enable );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckBox::ApplyWidgetStyle()
|
void wxCheckBox::ApplyWidgetStyle()
|
||||||
|
@@ -99,9 +99,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
|
|||||||
}
|
}
|
||||||
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -134,9 +134,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -582,7 +580,7 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
|||||||
|
|
||||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
void wxComboBox::OnSize( wxSizeEvent &event )
|
||||||
{
|
{
|
||||||
wxControl::OnSize( event );
|
event.Skip();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -110,8 +110,9 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
|
|
||||||
if (!window) return;
|
if (!window) return;
|
||||||
|
|
||||||
GtkWidget *widget = window->m_wxwindow;
|
GtkWidget *widget = window->GetWxWindow();
|
||||||
if (!widget) return;
|
if (!widget)
|
||||||
|
return;
|
||||||
|
|
||||||
m_window = widget->window;
|
m_window = widget->window;
|
||||||
|
|
||||||
@@ -126,10 +127,10 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
/* still not realized ? */
|
/* still not realized ? */
|
||||||
if (!m_window) return;
|
if (!m_window) return;
|
||||||
|
|
||||||
if (window->m_wxwindow)
|
if (window->GetWxWindow())
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
m_cmap = gtk_widget_get_colormap( window->GetWxWindow() );
|
||||||
else
|
else
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_widget );
|
m_cmap = gtk_widget_get_colormap( window->GetHandle() );
|
||||||
|
|
||||||
m_isMemDC = FALSE;
|
m_isMemDC = FALSE;
|
||||||
|
|
||||||
|
@@ -69,11 +69,9 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation
|
|||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
|
if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
|
||||||
{
|
{
|
||||||
win->m_sizeSet = FALSE;
|
win->InternalSetSize( alloc->width, alloc->height );
|
||||||
win->m_width = alloc->width;
|
|
||||||
win->m_height = alloc->height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,10 +85,9 @@ static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEvent
|
|||||||
|
|
||||||
if (!win->HasVMT()) return FALSE;
|
if (!win->HasVMT()) return FALSE;
|
||||||
|
|
||||||
win->m_x = event->x;
|
win->InternalSetPosition(event->x, event->y);
|
||||||
win->m_y = event->y;
|
|
||||||
|
|
||||||
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
|
wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
|
||||||
mevent.SetEventObject( win );
|
mevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( mevent );
|
win->GetEventHandler()->ProcessEvent( mevent );
|
||||||
|
|
||||||
@@ -114,7 +111,7 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
|
|||||||
{
|
{
|
||||||
wxIcon icon( win->m_icon );
|
wxIcon icon( win->m_icon );
|
||||||
win->m_icon = wxNullIcon;
|
win->m_icon = wxNullIcon;
|
||||||
win->SetIcon( icon );
|
win->SetIcon( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -129,43 +126,43 @@ gtk_dialog_map_callback( GtkWidget *widget, wxDialog *win )
|
|||||||
{
|
{
|
||||||
/* I haven''t been able to set the position of
|
/* I haven''t been able to set the position of
|
||||||
the dialog before it is shown, so I do it here */
|
the dialog before it is shown, so I do it here */
|
||||||
gtk_widget_set_uposition( widget, win->m_x, win->m_y );
|
gtk_widget_set_uposition( widget, win->GetX(), win->GetY() );
|
||||||
|
|
||||||
/* all this is for Motif Window Manager "hints" and is supposed to be
|
/* all this is for Motif Window Manager "hints" and is supposed to be
|
||||||
recognized by other WM as well. not tested. */
|
recognized by other WM as well. not tested. */
|
||||||
long decor = (long) GDK_DECOR_BORDER;
|
long decor = (long) GDK_DECOR_BORDER;
|
||||||
long func = (long) GDK_FUNC_MOVE ;
|
long func = (long) GDK_FUNC_MOVE ;
|
||||||
|
|
||||||
if ((win->m_windowStyle & wxCAPTION) != 0)
|
if ((win->GetWindowStyle() & wxCAPTION) != 0)
|
||||||
decor |= GDK_DECOR_TITLE;
|
decor |= GDK_DECOR_TITLE;
|
||||||
if ((win->m_windowStyle & wxSYSTEM_MENU) != 0)
|
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
|
||||||
{
|
{
|
||||||
decor |= GDK_DECOR_MENU;
|
decor |= GDK_DECOR_MENU;
|
||||||
func |= GDK_FUNC_CLOSE;
|
func |= GDK_FUNC_CLOSE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
func |= GDK_FUNC_MAXIMIZE;
|
func |= GDK_FUNC_MAXIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) != 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_RESIZE;
|
func |= GDK_FUNC_RESIZE;
|
||||||
decor |= GDK_DECOR_RESIZEH;
|
decor |= GDK_DECOR_RESIZEH;
|
||||||
}
|
}
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
/* GTK's shrinking/growing policy */
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
|
||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -186,6 +183,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxPanel)
|
|||||||
|
|
||||||
void wxDialog::Init()
|
void wxDialog::Init()
|
||||||
{
|
{
|
||||||
|
m_returnCode = 0;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
}
|
}
|
||||||
@@ -236,12 +234,12 @@ bool wxDialog::Create( wxWindow *parent,
|
|||||||
/* we cannot set MWM hints before the widget has
|
/* we cannot set MWM hints before the widget has
|
||||||
been realized, so we do this directly after realization */
|
been realized, so we do this directly after realization */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_dialog_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
/* we set the position of the window after the map event. setting it
|
/* we set the position of the window after the map event. setting it
|
||||||
before has no effect (with KWM) */
|
before has no effect (with KWM) */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "map",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "map",
|
||||||
GTK_SIGNAL_FUNC(gtk_dialog_map_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_dialog_map_callback), (gpointer) this );
|
||||||
|
|
||||||
/* the user resized the frame by dragging etc. */
|
/* the user resized the frame by dragging etc. */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
@@ -434,17 +432,17 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
if ((m_x != -1) || (m_y != -1))
|
if ((m_x != -1) || (m_y != -1))
|
||||||
{
|
{
|
||||||
if ((m_x != old_x) || (m_y != old_y))
|
if ((m_x != old_x) || (m_y != old_y))
|
||||||
{
|
{
|
||||||
/* we set the position here and when showing the dialog
|
/* we set the position here and when showing the dialog
|
||||||
for the first time in idle time */
|
for the first time in idle time */
|
||||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_width != old_width) || (m_height != old_height))
|
if ((m_width != old_width) || (m_height != old_height))
|
||||||
{
|
{
|
||||||
/* actual resizing is deferred to GtkOnSize in idle time and
|
/* actual resizing is deferred to GtkOnSize in idle time and
|
||||||
when showing the dialog */
|
when showing the dialog */
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,9 +515,9 @@ bool wxDialog::Show( bool show )
|
|||||||
if (show != m_isShown)
|
if (show != m_isShown)
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide( m_widget );
|
gtk_widget_hide( m_widget );
|
||||||
|
|
||||||
|
220
src/gtk1/dnd.cpp
220
src/gtk1/dnd.cpp
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -48,9 +48,9 @@ extern bool g_blockEventsOnDrag;
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char * gv_xpm[] = {
|
static char * gv_xpm[] = {
|
||||||
"40 34 3 1",
|
"40 34 3 1",
|
||||||
" s None c None",
|
" s None c None",
|
||||||
". c black",
|
". c black",
|
||||||
"X c white",
|
"X c white",
|
||||||
" ",
|
" ",
|
||||||
" ",
|
" ",
|
||||||
" ...... ",
|
" ...... ",
|
||||||
@@ -91,11 +91,11 @@ static char * page_xpm[] = {
|
|||||||
/* width height ncolors chars_per_pixel */
|
/* width height ncolors chars_per_pixel */
|
||||||
"32 32 5 1",
|
"32 32 5 1",
|
||||||
/* colors */
|
/* colors */
|
||||||
" s None c None",
|
" s None c None",
|
||||||
". c black",
|
". c black",
|
||||||
"X c wheat",
|
"X c wheat",
|
||||||
"o c tan",
|
"o c tan",
|
||||||
"O c #6699FF",
|
"O c #6699FF",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
" ................... ",
|
" ................... ",
|
||||||
" .XXXXXXXXXXXXXXXXX.. ",
|
" .XXXXXXXXXXXXXXXXX.. ",
|
||||||
@@ -137,9 +137,9 @@ static char * page_xpm[] = {
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
guint WXUNUSED(time),
|
guint WXUNUSED(time),
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -163,11 +163,11 @@ static void target_drag_leave( GtkWidget *WXUNUSED(widget),
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
guint time,
|
guint time,
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
|||||||
if (drop_target->m_firstMotion)
|
if (drop_target->m_firstMotion)
|
||||||
{
|
{
|
||||||
/* the first "drag_motion" event substitutes a "drag_enter" event */
|
/* the first "drag_motion" event substitutes a "drag_enter" event */
|
||||||
drop_target->OnEnter();
|
drop_target->OnEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* give program a chance to react (i.e. to say no by returning FALSE) */
|
/* give program a chance to react (i.e. to say no by returning FALSE) */
|
||||||
@@ -208,11 +208,11 @@ static gboolean target_drag_motion( GtkWidget *WXUNUSED(widget),
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static gboolean target_drag_drop( GtkWidget *widget,
|
static gboolean target_drag_drop( GtkWidget *widget,
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
guint time,
|
guint time,
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -245,9 +245,9 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
/* cancel the whole thing */
|
/* cancel the whole thing */
|
||||||
gtk_drag_finish( context,
|
gtk_drag_finish( context,
|
||||||
FALSE, /* no success */
|
FALSE, /* no success */
|
||||||
FALSE, /* don't delete data on dropping side */
|
FALSE, /* don't delete data on dropping side */
|
||||||
time );
|
time );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* after this, invalidate the drop_target's GdkDragContext */
|
/* after this, invalidate the drop_target's GdkDragContext */
|
||||||
@@ -267,13 +267,13 @@ static gboolean target_drag_drop( GtkWidget *widget,
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
GtkSelectionData *data,
|
GtkSelectionData *data,
|
||||||
guint WXUNUSED(info),
|
guint WXUNUSED(info),
|
||||||
guint time,
|
guint time,
|
||||||
wxDropTarget *drop_target )
|
wxDropTarget *drop_target )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -288,9 +288,9 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
|||||||
qualifies for junk */
|
qualifies for junk */
|
||||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||||
|
|
||||||
// printf( "no data.\n" );
|
// printf( "no data.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inform the wxDropTarget about the current GtkSelectionData.
|
/* inform the wxDropTarget about the current GtkSelectionData.
|
||||||
@@ -299,12 +299,12 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
|
|||||||
|
|
||||||
if (drop_target->OnData( x, y ))
|
if (drop_target->OnData( x, y ))
|
||||||
{
|
{
|
||||||
/* tell GTK that data transfer was successfull */
|
/* tell GTK that data transfer was successfull */
|
||||||
gtk_drag_finish( context, TRUE, FALSE, time );
|
gtk_drag_finish( context, TRUE, FALSE, time );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* tell GTK that data transfer was not successfull */
|
/* tell GTK that data transfer was not successfull */
|
||||||
gtk_drag_finish( context, FALSE, FALSE, time );
|
gtk_drag_finish( context, FALSE, FALSE, time );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,9 +365,9 @@ bool wxDropTarget::RequestData( wxDataFormat format )
|
|||||||
|
|
||||||
/* this should trigger an "drag_data_received" event */
|
/* this should trigger an "drag_data_received" event */
|
||||||
gtk_drag_get_data( m_dragWidget,
|
gtk_drag_get_data( m_dragWidget,
|
||||||
m_dragContext,
|
m_dragContext,
|
||||||
format.GetAtom(),
|
format.GetAtom(),
|
||||||
m_dragTime );
|
m_dragTime );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -409,8 +409,8 @@ bool wxDropTarget::GetData( wxDataObject *data_object )
|
|||||||
|
|
||||||
if (data_object->GetFormat().GetType() == wxDF_PRIVATE)
|
if (data_object->GetFormat().GetType() == wxDF_PRIVATE)
|
||||||
{
|
{
|
||||||
wxPrivateDataObject *priv_object = (wxPrivateDataObject*)data_object;
|
wxPrivateDataObject *priv_object = (wxPrivateDataObject*)data_object;
|
||||||
priv_object->SetData( (const char*)m_dragData->data, (size_t)m_dragData->length );
|
priv_object->SetData( (const char*)m_dragData->data, (size_t)m_dragData->length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -423,16 +423,16 @@ void wxDropTarget::UnregisterWidget( GtkWidget *widget )
|
|||||||
gtk_drag_dest_unset( widget );
|
gtk_drag_dest_unset( widget );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
|
||||||
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDropTarget::RegisterWidget( GtkWidget *widget )
|
void wxDropTarget::RegisterWidget( GtkWidget *widget )
|
||||||
@@ -450,22 +450,22 @@ void wxDropTarget::RegisterWidget( GtkWidget *widget )
|
|||||||
seems to be broken without the other two. */
|
seems to be broken without the other two. */
|
||||||
|
|
||||||
gtk_drag_dest_set( widget,
|
gtk_drag_dest_set( widget,
|
||||||
(GtkDestDefaults) 0, /* no default behaviour */
|
(GtkDestDefaults) 0, /* no default behaviour */
|
||||||
(GtkTargetEntry*) NULL, /* we don't supply any formats here */
|
(GtkTargetEntry*) NULL, /* we don't supply any formats here */
|
||||||
0, /* number of targets = 0 */
|
0, /* number of targets = 0 */
|
||||||
(GdkDragAction) 0 ); /* we don't supply any actions here */
|
(GdkDragAction) 0 ); /* we don't supply any actions here */
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_leave",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_leave",
|
||||||
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_leave), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_motion",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_motion",
|
||||||
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_motion), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_drop",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_drop",
|
||||||
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_drop), (gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(widget), "drag_data_received",
|
gtk_signal_connect( GTK_OBJECT(widget), "drag_data_received",
|
||||||
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
GTK_SIGNAL_FUNC(target_drag_data_received), (gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -482,7 +482,7 @@ bool wxTextDropTarget::OnDrop( int WXUNUSED(x), int WXUNUSED(y) )
|
|||||||
if (IsSupported( wxDF_TEXT ))
|
if (IsSupported( wxDF_TEXT ))
|
||||||
{
|
{
|
||||||
RequestData( wxDF_TEXT );
|
RequestData( wxDF_TEXT );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -554,7 +554,7 @@ bool wxFileDropTarget::OnDrop( int x, int y )
|
|||||||
if (IsSupported( wxDF_FILENAME ))
|
if (IsSupported( wxDF_FILENAME ))
|
||||||
{
|
{
|
||||||
RequestData( wxDF_FILENAME );
|
RequestData( wxDF_FILENAME );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -598,11 +598,11 @@ bool wxFileDropTarget::OnData( int x, int y )
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *context,
|
GdkDragContext *context,
|
||||||
GtkSelectionData *selection_data,
|
GtkSelectionData *selection_data,
|
||||||
guint WXUNUSED(info),
|
guint WXUNUSED(info),
|
||||||
guint WXUNUSED(time),
|
guint WXUNUSED(time),
|
||||||
wxDropSource *drop_source )
|
wxDropSource *drop_source )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -615,33 +615,33 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxDataObject *data_object = (wxDataObject*) node->Data();
|
wxDataObject *data_object = (wxDataObject*) node->Data();
|
||||||
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
if (data_object->GetFormat().GetAtom() == selection_data->target)
|
||||||
{
|
{
|
||||||
// printf( "format found.\n" );
|
// printf( "format found.\n" );
|
||||||
|
|
||||||
size_t data_size = data_object->GetSize();
|
size_t data_size = data_object->GetSize();
|
||||||
|
|
||||||
if (data_size > 0)
|
if (data_size > 0)
|
||||||
{
|
{
|
||||||
// printf( "data size: %d.\n", (int)data_size );
|
// printf( "data size: %d.\n", (int)data_size );
|
||||||
|
|
||||||
guchar *buffer = new guchar[data_size];
|
guchar *buffer = new guchar[data_size];
|
||||||
data_object->WriteData( buffer );
|
data_object->WriteData( buffer );
|
||||||
|
|
||||||
gtk_selection_data_set( selection_data,
|
gtk_selection_data_set( selection_data,
|
||||||
selection_data->target,
|
selection_data->target,
|
||||||
8, // 8-bit
|
8, // 8-bit
|
||||||
buffer,
|
buffer,
|
||||||
data_size );
|
data_size );
|
||||||
|
|
||||||
free( buffer );
|
free( buffer );
|
||||||
|
|
||||||
/* so far only copy, no moves. TODO. */
|
/* so far only copy, no moves. TODO. */
|
||||||
drop_source->m_retValue = wxDragCopy;
|
drop_source->m_retValue = wxDragCopy;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -654,8 +654,8 @@ source_drag_data_get (GtkWidget *WXUNUSED(widget),
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *WXUNUSED(context),
|
GdkDragContext *WXUNUSED(context),
|
||||||
wxDropSource *drop_source )
|
wxDropSource *drop_source )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -669,8 +669,8 @@ static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *WXUNUSED(context),
|
GdkDragContext *WXUNUSED(context),
|
||||||
wxDropSource *WXUNUSED(drop_source) )
|
wxDropSource *WXUNUSED(drop_source) )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -682,8 +682,8 @@ static void source_drag_begin( GtkWidget *WXUNUSED(widget),
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void source_drag_end( GtkWidget *WXUNUSED(widget),
|
static void source_drag_end( GtkWidget *WXUNUSED(widget),
|
||||||
GdkDragContext *WXUNUSED(context),
|
GdkDragContext *WXUNUSED(context),
|
||||||
wxDropSource *drop_source )
|
wxDropSource *drop_source )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
@@ -702,8 +702,8 @@ wxDropSource::wxDropSource( wxWindow *win, const wxIcon &go, const wxIcon &stop
|
|||||||
m_waiting = TRUE;
|
m_waiting = TRUE;
|
||||||
|
|
||||||
m_window = win;
|
m_window = win;
|
||||||
m_widget = win->m_widget;
|
m_widget = win->GetWidget();
|
||||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
|
||||||
|
|
||||||
m_data = (wxDataBroker*) NULL;
|
m_data = (wxDataBroker*) NULL;
|
||||||
m_retValue = wxDragCancel;
|
m_retValue = wxDragCancel;
|
||||||
@@ -722,14 +722,14 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
|
|||||||
m_waiting = TRUE;
|
m_waiting = TRUE;
|
||||||
|
|
||||||
m_window = win;
|
m_window = win;
|
||||||
m_widget = win->m_widget;
|
m_widget = win->GetWidget();
|
||||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
|
||||||
m_retValue = wxDragCancel;
|
m_retValue = wxDragCancel;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
m_data = new wxDataBroker();
|
m_data = new wxDataBroker();
|
||||||
m_data->Add( data );
|
m_data->Add( data );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -748,8 +748,8 @@ wxDropSource::wxDropSource( wxDataObject *data, wxWindow *win, const wxIcon &go,
|
|||||||
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
|
wxDropSource::wxDropSource( wxDataBroker *data, wxWindow *win )
|
||||||
{
|
{
|
||||||
m_window = win;
|
m_window = win;
|
||||||
m_widget = win->m_widget;
|
m_widget = win->GetWidget();
|
||||||
if (win->m_wxwindow) m_widget = win->m_wxwindow;
|
if (win->GetWxWindow()) m_widget = win->GetWxWindow();
|
||||||
m_retValue = wxDragCancel;
|
m_retValue = wxDragCancel;
|
||||||
|
|
||||||
m_data = data;
|
m_data = data;
|
||||||
@@ -765,7 +765,7 @@ void wxDropSource::SetData( wxDataObject *data )
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
m_data = new wxDataBroker();
|
m_data = new wxDataBroker();
|
||||||
m_data->Add( data );
|
m_data->Add( data );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -827,21 +827,21 @@ wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
|||||||
{
|
{
|
||||||
GdkDragContext *context = gtk_drag_begin( m_widget,
|
GdkDragContext *context = gtk_drag_begin( m_widget,
|
||||||
target_list,
|
target_list,
|
||||||
GDK_ACTION_COPY,
|
GDK_ACTION_COPY,
|
||||||
button_number, /* number of mouse button which started drag */
|
button_number, /* number of mouse button which started drag */
|
||||||
(GdkEvent*) &event );
|
(GdkEvent*) &event );
|
||||||
|
|
||||||
wxMask *mask = m_goIcon.GetMask();
|
wxMask *mask = m_goIcon.GetMask();
|
||||||
GdkBitmap *bm = (GdkBitmap *) NULL;
|
GdkBitmap *bm = (GdkBitmap *) NULL;
|
||||||
if (mask) bm = mask->GetBitmap();
|
if (mask) bm = mask->GetBitmap();
|
||||||
GdkPixmap *pm = m_goIcon.GetPixmap();
|
GdkPixmap *pm = m_goIcon.GetPixmap();
|
||||||
|
|
||||||
gtk_drag_set_icon_pixmap( context,
|
gtk_drag_set_icon_pixmap( context,
|
||||||
gtk_widget_get_colormap( m_widget ),
|
gtk_widget_get_colormap( m_widget ),
|
||||||
pm,
|
pm,
|
||||||
bm,
|
bm,
|
||||||
0,
|
0,
|
||||||
0 );
|
0 );
|
||||||
|
|
||||||
while (m_waiting) gtk_main_iteration();;
|
while (m_waiting) gtk_main_iteration();;
|
||||||
}
|
}
|
||||||
@@ -858,13 +858,13 @@ void wxDropSource::RegisterWindow()
|
|||||||
if (!m_widget) return;
|
if (!m_widget) return;
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_data_get",
|
||||||
GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this);
|
GTK_SIGNAL_FUNC (source_drag_data_get), (gpointer) this);
|
||||||
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete",
|
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_data_delete",
|
||||||
GTK_SIGNAL_FUNC (source_drag_data_delete), (gpointer) this );
|
GTK_SIGNAL_FUNC (source_drag_data_delete), (gpointer) this );
|
||||||
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_begin",
|
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_begin",
|
||||||
GTK_SIGNAL_FUNC (source_drag_begin), (gpointer) this );
|
GTK_SIGNAL_FUNC (source_drag_begin), (gpointer) this );
|
||||||
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_end",
|
gtk_signal_connect (GTK_OBJECT(m_widget), "drag_end",
|
||||||
GTK_SIGNAL_FUNC (source_drag_end), (gpointer) this );
|
GTK_SIGNAL_FUNC (source_drag_end), (gpointer) this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,13 +873,13 @@ void wxDropSource::UnregisterWindow()
|
|||||||
if (!m_widget) return;
|
if (!m_widget) return;
|
||||||
|
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_data_get), (gpointer) this );
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_data_delete), (gpointer) this );
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_begin), (gpointer) this );
|
||||||
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
|
||||||
GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this );
|
GTK_SIGNAL_FUNC(source_drag_end), (gpointer) this );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,7 +57,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFileDialog *dial
|
|||||||
|
|
||||||
int style = dialog->GetStyle();
|
int style = dialog->GetStyle();
|
||||||
|
|
||||||
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->m_widget);
|
GtkFileSelection *filedlg = GTK_FILE_SELECTION(dialog->GetHandle());
|
||||||
char *filename = gtk_file_selection_get_filename(filedlg);
|
char *filename = gtk_file_selection_get_filename(filedlg);
|
||||||
|
|
||||||
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )
|
if ( (style & wxSAVE) && ( style & wxOVERWRITE_PROMPT ) )
|
||||||
|
@@ -159,12 +159,12 @@ wxFont& wxFont::operator = ( const wxFont& font )
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::operator == ( const wxFont& font )
|
bool wxFont::operator == ( const wxFont& font ) const
|
||||||
{
|
{
|
||||||
return m_refData == font.m_refData;
|
return m_refData == font.m_refData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::operator != ( const wxFont& font )
|
bool wxFont::operator != ( const wxFont& font ) const
|
||||||
{
|
{
|
||||||
return m_refData != font.m_refData;
|
return m_refData != font.m_refData;
|
||||||
}
|
}
|
||||||
|
@@ -73,11 +73,9 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
printf( ".\n" );
|
printf( ".\n" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
|
if ((win->GetWidth() != alloc->width) || (win->GetHeight() != alloc->height))
|
||||||
{
|
{
|
||||||
win->m_sizeSet = FALSE;
|
win->InternalSetSize( alloc->width, alloc->height );
|
||||||
win->m_width = alloc->width;
|
|
||||||
win->m_height = alloc->height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +110,7 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_menuBarDetached = FALSE;
|
win->m_menuBarDetached = FALSE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -126,7 +124,7 @@ static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_menuBarDetached = TRUE;
|
win->m_menuBarDetached = TRUE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -140,7 +138,7 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_toolBarDetached = FALSE;
|
win->m_toolBarDetached = FALSE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -154,7 +152,7 @@ static void gtk_toolbar_detached_callback( GtkWidget *widget, GtkWidget *WXUNUSE
|
|||||||
if (!win->HasVMT()) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->m_toolBarDetached = TRUE;
|
win->m_toolBarDetached = TRUE;
|
||||||
win->m_sizeSet = FALSE;
|
win->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -167,10 +165,9 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC
|
|||||||
|
|
||||||
if (!win->HasVMT()) return FALSE;
|
if (!win->HasVMT()) return FALSE;
|
||||||
|
|
||||||
win->m_x = event->x;
|
win->InternalSetPosition(event->x, event->y);
|
||||||
win->m_y = event->y;
|
|
||||||
|
|
||||||
wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
|
wxMoveEvent mevent( wxPoint(win->GetX(),win->GetY()), win->GetId() );
|
||||||
mevent.SetEventObject( win );
|
mevent.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( mevent );
|
win->GetEventHandler()->ProcessEvent( mevent );
|
||||||
|
|
||||||
@@ -194,60 +191,60 @@ gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win )
|
|||||||
long decor = (long) GDK_DECOR_BORDER;
|
long decor = (long) GDK_DECOR_BORDER;
|
||||||
long func = (long) GDK_FUNC_MOVE;
|
long func = (long) GDK_FUNC_MOVE;
|
||||||
|
|
||||||
if ((win->m_windowStyle & wxCAPTION) != 0)
|
if ((win->GetWindowStyle() & wxCAPTION) != 0)
|
||||||
decor |= GDK_DECOR_TITLE;
|
decor |= GDK_DECOR_TITLE;
|
||||||
if ((win->m_windowStyle & wxSYSTEM_MENU) != 0)
|
if ((win->GetWindowStyle() & wxSYSTEM_MENU) != 0)
|
||||||
{
|
{
|
||||||
decor |= GDK_DECOR_MENU;
|
decor |= GDK_DECOR_MENU;
|
||||||
func |= GDK_FUNC_CLOSE;
|
func |= GDK_FUNC_CLOSE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMINIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMINIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_MINIMIZE;
|
func |= GDK_FUNC_MINIMIZE;
|
||||||
decor |= GDK_DECOR_MINIMIZE;
|
decor |= GDK_DECOR_MINIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxMAXIMIZE_BOX) != 0)
|
if ((win->GetWindowStyle() & wxMAXIMIZE_BOX) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_MAXIMIZE;
|
func |= GDK_FUNC_MAXIMIZE;
|
||||||
decor |= GDK_DECOR_MAXIMIZE;
|
decor |= GDK_DECOR_MAXIMIZE;
|
||||||
}
|
}
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) != 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) != 0)
|
||||||
{
|
{
|
||||||
func |= GDK_FUNC_RESIZE;
|
func |= GDK_FUNC_RESIZE;
|
||||||
decor |= GDK_DECOR_RESIZEH;
|
decor |= GDK_DECOR_RESIZEH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gdk_window_set_decorations( win->m_widget->window, (GdkWMDecoration)decor);
|
gdk_window_set_decorations( win->GetHandle()->window, (GdkWMDecoration)decor);
|
||||||
gdk_window_set_functions( win->m_widget->window, (GdkWMFunction)func);
|
gdk_window_set_functions( win->GetHandle()->window, (GdkWMFunction)func);
|
||||||
|
|
||||||
/* GTK's shrinking/growing policy */
|
/* GTK's shrinking/growing policy */
|
||||||
if ((win->m_windowStyle & wxRESIZE_BORDER) == 0)
|
if ((win->GetWindowStyle() & wxRESIZE_BORDER) == 0)
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 0, 0, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 0, 0, 1);
|
||||||
else
|
else
|
||||||
gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
|
gtk_window_set_policy(GTK_WINDOW(win->GetHandle()), 1, 1, 1);
|
||||||
|
|
||||||
/* reset the icon */
|
/* reset the icon */
|
||||||
if (win->m_icon != wxNullIcon)
|
if (win->m_icon != wxNullIcon)
|
||||||
{
|
{
|
||||||
wxIcon icon( win->m_icon );
|
wxIcon icon( win->m_icon );
|
||||||
win->m_icon = wxNullIcon;
|
win->m_icon = wxNullIcon;
|
||||||
win->SetIcon( icon );
|
win->SetIcon( icon );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we set the focus to the child that accepts the focus. this
|
/* we set the focus to the child that accepts the focus. this
|
||||||
doesn't really have to be done in "realize" but why not? */
|
doesn't really have to be done in "realize" but why not? */
|
||||||
wxNode *node = win->m_children.First();
|
wxWindowList::Node *node = win->GetChildren().GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxWindow *child = (wxWindow*) node->Data();
|
wxWindow *child = node->GetData();
|
||||||
if (child->AcceptsFocus())
|
if (child->AcceptsFocus())
|
||||||
{
|
{
|
||||||
child->SetFocus();
|
child->SetFocus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -267,45 +264,45 @@ static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child )
|
|||||||
if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
|
if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
|
||||||
{
|
{
|
||||||
/* actually, menubars are never inserted here, but this
|
/* actually, menubars are never inserted here, but this
|
||||||
may change one day */
|
may change one day */
|
||||||
|
|
||||||
/* these are outside the client area */
|
/* these are outside the client area */
|
||||||
wxFrame* frame = (wxFrame*) parent;
|
wxFrame* frame = (wxFrame*) parent;
|
||||||
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
|
||||||
GTK_WIDGET(child->m_widget),
|
GTK_WIDGET(child->GetHandle()),
|
||||||
child->m_x,
|
child->GetX(),
|
||||||
child->m_y,
|
child->GetY(),
|
||||||
child->m_width,
|
child->GetWidth(),
|
||||||
child->m_height );
|
child->GetHeight() );
|
||||||
|
|
||||||
/* we connect to these events for recalculating the client area
|
/* we connect to these events for recalculating the client area
|
||||||
space when the toolbar is floating */
|
space when the toolbar is floating */
|
||||||
if (wxIS_KIND_OF(child,wxToolBar))
|
if (wxIS_KIND_OF(child,wxToolBar))
|
||||||
{
|
{
|
||||||
wxToolBar *toolBar = (wxToolBar*) child;
|
wxToolBar *toolBar = (wxToolBar*) child;
|
||||||
if (toolBar->m_windowStyle & wxTB_DOCKABLE)
|
if (toolBar->GetWindowStyle() & wxTB_DOCKABLE)
|
||||||
{
|
{
|
||||||
gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
|
gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_attached",
|
||||||
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
|
GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
|
gtk_signal_connect( GTK_OBJECT(toolBar->GetHandle()), "child_detached",
|
||||||
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
|
GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* these are inside the client area */
|
/* these are inside the client area */
|
||||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(parent->GetWxWindow()),
|
||||||
GTK_WIDGET(child->m_widget),
|
GTK_WIDGET(child->GetHandle()),
|
||||||
child->m_x,
|
child->GetX(),
|
||||||
child->m_y,
|
child->GetY(),
|
||||||
child->m_width,
|
child->GetWidth(),
|
||||||
child->m_height );
|
child->GetHeight() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resize on OnInternalIdle */
|
/* resize on OnInternalIdle */
|
||||||
parent->m_sizeSet = FALSE;
|
parent->UpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -413,7 +410,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
/* we cannot set MWM hints and icons before the widget has
|
/* we cannot set MWM hints and icons before the widget has
|
||||||
been realized, so we do this directly after realization */
|
been realized, so we do this directly after realization */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
|
||||||
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
|
GTK_SIGNAL_FUNC(gtk_frame_realized_callback), (gpointer) this );
|
||||||
|
|
||||||
/* the user resized the frame by dragging etc. */
|
/* the user resized the frame by dragging etc. */
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
|
||||||
@@ -523,15 +520,15 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
if ((m_x != old_x) || (m_y != old_y))
|
if ((m_x != old_x) || (m_y != old_y))
|
||||||
{
|
{
|
||||||
/* we set the size here and in gtk_frame_map_callback */
|
/* we set the size here and in gtk_frame_map_callback */
|
||||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_width != old_width) || (m_height != old_height))
|
if ((m_width != old_width) || (m_height != old_height))
|
||||||
{
|
{
|
||||||
/* we set the size in GtkOnSize, i.e. mostly the actual resizing is
|
/* we set the size in GtkOnSize, i.e. mostly the actual resizing is
|
||||||
done either directly before the frame is shown or in idle time
|
done either directly before the frame is shown or in idle time
|
||||||
so that different calls to SetSize() don't lead to flicker. */
|
so that different calls to SetSize() don't lead to flicker. */
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,30 +557,30 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
|||||||
{
|
{
|
||||||
/* menu bar */
|
/* menu bar */
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
|
||||||
if (!m_menuBarDetached)
|
|
||||||
(*height) -= wxMENU_HEIGHT;
|
|
||||||
else
|
|
||||||
(*height) -= wxPLACE_HOLDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* status bar */
|
|
||||||
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
|
|
||||||
|
|
||||||
/* tool bar */
|
|
||||||
if (m_frameToolBar)
|
|
||||||
{
|
{
|
||||||
if (!m_toolBarDetached)
|
if (!m_menuBarDetached)
|
||||||
{
|
(*height) -= wxMENU_HEIGHT;
|
||||||
int y = 0;
|
else
|
||||||
m_frameToolBar->GetSize( (int *) NULL, &y );
|
|
||||||
(*height) -= y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
(*height) -= wxPLACE_HOLDER;
|
(*height) -= wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mini edge */
|
/* status bar */
|
||||||
|
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
|
||||||
|
|
||||||
|
/* tool bar */
|
||||||
|
if (m_frameToolBar)
|
||||||
|
{
|
||||||
|
if (!m_toolBarDetached)
|
||||||
|
{
|
||||||
|
int y = 0;
|
||||||
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
|
(*height) -= y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
(*height) -= wxPLACE_HOLDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mini edge */
|
||||||
(*height) -= m_miniEdge*2 + m_miniTitle;
|
(*height) -= m_miniEdge*2 + m_miniTitle;
|
||||||
}
|
}
|
||||||
if (width)
|
if (width)
|
||||||
@@ -598,26 +595,26 @@ void wxFrame::DoSetClientSize( int width, int height )
|
|||||||
|
|
||||||
/* menu bar */
|
/* menu bar */
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
if (!m_menuBarDetached)
|
if (!m_menuBarDetached)
|
||||||
height += wxMENU_HEIGHT;
|
height += wxMENU_HEIGHT;
|
||||||
else
|
else
|
||||||
height += wxPLACE_HOLDER;
|
height += wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* status bar */
|
/* status bar */
|
||||||
if (m_frameStatusBar) height += wxSTATUS_HEIGHT;
|
if (m_frameStatusBar) height += wxSTATUS_HEIGHT;
|
||||||
|
|
||||||
/* tool bar */
|
/* tool bar */
|
||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
if (!m_toolBarDetached)
|
if (!m_toolBarDetached)
|
||||||
{
|
{
|
||||||
int y = 0;
|
int y = 0;
|
||||||
m_frameToolBar->GetSize( (int *) NULL, &y );
|
m_frameToolBar->GetSize( (int *) NULL, &y );
|
||||||
height += y;
|
height += y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
height += wxPLACE_HOLDER;
|
height += wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,15 +667,13 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
int yy = m_miniEdge + m_miniTitle;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = wxMENU_HEIGHT;
|
int hh = wxMENU_HEIGHT;
|
||||||
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
|
if (m_menuBarDetached) hh = wxPLACE_HOLDER;
|
||||||
m_frameMenuBar->m_x = xx;
|
m_frameMenuBar->InternalSetPosition(xx, yy);
|
||||||
m_frameMenuBar->m_y = yy;
|
m_frameMenuBar->InternalSetSize(ww, hh);
|
||||||
m_frameMenuBar->m_width = ww;
|
|
||||||
m_frameMenuBar->m_height = hh;
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
m_frameMenuBar->m_widget,
|
m_frameMenuBar->GetHandle(),
|
||||||
xx, yy, ww, hh );
|
xx, yy, ww, hh );
|
||||||
client_area_y_offset += hh;
|
client_area_y_offset += hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
@@ -686,37 +681,40 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
int xx = m_miniEdge;
|
int xx = m_miniEdge;
|
||||||
int yy = m_miniEdge + m_miniTitle;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
if (m_frameMenuBar)
|
if (m_frameMenuBar)
|
||||||
{
|
{
|
||||||
if (!m_menuBarDetached)
|
if (!m_menuBarDetached)
|
||||||
yy += wxMENU_HEIGHT;
|
yy += wxMENU_HEIGHT;
|
||||||
else
|
else
|
||||||
yy += wxPLACE_HOLDER;
|
yy += wxPLACE_HOLDER;
|
||||||
}
|
}
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = m_frameToolBar->m_height;
|
int hh = m_frameToolBar->GetHeight();
|
||||||
if (m_toolBarDetached) hh = wxPLACE_HOLDER;
|
// VZ: according to earlier comments in this file, the tbar height
|
||||||
m_frameToolBar->m_x = xx;
|
// shouldn't be changed, so I comment out the next line
|
||||||
m_frameToolBar->m_y = yy;
|
// (09.05.99)
|
||||||
/* m_frameToolBar->m_height = hh; don't change the toolbar's height */
|
//if (m_toolBarDetached) hh = wxPLACE_HOLDER;
|
||||||
m_frameToolBar->m_width = ww;
|
|
||||||
|
m_frameToolBar->InternalSetPosition(xx, yy);
|
||||||
|
m_frameToolBar->InternalSetSize(ww, hh);
|
||||||
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
m_frameToolBar->m_widget,
|
m_frameToolBar->GetHandle(),
|
||||||
xx, yy, ww, hh );
|
xx, yy, ww, hh );
|
||||||
client_area_y_offset += hh;
|
client_area_y_offset += hh;
|
||||||
}
|
}
|
||||||
|
|
||||||
int client_x = m_miniEdge;
|
int client_x = m_miniEdge;
|
||||||
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
|
int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
|
||||||
int client_w = m_width - 2*m_miniEdge;
|
int client_w = m_width - 2*m_miniEdge;
|
||||||
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
|
int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
m_wxwindow,
|
m_wxwindow,
|
||||||
client_x, client_y, client_w, client_h );
|
client_x, client_y, client_w, client_h );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* if there is no m_mainWidget between m_widget and m_wxwindow there
|
/* if there is no m_mainWidget between m_widget and m_wxwindow there
|
||||||
is no need to set the size or position of m_wxwindow. */
|
is no need to set the size or position of m_wxwindow. */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
@@ -725,13 +723,11 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
|
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = wxSTATUS_HEIGHT;
|
int hh = wxSTATUS_HEIGHT;
|
||||||
m_frameStatusBar->m_x = xx;
|
m_frameStatusBar->InternalSetPosition(xx, yy);
|
||||||
m_frameStatusBar->m_y = yy;
|
m_frameStatusBar->InternalSetSize(ww, hh);
|
||||||
m_frameStatusBar->m_width = ww;
|
|
||||||
m_frameStatusBar->m_height = hh;
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_wxwindow),
|
||||||
m_frameStatusBar->m_widget,
|
m_frameStatusBar->GetHandle(),
|
||||||
xx, yy, ww, hh );
|
xx, yy, ww, hh );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we actually set the size of a frame here and no-where else */
|
/* we actually set the size of a frame here and no-where else */
|
||||||
@@ -747,7 +743,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
/* send size event to status bar */
|
/* send size event to status bar */
|
||||||
if (m_frameStatusBar)
|
if (m_frameStatusBar)
|
||||||
{
|
{
|
||||||
wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() );
|
wxSizeEvent event2( wxSize(m_frameStatusBar->GetWidth(),m_frameStatusBar->GetHeight()), m_frameStatusBar->GetId() );
|
||||||
event2.SetEventObject( m_frameStatusBar );
|
event2.SetEventObject( m_frameStatusBar );
|
||||||
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
|
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
|
||||||
}
|
}
|
||||||
@@ -812,7 +808,7 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
|
|||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
/* support for native hot keys */
|
/* support for native hot keys */
|
||||||
gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->m_widget));
|
gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->GetHandle()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxNode *node = menu->GetItems().First();
|
wxNode *node = menu->GetItems().First();
|
||||||
@@ -847,24 +843,24 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameMenuBar->m_parent != this)
|
if (m_frameMenuBar->GetParent() != this)
|
||||||
{
|
{
|
||||||
m_frameMenuBar->m_parent = this;
|
m_frameMenuBar->SetParent(this);
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
||||||
m_frameMenuBar->m_widget,
|
m_frameMenuBar->GetHandle(),
|
||||||
m_frameMenuBar->m_x,
|
m_frameMenuBar->GetX(),
|
||||||
m_frameMenuBar->m_y,
|
m_frameMenuBar->GetY(),
|
||||||
m_frameMenuBar->m_width,
|
m_frameMenuBar->GetWidth(),
|
||||||
m_frameMenuBar->m_height );
|
m_frameMenuBar->GetHeight() );
|
||||||
|
|
||||||
if (menuBar->m_windowStyle & wxMB_DOCKABLE)
|
if (menuBar->GetWindowStyle() & wxMB_DOCKABLE)
|
||||||
{
|
{
|
||||||
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
|
gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_attached",
|
||||||
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
|
gtk_signal_connect( GTK_OBJECT(menuBar->GetHandle()), "child_detached",
|
||||||
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,9 +37,7 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
|
|||||||
|
|
||||||
m_widget = gtk_progress_bar_new();
|
m_widget = gtk_progress_bar_new();
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -282,9 +282,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
gtk_widget_show( list_item );
|
gtk_widget_show( list_item );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -419,7 +417,7 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
if (GetWindowStyleFlag() & wxLB_MULTIPLE)
|
if (HasFlag(wxLB_MULTIPLE))
|
||||||
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
|
||||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||||
|
|
||||||
@@ -454,7 +452,7 @@ void wxListBox::AppendCommon( const wxString &item )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
if (m_toolTip) m_toolTip->Apply( this );
|
if (m_tooltip) m_tooltip->Apply( this );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -858,9 +856,12 @@ void wxListBox::ApplyWidgetStyle()
|
|||||||
if (m_backgroundColour.Ok())
|
if (m_backgroundColour.Ok())
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
GdkWindow *window = GTK_WIDGET(m_list)->window;
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
if ( window )
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
{
|
||||||
gdk_window_clear( window );
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
|
gdk_window_clear( window );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *child = m_list->children;
|
GList *child = m_list->children;
|
||||||
|
@@ -90,15 +90,13 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
|||||||
|
|
||||||
wxMenuBar *menu_bar = child_frame->m_menuBar;
|
wxMenuBar *menu_bar = child_frame->m_menuBar;
|
||||||
if (!menu_bar) return;
|
if (!menu_bar) return;
|
||||||
if (!menu_bar->m_widget) return;
|
if (!menu_bar->GetHandle()) return;
|
||||||
|
|
||||||
menu_bar->m_x = 0;
|
menu_bar->InternalSetPosition(0, 0);
|
||||||
menu_bar->m_y = 0;
|
menu_bar->InternalSetSize(m_width, wxMENU_HEIGHT);
|
||||||
menu_bar->m_width = m_width;
|
|
||||||
menu_bar->m_height = wxMENU_HEIGHT;
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_set_size( GTK_MYFIXED(m_mainWidget),
|
||||||
menu_bar->m_widget,
|
menu_bar->GetHandle(),
|
||||||
0, 0, m_width, wxMENU_HEIGHT );
|
0, 0, m_width, wxMENU_HEIGHT );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnInternalIdle()
|
void wxMDIParentFrame::OnInternalIdle()
|
||||||
@@ -110,7 +108,7 @@ void wxMDIParentFrame::OnInternalIdle()
|
|||||||
|
|
||||||
if (m_justInserted)
|
if (m_justInserted)
|
||||||
{
|
{
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
|
||||||
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
|
gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 );
|
||||||
|
|
||||||
m_justInserted = FALSE;
|
m_justInserted = FALSE;
|
||||||
@@ -122,19 +120,19 @@ void wxMDIParentFrame::OnInternalIdle()
|
|||||||
wxMDIChildFrame *active_child_frame = GetActiveChild();
|
wxMDIChildFrame *active_child_frame = GetActiveChild();
|
||||||
bool visible_child_menu = FALSE;
|
bool visible_child_menu = FALSE;
|
||||||
|
|
||||||
wxNode *node = m_clientWindow->m_children.First();
|
wxNode *node = m_clientWindow->GetChildren().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
||||||
if (child_frame->m_menuBar)
|
if (child_frame->m_menuBar)
|
||||||
{
|
{
|
||||||
if (child_frame == active_child_frame)
|
if (child_frame == active_child_frame)
|
||||||
{
|
{
|
||||||
gtk_widget_show( child_frame->m_menuBar->m_widget );
|
gtk_widget_show( child_frame->m_menuBar->GetHandle() );
|
||||||
visible_child_menu = TRUE;
|
visible_child_menu = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_widget_hide( child_frame->m_menuBar->m_widget );
|
gtk_widget_hide( child_frame->m_menuBar->GetHandle() );
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -152,7 +150,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
{
|
{
|
||||||
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
if (!m_clientWindow) return (wxMDIChildFrame*) NULL;
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->GetHandle());
|
||||||
if (!notebook) return (wxMDIChildFrame*) NULL;
|
if (!notebook) return (wxMDIChildFrame*) NULL;
|
||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
@@ -165,7 +163,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
|||||||
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
|
GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
|
||||||
if (!page) return (wxMDIChildFrame*) NULL;
|
if (!page) return (wxMDIChildFrame*) NULL;
|
||||||
|
|
||||||
wxNode *node = m_clientWindow->m_children.First();
|
wxNode *node = m_clientWindow->GetChildren().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data();
|
||||||
@@ -191,13 +189,13 @@ wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
|||||||
void wxMDIParentFrame::ActivateNext()
|
void wxMDIParentFrame::ActivateNext()
|
||||||
{
|
{
|
||||||
if (m_clientWindow)
|
if (m_clientWindow)
|
||||||
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ActivatePrevious()
|
void wxMDIParentFrame::ActivatePrevious()
|
||||||
{
|
{
|
||||||
if (m_clientWindow)
|
if (m_clientWindow)
|
||||||
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) );
|
gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->GetHandle()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
|
||||||
@@ -279,9 +277,9 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
|||||||
|
|
||||||
if (m_menuBar)
|
if (m_menuBar)
|
||||||
{
|
{
|
||||||
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
|
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->GetParent();
|
||||||
|
|
||||||
if (m_menuBar->m_parent != this)
|
if (m_menuBar->GetParent() != this)
|
||||||
{
|
{
|
||||||
wxNode *node = m_menuBar->GetMenus().First();
|
wxNode *node = m_menuBar->GetMenus().First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -291,16 +289,16 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menuBar->m_parent = mdi_frame;
|
m_menuBar->SetParent( mdi_frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the menu bar of the child window is shown in idle time as needed */
|
/* the menu bar of the child window is shown in idle time as needed */
|
||||||
gtk_widget_hide( m_menuBar->m_widget );
|
gtk_widget_hide( m_menuBar->GetHandle() );
|
||||||
|
|
||||||
/* insert the invisible menu bar into the _parent_ mdi frame */
|
/* insert the invisible menu bar into the _parent_ mdi frame */
|
||||||
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_mainWidget),
|
||||||
m_menuBar->m_widget,
|
m_menuBar->GetHandle(),
|
||||||
0, 0, mdi_frame->m_width, wxMENU_HEIGHT );
|
0, 0, mdi_frame->GetWidth(), wxMENU_HEIGHT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,11 +323,11 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if ((win->m_x == alloc->x) &&
|
if ((win->GetX() == alloc->x) &&
|
||||||
(win->m_y == alloc->y) &&
|
(win->GetY() == alloc->y) &&
|
||||||
(win->m_width == alloc->width) &&
|
(win->GetWidth() == alloc->width) &&
|
||||||
(win->m_height == alloc->height) &&
|
(win->GetHeight() == alloc->height) &&
|
||||||
(win->m_sizeSet))
|
(win->IsSizeSet()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -349,16 +347,16 @@ static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* chil
|
|||||||
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
|
GtkWidget *label_widget = gtk_label_new( s.mbc_str() );
|
||||||
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
|
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(child->GetHandle()), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetHandle());
|
||||||
|
|
||||||
gtk_notebook_append_page( notebook, child->m_widget, label_widget );
|
gtk_notebook_append_page( notebook, child->GetHandle(), label_widget );
|
||||||
|
|
||||||
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
||||||
|
|
||||||
wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->m_parent;
|
wxMDIParentFrame *parent_frame = (wxMDIParentFrame*) parent->GetParent();
|
||||||
parent_frame->m_justInserted = TRUE;
|
parent_frame->m_justInserted = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,9 +391,7 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
|||||||
|
|
||||||
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -404,5 +400,3 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -70,33 +70,33 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
|
|||||||
|
|
||||||
gtk_draw_shadow( widget->style,
|
gtk_draw_shadow( widget->style,
|
||||||
widget->window,
|
widget->window,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
GTK_SHADOW_OUT,
|
GTK_SHADOW_OUT,
|
||||||
0, 0,
|
0, 0,
|
||||||
win->m_width, win->m_height );
|
win->GetWidth(), win->GetHeight() );
|
||||||
|
|
||||||
if (!win->m_title.IsEmpty() &&
|
if (!win->m_title.IsEmpty() &&
|
||||||
((win->m_windowStyle & wxCAPTION) ||
|
((win->GetWindowStyle() & wxCAPTION) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( widget->window );
|
GdkGC *gc = gdk_gc_new( widget->window );
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
||||||
int x = 2;
|
int x = 2;
|
||||||
if (win->m_windowStyle & wxSYSTEM_MENU) x = 18;
|
if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 18;
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( widget->window, gc, TRUE,
|
gdk_draw_rectangle( widget->window, gc, TRUE,
|
||||||
x,
|
x,
|
||||||
3,
|
3,
|
||||||
win->m_width - 4 - x,
|
win->GetWidth() - 4 - x,
|
||||||
font->ascent + font->descent+1 );
|
font->ascent + font->descent+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->white );
|
gdk_gc_set_foreground( gc, &widget->style->white );
|
||||||
gdk_draw_string( widget->window, font, gc,
|
gdk_draw_string( widget->window, font, gc,
|
||||||
x+2,
|
x+2,
|
||||||
3+font->ascent,
|
3+font->ascent,
|
||||||
win->m_title.mb_str() );
|
win->m_title.mb_str() );
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
}
|
}
|
||||||
@@ -114,33 +114,33 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
|
|||||||
|
|
||||||
gtk_draw_shadow( widget->style,
|
gtk_draw_shadow( widget->style,
|
||||||
widget->window,
|
widget->window,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
GTK_SHADOW_OUT,
|
GTK_SHADOW_OUT,
|
||||||
0, 0,
|
0, 0,
|
||||||
win->m_width, win->m_height );
|
win->GetWidth(), win->GetHeight() );
|
||||||
|
|
||||||
if (!win->m_title.IsEmpty() &&
|
if (!win->m_title.IsEmpty() &&
|
||||||
((win->m_windowStyle & wxCAPTION) ||
|
((win->GetWindowStyle() & wxCAPTION) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_HORIZ) ||
|
(win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) ||
|
||||||
(win->m_windowStyle & wxTINY_CAPTION_VERT)))
|
(win->GetWindowStyle() & wxTINY_CAPTION_VERT)))
|
||||||
{
|
{
|
||||||
GdkGC *gc = gdk_gc_new( widget->window );
|
GdkGC *gc = gdk_gc_new( widget->window );
|
||||||
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
GdkFont *font = wxSMALL_FONT->GetInternalFont(1.0);
|
||||||
int x = 2;
|
int x = 2;
|
||||||
if (win->m_windowStyle & wxSYSTEM_MENU) x = 17;
|
if (win->GetWindowStyle() & wxSYSTEM_MENU) x = 17;
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] );
|
||||||
gdk_draw_rectangle( widget->window, gc, TRUE,
|
gdk_draw_rectangle( widget->window, gc, TRUE,
|
||||||
x,
|
x,
|
||||||
3,
|
3,
|
||||||
win->m_width - 4 - x,
|
win->GetWidth() - 4 - x,
|
||||||
font->ascent + font->descent+1 );
|
font->ascent + font->descent+1 );
|
||||||
|
|
||||||
gdk_gc_set_foreground( gc, &widget->style->white );
|
gdk_gc_set_foreground( gc, &widget->style->white );
|
||||||
gdk_draw_string( widget->window, font, gc,
|
gdk_draw_string( widget->window, font, gc,
|
||||||
x+2,
|
x+2,
|
||||||
3+font->ascent,
|
3+font->ascent,
|
||||||
win->m_title.mb_str() );
|
win->m_title.mb_str() );
|
||||||
|
|
||||||
gdk_gc_unref( gc );
|
gdk_gc_unref( gc );
|
||||||
}
|
}
|
||||||
@@ -164,9 +164,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
(GdkEventMask)
|
(GdkEventMask)
|
||||||
(GDK_BUTTON_PRESS_MASK |
|
(GDK_BUTTON_PRESS_MASK |
|
||||||
GDK_BUTTON_RELEASE_MASK |
|
GDK_BUTTON_RELEASE_MASK |
|
||||||
GDK_POINTER_MOTION_MASK |
|
GDK_POINTER_MOTION_MASK |
|
||||||
GDK_POINTER_MOTION_HINT_MASK |
|
GDK_POINTER_MOTION_HINT_MASK |
|
||||||
GDK_BUTTON_MOTION_MASK |
|
GDK_BUTTON_MOTION_MASK |
|
||||||
GDK_BUTTON1_MOTION_MASK),
|
GDK_BUTTON1_MOTION_MASK),
|
||||||
(GdkWindow *) NULL,
|
(GdkWindow *) NULL,
|
||||||
(GdkCursor *) NULL,
|
(GdkCursor *) NULL,
|
||||||
@@ -174,7 +174,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
|||||||
|
|
||||||
win->m_diffX = (int)gdk_event->x;
|
win->m_diffX = (int)gdk_event->x;
|
||||||
win->m_diffY = (int)gdk_event->y;
|
win->m_diffY = (int)gdk_event->y;
|
||||||
DrawFrame( widget, 0, 0, win->m_width, win->m_height );
|
DrawFrame( widget, 0, 0, win->GetWidth(), win->GetHeight() );
|
||||||
win->m_oldX = 0;
|
win->m_oldX = 0;
|
||||||
win->m_oldY = 0;
|
win->m_oldY = 0;
|
||||||
|
|
||||||
@@ -202,16 +202,15 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
|||||||
int x = (int)gdk_event->x;
|
int x = (int)gdk_event->x;
|
||||||
int y = (int)gdk_event->y;
|
int y = (int)gdk_event->y;
|
||||||
|
|
||||||
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
|
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
|
||||||
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
|
||||||
int org_x = 0;
|
int org_x = 0;
|
||||||
int org_y = 0;
|
int org_y = 0;
|
||||||
gdk_window_get_origin( widget->window, &org_x, &org_y );
|
gdk_window_get_origin( widget->window, &org_x, &org_y );
|
||||||
x += org_x - win->m_diffX;
|
x += org_x - win->m_diffX;
|
||||||
y += org_y - win->m_diffY;
|
y += org_y - win->m_diffY;
|
||||||
win->m_x = x;
|
win->InternalSetPosition(x, y);
|
||||||
win->m_y = y;
|
gtk_widget_set_uposition( win->GetWidget(), x, y );
|
||||||
gtk_widget_set_uposition( win->m_widget, x, y );
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -241,10 +240,10 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
|||||||
gdk_event->state = state;
|
gdk_event->state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
|
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
|
||||||
win->m_oldX = (int)gdk_event->x - win->m_diffX;
|
win->m_oldX = (int)gdk_event->x - win->m_diffX;
|
||||||
win->m_oldY = (int)gdk_event->y - win->m_diffY;
|
win->m_oldY = (int)gdk_event->y - win->m_diffY;
|
||||||
DrawFrame( widget, win->m_oldX, win->m_oldY, win->m_width, win->m_height );
|
DrawFrame( widget, win->m_oldX, win->m_oldY, win->GetWidth(), win->GetHeight() );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -290,8 +289,8 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
|||||||
GtkWidget *close_button = gtk_button_new_with_label( "x" );
|
GtkWidget *close_button = gtk_button_new_with_label( "x" );
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
|
||||||
close_button,
|
close_button,
|
||||||
4, 4, 12, 11 );
|
4, 4, 12, 11 );
|
||||||
|
|
||||||
gtk_widget_show( close_button );
|
gtk_widget_show( close_button );
|
||||||
|
|
||||||
|
@@ -125,10 +125,10 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if ((win->m_x == alloc->x) &&
|
if ((win->GetX() == alloc->x) &&
|
||||||
(win->m_y == alloc->y) &&
|
(win->GetY() == alloc->y) &&
|
||||||
(win->m_width == alloc->width) &&
|
(win->GetWidth() == alloc->width) &&
|
||||||
(win->m_height == alloc->height))
|
(win->GetHeight() == alloc->height))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -188,16 +188,16 @@ static void wxInsertChildInNotebook( wxNotebook* parent, wxWindow* child )
|
|||||||
page->m_box = gtk_hbox_new (FALSE, 0);
|
page->m_box = gtk_hbox_new (FALSE, 0);
|
||||||
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
|
gtk_container_border_width(GTK_CONTAINER(page->m_box), 2);
|
||||||
|
|
||||||
GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget);
|
GtkNotebook *notebook = GTK_NOTEBOOK(parent->GetWidget());
|
||||||
|
|
||||||
page->m_client = child;
|
page->m_client = child;
|
||||||
gtk_notebook_append_page( notebook, child->m_widget, page->m_box );
|
gtk_notebook_append_page( notebook, child->GetWidget(), page->m_box );
|
||||||
|
|
||||||
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
page->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
|
||||||
|
|
||||||
page->m_parent = notebook;
|
page->m_parent = notebook;
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate",
|
gtk_signal_connect( GTK_OBJECT(child->GetWidget()), "size_allocate",
|
||||||
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child );
|
||||||
|
|
||||||
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
|
wxASSERT_MSG( page->m_page, _T("Notebook page creation error") );
|
||||||
@@ -267,9 +267,7 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
|||||||
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
|
GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback),
|
||||||
(gpointer)this );
|
(gpointer)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
|
||||||
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
|
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
|
||||||
|
@@ -68,7 +68,7 @@ BEGIN_EVENT_TABLE(wxRadioBox, wxControl)
|
|||||||
EVT_SIZE(wxRadioBox::OnSize)
|
EVT_SIZE(wxRadioBox::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxRadioBox::wxRadioBox(void)
|
wxRadioBox::wxRadioBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,9 +108,9 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(m_parent->GetWxWindow()),
|
||||||
GTK_WIDGET(m_radio),
|
GTK_WIDGET(m_radio),
|
||||||
m_x+10, m_y+10+(i*24), 10, 10 );
|
m_x+10, m_y+10+(i*24), 10, 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize ls = LayoutItems();
|
wxSize ls = LayoutItems();
|
||||||
@@ -120,9 +120,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
if (newSize.y == -1) newSize.y = ls.y;
|
if (newSize.y == -1) newSize.y = ls.y;
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -137,7 +135,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRadioBox::~wxRadioBox(void)
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
wxNode *node = m_boxes.First();
|
wxNode *node = m_boxes.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -150,9 +148,9 @@ wxRadioBox::~wxRadioBox(void)
|
|||||||
|
|
||||||
void wxRadioBox::OnSize( wxSizeEvent &event )
|
void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||||
{
|
{
|
||||||
wxControl::OnSize( event );
|
|
||||||
|
|
||||||
LayoutItems();
|
LayoutItems();
|
||||||
|
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxRadioBox::LayoutItems()
|
wxSize wxRadioBox::LayoutItems()
|
||||||
@@ -181,7 +179,7 @@ wxSize wxRadioBox::LayoutItems()
|
|||||||
int len = 22+gdk_string_measure( font, label->label );
|
int len = 22+gdk_string_measure( font, label->label );
|
||||||
if (len > max_len) max_len = len;
|
if (len > max_len) max_len = len;
|
||||||
|
|
||||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y );
|
gtk_myfixed_move( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y );
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
@@ -195,7 +193,7 @@ wxSize wxRadioBox::LayoutItems()
|
|||||||
{
|
{
|
||||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||||
|
|
||||||
gtk_myfixed_resize( GTK_MYFIXED(m_parent->m_wxwindow), button, max_len, 20 );
|
gtk_myfixed_resize( GTK_MYFIXED(m_parent->GetWxWindow()), button, max_len, 20 );
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
if (!node) break;
|
if (!node) break;
|
||||||
@@ -231,7 +229,7 @@ wxSize wxRadioBox::LayoutItems()
|
|||||||
{
|
{
|
||||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||||
|
|
||||||
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow), button, m_x+x, m_y+y, max, 20 );
|
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->GetWxWindow()), button, m_x+x, m_y+y, max, 20 );
|
||||||
x += max;
|
x += max;
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
@@ -389,9 +387,10 @@ void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
|
|||||||
wxFAIL_MSG(_T("wxRadioBox::SetLabel not implemented."));
|
wxFAIL_MSG(_T("wxRadioBox::SetLabel not implemented."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::Enable( bool enable )
|
bool wxRadioBox::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxControl::Enable( enable );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
wxNode *node = m_boxes.First();
|
wxNode *node = m_boxes.First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -402,6 +401,8 @@ void wxRadioBox::Enable( bool enable )
|
|||||||
gtk_widget_set_sensitive( label, enable );
|
gtk_widget_set_sensitive( label, enable );
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioBox::Enable( int item, bool enable )
|
void wxRadioBox::Enable( int item, bool enable )
|
||||||
|
@@ -91,9 +91,7 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab
|
|||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -138,13 +136,14 @@ bool wxRadioButton::GetValue(void) const
|
|||||||
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
return GTK_TOGGLE_BUTTON(m_widget)->active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::Enable( bool enable )
|
bool wxRadioButton::Enable( bool enable )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") );
|
if ( !wxControl::Enable( enable ) )
|
||||||
|
return FALSE;
|
||||||
wxControl::Enable( enable );
|
|
||||||
|
|
||||||
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRadioButton::ApplyWidgetStyle()
|
void wxRadioButton::ApplyWidgetStyle()
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
|
|||||||
float line_step = win->m_adjust->step_increment;
|
float line_step = win->m_adjust->step_increment;
|
||||||
float page_step = win->m_adjust->page_increment;
|
float page_step = win->m_adjust->page_increment;
|
||||||
|
|
||||||
if (win->m_isScrolling)
|
if (win->IsScrolling())
|
||||||
{
|
{
|
||||||
command = wxEVT_SCROLL_THUMBTRACK;
|
command = wxEVT_SCROLL_THUMBTRACK;
|
||||||
}
|
}
|
||||||
@@ -70,8 +70,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
|
|||||||
|
|
||||||
int value = (int)(win->m_adjust->value+0.5);
|
int value = (int)(win->m_adjust->value+0.5);
|
||||||
|
|
||||||
int orient = wxHORIZONTAL;
|
int orient = win->HasFlag(wxSB_VERTICAL) ? wxVERTICAL : wxHORIZONTAL;
|
||||||
if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
|
|
||||||
|
|
||||||
wxScrollEvent event( command, win->GetId(), value, orient );
|
wxScrollEvent event( command, win->GetId(), value, orient );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
@@ -90,11 +89,11 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
|
|||||||
|
|
||||||
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
||||||
GdkEventButton *WXUNUSED(gdk_event),
|
GdkEventButton *WXUNUSED(gdk_event),
|
||||||
wxScrollBar *win )
|
wxScrollBar *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
win->m_isScrolling = TRUE;
|
win->SetScrolling(TRUE);
|
||||||
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
|
// g_blockEventsOnScroll = TRUE; doesn't work in DialogEd
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -106,11 +105,11 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
|||||||
|
|
||||||
static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
static gint gtk_scrollbar_button_release_callback( GtkRange *WXUNUSED(widget),
|
||||||
GdkEventButton *WXUNUSED(gdk_event),
|
GdkEventButton *WXUNUSED(gdk_event),
|
||||||
wxScrollBar *win )
|
wxScrollBar *win )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
win->m_isScrolling = FALSE;
|
win->SetScrolling(FALSE);
|
||||||
// g_blockEventsOnScroll = FALSE;
|
// g_blockEventsOnScroll = FALSE;
|
||||||
|
|
||||||
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
|
gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
|
||||||
@@ -150,22 +149,20 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
||||||
"value_changed",
|
"value_changed",
|
||||||
(GtkSignalFunc) gtk_scrollbar_callback,
|
(GtkSignalFunc) gtk_scrollbar_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget),
|
gtk_signal_connect( GTK_OBJECT(m_widget),
|
||||||
"button_press_event",
|
"button_press_event",
|
||||||
(GtkSignalFunc)gtk_scrollbar_button_press_callback,
|
(GtkSignalFunc)gtk_scrollbar_button_press_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget),
|
gtk_signal_connect( GTK_OBJECT(m_widget),
|
||||||
"button_release_event",
|
"button_release_event",
|
||||||
(GtkSignalFunc)gtk_scrollbar_button_release_callback,
|
(GtkSignalFunc)gtk_scrollbar_button_release_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -299,9 +296,9 @@ bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
GtkRange *range = GTK_RANGE(m_widget);
|
GtkRange *range = GTK_RANGE(m_widget);
|
||||||
return ( (window == GTK_WIDGET(range)->window) ||
|
return ( (window == GTK_WIDGET(range)->window) ||
|
||||||
(window == range->trough) ||
|
(window == range->trough) ||
|
||||||
(window == range->slider) ||
|
(window == range->slider) ||
|
||||||
(window == range->step_forw) ||
|
(window == range->step_forw) ||
|
||||||
(window == range->step_back) );
|
(window == range->step_back) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxScrollBar::ApplyWidgetStyle()
|
void wxScrollBar::ApplyWidgetStyle()
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -110,26 +110,26 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
|
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), TRUE );
|
||||||
|
|
||||||
/* labels need more space and too small window will
|
/* labels need more space and too small window will
|
||||||
cause junk to appear on the dialog */
|
cause junk to appear on the dialog */
|
||||||
if (style & wxSL_VERTICAL)
|
if (style & wxSL_VERTICAL)
|
||||||
{
|
{
|
||||||
wxSize sz( size );
|
wxSize sz( size );
|
||||||
if (sz.x < 35)
|
if (sz.x < 35)
|
||||||
{
|
{
|
||||||
sz.x = 35;
|
sz.x = 35;
|
||||||
SetSize( sz );
|
SetSize( sz );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxSize sz( size );
|
wxSize sz( size );
|
||||||
if (sz.y < 35)
|
if (sz.y < 35)
|
||||||
{
|
{
|
||||||
sz.y = 35;
|
sz.y = 35;
|
||||||
SetSize( sz );
|
SetSize( sz );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
|
gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
|
||||||
@@ -138,15 +138,13 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
gtk_signal_connect( GTK_OBJECT(m_adjust),
|
||||||
"value_changed",
|
"value_changed",
|
||||||
(GtkSignalFunc) gtk_slider_callback,
|
(GtkSignalFunc) gtk_slider_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
SetRange( minValue, maxValue );
|
SetRange( minValue, maxValue );
|
||||||
SetValue( value );
|
SetValue( value );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -281,9 +279,9 @@ bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
GtkRange *range = GTK_RANGE(m_widget);
|
GtkRange *range = GTK_RANGE(m_widget);
|
||||||
return ( (window == GTK_WIDGET(range)->window) ||
|
return ( (window == GTK_WIDGET(range)->window) ||
|
||||||
(window == range->trough) ||
|
(window == range->trough) ||
|
||||||
(window == range->slider) ||
|
(window == range->slider) ||
|
||||||
(window == range->step_forw) ||
|
(window == range->step_forw) ||
|
||||||
(window == range->step_back) );
|
(window == range->step_back) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::ApplyWidgetStyle()
|
void wxSlider::ApplyWidgetStyle()
|
||||||
|
@@ -111,9 +111,7 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
(GtkSignalFunc) gtk_spinbutt_callback,
|
(GtkSignalFunc) gtk_spinbutt_callback,
|
||||||
(gpointer) this );
|
(gpointer) this );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -60,9 +60,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
|
|||||||
m_widget = gtk_label_new( "Bitmap" );
|
m_widget = gtk_label_new( "Bitmap" );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -45,9 +45,7 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
|
|||||||
|
|
||||||
m_widget = gtk_frame_new(m_label.mbc_str());
|
m_widget = gtk_frame_new(m_label.mbc_str());
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling
|
// Copyright: (c) 1998 Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -46,9 +46,7 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
|
|||||||
else
|
else
|
||||||
m_widget = gtk_hseparator_new();
|
m_widget = gtk_hseparator_new();
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -76,9 +76,7 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
if (tool->m_enabled)
|
if (tool->m_enabled)
|
||||||
{
|
{
|
||||||
if (tb->m_fg->red != 0)
|
if (tb->m_fg->red != 0)
|
||||||
{
|
{
|
||||||
tb->m_fg->red = 0;
|
tb->m_fg->red = 0;
|
||||||
tb->m_fg->green = 0;
|
tb->m_fg->green = 0;
|
||||||
tb->m_fg->blue = 0;
|
tb->m_fg->blue = 0;
|
||||||
@@ -82,12 +82,12 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
#else
|
#else
|
||||||
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tb->m_fg->red == 0)
|
if (tb->m_fg->red == 0)
|
||||||
{
|
{
|
||||||
tb->m_fg->red = 33000;
|
tb->m_fg->red = 33000;
|
||||||
tb->m_fg->green = 33000;
|
tb->m_fg->green = 33000;
|
||||||
tb->m_fg->blue = 33000;
|
tb->m_fg->blue = 33000;
|
||||||
@@ -103,7 +103,7 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
#else
|
#else
|
||||||
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
gtk_tooltips_set_colors( GTK_TOOLBAR(tb->m_toolbar)->tooltips, tb->m_bg, tb->m_fg );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* emit the event */
|
/* emit the event */
|
||||||
@@ -160,11 +160,11 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
if (style & wxTB_DOCKABLE)
|
if (style & wxTB_DOCKABLE)
|
||||||
{
|
{
|
||||||
m_widget = gtk_handle_box_new();
|
m_widget = gtk_handle_box_new();
|
||||||
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
|
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
|
||||||
gtk_widget_show( GTK_WIDGET(m_toolbar) );
|
gtk_widget_show( GTK_WIDGET(m_toolbar) );
|
||||||
|
|
||||||
#if (GTK_MINOR_VERSION > 0)
|
#if (GTK_MINOR_VERSION > 0)
|
||||||
if (style & wxTB_FLAT)
|
if (style & wxTB_FLAT)
|
||||||
gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
|
gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -209,9 +209,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
m_xMargin = 0;
|
m_xMargin = 0;
|
||||||
m_yMargin = 0;
|
m_yMargin = 0;
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -281,7 +279,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
|
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
|
||||||
toggle, clientData,
|
toggle, clientData,
|
||||||
helpString1, helpString2,
|
helpString1, helpString2,
|
||||||
tool_pixmap );
|
tool_pixmap );
|
||||||
|
|
||||||
GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
|
GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
|
||||||
: GTK_TOOLBAR_CHILD_BUTTON;
|
: GTK_TOOLBAR_CHILD_BUTTON;
|
||||||
@@ -359,8 +357,8 @@ void wxToolBar::EnableTool(int toolIndex, bool enable)
|
|||||||
/* we don't disable the tools for now as the bitmaps don't get
|
/* we don't disable the tools for now as the bitmaps don't get
|
||||||
greyed anyway and this also disables tooltips
|
greyed anyway and this also disables tooltips
|
||||||
|
|
||||||
if (tool->m_item)
|
if (tool->m_item)
|
||||||
gtk_widget_set_sensitive( tool->m_item, enable );
|
gtk_widget_set_sensitive( tool->m_item, enable );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -511,7 +509,7 @@ void wxToolBar::SetToolLongHelp(int toolIndex, const wxString& helpString)
|
|||||||
if (tool->m_index == toolIndex)
|
if (tool->m_index == toolIndex)
|
||||||
{
|
{
|
||||||
tool->m_longHelpString = helpString;
|
tool->m_longHelpString = helpString;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -530,7 +528,7 @@ void wxToolBar::SetToolShortHelp(int toolIndex, const wxString& helpString)
|
|||||||
if (tool->m_index == toolIndex)
|
if (tool->m_index == toolIndex)
|
||||||
{
|
{
|
||||||
tool->m_shortHelpString = helpString;
|
tool->m_shortHelpString = helpString;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
@@ -46,11 +46,11 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
|||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle) wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->HasVMT()) return;
|
||||||
|
|
||||||
win->SetModified();
|
win->SetModified();
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
||||||
event.SetString( win->GetValue() );
|
event.SetString( win->GetValue() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( event );
|
win->GetEventHandler()->ProcessEvent( event );
|
||||||
@@ -67,7 +67,7 @@ gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
|||||||
|
|
||||||
win->CalculateScrollbar();
|
win->CalculateScrollbar();
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
if (!win->HasVMT()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -152,7 +152,6 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
/* ... and put into the upper left hand corner of the table */
|
/* ... and put into the upper left hand corner of the table */
|
||||||
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
|
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
|
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
|
||||||
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
||||||
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
(GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
|
||||||
@@ -160,13 +159,11 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
|
|
||||||
/* always wrap words */
|
/* always wrap words */
|
||||||
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
|
gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
|
||||||
|
|
||||||
/* put the horizontal scrollbar in the lower left hand corner */
|
/* put the horizontal scrollbar in the lower left hand corner */
|
||||||
if (bHasHScrollbar)
|
if (bHasHScrollbar)
|
||||||
{
|
{
|
||||||
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
|
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
|
||||||
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( hscrollbar, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
|
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
|
||||||
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
|
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
|
||||||
GTK_FILL,
|
GTK_FILL,
|
||||||
@@ -178,11 +175,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
|
gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finally, put the vertical scrollbar in the upper right corner */
|
/* finally, put the vertical scrollbar in the upper right corner */
|
||||||
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
|
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
|
gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
|
||||||
GTK_FILL,
|
GTK_FILL,
|
||||||
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
|
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
|
||||||
@@ -200,9 +195,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
|||||||
if (newSize.y == -1) newSize.y = 26;
|
if (newSize.y == -1) newSize.y = 26;
|
||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
@@ -948,46 +941,53 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
|
|||||||
return (window == GTK_ENTRY(m_text)->text_area);
|
return (window == GTK_ENTRY(m_text)->text_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
|
bool wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
|
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
|
||||||
|
|
||||||
// doesn't work
|
// doesn't work
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
|
bool wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
|
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
|
||||||
|
|
||||||
// doesn't work
|
// doesn't work
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
|
wxCHECK_MSG( m_text != NULL, FALSE, _T("invalid text ctrl") );
|
||||||
|
|
||||||
wxControl::SetBackgroundColour( colour );
|
wxControl::SetBackgroundColour( colour );
|
||||||
|
|
||||||
if (!m_widget->window) return;
|
if (!m_widget->window)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
if (sysbg.Red() == colour.Red() &&
|
if (sysbg.Red() == colour.Red() &&
|
||||||
sysbg.Green() == colour.Green() &&
|
sysbg.Green() == colour.Green() &&
|
||||||
sysbg.Blue() == colour.Blue())
|
sysbg.Blue() == colour.Blue())
|
||||||
{
|
{
|
||||||
return;
|
return FALSE; // FIXME or TRUE?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_backgroundColour.Ok()) return;
|
if (!m_backgroundColour.Ok())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (m_windowStyle & wxTE_MULTILINE)
|
if (m_windowStyle & wxTE_MULTILINE)
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_TEXT(m_text)->text_area;
|
GdkWindow *window = GTK_TEXT(m_text)->text_area;
|
||||||
if (!window) return;
|
if (!window)
|
||||||
|
return FALSE;
|
||||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
|
||||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||||
gdk_window_clear( window );
|
gdk_window_clear( window );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::ApplyWidgetStyle()
|
void wxTextCtrl::ApplyWidgetStyle()
|
||||||
|
@@ -133,9 +133,7 @@ printf("5\n");
|
|||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
|
|
||||||
printf("Robert's new insertion code :-)\n");
|
printf("Robert's new insertion code :-)\n");
|
||||||
m_parent->AddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
(m_parent->m_insertCallback)( m_parent, this );
|
|
||||||
|
|
||||||
printf("postcreate\n");
|
printf("postcreate\n");
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user