CW5.2 Pro Adaptions, wxMac starting to move in

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
1999-11-05 09:16:09 +00:00
parent 20f2deb3cf
commit 519cb848a8
176 changed files with 19303 additions and 9141 deletions

View File

@@ -67,11 +67,6 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
/** Returns the standard icons for the msg dialogs, implemented in
src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
virtual wxIcon GetStdIcon(int which) const;
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
@@ -141,6 +136,11 @@ public:
public:
static long sm_lastMessageTime;
static wxWindow* s_captureWindow ;
static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right
static RgnHandle s_macCursorRgn ;
EventRecord* m_macCurrentEvent ;
int m_nCmdShow;
protected:
@@ -149,23 +149,54 @@ protected:
// mac specifics
public :
static bool s_macDefaultEncodingIsPC ;
static bool s_macSupportPCMenuShortcuts ;
static long s_macAboutMenuItemId ;
static wxString s_macHelpMenuTitleName ;
void MacDoOneEvent() ;
static bool s_macHasAppearance ;
static long s_macAppearanceVersion ;
static bool s_macHasNavigation ;
static bool s_macNavigationVersion ;
static bool s_macHasWindowManager ;
static long s_macWindowManagerVersion ;
static bool s_macHasMenuManager ;
static long s_macMenuManagerVersion ;
static bool s_macHasDialogManager ;
static long s_macDialogManagerVersion ;
RgnHandle m_macCursorRgn ;
RgnHandle m_macSleepRgn ;
RgnHandle m_macHelpRgn ;
virtual void MacSuspend( bool convertClipboard ) ;
virtual void MacResume( bool convertClipboard ) ;
virtual void MacConvertPrivateToPublicScrap() ;
virtual void MacConvertPublicToPrivateScrap() ;
// event main methods
void MacDoOneEvent() ;
void MacHandleOneEvent( EventRecord *ev ) ;
void MacHandleNullEvent( EventRecord *ev ) ;
void MacHandleHighLevelEvent( EventRecord *ev ) ;
void MacHandleMouseDownEvent( EventRecord *ev ) ;
void MacHandleMouseUpEvent( EventRecord *ev ) ;
void MacHandleKeyDownEvent( EventRecord *ev ) ;
void MacHandleKeyUpEvent( EventRecord *ev ) ;
void MacHandleAutoKeyEvent( EventRecord *ev ) ;
void MacHandleActivateEvent( EventRecord *ev ) ;
void MacHandleUpdateEvent( EventRecord *ev ) ;
void MacHandleDiskEvent( EventRecord *ev ) ;
void MacHandleOSEvent( EventRecord *ev ) ;
EventRecord* MacGetCurrentEvent() { return m_macCurrentEvent ; }
// primary events
virtual void MacHandleMouseDownEvent( EventRecord *ev ) ;
virtual void MacHandleMouseUpEvent( EventRecord *ev ) ;
virtual void MacHandleActivateEvent( EventRecord *ev ) ;
virtual void MacHandleUpdateEvent( EventRecord *ev ) ;
virtual void MacHandleKeyDownEvent( EventRecord *ev ) ;
virtual void MacHandleKeyUpEvent( EventRecord *ev ) ;
virtual void MacHandleDiskEvent( EventRecord *ev ) ;
virtual void MacHandleOSEvent( EventRecord *ev ) ;
virtual void MacHandleHighLevelEvent( EventRecord *ev ) ;
virtual void MacHandleMenuSelect( int menuid , int menuitem ) ;
virtual OSErr MacHandleAEODoc(AppleEvent *event , AppleEvent *reply) ;
virtual OSErr MacHandleAEPDoc(AppleEvent *event , AppleEvent *reply) ;
virtual OSErr MacHandleAEOApp(AppleEvent *event , AppleEvent *reply) ;
virtual OSErr MacHandleAEQuit(AppleEvent *event , AppleEvent *reply) ;
DECLARE_EVENT_TABLE()
};
@@ -173,6 +204,18 @@ DECLARE_EVENT_TABLE()
// TODO: add platform-specific arguments
int WXDLLEXPORT wxEntry( int argc, char *argv[] );
void wxMacConvertFromPCForControls( char * p ) ;
void wxMacConvertToPC( const char *from , char *to , int len ) ;
void wxMacConvertFromPC( const char *from , char *to , int len ) ;
void wxMacConvertToPC( const char *from , char *to , int len ) ;
void wxMacConvertFromPC( char * p ) ;
void wxMacConvertFromPC( unsigned char *p ) ;
wxString wxMacMakeMacStringFromPC( const char * p ) ;
void wxMacConvertToPC( char * p ) ;
void wxMacConvertToPC( unsigned char *p ) ;
wxString wxMacMakePCStringFromMac( const char * p ) ;
#endif
// _WX_APP_H_

View File

@@ -28,6 +28,12 @@ class WXDLLEXPORT wxBitmapHandler;
class WXDLLEXPORT wxIcon;
class WXDLLEXPORT wxCursor;
GWorldPtr wxMacCreateGWorld( int height , int widtdh , int depth ) ;
void wxMacDestroyGWorld( GWorldPtr gw ) ;
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
CTabHandle wxMacCreateColorTable( int numColors ) ;
// A mask is a mono bitmap used for drawing bitmaps
// transparently.
class WXDLLEXPORT wxMask: public wxObject
@@ -54,15 +60,15 @@ public:
bool Create(const wxBitmap& bitmap, int paletteIndex);
bool Create(const wxBitmap& bitmap);
/* TODO: platform-specific data access
// Implementation
inline WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
inline void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
protected:
WXHBITMAP m_maskBitmap;
*/
};
enum { kMacBitmapTypeUnknownType , kMacBitmapTypeGrafWorld, kMacBitmapTypePict } ;
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
{
friend class WXDLLEXPORT wxBitmap;
@@ -81,7 +87,9 @@ public:
wxPalette m_bitmapPalette;
int m_quality;
/* WXHBITMAP m_hBitmap; TODO: platform-specific handle */
int m_bitmapType ;
PicHandle m_hPict ;
WXHBITMAP m_hBitmap;
wxMask * m_bitmapMask; // Optional mask
};
@@ -128,14 +136,11 @@ public:
// Initialize with raw data.
wxBitmap(const char bits[], int width, int height, int depth = 1);
/* TODO: maybe implement XPM reading
// Initialize with XPM data
wxBitmap(const char **data);
*/
// Load a file or resource
// TODO: make default type whatever's appropriate for the platform.
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_PICT_RESOURCE);
// Constructor for generalised creation from data
wxBitmap(void *data, long type, int width, int height, int depth = 1);
@@ -184,14 +189,11 @@ public:
protected:
static wxList sm_handlers;
/*
// TODO: Implementation
public:
void SetHBITMAP(WXHBITMAP bmp);
inline WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
bool FreeResource(bool force = FALSE);
*/
};
#endif
// _WX_BITMAP_H_

View File

@@ -47,6 +47,8 @@ class WXDLLEXPORT wxBitmapButton: public wxButton
SetBitmapLabel(bitmap);
}
virtual void SetLabel( const wxString &name ) {}
virtual void SetBitmapLabel(const wxBitmap& bitmap);
inline wxBitmap& GetBitmapLabel() const { return (wxBitmap&) m_buttonBitmap; }

View File

@@ -42,10 +42,8 @@ class WXDLLEXPORT wxButton: public wxControl
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
virtual void SetDefault();
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const ;
virtual void Command(wxCommandEvent& event);
};

View File

@@ -44,8 +44,7 @@ class WXDLLEXPORT wxCheckBox: public wxControl
const wxString& name = wxCheckBoxNameStr);
virtual void SetValue(bool);
virtual bool GetValue() const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void SetLabel(const wxString& label);
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
virtual void Command(wxCommandEvent& event);
};
@@ -76,6 +75,7 @@ class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox
virtual bool GetValue() const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void SetLabel(const wxBitmap *bitmap);
virtual void SetLabel( const wxString &name ) {}
};
#endif
// _WX_CHECKBOX_H_

View File

@@ -63,9 +63,11 @@ class WXDLLEXPORT wxChoice: public wxControl
virtual inline void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } ;
virtual inline int GetColumns() const { return 1 ; };
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_noStrings;
MenuHandle m_macPopUpMenuHandle ;
};
#endif

View File

@@ -24,17 +24,6 @@
#include "wx/list.h"
bool WXDLLEXPORT wxOpenClipboard();
bool WXDLLEXPORT wxClipboardOpen();
bool WXDLLEXPORT wxCloseClipboard();
bool WXDLLEXPORT wxEmptyClipboard();
bool WXDLLEXPORT wxIsClipboardFormatAvailable(int dataFormat);
bool WXDLLEXPORT wxSetClipboardData(int dataFormat, wxObject *obj, int width = 0, int height = 0);
wxObject* WXDLLEXPORT wxGetClipboardData(int dataFormat, long *len = NULL);
int WXDLLEXPORT wxEnumClipboardFormats(int dataFormat);
int WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
bool WXDLLEXPORT wxGetClipboardFormatName(int dataFormat, char *formatName, int maxCount);
/* A clipboard client holds data belonging to the clipboard.
For plain text, a client is not necessary. */
class WXDLLEXPORT wxClipboardClient : public wxObject

View File

@@ -74,9 +74,7 @@ public:
void InitFromName(const wxString& col);
/* TODO
WXCOLORREF GetPixel() const { return m_pixel; };
*/
const WXCOLORREF GetPixel() const { return m_pixel; };
private:
bool m_isInit;
@@ -85,9 +83,8 @@ private:
unsigned char m_green;
public:
/* TODO: implementation
WXCOLORREF m_pixel ;
*/
WXCOLORREF m_pixel ;
void Set( WXCOLORREF color ) { m_pixel = color ; m_red = m_pixel.red>>8 ;m_blue = m_pixel.blue>>8 ;m_green = m_pixel.green>>8 ;}
private:
DECLARE_DYNAMIC_CLASS(wxColour)

View File

@@ -78,6 +78,10 @@ class WXDLLEXPORT wxComboBox: public wxChoice
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_noStrings;
MenuHandle m_macPopUpMenuHandle ;
};
#endif

View File

@@ -16,35 +16,77 @@
#pragma interface "control.h"
#endif
#include "wx/window.h"
#include "wx/list.h"
#include "wx/validate.h"
// General item class
class WXDLLEXPORT wxControl: public wxWindow
class WXDLLEXPORT wxControl : public wxControlBase
{
DECLARE_ABSTRACT_CLASS(wxControl)
DECLARE_ABSTRACT_CLASS(wxControl)
public:
wxControl();
~wxControl();
virtual ~wxControl();
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
// appropriate event handlers
virtual void SetLabel(const wxString& label);
virtual wxString GetLabel() const ;
// Simulates an event
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
void Centre(int direction = wxHORIZONTAL);
inline void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
// implementation from now on
// --------------------------
inline wxFunction GetCallback() { return m_callback; }
// Calls the callback and appropriate event handlers
bool ProcessCommand(wxCommandEvent& event);
wxList& GetSubcontrols() { return m_subControls; }
void OnEraseBackground(wxEraseEvent& event);
#if WXWIN_COMPATIBILITY
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
wxColour* GetButtonColour() const { return NULL; }
inline virtual void SetLabelFont(const wxFont& font);
inline virtual void SetButtonFont(const wxFont& font);
inline wxFont& GetLabelFont() const;
inline wxFont& GetButtonFont() const;
// Adds callback
inline void Callback(const wxFunction function);
wxFunction GetCallback() { return m_callback; }
protected:
wxFunction m_callback; // Callback associated with the window
#endif // WXWIN_COMPATIBILITY
DECLARE_EVENT_TABLE()
protected:
// For controls like radiobuttons which are really composite
wxList m_subControls;
virtual wxSize DoGetBestSize();
// create the control of the given class with the given style, returns FALSE
// if creation failed
bool MSWCreateControl(const wxChar *classname, WXDWORD style);
// determine the extended styles combination for this window (may slightly
// modify styl parameter)
WXDWORD GetExStyle(WXDWORD& style) const;
private:
DECLARE_EVENT_TABLE()
};
#if WXWIN_COMPATIBILITY
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
#endif // WXWIN_COMPATIBILITY
wxControl *wxFindControlFromMacControl(ControlHandle inControl ) ;
void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *control) ;
void wxRemoveMacControlAssociation(wxControl *control) ;
#endif
// _WX_CONTROL_H_

View File

@@ -27,9 +27,7 @@ public:
~wxCursorRefData();
protected:
/* TODO: implementation
WXHCURSOR m_hCursor;
*/
};
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
@@ -49,24 +47,22 @@ public:
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
/* TODO: make default type suit platform */
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type);
~wxCursor();
// TODO: also verify the internal cursor handle
virtual bool Ok() const { return (m_refData != NULL) ; }
virtual bool Ok() const { return (m_refData != NULL && M_CURSORDATA->m_hCursor != NULL ) ; }
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
/* TODO: implementation
void MacInstall() const ;
void SetHCURSOR(WXHCURSOR cursor);
inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
*/
};
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);

View File

@@ -61,53 +61,53 @@ class WXDLLEXPORT wxDC: public wxObject
virtual bool Ok(void) const { return m_ok; };
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0;
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
{
FloodFill(pt.x, pt.y, col, style);
}
virtual bool GetPixel( long x1, long y1, wxColour *col ) const = 0;
virtual bool GetPixel( long x1, long y1, wxColour *col ) const ;
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
{
return GetPixel(pt.x, pt.y, col);
}
virtual void DrawLine( long x1, long y1, long x2, long y2 ) = 0;
virtual void DrawLine( long x1, long y1, long x2, long y2 );
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
{
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
}
virtual void CrossHair( long x, long y ) = 0;
virtual void CrossHair( long x, long y );
inline void CrossHair(const wxPoint& pt)
{
CrossHair(pt.x, pt.y);
}
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc ) = 0;
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
{
DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
}
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) = 0;
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
{
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
}
virtual void DrawPoint( long x, long y ) = 0;
virtual void DrawPoint( long x, long y );
virtual void DrawPoint( wxPoint& point );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 0;
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ) = 0;
int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height ) = 0;
virtual void DrawRectangle( long x, long y, long width, long height );
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
{
DrawRectangle(pt.x, pt.y, sz.x, sz.y);
@@ -116,7 +116,7 @@ class WXDLLEXPORT wxDC: public wxObject
{
DrawRectangle(rect.x, rect.y, rect.width, rect.height);
}
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ) = 0;
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
{
DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
@@ -126,7 +126,7 @@ class WXDLLEXPORT wxDC: public wxObject
DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
}
virtual void DrawEllipse( long x, long y, long width, long height ) = 0;
virtual void DrawEllipse( long x, long y, long width, long height );
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
{
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
@@ -137,10 +137,10 @@ class WXDLLEXPORT wxDC: public wxObject
}
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( wxList *points );
virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0;
virtual bool CanDrawBitmap(void) const ;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
@@ -148,47 +148,44 @@ class WXDLLEXPORT wxDC: public wxObject
DrawIcon(icon, pt.x, pt.y);
}
// TODO DrawBitmap is not always the same as DrawIcon, especially if bitmaps and
// icons are implemented differently.
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE )
{ DrawIcon( *((wxIcon*)(&bmp)), x, y, useMask ); }
void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE ) ;
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ) = 0;
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
inline bool Blit(const wxPoint& destPt, const wxSize& sz,
wxDC *source, const wxPoint& srcPt, int rop = wxCOPY, bool useMask = FALSE)
{
return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
}
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ) = 0;
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
{
DrawText(text, pt.x, pt.y, use16bit);
}
virtual bool CanGetTextExtent(void) const = 0;
virtual bool CanGetTextExtent(void) const ;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16 = FALSE ) = 0;
virtual long GetCharWidth(void) = 0;
virtual long GetCharHeight(void) = 0;
wxFont *theFont = NULL, bool use16 = FALSE ) const ;
virtual long GetCharWidth(void);
virtual long GetCharHeight(void);
virtual void Clear(void) = 0;
virtual void Clear(void);
virtual void SetFont( const wxFont &font ) = 0;
virtual void SetFont( const wxFont &font );
virtual wxFont& GetFont(void) const { return (wxFont&) m_font; };
virtual void SetPen( const wxPen &pen ) = 0;
virtual void SetPen( const wxPen &pen );
virtual wxPen& GetPen(void) const { return (wxPen&) m_pen; };
virtual void SetBrush( const wxBrush &brush ) = 0;
virtual void SetBrush( const wxBrush &brush );
virtual wxBrush& GetBrush(void) const { return (wxBrush&) m_brush; };
virtual void SetBackground( const wxBrush &brush ) = 0;
virtual void SetBackground( const wxBrush &brush );
virtual wxBrush& GetBackground(void) const { return (wxBrush&) m_backgroundBrush; };
virtual void SetLogicalFunction( int function ) = 0;
virtual void SetLogicalFunction( int function );
virtual int GetLogicalFunction(void) const { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col );
@@ -196,10 +193,10 @@ class WXDLLEXPORT wxDC: public wxObject
virtual wxColour& GetTextBackground(void) const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground(void) const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode ) = 0;
virtual void SetBackgroundMode( int mode );
virtual int GetBackgroundMode(void) const { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette ) = 0;
virtual void SetPalette( const wxPalette& palette );
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called
@@ -368,6 +365,30 @@ class WXDLLEXPORT wxDC: public wxObject
long m_clipX1,m_clipY1,m_clipX2,m_clipY2;
long m_minX,m_maxX,m_minY,m_maxY;
//begin wxmac
GrafPtr m_macPort ;
// in order to preserve the const inheritance of the virtual functions, we have to
// use mutable variables starting from CWPro 5
void MacInstallFont() const ;
void MacInstallPen() const ;
void MacInstallBrush() const ;
mutable bool m_macFontInstalled ;
mutable bool m_macPenInstalled ;
mutable bool m_macBrushInstalled ;
mutable long m_macPortId ;
GrafPtr m_macOrigPort ;
Rect m_macClipRect ;
Point m_macLocalOrigin ;
void MacSetupPort() const ;
void MacVerifySetup() const { if ( m_macPortId != m_macCurrentPortId ) MacSetupPort() ; }
static long m_macCurrentPortId ;
};
#endif

View File

@@ -25,100 +25,44 @@
class WXDLLEXPORT wxPaintDC;
class WXDLLEXPORT wxWindow;
// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
// On many platforms, however, they will be the same.
class WXDLLEXPORT wxWindowDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
public:
wxWindowDC(void);
wxWindowDC(void);
wxWindowDC( wxWindow *win );
// Create a DC corresponding to a canvas
wxWindowDC(wxWindow *win);
~wxWindowDC(void);
virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
virtual void DrawLine( long x1, long y1, long x2, long y2 );
virtual void CrossHair( long x, long y );
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height );
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap(void) const;
virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE );
virtual bool Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
virtual bool CanGetTextExtent(void) const;
virtual void GetTextExtent( const wxString &string, long *width, long *height,
long *descent = NULL, long *externalLeading = NULL,
wxFont *theFont = NULL, bool use16 = FALSE );
virtual long GetCharWidth(void);
virtual long GetCharHeight(void);
virtual void Clear(void);
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
virtual void SetBackground( const wxBrush &brush );
virtual void SetLogicalFunction( int function );
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void SetClippingRegion( const wxRegion& region ) ;
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
~wxWindowDC(void);
};
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPaintDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC(void):wxWindowDC() {};
wxPaintDC( wxWindow *win ): wxWindowDC(win) {};
};
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxClientDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
public:
wxClientDC(void);
wxClientDC(void):wxWindowDC() {};
wxClientDC( wxWindow *win ): wxWindowDC(win) {};
// Create a DC corresponding to a canvas
wxClientDC(wxWindow *win);
~wxClientDC(void);
};
class WXDLLEXPORT wxPaintDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC(void);
// Create a DC corresponding to a canvas
wxPaintDC(wxWindow *win);
~wxPaintDC(void);
};
#endif

View File

@@ -28,9 +28,8 @@ class WXDLLEXPORT wxMemoryDC: public wxPaintDC
~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const;
wxBitmap GetSelectedObject() { return m_selected ; }
private:
friend wxPaintDC;
wxBitmap m_selected;
};

View File

@@ -17,6 +17,7 @@
#endif
#include "wx/dc.h"
#include "wx/cmndata.h"
class WXDLLEXPORT wxPrinterDC: public wxDC
{
@@ -24,9 +25,16 @@ class WXDLLEXPORT wxPrinterDC: public wxDC
DECLARE_CLASS(wxPrinterDC)
// Create a printer DC
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT);
wxPrinterDC(const wxPrintData& printdata );
~wxPrinterDC();
virtual bool StartDoc( const wxString& WXUNUSED(message) ) ;
virtual void EndDoc(void) ;
virtual void StartPage(void) ;
virtual void EndPage(void) ;
protected :
TPPrPort m_macPrintPort ;
wxPrintData m_printData ;
};
#endif

View File

@@ -60,23 +60,17 @@ public:
~wxDialog();
virtual bool Destroy();
void SetClientSize(int width, int height);
void GetPosition(int *x, int *y) const;
bool Show(bool show);
void Fit();
void Iconize(bool iconize);
virtual bool IsIconized() const;
void Fit();
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void OnCharHook(wxKeyEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void SetModal(bool flag);
virtual void Centre(int direction = wxBOTH);
virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual int ShowModal();
@@ -87,9 +81,17 @@ public:
void OnApply(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnSize(wxSizeEvent& event) ;
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
// splits text up at newlines and places the
// lines into a vertical wxBoxSizer
wxSizer *CreateTextSizer( const wxString &message );
// places buttons into a horizontal wxBoxSizer
wxSizer *CreateButtonSizer( long flags );
DECLARE_EVENT_TABLE()
};

View File

@@ -155,7 +155,7 @@ class WXDLLEXPORT wxDropTarget: public wxObject
// protected:
friend wxWindow;
friend class wxWindow;
// Override these to indicate what kind of data you support:

View File

@@ -1,88 +1,105 @@
/////////////////////////////////////////////////////////////////////////////
// Name: font.h
// Purpose: wxFont class
// Author: AUTHOR
// Author: Julian Smart
// Modified by:
// Created: ??/??/98
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Licence: wxWindows licence
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONT_H_
#define _WX_FONT_H_
#ifdef __GNUG__
#pragma interface "font.h"
#pragma interface "font.h"
#endif
#include "wx/gdiobj.h"
// ----------------------------------------------------------------------------
// public functions
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFont;
// convert wxFontEncoding into one of Windows XXX_CHARSET constants (fill exact
// parameter if it's not NULL with TRUE if encoding is realyl supported under
// Windows and FALSE if not and we just chose something close to it)
extern int wxCharsetFromEncoding(wxFontEncoding encoding, bool *exact = NULL);
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
// ----------------------------------------------------------------------------
// wxFont
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxFont : public wxFontBase
{
friend class WXDLLEXPORT wxFont;
public:
wxFontRefData();
wxFontRefData(const wxFontRefData& data);
~wxFontRefData();
// ctors and such
wxFont() { Init(); }
wxFont(const wxFont& font) { Init(); Ref(font); }
wxFont(int size,
int family,
int style,
int weight,
bool underlined = FALSE,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Init();
(void)Create(size, family, style, weight, underlined, face, encoding);
}
bool Create(int size,
int family,
int style,
int weight,
bool underlined = FALSE,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
virtual ~wxFont();
// assignment
wxFont& operator=(const wxFont& font);
// implement base class pure virtuals
virtual int GetPointSize() const;
virtual int GetFamily() const;
virtual int GetStyle() const;
virtual int GetWeight() const;
virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const;
virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family);
virtual void SetStyle(int style);
virtual void SetWeight(int weight);
virtual void SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding);
// implementation only from now on
// -------------------------------
int GetFontId() const;
virtual bool IsFree() const;
virtual bool RealizeResource();
virtual WXHANDLE GetResourceHandle();
virtual bool FreeResource(bool force = FALSE);
/*
virtual bool UseResource();
virtual bool ReleaseResource();
*/
protected:
int m_pointSize;
int m_family;
int m_style;
int m_weight;
bool m_underlined;
wxString m_faceName;
/* TODO: implementation
WXHFONT m_hFont;
*/
};
// common part of all ctors
void Init();
#define M_FONTDATA ((wxFontRefData *)m_refData)
void Unshare();
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
// Font
class WXDLLEXPORT wxFont: public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxFont)
public:
wxFont();
wxFont(int pointSize, int family, int style, int weight, bool underlined = FALSE, const wxString& faceName = wxEmptyString);
inline wxFont(const wxFont& font) { Ref(font); }
~wxFont();
bool Create(int pointSize, int family, int style, int weight, bool underlined = FALSE, const wxString& faceName = wxEmptyString);
virtual bool Ok() const { return (m_refData != NULL) ; }
inline int GetPointSize() const { return M_FONTDATA->m_pointSize; }
inline int GetFamily() const { return M_FONTDATA->m_family; }
inline int GetStyle() const { return M_FONTDATA->m_style; }
inline int GetWeight() const { return M_FONTDATA->m_weight; }
wxString GetFamilyString() const ;
wxString GetFaceName() const ;
wxString GetStyleString() const ;
wxString GetWeightString() const ;
inline bool GetUnderlined() const { return M_FONTDATA->m_underlined; }
void SetPointSize(int pointSize);
void SetFamily(int family);
void SetStyle(int style);
void SetWeight(int weight);
void SetFaceName(const wxString& faceName);
void SetUnderlined(bool underlined);
inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
// Implementation
protected:
bool RealizeResource();
void Unshare();
private:
DECLARE_DYNAMIC_CLASS(wxFont)
};
#endif

View File

@@ -19,12 +19,14 @@
#include "wx/window.h"
#include "wx/toolbar.h"
#include "wx/accel.h"
#include "wx/icon.h"
WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxStatusBar;
class WXDLLEXPORT wxMacToolTip ;
class WXDLLEXPORT wxFrame: public wxWindow {
@@ -54,14 +56,6 @@ public:
const wxString& name = wxFrameNameStr);
virtual bool Destroy();
void SetClientSize(int width, int height);
void GetClientSize(int *width, int *height) const;
void GetSize(int *width, int *height) const ;
void GetPosition(int *x, int *y) const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void ClientToScreen(int *x, int *y) const;
void ScreenToClient(int *x, int *y) const;
void OnSize(wxSizeEvent& event);
void OnMenuHighlight(wxMenuEvent& event);
@@ -69,18 +63,10 @@ public:
void OnIdle(wxIdleEvent& event);
void OnCloseWindow(wxCloseEvent& event);
bool Show(bool show);
// Set menu bar
void SetMenuBar(wxMenuBar *menu_bar);
virtual wxMenuBar *GetMenuBar() const ;
// Set title
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void Centre(int direction = wxBOTH);
// Call this to simulate a menu command
virtual void Command(int id);
virtual void ProcessCommand(int id);
@@ -96,6 +82,8 @@ public:
virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id,
const wxString& name);
#if wxUSE_TOOLBAR
// Create toolbar
virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name);
@@ -104,6 +92,8 @@ public:
virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; }
virtual void PositionToolBar();
#endif
// Set status line text
virtual void SetStatusText(const wxString& text, int number = 0);
@@ -136,10 +126,18 @@ public:
// Query app for menu item updates (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin);
void DoMenuUpdates(wxMenu* menu);
// Checks if there is a toolbar, and returns the first free client position
virtual wxPoint GetClientAreaOrigin() const;
virtual void GetClientSize(int *x, int *y) const ;
virtual void DoSetClientSize(int clientwidth, int clientheight) ;
// tooltip management
#if wxUSE_TOOLTIPS
wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; }
void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = wxMacToolTip; }
#endif // tooltips
protected:
wxMenuBar * m_frameMenuBar;
@@ -147,7 +145,9 @@ protected:
wxIcon m_icon;
bool m_iconized;
static bool m_useNativeStatusBar;
#if wxUSE_TOOLBAR
wxToolBar * m_frameToolBar ;
#endif
DECLARE_EVENT_TABLE()
};

View File

@@ -56,8 +56,6 @@ class WXDLLEXPORT wxGauge: public wxControl
int GetRange() const ;
int GetValue() const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
protected:

View File

@@ -27,9 +27,7 @@ public:
~wxIconRefData();
public:
/* TODO: whatever your actual icon handle is
WXHICON m_hIcon;
*/
};
#define M_ICONDATA ((wxIconRefData *)m_refData)
@@ -47,33 +45,31 @@ public:
inline wxIcon(const wxIcon& icon) { Ref(icon); }
wxIcon(const char bits[], int width, int height);
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICON_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
~wxIcon();
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
bool LoadFile(const wxString& name, long flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
int desiredWidth /* = -1 */ , int desiredHeight = -1);
bool LoadFile(const wxString& name ,long flags = wxBITMAP_TYPE_ICON_RESOURCE )
{ return LoadFile( name , flags , -1 , -1 ) ; }
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
/* TODO: implementation
void SetHICON(WXHICON ico);
inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
*/
/* TODO */
virtual bool Ok() const { return (m_refData != NULL) ; }
};
/* Example handlers. TODO: write your own handlers for relevant types.
class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
/*
class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
DECLARE_DYNAMIC_CLASS(wxICONFileHandler)
public:
inline wxICOFileHandler()
inline wxICONFileHandler()
{
m_name = "ICO icon file";
m_extension = "ico";
@@ -83,16 +79,17 @@ public:
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
};
*/
class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
DECLARE_DYNAMIC_CLASS(wxICONResourceHandler)
public:
inline wxICOResourceHandler()
inline wxICONResourceHandler()
{
m_name = "ICO resource";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO_RESOURCE;
m_name = "ICON resource";
m_extension = "";
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
@@ -100,7 +97,5 @@ public:
};
*/
#endif
// _WX_ICON_H_

View File

@@ -17,6 +17,7 @@
#endif
#include "wx/control.h"
#include "wx/dynarray.h"
WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr;
@@ -26,6 +27,9 @@ class WXDLLEXPORT wxArrayInt;
WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
// List box item
WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
class WXDLLEXPORT wxListBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListBox)
@@ -73,7 +77,6 @@ class WXDLLEXPORT wxListBox: public wxControl
virtual int GetSelections(wxArrayInt& aSelections) const;
virtual bool Selected(int n) const ;
virtual wxString GetString(int n) const ;
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
// Set the specified item at the first visible item
// or scroll to max range.
@@ -88,9 +91,33 @@ class WXDLLEXPORT wxListBox: public wxControl
void Command(wxCommandEvent& event);
void MacSetRedraw( bool doDraw ) ;
protected:
int m_noItems;
int m_selected;
void MacDestroy() ;
void MacDelete( int n ) ;
void MacInsert( int n , const char * text) ;
void MacAppend( const char * text) ;
void MacSet( int n , const char *text ) ;
void MacClear() ;
void MacSetSelection( int n , bool select ) ;
int MacGetSelection() const ;
int MacGetSelections(wxArrayInt& aSelections) const ;
bool MacIsSelected( int n ) const ;
void MacScrollTo( int n ) ;
void OnSize( const wxSizeEvent &size ) ;
void MacDoClick() ;
void MacDoDoubleClick() ;
public :
ListHandle m_macList ;
wxArrayString m_stringArray ;
wxListDataArray m_dataArray ;
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
DECLARE_EVENT_TABLE()
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -125,6 +125,7 @@ public:
// MDI operations
virtual void Maximize();
virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame
virtual void Restore();
virtual void Activate();
};

View File

@@ -92,6 +92,10 @@ public:
inline wxList& GetItems() const { return (wxList&) m_menuItems; }
void SetInvokingWindow(wxWindow *pWin) { m_pInvokingWindow = pWin; }
wxWindow * GetInvokingWindow() const { return m_pInvokingWindow; }
bool MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) ;
public:
wxFunction m_callback;
@@ -101,7 +105,21 @@ public:
wxList m_menuItems;
wxEvtHandler * m_parent;
wxEvtHandler * m_eventHandler;
wxWindow* m_pInvokingWindow;
void* m_clientData;
MenuHandle m_macMenuHandle;
short m_macMenuId;
bool m_macMenuEnabled ;
// void MacSetTitle(const wxString& title);
int MacGetIndexFromId( int id ) ;
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
void MacEnableMenu( bool bDoEnable ) ;
static short s_macNextMenuId ;
protected:
};
// ----------------------------------------------------------------------------
@@ -149,14 +167,17 @@ class WXDLLEXPORT wxMenuBar: public wxEvtHandler
inline int GetMenuCount() const { return m_menuCount; }
inline wxMenu* GetMenu(int i) const { return m_menus[i]; }
void MacInstallMenuBar() ;
void MacMenuSelect(wxEvtHandler* handler, long when , int macMenuId, int macMenuItemNum) ;
public:
wxEvtHandler * m_eventHandler;
int m_menuCount;
wxMenu ** m_menus;
wxString * m_titles;
wxFrame * m_menuBarFrame;
/* TODO: data that represents the actual menubar when created.
*/
static wxMenuBar* s_macInstalledMenuBar ;
};
#endif // _WX_MENU_H_

View File

@@ -29,67 +29,48 @@
#include "wx/ownerdrw.h"
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// id for a separator line in the menu (invalid for normal item)
#define ID_SEPARATOR (-1)
// ----------------------------------------------------------------------------
// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxMenuItem: public wxObject
class WXDLLEXPORT wxMenuItem: public wxMenuItemBase
#if wxUSE_OWNER_DRAWN
, public wxOwnerDrawn
#endif
{
DECLARE_DYNAMIC_CLASS(wxMenuItem)
public:
// ctor & dtor
wxMenuItem(wxMenu *pParentMenu = NULL, int id = ID_SEPARATOR,
const wxString& strName = "", const wxString& wxHelp = "",
bool bCheckable = FALSE, wxMenu *pSubMenu = NULL);
virtual ~wxMenuItem();
// ctor & dtor
wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL,
int id = wxID_SEPARATOR,
const wxString& name = wxEmptyString,
const wxString& help = wxEmptyString,
bool isCheckable = FALSE,
wxMenu *subMenu = (wxMenu *)NULL);
virtual ~wxMenuItem();
// accessors (some more are inherited from wxOwnerDrawn or are below)
bool IsSeparator() const { return m_idItem == ID_SEPARATOR; }
bool IsEnabled() const { return m_bEnabled; }
bool IsChecked() const { return m_bChecked; }
// override base class virtuals
virtual void SetText(const wxString& strName);
virtual wxString GetLabel() const;
virtual void SetCheckable(bool checkable);
int GetId() const { return m_idItem; }
const wxString& GetHelp() const { return m_strHelp; }
wxMenu *GetSubMenu() const { return m_pSubMenu; }
virtual void Enable(bool bDoEnable = TRUE);
virtual void Check(bool bDoCheck = TRUE);
virtual bool IsChecked() const;
// operations
void SetName(const wxString& strName) { m_strName = strName; }
void SetHelp(const wxString& strHelp) { m_strHelp = strHelp; }
#if wxUSE_ACCEL
virtual wxAcceleratorEntry *GetAccel() const;
#endif // wxUSE_ACCEL
void Enable(bool bDoEnable = TRUE);
void Check(bool bDoCheck = TRUE);
// unfortunately needed to resolve ambiguity between
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
void DeleteSubMenu();
// the id for a popup menu is really its menu handle (as required by
// ::AppendMenu() API), so this function will return either the id or the
// menu handle depending on what we're
int GetRealId() const;
private:
int m_idItem; // numeric id of the item
wxString m_strHelp; // associated help string
wxMenu *m_pSubMenu, // may be NULL
*m_pParentMenu; // menu this item is contained in
bool m_bEnabled, // enabled or greyed?
m_bChecked; // checked? (only if checkable)
#if wxUSE_OWNER_DRAWN
// wxOwnerDrawn base class already has these variables - nothing to do
#else //!owner drawn
bool m_bCheckable; // can be checked?
wxString m_strName; // name or label of the item
public:
const wxString& GetName() const { return m_strName; }
bool IsCheckable() const { return m_bCheckable; }
#endif //owner drawn
DECLARE_DYNAMIC_CLASS(wxMenuItem)
};
#endif //_MENUITEM_H

View File

@@ -15,73 +15,91 @@
#ifndef _WX_METAFIILE_H_
#define _WX_METAFIILE_H_
#ifdef __GNUG__
#pragma interface "metafile.h"
#if wxUSE_METAFILE
#include "wx/dc.h"
#include "wx/gdiobj.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dataobj.h" wx/defs.h
#endif
#include "wx/setup.h"
/*
* Metafile and metafile device context classes - work in Windows 3.1 only
* Metafile and metafile device context classes
*
*/
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxMetaFile: public wxObject
#define wxMetaFile wxMetafile
#define wxMetaFileDC wxMetafileDC
class WXDLLEXPORT wxMetafile;
class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData
{
DECLARE_DYNAMIC_CLASS(wxMetaFile)
friend class WXDLLEXPORT wxMetafile;
public:
wxMetafileRefData(void);
~wxMetafileRefData(void);
public:
PicHandle m_metafile;
};
#define M_METAFILEDATA ((wxMetafileRefData *)m_refData)
class WXDLLEXPORT wxMetafile: public wxGDIObject
{
DECLARE_DYNAMIC_CLASS(wxMetafile)
public:
wxMetaFile(const wxString& file = "");
~wxMetaFile();
// Copy constructor
inline wxMetafile(const wxMetafile& metafile)
{ Ref(metafile); }
wxMetafile(const wxString& file = "");
~wxMetafile(void);
// After this is called, the metafile cannot be used for anything
// since it is now owned by the clipboard.
virtual bool SetClipboard(int width = 0, int height = 0);
virtual bool Play(wxDC *dc);
// TODO
inline bool Ok() { return FALSE; };
inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); };
/* TODO: Implementation
inline WXHANDLE GetHMETAFILE() { return m_metaFile; }
inline void SetHMETAFILE(WXHANDLE mf) { m_metaFile = mf; }
// Implementation
inline PicHandle GetHMETAFILE(void) { return M_METAFILEDATA->m_metafile; }
void SetHMETAFILE(PicHandle mf) ;
// Operators
inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; }
inline bool operator == (const wxMetafile& metafile) { return m_refData == metafile.m_refData; }
inline bool operator != (const wxMetafile& metafile) { return m_refData != metafile.m_refData; }
protected:
WXHANDLE m_metaFile;
*/
};
class WXDLLEXPORT wxMetaFileDC: public wxDC
class WXDLLEXPORT wxMetafileDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxMetaFileDC)
DECLARE_DYNAMIC_CLASS(wxMetafileDC)
public:
// Don't supply origin and extent
// Supply them to wxMakeMetaFilePlaceable instead.
wxMetaFileDC(const wxString& file = "");
wxMetafileDC(const wxString& file = "");
// Supply origin and extent (recommended).
// Then don't need to supply them to wxMakeMetaFilePlaceable.
wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
~wxMetaFileDC();
~wxMetafileDC(void);
// Should be called at end of drawing
virtual wxMetaFile *Close();
virtual void SetMapMode(int mode);
virtual void GetTextExtent(const wxString& string, float *x, float *y,
float *descent = NULL, float *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE);
virtual wxMetafile *Close(void);
// Implementation
inline wxMetaFile *GetMetaFile() { return m_metaFile; }
inline void SetMetaFile(wxMetaFile *mf) { m_metaFile = mf; }
inline int GetWindowsMappingMode() { return m_windowsMappingMode; }
inline void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; }
inline wxMetafile *GetMetaFile(void) const { return m_metaFile; }
inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
protected:
int m_windowsMappingMode;
wxMetaFile *m_metaFile;
wxMetafile* m_metaFile;
};
/*
@@ -92,10 +110,57 @@ protected:
*/
// No origin or extent
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, float scale = 1.0);
#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable
bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0);
// Optional origin and extent
bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE);
// ----------------------------------------------------------------------------
// wxMetafileDataObject is a specialization of wxDataObject for metafile data
// ----------------------------------------------------------------------------
// TODO: implement OLE side of things. At present, it's just for clipboard
// use.
#if wxUSE_DRAG_AND_DROP
class WXDLLEXPORT wxMetafileDataObject : public wxDataObject
{
public:
// ctors
wxMetafileDataObject() { m_width = 0; m_height = 0; };
wxMetafileDataObject(const wxMetafile& metafile, int width = 0, int height = 0):
m_metafile(metafile), m_width(width), m_height(height) { }
void SetMetafile(const wxMetafile& metafile, int w = 0, int h = 0)
{ m_metafile = metafile; m_width = w; m_height = h; }
wxMetafile GetMetafile() const { return m_metafile; }
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
virtual wxDataFormat GetFormat() const { return wxDF_METAFILE; }
/* ??
// implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return (wxDataFormat) wxDataObject::Text; }
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDataObject::Text || format == wxDataObject::Locale; }
virtual size_t GetDataSize() const
{ return m_strText.Len() + 1; } // +1 for trailing '\0'of course
virtual void GetDataHere(void *pBuf) const
{ memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
*/
private:
wxMetafile m_metafile;
int m_width;
int m_height;
};
#endif
#endif // wxUSE_METAFILE
#endif
// _WX_METAFIILE_H_

View File

@@ -165,6 +165,7 @@ public:
virtual bool DoPhase(int nPhase);
protected:
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
// common part of all ctors
void Init();

View File

@@ -26,10 +26,9 @@ class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
public:
wxPaletteRefData();
~wxPaletteRefData();
/* TODO: implementation
protected:
WXHPALETTE m_hPalette;
*/
wxColour* m_palette;
wxInt32 m_count ;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)

View File

@@ -25,63 +25,88 @@ class WXDLLEXPORT wxBitmap ;
class WXDLLEXPORT wxRadioBox: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxRadioBox)
DECLARE_DYNAMIC_CLASS(wxRadioBox)
public:
wxRadioBox();
wxRadioBox();
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
{
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
{
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
}
~wxRadioBox();
~wxRadioBox();
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
int FindString(const wxString& s) const;
void SetSelection(int N);
int GetSelection() const;
wxString GetString(int N) const;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void GetSize(int *x, int *y) const;
void GetPosition(int *x, int *y) const;
wxString GetLabel() const;
void SetLabel(const wxString& label);
void SetLabel(int item, const wxString& label) ;
wxString GetLabel(int item) const;
bool Show(bool show);
void SetFocus();
void Enable(bool enable);
void Enable(int item, bool enable);
void Show(int item, bool show) ;
inline void SetLabelFont(const wxFont& WXUNUSED(font)) {};
inline void SetButtonFont(const wxFont& font) { SetFont(font); }
int FindString(const wxString& s) const;
void SetSelection(int N);
int GetSelection() const;
wxString GetString(int N) const;
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection(const wxString& s);
inline virtual int Number() const { return m_noItems; } ;
void Command(wxCommandEvent& event);
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
void GetSize(int *x, int *y) const;
void GetPosition(int *x, int *y) const;
void SetLabel(int item, const wxString& label);
void SetLabel(int item, wxBitmap *bitmap);
wxString GetLabel(int item) const;
bool Show(bool show);
void SetFocus();
bool Enable(bool enable);
void Enable(int item, bool enable);
void Show(int item, bool show);
void SetLabelFont(const wxFont& WXUNUSED(font)) {};
void SetButtonFont(const wxFont& font) { SetFont(font); }
virtual wxString GetStringSelection() const;
virtual bool SetStringSelection(const wxString& s);
virtual int Number() const { return m_noItems; };
void Command(wxCommandEvent& event);
int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
// implementation only from now on
// -------------------------------
WXHWND *GetRadioButtons() const { return m_radioButtons; }
bool ContainsHWND(WXHWND hWnd) const;
void SendNotificationEvent();
// get the number of buttons per column/row
int GetNumVer() const;
int GetNumHor() const;
#if WXWIN_COMPATIBILITY
wxRadioBox(wxWindow *parent, wxFunction func, const char *title,
int x = -1, int y = -1, int width = -1, int height = -1,
int n = 0, char **choices = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, const char *name = wxRadioBoxNameStr);
#endif // WXWIN_COMPATIBILITY
protected:
/* TODO: implementation
WXHWND * m_radioButtons;
*/
int m_majorDim ;
int m_noItems;
int m_noRowsOrCols;
int m_selectedButton;
void SubclassRadioButton(WXHWND hWndBtn);
WXHWND * m_radioButtons;
int m_majorDim;
int * m_radioWidth; // for bitmaps
int * m_radioHeight;
int m_noItems;
int m_noRowsOrCols;
int m_selectedButton;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
};
#endif

View File

@@ -43,6 +43,7 @@ public:
wxRegion(long x, long y, long w, long h);
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect);
wxRegion( WXHRGN hRegion );
wxRegion();
~wxRegion();
@@ -100,6 +101,7 @@ public:
bool Combine(long x, long y, long width, long height, wxRegionOp op);
bool Combine(const wxRegion& region, wxRegionOp op);
bool Combine(const wxRect& rect, wxRegionOp op);
const WXHRGN GetWXHRGN() const ;
};
class WXDLLEXPORT wxRegionIterator : public wxObject {
@@ -125,7 +127,6 @@ public:
long GetH() const;
long GetHeight() const { return GetH(); }
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
private:
long m_current;
long m_numRects;

View File

@@ -55,6 +55,7 @@ public:
bool refresh = TRUE);
void Command(wxCommandEvent& event);
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_pageSize;

View File

@@ -16,6 +16,19 @@
* General features
*
*/
#define wxUSE_BUSYINFO 1
#define WORDS_BIGENDIAN 1
#define wxUSE_LIBPNG 1
// Use PNG bitmap code
#define wxUSE_LIBJPEG 1
// Use JPEG bitmap code
#define wxUSE_STREAMS 1
#define wxUSE_ZLIB 1
#define wxUSE_ZIPSTREAM 1
#define wxUSE_SOCKETS 1
#define wxUSE_CONSTRAINTS 1
// Use constraints mechanism
@@ -24,7 +37,7 @@
#define _WX_GOODCOMPILER__
// gcc can have problems, but Windows compilers
// are generally OK.
#define WXWIN_COMPATIBILITY 1
#define WXWIN_COMPATIBILITY 0
// Compatibility with 1.66 API.
// Level 0: no backward compatibility, all new features
// Level 1: wxDC, OnSize (etc.) compatibility, but
@@ -36,7 +49,7 @@
// 0 for no PostScript device context
#define wxUSE_AFM_FOR_POSTSCRIPT 0
// 1 to use font metric files in GetTextExtent
#define wxUSE_METAFILE 0
#define wxUSE_METAFILE 1
// 0 for no Metafile and metafile device context
#define wxUSE_FORM 0
// 0 for no wxForm
@@ -44,9 +57,9 @@
// 0 for no interprocess comms
#define wxUSE_HELP 0
// 0 for no help facility
#define wxUSE_RESOURCES 0
#define wxUSE_RESOURCES 1
// 0 for no wxGetResource/wxWriteResource
#define wxUSE_CLIPBOARD 0
#define wxUSE_CLIPBOARD 1
// 0 for no clipboard functions
#define wxUSE_SPLINES 0
// 0 for no splines
@@ -55,17 +68,17 @@
// AIAI spline code is slower, but freer of copyright issues.
// 0 for no splines
#define wxUSE_TOOLBAR 0
#define wxUSE_TOOLBAR 1
// Use toolbars
#define wxUSE_DRAG_AND_DROP 0
// 0 for no drag and drop
#define wxUSE_WX_RESOURCES 0
#define wxUSE_WX_RESOURCES 1
// Use .wxr resource mechanism (requires PrologIO library)
#define wxUSE_DOC_VIEW_ARCHITECTURE 1
// Set to 0 to disable document/view architecture
#define wxUSE_PRINTING_ARCHITECTURE 0
#define wxUSE_PRINTING_ARCHITECTURE 1
// Set to 0 to disable print/preview architecture code
#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
// Set to 0 to disable PostScript print/preview architecture code
@@ -111,6 +124,18 @@
// but you can't mix them. Set to 1 for <iostream.h>,
// 0 for <iostream>
#define wxUSE_ZIPSTREAM 1
#define wxUSE_FS_ZIP 1
#define wxUSE_FS_INET 1
#define wxUSE_STREAMS 1
// If enabled (1), compiles wxWindows streams classes
#define wxUSE_STD_IOSTREAM 1
// Use standard C++ streams if 1. If 0, use wxWin
// streams implementation.
#define wxUSE_WXCONFIG 0
// if enabled, compiles built-in OS independent wxConfig
// class and it's file (any platform) and registry (Win)
@@ -125,5 +150,43 @@
// will be used to write, in a portable way,
// float on the disk
// use wxFile class - required by i18n code, wxConfig and others - recommended
#define wxUSE_FILE 1
// use wxTextFile class: requires wxFile, required by wxConfig
#define wxUSE_TEXTFILE 1
// i18n support: _() macro, wxLocale class. Requires wxFile
#define wxUSE_INTL 1
// wxLogXXX functions - highly recommended
#define wxUSE_LOG 1
// wxValidator class
#define wxUSE_VALIDATORS 1
// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar)
#define wxUSE_ACCEL 1
// wxSashWindow class
#define wxUSE_SASH 1
// text entry dialog and wxGetTextFromUser function
#define wxUSE_TEXTDLG 1
#define wxUSE_STATLINE 1
// wxToolBar class
#define wxUSE_TOOLBAR 1
// wxStatusBar class
#define wxUSE_STATUSBAR 1
// progress dialog class for lengthy operations
#define wxUSE_PROGRESSDLG 1
// wxDirDlg class for getting a directory name from user
#define wxUSE_DIRDLG 1
#endif
// _WX_SETUP_H_

View File

@@ -51,9 +51,6 @@ public:
virtual int GetValue() const ;
virtual void SetValue(int);
void GetSize(int *x, int *y) const ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void GetPosition(int *x, int *y) const ;
bool Show(bool show);
void SetRange(int minValue, int maxValue);
@@ -78,7 +75,12 @@ public:
void SetTick(int tickPos) ;
void Command(wxCommandEvent& event);
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
wxStaticText* m_macMinimumStatic ;
wxStaticText* m_macMaximumStatic ;
wxStaticText* m_macValueStatic ;
int m_rangeMin;
int m_rangeMax;
int m_pageSize;

View File

@@ -63,10 +63,12 @@ class WXDLLEXPORT wxSpinButton: public wxControl
////////////////////////////////////////////////////////////////////////////
void Command(wxCommandEvent& event) { ProcessCommand(event); };
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
int m_min;
int m_max;
int m_value ;
};
class WXDLLEXPORT wxSpinEvent: public wxScrollEvent

View File

@@ -47,7 +47,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
virtual void OnPaint( wxPaintEvent &event ) ;
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_messageBitmap; }
@@ -57,7 +57,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
protected:
wxBitmap m_messageBitmap;
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -47,8 +47,8 @@ class WXDLLEXPORT wxStaticBox: public wxControl
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetLabel(const wxString& label);
protected:
DECLARE_EVENT_TABLE()
};

View File

@@ -44,9 +44,8 @@ class WXDLLEXPORT wxStaticText: public wxControl
const wxString& name = wxStaticTextNameStr);
// accessors
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetLabel(const wxString&);
void SetLabel(const wxString& , bool resize );
void SetLabel( const wxString &str ) { SetLabel( str , true ) ; }
// operations
virtual void Command(wxCommandEvent& WXUNUSED(event)) {};
virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {};

View File

@@ -19,7 +19,7 @@
#include "wx/generic/statusbr.h"
class WXDLLEXPORT wxStatusBarXX : public wxStatusBar
class WXDLLEXPORT wxStatusBarMac : public wxStatusBar
{
DECLARE_DYNAMIC_CLASS(wxStatusBarXX);
@@ -51,3 +51,4 @@ protected:
};
#endif
// _WX_STATBAR_H_

View File

@@ -119,11 +119,12 @@ public:
virtual void PositionToXY(long pos, long *x, long *y) const ;
virtual void ShowPosition(long pos);
virtual void Clear();
virtual bool MacCanFocus() const { return true ; }
// callbacks
// ---------
void OnDropFiles(wxDropFilesEvent& event);
// void OnChar(wxKeyEvent& event); // Process 'enter' if required
void OnChar(wxKeyEvent& event); // Process 'enter' if required
// void OnEraseBackground(wxEraseEvent& event);
// Implementation

View File

@@ -45,9 +45,5 @@ private:
DECLARE_ABSTRACT_CLASS(wxTimer)
};
/* Note: these are implemented in common/timercmn.cpp, so need to implement them separately.
* But you may need to modify timercmn.cpp.
*/
#endif
// _WX_TIMER_H_

View File

@@ -16,7 +16,10 @@
#pragma interface "toolbar.h"
#endif
#if wxUSE_TOOLBAR
#include "wx/tbarbase.h"
#include "wx/dynarray.h"
WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
@@ -62,16 +65,19 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
// Add all the buttons
virtual bool CreateTools();
virtual void Layout() {}
virtual void LayoutButtons() {}
// The post-tool-addition call. TODO: do here whatever's
// necessary for completing the toolbar construction.
bool Realize() { return CreateTools(); };
virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
protected:
wxArrayPtrVoid m_macToolHandles ;
DECLARE_EVENT_TABLE()
};
#endif // wxUSE_TOOLBAR
#endif
// _WX_TOOLBAR_H_

View File

@@ -16,577 +16,331 @@
#pragma interface "window.h"
#endif
#include "wx/gdicmn.h"
#include "wx/icon.h"
#include "wx/cursor.h"
#include "wx/pen.h"
#include "wx/font.h"
#include "wx/validate.h"
#include "wx/event.h"
#include "wx/string.h"
#include "wx/list.h"
#include "wx/region.h"
#include "wx/accel.h"
// ---------------------------------------------------------------------------
// forward declarations
// ---------------------------------------------------------------------------
#define wxKEY_SHIFT 1
#define wxKEY_CTRL 2
/*
* Base class for frame, panel, canvas, panel items, dialog box.
*
*/
/*
* 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 wxWindow;
class WXDLLEXPORT wxEvent;
class WXDLLEXPORT wxCommandEvent;
class WXDLLEXPORT wxKeyEvent;
class WXDLLEXPORT wxControl;
class WXDLLEXPORT wxCursor;
class WXDLLEXPORT wxColourMap;
class WXDLLEXPORT wxFont;
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxRect;
class WXDLLEXPORT wxBitmap;
class WXDLLEXPORT wxSizer;
class WXDLLEXPORT wxList;
class WXDLLEXPORT wxLayoutConstraints;
class WXDLLEXPORT wxMouseEvent;
class WXDLLEXPORT wxButton;
class WXDLLEXPORT wxColour;
class WXDLLEXPORT wxBrush;
class WXDLLEXPORT wxPen;
class WXDLLEXPORT wxIcon;
class WXDLLEXPORT wxDC;
class WXDLLEXPORT wxValidator;
#if wxUSE_DRAG_AND_DROP
class WXDLLEXPORT wxDropTarget;
#endif
// ---------------------------------------------------------------------------
// constants
// ---------------------------------------------------------------------------
#if wxUSE_WX_RESOURCES
class WXDLLEXPORT wxResourceTable;
class WXDLLEXPORT wxItemResource;
#endif
WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr;
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
//-----------------------------------------------------------------------------
// wxClientData
//-----------------------------------------------------------------------------
class wxClientData
// FIXME does anybody use those? they're unused by wxWindows...
enum
{
public:
wxClientData() { }
virtual ~wxClientData() { }
wxKEY_SHIFT = 1,
wxKEY_CTRL = 2
};
//-----------------------------------------------------------------------------
// wxStringClientData
//-----------------------------------------------------------------------------
class wxStringClientData: public wxClientData
class WXDLLEXPORT wxWindow: public wxWindowBase
{
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;
};
class WXDLLEXPORT wxWindow: public wxEvtHandler
{
DECLARE_ABSTRACT_CLASS(wxWindow)
DECLARE_DYNAMIC_CLASS(wxWindow);
friend class wxDC;
friend class wxPaintDC;
public:
wxWindow();
inline wxWindow(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
m_children = new wxList;
Create(parent, id, pos, size, style, name);
}
typedef struct MacWindowData
{
SInt16 m_macWindowBackgroundTheme ;
WindowRef m_macWindow ;
ControlHandle m_macRootControl ;
wxWindow* m_macFocus ;
} MacWindowData ;
wxWindow() { Init(); }
virtual ~wxWindow();
wxWindow(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr)
{
Init();
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
virtual ~wxWindow();
// Fit the window around the items
virtual void Fit();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
// Show or hide the window
virtual bool Show(bool show);
// Is the window shown?
virtual bool IsShown() const;
// implement base class pure virtuals
virtual void SetTitle( const wxString& title);
virtual wxString GetTitle() const;
// Raise the window to the top of the Z order
virtual void Raise();
virtual void Raise();
virtual void Lower();
// Lower the window to the bottom of the Z order
virtual void Lower();
virtual bool Show( bool show = TRUE );
virtual bool Enable( bool enable = TRUE );
// Is the window enabled?
virtual bool IsEnabled() const;
virtual void SetFocus();
// For compatibility
inline bool Enabled() const { return IsEnabled(); }
virtual bool Reparent( wxWindow *newParent );
// Dialog support: override these and call
// base class members to add functionality
// that can't be done using validators.
virtual void WarpPointer(int x, int y);
virtual void CaptureMouse();
virtual void ReleaseMouse();
// Transfer values to controls. If returns FALSE,
// it's an application error (pops up a dialog)
virtual bool TransferDataToWindow();
virtual void Refresh( bool eraseBackground = TRUE,
const wxRect *rect = (const wxRect *) NULL );
virtual void Clear();
// Transfer values from controls. If returns FALSE,
// transfer failed: don't quit
virtual bool TransferDataFromWindow();
virtual bool SetCursor( const wxCursor &cursor );
virtual bool SetFont( const wxFont &font );
// Validate controls. If returns FALSE,
// validation failed: don't quit
virtual bool Validate();
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;
// Return code for dialogs
inline void SetReturnCode(int retCode);
inline int GetReturnCode();
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
// Set the cursor
virtual void SetCursor(const wxCursor& cursor);
inline virtual wxCursor *GetCursor() const { return (wxCursor *)& m_windowCursor; };
// Get the window with the focus
static wxWindow *FindFocus();
// Get character size
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
// Get overall window size
virtual void GetSize(int *width, int *height) const;
wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); }
// Get window position, relative to parent (or screen if no parent)
virtual void GetPosition(int *x, int *y) const;
wxPoint GetPosition() const
{ int x, y; GetPosition(&x, &y); return wxPoint(x, y); }
// Get size and position
wxRect GetRect() const
{ int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); }
// Get client (application-useable) size
virtual void GetClientSize(int *width, int *height) const;
wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); }
// Set overall size and position
virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO)
{ SetSize(rect.x, rect.y, rect.width, rect.height, sizeFlags); }
// set size only
void SetSize(int width, int height)
{ SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); }
void SetSize(const wxSize& size)
{ SetSize(-1, -1, size.x, size.y, wxSIZE_USE_EXISTING); }
// set position only
virtual void Move(int x, int y) { SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); }
void Move(const wxPoint& pt) { SetSize(pt.x, pt.y, -1, -1, wxSIZE_USE_EXISTING); }
// Set client size
virtual void SetClientSize(int width, int height);
void SetClientSize(const wxSize& sz) { SetClientSize(sz.x, sz.y); }
// Convert client to screen coordinates
virtual void ClientToScreen(int *x, int *y) const;
wxPoint ClientToScreen(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ClientToScreen(& x, & y); return wxPoint(x, y); }
// Convert screen to client coordinates
virtual void ScreenToClient(int *x, int *y) const;
wxPoint ScreenToClient(const wxPoint& pt) const
{ int x = pt.x; int y = pt.y; ScreenToClient(& x, & y); return wxPoint(x, y); }
// Set the focus to this window
virtual void SetFocus();
// Capture/release mouse
virtual void CaptureMouse();
virtual void ReleaseMouse();
// Enable or disable the window
virtual void Enable(bool enable);
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE );
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
virtual int GetScrollPos( int orient ) const;
virtual int GetScrollThumb( int orient ) const;
virtual int GetScrollRange( int orient ) const;
virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = (wxRect *) NULL );
#if wxUSE_DRAG_AND_DROP
// Associate a drop target with this window (if the window already had a drop
// target, it's deleted!) and return the current drop target (may be NULL).
void SetDropTarget(wxDropTarget *pDropTarget);
wxDropTarget *GetDropTarget() const { return m_pDropTarget; }
#endif
virtual void SetDropTarget( wxDropTarget *dropTarget );
#endif // wxUSE_DRAG_AND_DROP
// Accept files for dragging
virtual void DragAcceptFiles(bool accept);
// Accept files for dragging
virtual void DragAcceptFiles(bool accept);
// Update region access
virtual wxRegion GetUpdateRegion() const;
virtual bool IsExposed(int x, int y, int w, int h) const;
virtual bool IsExposed(const wxPoint& pt) const;
virtual bool IsExposed(const wxRect& rect) const;
#if WXWIN_COMPATIBILITY
// Set/get scroll attributes
virtual void SetScrollRange(int orient, int range, bool refresh = TRUE);
virtual void SetScrollPage(int orient, int page, bool refresh = TRUE);
virtual int OldGetScrollRange(int orient) const;
virtual int GetScrollPage(int orient) const;
// Set/get the window title
virtual inline void SetTitle(const wxString& WXUNUSED(title)) {};
inline virtual wxString GetTitle() const { return wxString(""); };
// Most windows have the concept of a label; for frames, this is the
// title; for items, this is the label or button text.
inline virtual wxString GetLabel() const { return GetTitle(); }
// event handlers
// Handle a control command
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Set/get the window name (used for resource setting in X)
inline virtual wxString GetName() const;
inline virtual void SetName(const wxString& name);
// Override to define new behaviour for default action (e.g. double
// clicking on a listbox)
virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { }
#endif // WXWIN_COMPATIBILITY
// Centre the window
virtual void Centre(int direction) ;
inline void Center(int direction = wxHORIZONTAL) { Centre(direction); }
#if wxUSE_CARET && WXWIN_COMPATIBILITY
// caret manipulation (old MSW only functions, see wxCaret class for the
// new API)
void CreateCaret(int w, int h);
void CreateCaret(const wxBitmap *bitmap);
void DestroyCaret();
void ShowCaret(bool show);
void SetCaretPos(int x, int y);
void GetCaretPos(int *x, int *y) const;
#endif // wxUSE_CARET
// Popup a menu
virtual bool PopupMenu(wxMenu *menu, int x, int y);
// Native resource loading (implemented in src/msw/nativdlg.cpp)
// FIXME: should they really be all virtual?
virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
wxWindow* GetWindowChild1(wxWindowID id);
wxWindow* GetWindowChild(wxWindowID id);
// Send the window a refresh event
virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
// implementation from now on
// --------------------------
// New functions that will replace the above.
virtual void SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh = TRUE);
void MacClientToRootWindow( int *x , int *y ) const ;
void MacRootWindowToClient( int *x , int *y ) const ;
virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE);
virtual int GetScrollPos(int orient) const;
virtual int GetScrollRange(int orient) const;
virtual int GetScrollThumb(int orient) const;
virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL);
// simple accessors
// ----------------
// Caret manipulation
virtual void CreateCaret(int w, int h);
virtual void CreateCaret(const wxBitmap *bitmap);
virtual void DestroyCaret();
virtual void ShowCaret(bool show);
virtual void SetCaretPos(int x, int y);
virtual void GetCaretPos(int *x, int *y) const;
WXHWND GetHWND() const { return m_hWnd; }
void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
virtual WXWidget GetHandle() const { return (WXWidget) GetHWND(); }
// Tell window how much it can be sized
virtual void SetSizeHints(int minW = -1, int minH = -1, int maxW = -1, int maxH = -1, int incW = -1, int incH = -1);
// Set/get the window's identifier
inline int GetId() const;
inline void SetId(int id);
virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
inline virtual wxAcceleratorTable& GetAcceleratorTable() const { return (wxAcceleratorTable&) m_acceleratorTable; }
// Make the window modal (all other windows unresponsive)
virtual void MakeModal(bool modal);
// Get the private handle (platform-dependent)
inline void *GetHandle() const;
// Set/get the window's relatives
inline wxWindow *GetParent() const;
inline void SetParent(wxWindow *p) ;
inline wxWindow *GetGrandParent() const;
inline wxList& GetChildren() const;
// Set/get the window's font
virtual void SetFont(const wxFont& f);
inline virtual wxFont& GetFont() const;
// Set/get the window's validator
void SetValidator(const wxValidator& validator);
inline wxValidator *GetValidator() const;
// Set/get the window's style
inline void SetWindowStyleFlag(long flag);
inline long GetWindowStyleFlag() const;
// Handle a control command
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Set/get event handler
inline void SetEventHandler(wxEvtHandler *handler);
inline wxEvtHandler *GetEventHandler() const;
// Push/pop event handler (i.e. allow a chain of event handlers
// be searched)
void PushEventHandler(wxEvtHandler *handler) ;
wxEvtHandler *PopEventHandler(bool deleteHandler = FALSE) ;
// Close the window by calling OnClose, posting a deletion
virtual bool Close(bool force = FALSE);
// Destroy the window (delayed, if a managed window)
virtual bool Destroy() ;
// Mode for telling default OnSize members to
// call Layout(), if not using Sizers, just top-down constraints
inline void SetAutoLayout(bool a);
inline bool GetAutoLayout() const;
// Set/get constraints
inline wxLayoutConstraints *GetConstraints() const;
void SetConstraints(wxLayoutConstraints *c);
// Set/get window background colour
inline virtual void SetBackgroundColour(const wxColour& col);
inline virtual wxColour GetBackgroundColour() const;
// Set/get window foreground colour
inline virtual void SetForegroundColour(const wxColour& col);
inline virtual wxColour GetForegroundColour() const;
// Get the default button, if there is one
inline virtual wxButton *GetDefaultItem() const;
inline virtual void SetDefaultItem(wxButton *but);
// Override to define new behaviour for default action (e.g. double clicking
// on a listbox)
virtual void OnDefaultAction(wxControl *initiatingItem);
// Resource loading
#if wxUSE_WX_RESOURCES
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL);
#endif
virtual void GetTextExtent(const wxString& string, int *x, int *y,
int *descent = NULL,
int *externalLeading = NULL,
const wxFont *theFont = NULL, bool use16 = FALSE) const;
// Is the window retained?
inline bool IsRetained() const;
// Warp the pointer the given position
virtual void WarpPointer(int x_pos, int y_pos) ;
// Clear the window
virtual void Clear();
// Find a window by id or name
virtual wxWindow *FindWindow(long id);
virtual wxWindow *FindWindow(const wxString& name);
// Constraint operations
bool Layout();
void SetSizer(wxSizer *sizer); // Adds sizer child to this window
inline wxSizer *GetSizer() const ;
inline wxWindow *GetSizerParent() const ;
inline void SetSizerParent(wxWindow *win);
// Do Update UI processing for controls
void UpdateWindowUI();
void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event);
void OnIdle(wxIdleEvent& event);
// Does this window want to accept keyboard focus?
virtual bool AcceptsFocus() const;
virtual void PrepareDC( wxDC &dc ) {};
bool GetUseCtl3D() const { return m_useCtl3D; }
bool GetTransparentBackground() const { return m_backgroundTransparent; }
void SetTransparent(bool t = TRUE) { m_backgroundTransparent = t; }
// event handlers
// --------------
void OnEraseBackground(wxEraseEvent& event);
void OnIdle(wxIdleEvent& event);
public:
////////////////////////////////////////////////////////////////////////
//// IMPLEMENTATION
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// For implementation purposes - sometimes decorations make the client area
// smaller
virtual wxPoint GetClientAreaOrigin() const;
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// Makes an adjustment to the window position (for example, a frame that has
// a toolbar that it manages itself).
virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags);
// Executes the default message
virtual long Default();
wxWindow *FindItem(long id) const;
wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const;
/* TODO: you may need something like this
// Determine whether 3D effects are wanted
virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D);
*/
// Make a Windows extended style from the given wxWindows window style
static WXDWORD MakeExtendedStyle(long style,
bool eliminateBorders = TRUE);
// Determine whether 3D effects are wanted
WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const;
virtual void AddChild(wxWindow *child); // Adds reference to the child object
virtual void RemoveChild(wxWindow *child); // Removes reference to child
// (but doesn't delete the child object)
virtual void DestroyChildren(); // Removes and destroys all children
// MSW only: TRUE if this control is part of the main control
virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; };
inline bool IsBeingDeleted() const { return FALSE; } // TODO: Should probably eliminate this
#if WXWIN_COMPATIBILITY
wxObject *GetChild(int number) const;
virtual void MSWDeviceToLogical(float *x, float *y) const;
#endif // WXWIN_COMPATIBILITY
// Constraint implementation
void UnsetConstraints(wxLayoutConstraints *c);
inline wxList *GetConstraintsInvolvedIn() const ;
// Back-pointer to other windows we're involved with, so if we delete
// this window, we must delete any constraints we're involved with.
void AddConstraintReference(wxWindow *otherWin);
void RemoveConstraintReference(wxWindow *otherWin);
void DeleteRelatedConstraints();
// Create an appropriate wxWindow from a HWND
virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd);
virtual void ResetConstraints();
virtual void SetConstraintSizes(bool recurse = TRUE);
virtual bool LayoutPhase1(int *noChanges);
virtual bool LayoutPhase2(int *noChanges);
virtual bool DoPhase(int);
// Transforms from sizer coordinate space to actual
// parent coordinate space
virtual void TransformSizerToActual(int *x, int *y) const ;
// Make sure the window style reflects the HWND style (roughly)
virtual void AdoptAttributesFromHWND();
// Set size with transformation to actual coordinates if nec.
virtual void SizerSetSize(int x, int y, int w, int h);
virtual void SizerMove(int x, int y);
// Setup background and foreground colours correctly
virtual void SetupColours();
// Only set/get the size/position of the constraint (if any)
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 ;
// Dialog units translations. Implemented in wincmn.cpp.
wxPoint ConvertPixelsToDialog(const wxPoint& pt) ;
wxPoint ConvertDialogToPixels(const wxPoint& pt) ;
inline wxSize ConvertPixelsToDialog(const wxSize& sz)
{ wxPoint pt(ConvertPixelsToDialog(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
inline wxSize ConvertDialogToPixels(const wxSize& sz)
{ wxPoint pt(ConvertDialogToPixels(wxPoint(sz.x, sz.y))); return wxSize(pt.x, pt.y); }
#if WXWIN_COMPATIBILITY
void SetShowing(bool show) { (void)Show(show); }
bool IsUserEnabled() const { return IsEnabled(); }
#endif // WXWIN_COMPATIBILITY
wxObject *GetChild(int number) const ;
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Generates a new id for controls
static int NewControlId();
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
// Transfers data to any child controls
void OnInitDialog(wxInitDialogEvent& event);
// Sends an OnInitDialog event, which in turns transfers data to
// to the window via validators.
virtual void InitDialog();
////////////////////////////////////////////////////////////////////////
//// PROTECTED DATA
protected:
int m_windowId;
long m_windowStyle; // Store the window's style
wxEvtHandler * m_windowEventHandler; // Usually is 'this'
wxLayoutConstraints * m_constraints; // Constraints for this window
wxList * m_constraintsInvolvedIn; // List of constraints we're involved in
wxSizer * m_windowSizer; // Window's top-level sizer (if any)
wxWindow * m_sizerParent; // Window's parent sizer (if any)
bool m_autoLayout; // Whether to call Layout() in OnSize
wxWindow * m_windowParent; // Each window always knows its parent
wxValidator * m_windowValidator;
int m_minSizeX;
int m_minSizeY;
int m_maxSizeX;
int m_maxSizeY;
// the window handle
WXHWND m_hWnd;
// Caret data
int m_caretWidth;
int m_caretHeight;
bool m_caretEnabled;
bool m_caretShown;
wxFont m_windowFont; // Window's font
wxCursor m_windowCursor; // Window's cursor
wxString m_windowName; // Window name
// the old window proc (we subclass all windows)
WXFARPROC m_oldWndProc;
wxButton * m_defaultItem;
// additional (MSW specific) flags
bool m_useCtl3D:1; // Using CTL3D for this control
bool m_backgroundTransparent:1;
bool m_mouseInWindow:1;
bool m_doubleClickAllowed:1;
bool m_winCaptured:1;
wxColour m_backgroundColour ;
wxColour m_foregroundColour ;
wxAcceleratorTable m_acceleratorTable;
// the size of one page for scrolling
int m_xThumbSize;
int m_yThumbSize;
#if wxUSE_DRAG_AND_DROP
wxDropTarget *m_pDropTarget; // the current drop target or NULL
#endif //USE_DRAG_AND_DROP
WXHMENU m_hMenu; // Menu, if any
public:
wxRegion m_updateRegion;
wxList * m_children; // Window's children
int m_returnCode;
// the return value of WM_GETDLGCODE handler
long m_lDlgCode;
DECLARE_EVENT_TABLE()
// implement the base class pure virtuals
virtual void DoClientToScreen( int *x, int *y ) const;
virtual void DoScreenToClient( int *x, int *y ) const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoGetClientSize( int *width, int *height ) const;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
// get the size which best suits the window: e.g., for a static text it
// will be the width and height of the text
virtual wxSize DoGetBestSize();
// move the window to the specified location and resize it: this is called
// from both DoSetSize() and DoSetClientSize() and would usually just call
// ::MoveWindow() except for composite controls which will want to arrange
// themselves inside the given rectangle
virtual void DoMoveWindow(int x, int y, int width, int height);
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
private:
// common part of all ctors
void Init();
DECLARE_NO_COPY_CLASS(wxWindow);
DECLARE_EVENT_TABLE()
};
////////////////////////////////////////////////////////////////////////
//// INLINES
// associate mac windows with wx counterparts
inline void *wxWindow::GetHandle() const { return (void *)NULL; }
inline int wxWindow::GetId() const { return m_windowId; }
inline void wxWindow::SetId(int id) { m_windowId = id; }
inline wxWindow *wxWindow::GetParent() const { return m_windowParent; }
inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; }
inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : (wxWindow*) NULL); }
inline wxList& wxWindow::GetChildren() const { return (wxList&) * m_children; }
inline wxFont& wxWindow::GetFont() const { return (wxFont&) m_windowFont; }
inline wxString wxWindow::GetName() const { return m_windowName; }
inline void wxWindow::SetName(const wxString& name) { m_windowName = name; }
inline long wxWindow::GetWindowStyleFlag() const { return m_windowStyle; }
inline void wxWindow::SetWindowStyleFlag(long flag) { m_windowStyle = flag; }
inline void wxWindow::SetEventHandler(wxEvtHandler *handler) { m_windowEventHandler = handler; }
inline wxEvtHandler *wxWindow::GetEventHandler() const { return m_windowEventHandler; }
inline void wxWindow::SetAutoLayout(bool a) { m_autoLayout = a; }
inline bool wxWindow::GetAutoLayout() const { return m_autoLayout; }
inline wxLayoutConstraints *wxWindow::GetConstraints() const { return m_constraints; }
inline void wxWindow::SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; };
inline wxColour wxWindow::GetBackgroundColour() const { return m_backgroundColour; };
inline void wxWindow::SetForegroundColour(const wxColour& col) { m_foregroundColour = col; };
inline wxColour wxWindow::GetForegroundColour() const { return m_foregroundColour; };
wxWindow* wxFindWinFromMacWindow( WindowRef inWindow ) ;
void wxAssociateWinWithMacWindow(WindowRef inWindow, wxWindow *win) ;
void wxRemoveMacWindowAssociation(wxWindow *win) ;
inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; }
inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; }
inline bool wxWindow::IsRetained() const { return ((m_windowStyle & wxRETAINED) == wxRETAINED); }
class wxMacFocusHelper
{
public :
wxMacFocusHelper( wxWindow * theWindow ) ;
~wxMacFocusHelper() ;
bool Ok() { return m_ok ; }
inline wxList *wxWindow::GetConstraintsInvolvedIn() const { return m_constraintsInvolvedIn; }
inline wxSizer *wxWindow::GetSizer() const { return m_windowSizer; }
inline wxWindow *wxWindow::GetSizerParent() const { return m_sizerParent; }
inline void wxWindow::SetSizerParent(wxWindow *win) { m_sizerParent = win; }
inline wxValidator *wxWindow::GetValidator() const { return m_windowValidator; }
inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; }
inline int wxWindow::GetReturnCode() { return m_returnCode; }
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
bool m_ok ;
} ;
// Get the active window.
wxWindow* WXDLLEXPORT wxGetActiveWindow();
class wxMacDrawingHelper
{
public :
wxMacDrawingHelper( wxWindow * theWindow ) ;
~wxMacDrawingHelper() ;
bool Ok() { return m_ok ; }
WXDLLEXPORT_DATA(extern wxList) wxTopLevelWindows;
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
PenState m_savedPenState ;
bool m_ok ;
} ;
class wxMacFocusClientHelper
{
public :
wxMacFocusClientHelper( wxWindow * theWindow ) ;
~wxMacFocusClientHelper() ;
bool Ok() { return m_ok ; }
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
bool m_ok ;
} ;
class wxMacDrawingClientHelper
{
public :
wxMacDrawingClientHelper( wxWindow * theWindow ) ;
~wxMacDrawingClientHelper() ;
bool Ok() { return m_ok ; }
private :
GrafPtr m_formerPort ;
GrafPtr m_currentPort ;
PenState m_savedPenState ;
bool m_ok ;
} ;
#endif
// _WX_WINDOW_H_