From 54da4255a20216b070ec044ae2b8af75e9f2681f Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 2 Aug 1999 04:44:01 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3235 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/caret.h | 2 + include/wx/choice.h | 5 + include/wx/dataobj.h | 2 +- include/wx/defs.h | 21 ++ include/wx/docview.h | 5 + include/wx/dynarray.h | 11 +- include/wx/expr.h | 3 +- include/wx/generic/helpxlp.h | 2 + include/wx/helpwin.h | 4 + include/wx/list.h | 10 +- include/wx/os2/bmpbuttn.h | 5 +- include/wx/os2/button.h | 3 - include/wx/os2/checkbox.h | 6 +- include/wx/os2/choice.h | 3 - include/wx/os2/dc.h | 469 +++++++++++++++++++++--------- include/wx/os2/dcclient.h | 25 +- include/wx/os2/dialog.h | 152 ++++------ include/wx/os2/dnd.h | 49 +++- include/wx/os2/frame.h | 318 ++++++++------------ include/wx/os2/gauge.h | 2 - include/wx/os2/icon.h | 10 +- include/wx/os2/listbox.h | 192 +++++------- include/wx/os2/mdi.h | 4 +- include/wx/os2/printdlg.h | 90 +++--- include/wx/os2/radiobox.h | 154 ++++------ include/wx/os2/slider.h | 2 - include/wx/os2/spinbutt.h | 10 - include/wx/os2/statbmp.h | 3 +- include/wx/os2/statbox.h | 2 - include/wx/os2/stattext.h | 2 - include/wx/os2/textctrl.h | 22 +- include/wx/os2/toolbar.h | 2 +- include/wx/os2/window.h | 548 +++++++++++++---------------------- include/wx/proplist.h | 25 +- include/wx/sckipc.h | 13 +- include/wx/sckstrm.h | 8 +- include/wx/window.h | 2 +- 37 files changed, 1063 insertions(+), 1123 deletions(-) diff --git a/include/wx/caret.h b/include/wx/caret.h index e88f6c96ca..bdc4279c56 100644 --- a/include/wx/caret.h +++ b/include/wx/caret.h @@ -178,6 +178,8 @@ private: #if defined(__WXMSW__) #include "wx/msw/caret.h" +#elif defined(__WXPM__) + #include "wx/os2/caret.h" #else #include "wx/generic/caret.h" #endif // platform diff --git a/include/wx/choice.h b/include/wx/choice.h index 9cd0899444..c87d9345c4 100644 --- a/include/wx/choice.h +++ b/include/wx/choice.h @@ -104,6 +104,11 @@ private: // the type of the client data for the items wxClientDataType m_clientDataItemsType; + // the above pure virtuals hide these virtuals in wxWindowBase + virtual void DoSetClientData(void* clientData ) { wxWindowBase::DoSetClientData(clientData); }; + virtual void* DoGetClientData() const { return(wxWindowBase::DoGetClientData()); }; + virtual void DoSetClientObject( wxClientData* clientData ) { wxWindowBase::DoSetClientObject(clientData); }; + virtual wxClientData* DoGetClientObject() const { return(wxWindowBase::DoGetClientObject()); }; }; // ---------------------------------------------------------------------------- diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index 48f84bca8d..0e9659bfc5 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -23,7 +23,7 @@ #elif defined(__WXMAC__) #include "wx/mac/dnd.h" #elif defined(__WXPM__) - #include "wx/os2/dnd.h" + #include "wx/os2/dataobj.h" #elif defined(__WXSTUBS__) #include "wx/stubs/dnd.h" #endif diff --git a/include/wx/defs.h b/include/wx/defs.h index c842b7f779..f53c19499f 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1420,6 +1420,27 @@ typedef void * WXDRAWITEMSTRUCT; typedef void * WXMEASUREITEMSTRUCT; typedef void * WXLPCREATESTRUCT; +#if defined(__WXPM__) +typedef unsigned long WXMPARAM; +typedef unsigned long WXMSGID; +typedef void* WXRESULT; +typedef int (*WXFARPROC)(); +// some windows handles not defined by PM +typedef unsigned long HANDLE; +typedef unsigned long HICON; +typedef unsigned long HFONT; +typedef unsigned long HMENU; +typedef unsigned long HPEN; +typedef unsigned long HBRUSH; +typedef unsigned long HPALETTE; +typedef unsigned long HCURSOR; +typedef unsigned long HINSTANCE; +typedef unsigned long HIMAGELIST; +typedef unsigned long HGLOBAL; +typedef unsigned long DWORD; +typedef unsigned short WORD; +#endif + #if defined(__GNUWIN32__) || defined(__WXWINE__) typedef int (*WXFARPROC)(); #elif defined(__WIN32__) diff --git a/include/wx/docview.h b/include/wx/docview.h index 592b3d6bd4..fb93a4a378 100644 --- a/include/wx/docview.h +++ b/include/wx/docview.h @@ -96,6 +96,11 @@ public: virtual wxInputStream& LoadObject(wxInputStream& stream); #endif +#if wxUSE_SERIAL + // need this to keep from hiding the virtual from wxObject + virtual void LoadObject(wxObjectInputStream& stream) { wxObject::LoadObject(stream); }; +#endif + // Called by wxWindows virtual bool OnSaveDocument(const wxString& filename); virtual bool OnOpenDocument(const wxString& filename); diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index b05f260955..c15997d203 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -174,7 +174,10 @@ class WXDLLEXPORT name : public wxBaseArray \ { \ public: \ name() \ - { wxASSERT( sizeof(T) <= sizeof(long) ); } \ + { size_t type = sizeof(T); \ + size_t sizelong = sizeof(long); \ + wxASSERT( type <= sizelong ); \ + } \ \ name& operator=(const name& src) \ { wxBaseArray* temp = (wxBaseArray*) this; \ @@ -232,7 +235,11 @@ class WXDLLEXPORT name : public wxBaseArray \ { \ public: \ name(SCMPFUNC##T fn) \ - { wxASSERT( sizeof(T) <= sizeof(long) ); m_fnCompare = fn; } \ + { size_t type = sizeof(T); \ + size_t sizelong = sizeof(long); \ + wxASSERT( type <= sizelong ); \ + m_fnCompare = fn; \ + } \ \ name& operator=(const name& src) \ { wxBaseArray* temp = (wxBaseArray*) this; \ diff --git a/include/wx/expr.h b/include/wx/expr.h index 777676fddd..4555550dce 100644 --- a/include/wx/expr.h +++ b/include/wx/expr.h @@ -96,7 +96,7 @@ void process_command(char *); void syntax_error(char *); } #else -#if __BORLANDC__ +#if defined(__BORLANDC__) || defined(__VISAGECPP__) char *proio_cons(char *, char *); char * wxmake_integer(char *); char * wxmake_word(char *); @@ -107,6 +107,7 @@ char * wxmake_exp2(char *, char *, char*); void add_expr(char *); void process_command(char *); void syntax_error(char *); +int lex_input(void); #else char *proio_cons(); char * wxmake_integer(); diff --git a/include/wx/generic/helpxlp.h b/include/wx/generic/helpxlp.h index d541e543ee..823b5b936f 100644 --- a/include/wx/generic/helpxlp.h +++ b/include/wx/generic/helpxlp.h @@ -117,6 +117,8 @@ class WXDLLEXPORT wxXLPHelpController: public wxHelpControllerBase bool helpRunning; wxXLPHelpConnection* helpConnection; wxXLPHelpClient helpClient; +private: + virtual bool Initialize(const wxString& file) { return(wxHelpControllerBase::Initialize(file)); }; }; #endif // wxUSE_HELP diff --git a/include/wx/helpwin.h b/include/wx/helpwin.h index 5743288dad..a5b207bb5a 100644 --- a/include/wx/helpwin.h +++ b/include/wx/helpwin.h @@ -1,7 +1,11 @@ #ifndef _WX_HELPWIN_H_BASE_ #define _WX_HELPWIN_H_BASE_ +#if defined(__WXMSW__) #include "wx/msw/helpwin.h" +#elif defined(__WXPM__) +#include "wx/os2/helpwin.h" +#endif #endif // _WX_HELPWIN_H_BASE_ diff --git a/include/wx/list.h b/include/wx/list.h index c7d31658c4..186ad733cf 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -29,6 +29,12 @@ #pragma interface "list.h" #endif +#ifdef __WXPM__ +#define LINKAGEMODE _Optlink +#else +#define LINKAGEMODE +#endif + // ----------------------------------------------------------------------------- // headers // ----------------------------------------------------------------------------- @@ -65,10 +71,10 @@ enum wxKeyType // type of compare function for list sort operation (as in 'qsort'): it should // return a negative value, 0 or positive value if the first element is less // than, equal or greater than the second -typedef int (*wxSortCompareFunction)(const void *elem1, const void *elem2); +typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2); // -typedef int (*wxListIterateFunction)(void *current); +typedef int (* LINKAGEMODE wxListIterateFunction)(void *current); // ----------------------------------------------------------------------------- // key stuff: a list may be optionally keyed on integer or string key diff --git a/include/wx/os2/bmpbuttn.h b/include/wx/os2/bmpbuttn.h index 750e38e438..ad8c3c25e9 100644 --- a/include/wx/os2/bmpbuttn.h +++ b/include/wx/os2/bmpbuttn.h @@ -78,9 +78,8 @@ class WXDLLEXPORT wxBitmapButton: public wxButton int m_marginX; int m_marginY; private: - // Supress VisualAge's hidden functin warning - void SetLabel(const wxString& label) - { wxButton::SetLabel(label); } + virtual void SetLabel(const wxString& string) + { wxButton::SetLabel(string); }; }; #endif diff --git a/include/wx/os2/button.h b/include/wx/os2/button.h index 10e49700cf..68b67d8c96 100644 --- a/include/wx/os2/button.h +++ b/include/wx/os2/button.h @@ -44,12 +44,9 @@ class WXDLLEXPORT wxButton: public wxControl virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); virtual void SetDefault(); - static wxSize GetDefaultSize(); virtual void SetLabel(const wxString& label); virtual wxString GetLabel() const ; virtual void Command(wxCommandEvent& event); -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/checkbox.h b/include/wx/os2/checkbox.h index b101211116..31c0a20463 100644 --- a/include/wx/os2/checkbox.h +++ b/include/wx/os2/checkbox.h @@ -47,8 +47,6 @@ class WXDLLEXPORT wxCheckBox: public wxControl virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); virtual void SetLabel(const wxString& label); virtual void Command(wxCommandEvent& event); -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox @@ -79,8 +77,8 @@ class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); virtual void SetLabel(const wxBitmap& bitmap); private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} - void SetLabel(const wxString& label) {wxCheckBox::SetLabel(label);} + virtual void SetLabel(const wxString& string) + { wxCheckBox::SetLabel(string); }; }; #endif // _WX_CHECKBOX_H_ diff --git a/include/wx/os2/choice.h b/include/wx/os2/choice.h index ea9854e3b8..7f360ed5cc 100644 --- a/include/wx/os2/choice.h +++ b/include/wx/os2/choice.h @@ -66,9 +66,6 @@ class WXDLLEXPORT wxChoice: public wxControl protected: int m_noStrings; - -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/dc.h b/include/wx/os2/dc.h index 8851693235..ce3e9998d1 100644 --- a/include/wx/os2/dc.h +++ b/include/wx/os2/dc.h @@ -1,170 +1,373 @@ ///////////////////////////////////////////////////////////////////////////// // Name: dc.h // Purpose: wxDC class -// Author: Julian Smart +// Author: AUTHOR // Modified by: -// Created: 01/02/97 +// Created: ??/??/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Copyright: (c) AUTHOR +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DC_H_ #define _WX_DC_H_ #ifdef __GNUG__ - #pragma interface "dc.h" +#pragma interface "dc.h" #endif -class WXDLLEXPORT wxDC : public wxDCBase -{ - DECLARE_DYNAMIC_CLASS(wxDC) - -public: - wxDC(); - ~wxDC(); - - // implement base class pure virtuals - // ---------------------------------- - - virtual void Clear(); - - virtual bool StartDoc(const wxString& message); - virtual void EndDoc(); - - virtual void StartPage(); - virtual void EndPage(); - - 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 SetBackgroundMode(int mode); - virtual void SetPalette(const wxPalette& palette); - - virtual void DestroyClippingRegion(); - - virtual long GetCharHeight() const; - virtual long GetCharWidth() const; - virtual void GetTextExtent(const wxString& string, - long *x, long *y, - long *descent = NULL, - long *externalLeading = NULL, - wxFont *theFont = NULL) const; - - virtual bool CanDrawBitmap() const; - virtual bool CanGetTextExtent() const; - virtual int GetDepth() const; - virtual wxSize GetPPI() const; - - virtual void SetMapMode(int mode); - virtual void SetUserScale(double x, double y); - virtual void SetSystemScale(double x, double y); - virtual void SetLogicalScale(double x, double y); - virtual void SetLogicalOrigin(long x, long y); - virtual void SetDeviceOrigin(long x, long y); - virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); - - // implementation from now on - // -------------------------- - - virtual void SetRop(WXHDC cdc); - virtual void DoClipping(WXHDC cdc); - virtual void SelectOldObjects(WXHDC dc); - - wxWindow *GetWindow() const { return m_canvas; } - void SetWindow(wxWindow *win) { m_canvas = win; } - - WXHDC GetHDC() const { return m_hDC; } - void SetHDC(WXHDC dc, bool bOwnsDC = FALSE) - { - m_hDC = dc; - m_bOwnsDC = bOwnsDC; - } +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/icon.h" +#include "wx/font.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#ifndef MM_TEXT +#define MM_TEXT 0 +#define MM_ISOTROPIC 1 +#define MM_ANISOTROPIC 2 +#define MM_LOMETRIC 3 +#define MM_HIMETRIC 4 +#define MM_TWIPS 5 +#define MM_POINTS 6 +#define MM_METRIC 7 +#endif -protected: - virtual void DoFloodFill(long x, long y, const wxColour& col, - int style = wxFLOOD_SURFACE); +//----------------------------------------------------------------------------- +// global variables +//----------------------------------------------------------------------------- - virtual bool DoGetPixel(long x, long y, wxColour *col) const; +extern int wxPageNumber; - virtual void DoDrawPoint(long x, long y); - virtual void DoDrawLine(long x1, long y1, long x2, long y2); +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- - virtual void DoDrawArc(long x1, long y1, - long x2, long y2, - long xc, long yc); - virtual void DoDrawEllipticArc(long x, long y, long w, long h, - double sa, double ea); +class WXDLLEXPORT wxDC: public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxDC) - virtual void DoDrawRectangle(long x, long y, long width, long height); - virtual void DoDrawRoundedRectangle(long x, long y, - long width, long height, - double radius); - virtual void DoDrawEllipse(long x, long y, long width, long height); + public: - virtual void DoCrossHair(long x, long y); + wxDC(void); + ~wxDC(void); + + void BeginDrawing(void) {}; + void EndDrawing(void) {}; + + virtual bool Ok(void) const { return m_ok; }; - virtual void DoDrawIcon(const wxIcon& icon, long x, long y); - virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y, - bool useMask = FALSE); + virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0; + inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE) + { + FloodFill(pt.x, pt.y, col, style); + } - virtual void DoDrawText(const wxString& text, long x, long y); + virtual bool GetPixel( long x1, long y1, wxColour *col ) const = 0; + inline bool GetPixel(const wxPoint& pt, wxColour *col) const + { + return GetPixel(pt.x, pt.y, col); + } - virtual bool DoBlit(long xdest, long ydest, long width, long height, - wxDC *source, long xsrc, long ysrc, - int rop = wxCOPY, bool useMask = FALSE); + virtual void DrawLine( long x1, long y1, long x2, long y2 ) = 0; + 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; + inline void CrossHair(const wxPoint& pt) + { + CrossHair(pt.x, pt.y); + } - // this is gnarly - we can't even call this function DoSetClippingRegion() - // because of virtual function hiding - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); - virtual void DoSetClippingRegion(long x, long y, - long width, long height); - virtual void DoGetClippingRegion(long *x, long *y, - long *width, long *height) + virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc ) = 0; + inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) { - GetClippingBox(x, y, width, height); + DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetSizeMM(int* width, int* height) const; + virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) = 0; + 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 DoDrawLines(int n, wxPoint points[], - long xoffset, long yoffset); - virtual void DoDrawPolygon(int n, wxPoint points[], - long xoffset, long yoffset, - int fillStyle = wxODDEVEN_RULE); + virtual void DrawPoint( long x, long y ) = 0; + virtual void DrawPoint( wxPoint& point ); + + virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 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; + 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; + inline void DrawRectangle(const wxPoint& pt, const wxSize& sz) + { + DrawRectangle(pt.x, pt.y, sz.x, sz.y); + } + inline void DrawRectangle(const wxRect& rect) + { + 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; + inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0) + { + DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); + } + inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0) + { + DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius); + } -#if wxUSE_SPLINES - virtual void DoDrawSpline(wxList *points); -#endif // wxUSE_SPLINES + virtual void DrawEllipse( long x, long y, long width, long height ) = 0; + inline void DrawEllipse(const wxPoint& pt, const wxSize& sz) + { + DrawEllipse(pt.x, pt.y, sz.x, sz.y); + } + inline void DrawEllipse(const wxRect& rect) + { + DrawEllipse(rect.x, rect.y, rect.width, rect.height); + } - // MSW-specific member variables - int m_windowExtX; - int m_windowExtY; + virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ); + virtual void DrawSpline( wxList *points ) = 0; + virtual void DrawSpline( int n, wxPoint points[] ); + + virtual bool CanDrawBitmap(void) const = 0; - // the window associated with this DC (may be NULL) - wxWindow *m_canvas; + virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); + inline void DrawIcon(const wxIcon& icon, const wxPoint& pt) + { + DrawIcon(icon, pt.x, pt.y); + } - wxBitmap m_selectedBitmap; + // 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 ); } - // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it - bool m_bOwnsDC:1; + 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; + 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); + } - // our HDC and its usage count: we only free it when the usage count drops - // to 0 - WXHDC m_hDC; - int m_hDCCount; + virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ) = 0; + inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE) + { + DrawText(text, pt.x, pt.y, use16bit); + } - // Store all old GDI objects when do a SelectObject, so we can select them - // back in (this unselecting user's objects) so we can safely delete the - // DC. - WXHBITMAP m_oldBitmap; - WXHPEN m_oldPen; - WXHBRUSH m_oldBrush; - WXHFONT m_oldFont; - WXHPALETTE m_oldPalette; + virtual bool CanGetTextExtent(void) const = 0; + 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; + + virtual void Clear(void) = 0; + + virtual void SetFont( const wxFont &font ) = 0; + virtual wxFont& GetFont(void) const { return (wxFont&) m_font; }; + + virtual void SetPen( const wxPen &pen ) = 0; + virtual wxPen& GetPen(void) const { return (wxPen&) m_pen; }; + + virtual void SetBrush( const wxBrush &brush ) = 0; + virtual wxBrush& GetBrush(void) const { return (wxBrush&) m_brush; }; + + virtual void SetBackground( const wxBrush &brush ) = 0; + virtual wxBrush& GetBackground(void) const { return (wxBrush&) m_backgroundBrush; }; + + virtual void SetLogicalFunction( int function ) = 0; + virtual int GetLogicalFunction(void) const { return m_logicalFunction; }; + + virtual void SetTextForeground( const wxColour &col ); + virtual void SetTextBackground( const wxColour &col ); + 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 int GetBackgroundMode(void) const { return m_backgroundMode; }; + + virtual void SetPalette( const wxPalette& palette ) = 0; + void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; + + // the first two must be overridden and called + virtual void SetClippingRegion( long x, long y, long width, long height ); + virtual void DestroyClippingRegion(void); + virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const; + + virtual inline long MinX(void) const { return m_minX; } + virtual inline long MaxX(void) const { return m_maxX; } + virtual inline long MinY(void) const { return m_minY; } + virtual inline long MaxY(void) const { return m_maxY; } + + virtual void GetSize( int* width, int* height ) const; + inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); } + virtual void GetSizeMM( long* width, long* height ) const; + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }; + virtual void EndDoc(void) {}; + virtual void StartPage(void) {}; + virtual void EndPage(void) {}; + + virtual void SetMapMode( int mode ); + virtual int GetMapMode(void) const { return m_mappingMode; }; + + virtual void SetUserScale( double x, double y ); + virtual void GetUserScale( double *x, double *y ); + virtual void SetLogicalScale( double x, double y ); + virtual void GetLogicalScale( double *x, double *y ); + + virtual void SetLogicalOrigin( long x, long y ); + virtual void GetLogicalOrigin( long *x, long *y ); + virtual void SetDeviceOrigin( long x, long y ); + virtual void GetDeviceOrigin( long *x, long *y ); + virtual void SetInternalDeviceOrigin( long x, long y ); + virtual void GetInternalDeviceOrigin( long *x, long *y ); + + virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); + + virtual void SetOptimization( bool WXUNUSED(optimize) ) {}; + virtual bool GetOptimization(void) { return m_optimize; }; + + virtual long DeviceToLogicalX(long x) const; + virtual long DeviceToLogicalY(long y) const; + virtual long DeviceToLogicalXRel(long x) const; + virtual long DeviceToLogicalYRel(long y) const; + virtual long LogicalToDeviceX(long x) const; + virtual long LogicalToDeviceY(long y) const; + virtual long LogicalToDeviceXRel(long x) const; + virtual long LogicalToDeviceYRel(long y) const; + + public: + + void CalcBoundingBox( long x, long y ); + void ComputeScaleAndOrigin(void); + + long XDEV2LOG(long x) const + { + long new_x = x - m_deviceOriginX; + if (new_x > 0) + return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; + else + return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; + } + long XDEV2LOGREL(long x) const + { + if (x > 0) + return (long)((double)(x) / m_scaleX + 0.5); + else + return (long)((double)(x) / m_scaleX - 0.5); + } + long YDEV2LOG(long y) const + { + long new_y = y - m_deviceOriginY; + if (new_y > 0) + return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; + else + return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; + } + long YDEV2LOGREL(long y) const + { + if (y > 0) + return (long)((double)(y) / m_scaleY + 0.5); + else + return (long)((double)(y) / m_scaleY - 0.5); + } + long XLOG2DEV(long x) const + { + long new_x = x - m_logicalOriginX; + if (new_x > 0) + return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; + else + return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; + } + long XLOG2DEVREL(long x) const + { + if (x > 0) + return (long)((double)(x) * m_scaleX + 0.5); + else + return (long)((double)(x) * m_scaleX - 0.5); + } + long YLOG2DEV(long y) const + { + long new_y = y - m_logicalOriginY; + if (new_y > 0) + return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; + else + return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; + } + long YLOG2DEVREL(long y) const + { + if (y > 0) + return (long)((double)(y) * m_scaleY + 0.5); + else + return (long)((double)(y) * m_scaleY - 0.5); + } + + public: + + bool m_ok; + bool m_colour; + + // not sure, what these mean + bool m_clipping; // Is clipping on right now ? + bool m_isInteractive; // Is GetPixel possible ? + bool m_autoSetting; // wxMSW only ? + bool m_dontDelete; // wxMSW only ? + bool m_optimize; // wxMSW only ? + wxString m_filename; // Not sure where this belongs. + + wxPen m_pen; + wxBrush m_brush; + wxBrush m_backgroundBrush; + wxColour m_textForegroundColour; + wxColour m_textBackgroundColour; + wxFont m_font; + + int m_logicalFunction; + int m_backgroundMode; + int m_textAlignment; // gone in wxWin 2.0 ? + + int m_mappingMode; + + // not sure what for, but what is a mm on a screen you don't know the size of? + double m_mm_to_pix_x,m_mm_to_pix_y; + + long m_internalDeviceOriginX,m_internalDeviceOriginY; // If un-scrolled is non-zero or + // d.o. changes with scrolling. + // Set using SetInternalDeviceOrigin(). + + long m_externalDeviceOriginX,m_externalDeviceOriginY; // To be set by external classes + // such as wxScrolledWindow + // using SetDeviceOrigin() + + long m_deviceOriginX,m_deviceOriginY; // Sum of the two above. + + long m_logicalOriginX,m_logicalOriginY; // User defined. + + double m_scaleX,m_scaleY; + double m_logicalScaleX,m_logicalScaleY; + double m_userScaleX,m_userScaleY; + long m_signX,m_signY; + + bool m_needComputeScaleX,m_needComputeScaleY; // not yet used + + float m_scaleFactor; // wxPSDC wants to have this. Will disappear. + + long m_clipX1,m_clipY1,m_clipX2,m_clipY2; + long m_minX,m_maxX,m_minY,m_maxY; }; #endif diff --git a/include/wx/os2/dcclient.h b/include/wx/os2/dcclient.h index 3130147c4f..67b199a081 100644 --- a/include/wx/os2/dcclient.h +++ b/include/wx/os2/dcclient.h @@ -90,22 +90,15 @@ class WXDLLEXPORT wxWindowDC: public wxDC virtual void DrawSpline( wxList *points ); private: - // VisualAge function hiding warning supression - void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea) - { wxDC::DrawEllipticArc(pt, sz, sa, ea); } - void DrawPoint( wxPoint& point ) - { wxDC::DrawPoint(point); } - void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ) - { DrawSpline(x1, y1, x2, y2, x3, y3); } - void DrawSpline( int n, wxPoint points[] ) - { DrawSpline(n, points); } - void GetTextExtent( const wxString &string, long *width, long *height, - long *descent = NULL, long *externalLeading = NULL, - wxFont *theFont = NULL ) const - { GetTextExtent( string, width, height, descent, externalLeading, theFont); }; - // these next two are ridiculous! the only difference is the const - long GetCharWidth(void) const {return(GetCharWidth());}; - long GetCharHeight(void) const {return(GetCharHeight());}; + void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, + double sa, double ea) + { wxDC::DrawEllipticArc(pt, sz, sa, ea); }; + void DrawPoint(wxPoint& pt) + { wxDC:DrawPoint(pt); }; + void DrawSpline(int n, wxPoint points[]) + { wxDC::DrawSpline(n, points); }; + void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3) + { wxDC::DrawSpline(x1, y1, x2, y2, x3, y3); }; }; //----------------------------------------------------------------------------- diff --git a/include/wx/os2/dialog.h b/include/wx/os2/dialog.h index 917667ed4f..f5609682f5 100644 --- a/include/wx/os2/dialog.h +++ b/include/wx/os2/dialog.h @@ -1,136 +1,110 @@ ///////////////////////////////////////////////////////////////////////////// // Name: dialog.h // Purpose: wxDialog class -// Author: Julian Smart +// Author: AUTHOR // Modified by: -// Created: 01/02/97 +// Created: ??/??/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) AUTHOR +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_DIALOG_H_ #define _WX_DIALOG_H_ #ifdef __GNUG__ - #pragma interface "dialog.h" +#pragma interface "dialog.h" #endif #include "wx/panel.h" -WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; +WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr; // Dialog boxes -class WXDLLEXPORT wxDialog : public wxDialogBase +class WXDLLEXPORT wxDialog: public wxDialogBase { - DECLARE_DYNAMIC_CLASS(wxDialog) - + DECLARE_DYNAMIC_CLASS(wxDialog) public: - wxDialog(); - - // Constructor with a modal flag, but no window id - the old convention - wxDialog(wxWindow *parent, - const wxString& title, bool modal, - int x = -1, int y= -1, int width = 500, int height = 500, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) + + wxDialog(); + + // Constructor with a modal flag, but no window id - the old convention + inline wxDialog( wxWindow* parent + ,const wxString& title + ,bool modal + ,int x = -1 + ,int y = -1 + ,int width = 500 + ,int height = 500 + ,long style = wxDEFAULT_DIALOG_STYLE + ,const wxString& name = wxDialogNameStr + ) { long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; - Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), - style | modalStyle, name); + Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name); } // Constructor with no modal flag - the new convention. - wxDialog(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr) + inline wxDialog( wxWindow* parent + ,wxWindowID id + ,const wxString& title + ,const wxPoint& pos = wxDefaultPosition + ,const wxSize& size = wxDefaultSize + ,long style = wxDEFAULT_DIALOG_STYLE + ,const wxString& name = wxDialogNameStr + ) { Create(parent, id, title, pos, size, style, name); } - bool Create(wxWindow *parent, wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); + bool Create( wxWindow* parent + ,wxWindowID id + ,const wxString& title + , // bool modal = FALSE, // TODO make this a window style? + const wxPoint& pos = wxDefaultPosition + ,const wxSize& size = wxDefaultSize + ,long style = wxDEFAULT_DIALOG_STYLE + ,const wxString& name = wxDialogNameStr + ); ~wxDialog(); - virtual bool Destroy(); - - virtual void DoSetClientSize(int width, int height); - - virtual void GetPosition(int *x, int *y) const; - - bool Show(bool show); - bool IsShown() const; - void Iconize(bool iconize); - -#if WXWIN_COMPATIBILITY - bool Iconized() const { return IsIconized(); }; -#endif +// --------------------------------------------------------------------------- +// Virtuals +// --------------------------------------------------------------------------- + virtual bool Destroy(); virtual bool IsIconized() const; - void Fit(); - - void SetTitle(const wxString& title); - wxString GetTitle() const ; - - void OnSize(wxSizeEvent& event); - bool OnClose(); - void OnCharHook(wxKeyEvent& event); - void OnPaint(wxPaintEvent& 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 bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } - // For now, same as Show(TRUE) but returns return code - virtual int ShowModal(); + virtual int ShowModal(); virtual void EndModal(int retCode); - // Standard buttons - void OnOK(wxCommandEvent& event); - void OnApply(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // implementation - // -------------- + void SetClientSize(int width, int height); + void GetPosition(int *x, int *y) const; + bool Show(bool show); + void Iconize(bool iconize); - long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + void Fit(); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + void SetTitle(const wxString& title); + wxString GetTitle() const ; - bool IsModalShowing() const { return m_modalShowing; } + void OnCharHook(wxKeyEvent& event); + void OnCloseWindow(wxCloseEvent& event); - // tooltip management -#if wxUSE_TOOLTIPS - WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } - void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } -#endif // tooltips + void SetModal(bool flag); -protected: - bool m_modalShowing; - WXHWND m_hwndOldFocus; // the window which had focus before we were shown + // Standard buttons + void OnOK(wxCommandEvent& event); + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); -private: -#if wxUSE_TOOLTIPS - WXHWND m_hwndToolTip; -#endif // tooltips + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); -private: - DECLARE_EVENT_TABLE() +DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/os2/dnd.h b/include/wx/os2/dnd.h index 105192154f..ce6d0e9d01 100644 --- a/include/wx/os2/dnd.h +++ b/include/wx/os2/dnd.h @@ -70,8 +70,55 @@ public: private: wxDataFormatId m_type; - wxString m_id; + wxString m_id; }; + +//------------------------------------------------------------------------- +// wxDataBroker (internal) +//------------------------------------------------------------------------- + +class wxDataBroker : public wxObject +{ + DECLARE_CLASS( wxDataBroker ) + +public: + + /* constructor */ + wxDataBroker(); + + /* add data object */ + void Add( wxDataObject *dataObject, bool preferred = FALSE ); + +private: + + /* OLE implementation, the methods don't need to be overridden */ + + /* get number of supported formats */ + virtual size_t GetFormatCount() const; + + /* return nth supported format */ + virtual wxDataFormat &GetNthFormat( size_t nth ) const; + + /* return preferrd/best supported format */ + virtual wxDataFormatId GetPreferredFormat() const; + + /* search through m_dataObjects, return TRUE if found */ + virtual bool IsSupportedFormat( wxDataFormat &format ) const; + + /* search through m_dataObjects and call child's GetSize() */ + virtual size_t GetSize( wxDataFormat& format ) const; + + /* search through m_dataObjects and call child's WriteData(dest) */ + virtual void WriteData( wxDataFormat& format, void *dest ) const; + + /* implementation */ + +public: + + wxList m_dataObjects; + size_t m_preferred; +}; + //------------------------------------------------------------------------- // wxDataObject //------------------------------------------------------------------------- diff --git a/include/wx/os2/frame.h b/include/wx/os2/frame.h index 7dfaf63fc6..408d6bc1a6 100644 --- a/include/wx/os2/frame.h +++ b/include/wx/os2/frame.h @@ -1,220 +1,156 @@ ///////////////////////////////////////////////////////////////////////////// // Name: frame.h // Purpose: wxFrame class -// Author: Julian Smart +// Author: AUTHOR // Modified by: -// Created: 01/02/97 +// Created: ??/??/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) AUTHOR +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_FRAME_H_ #define _WX_FRAME_H_ #ifdef __GNUG__ - #pragma interface "frame.h" +#pragma interface "frame.h" #endif #include "wx/window.h" #include "wx/toolbar.h" -#include "wx/msw/accel.h" +#include "wx/accel.h" #include "wx/icon.h" -WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; -WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; -WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr; +WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; +WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr; class WXDLLEXPORT wxMenuBar; class WXDLLEXPORT wxStatusBar; -class WXDLLEXPORT wxFrame : public wxWindow -{ - DECLARE_DYNAMIC_CLASS(wxFrame) +class WXDLLEXPORT wxFrame: public wxWindow { -public: - wxFrame(); - wxFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr) - { - Create(parent, id, title, pos, size, style, name); - } - - ~wxFrame(); - - bool Create(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual bool Destroy(); - - virtual void ClientToScreen(int *x, int *y) const; - virtual void ScreenToClient(int *x, int *y) const; - - void OnSize(wxSizeEvent& event); - void OnMenuHighlight(wxMenuEvent& event); - void OnActivate(wxActivateEvent& event); - void OnIdle(wxIdleEvent& event); - void OnCloseWindow(wxCloseEvent& event); - - bool Show(bool show); - - // Set menu bar - void SetMenuBar(wxMenuBar *menu_bar); - virtual wxMenuBar *GetMenuBar() const; - - // Call this to simulate a menu command - bool Command(int id) { return ProcessCommand(id); } - - // process menu command: returns TRUE if processed - bool ProcessCommand(int id); - - // make the window modal (all other windows unresponsive) - virtual void MakeModal(bool modal = TRUE); - - // Set icon - virtual void SetIcon(const wxIcon& icon); - - // Toolbar -#if wxUSE_TOOLBAR - virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT, - wxWindowID id = -1, - const wxString& name = wxToolBarNameStr); - - virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); - - virtual void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } - virtual wxToolBar *GetToolBar() const { return m_frameToolBar; } - - virtual void PositionToolBar(); -#endif // wxUSE_TOOLBAR - -#if wxUSE_STATUSBAR - // Status bar - virtual wxStatusBar* CreateStatusBar(int number = 1, - long style = wxST_SIZEGRIP, - wxWindowID id = 0, - const wxString& name = wxStatusLineNameStr); - - wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } - void SetStatusBar(wxStatusBar *statusBar) { m_frameStatusBar = statusBar; } - - virtual void PositionStatusBar(); - virtual wxStatusBar *OnCreateStatusBar(int number, - long style, - wxWindowID id, - const wxString& name); - - // Set status line text - virtual void SetStatusText(const wxString& text, int number = 0); - - // Set status line widths - virtual void SetStatusWidths(int n, const int widths_field[]); - - // Hint to tell framework which status bar to use - // TODO: should this go into a wxFrameworkSettings class perhaps? - static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; - static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; -#endif // wxUSE_STATUSBAR + DECLARE_DYNAMIC_CLASS(wxFrame) - // Iconize - virtual void Iconize(bool iconize); - - virtual bool IsIconized() const; - - // Is it maximized? - virtual bool IsMaximized() const; - - // Compatibility - bool Iconized() const { return IsIconized(); } - - virtual void Maximize(bool maximize); - // virtual bool LoadAccelerators(const wxString& table); - - // Responds to colour changes - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // Query app for menu item updates (called from OnIdle) - void DoMenuUpdates(); - void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); - - WXHMENU GetWinMenu() const { return m_hMenu; } - - // Returns the origin of client area (may be different from (0,0) if the - // frame has a toolbar) - virtual wxPoint GetClientAreaOrigin() const; - - // Implementation only from here - // event handlers - bool HandlePaint(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); - - bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass, - wxWindow *wx_win, const wxChar *title, - int x, int y, int width, int height, long style); +public: + wxFrame(); + inline wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + ~wxFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + 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); + void OnActivate(wxActivateEvent& event); + 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); + + // Set icon + virtual void SetIcon(const wxIcon& icon); + + // Create status line + virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, + const wxString& name = "statusBar"); + inline wxStatusBar *GetStatusBar() const { return m_frameStatusBar; } + virtual void PositionStatusBar(); + virtual wxStatusBar *OnCreateStatusBar(int number, long style, wxWindowID id, + const wxString& name); + + // Create toolbar + virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, const wxString& name = wxToolBarNameStr); + virtual wxToolBar *OnCreateToolBar(long style, wxWindowID id, const wxString& name); + // If made known to the frame, the frame will manage it automatically. + virtual inline void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; } + virtual inline wxToolBar *GetToolBar() const { return m_frameToolBar; } + virtual void PositionToolBar(); + + // Set status line text + virtual void SetStatusText(const wxString& text, int number = 0); + + // Set status line widths + virtual void SetStatusWidths(int n, const int widths_field[]); + + // Hint to tell framework which status bar to use + // TODO: should this go into a wxFrameworkSettings class perhaps? + static void UseNativeStatusBar(bool useNative) { m_useNativeStatusBar = useNative; }; + static bool UsesNativeStatusBar() { return m_useNativeStatusBar; }; + + // Fit frame around subwindows + virtual void Fit(); + + // Iconize + virtual void Iconize(bool iconize); + + virtual bool IsIconized() const ; + + // Compatibility + inline bool Iconized() const { return IsIconized(); } + + // Is the frame maximized? + virtual bool IsMaximized(void) const ; + + virtual void Maximize(bool maximize); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Query app for menu item updates (called from OnIdle) + void DoMenuUpdates(); + void DoMenuUpdates(wxMenu* menu, wxWindow* focusWin); - // tooltip management -#if wxUSE_TOOLTIPS - WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } - void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } -#endif // tooltips + // Checks if there is a toolbar, and returns the first free client position + virtual wxPoint GetClientAreaOrigin() const; protected: - // override base class virtuals - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoGetSize(int *width, int *height) const; - virtual void DoGetPosition(int *x, int *y) const; - - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - virtual void DoSetClientSize(int width, int height); - - // a plug in for MDI frame classes which need to do something special when - // the menubar is set - virtual void InternalSetMenuBar(); - - // propagate our state change to all child frames - void IconizeChildFrames(bool bIconize); - - // we add menu bar accel processing - bool MSWTranslateMessage(WXMSG* pMsg); - - // window proc for the frames - long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - wxMenuBar * m_frameMenuBar; - wxIcon m_icon; - bool m_iconized; - WXHICON m_defaultIcon; - -#if wxUSE_STATUSBAR - wxStatusBar * m_frameStatusBar; - - static bool m_useNativeStatusBar; -#endif // wxUSE_STATUSBAR - -#if wxUSE_TOOLBAR - wxToolBar * m_frameToolBar; -#endif // wxUSE_TOOLBAR - -private: -#if wxUSE_TOOLTIPS - WXHWND m_hwndToolTip; -#endif // tooltips - - DECLARE_EVENT_TABLE() + wxMenuBar * m_frameMenuBar; + wxStatusBar * m_frameStatusBar; + wxIcon m_icon; + bool m_iconized; + static bool m_useNativeStatusBar; + wxToolBar * m_frameToolBar ; + + DECLARE_EVENT_TABLE() }; #endif diff --git a/include/wx/os2/gauge.h b/include/wx/os2/gauge.h index bac0f982b5..ce19d9ef1f 100644 --- a/include/wx/os2/gauge.h +++ b/include/wx/os2/gauge.h @@ -63,8 +63,6 @@ class WXDLLEXPORT wxGauge: public wxControl protected: int m_rangeMax; int m_gaugePos; -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/icon.h b/include/wx/os2/icon.h index 038d778613..3e0c24729c 100644 --- a/include/wx/os2/icon.h +++ b/include/wx/os2/icon.h @@ -49,8 +49,6 @@ public: wxIcon(const char bits[], int width, int height); wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE, int desiredWidth = -1, int desiredHeight = -1); - wxIcon( char **bits, int width=-1, int height=-1 ); - ~wxIcon(); bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE, @@ -68,9 +66,11 @@ public: /* TODO */ virtual bool Ok() const { return (m_refData != NULL) ; } private: - // supress VisAge hiding warning - bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE) - { return(wxBitmap::LoadFile(name, type)); } + // supress virtual function hiding warning + virtual bool LoadFile( const wxString& name + ,long type = wxBITMAP_TYPE_BMP_RESOURCE + ) + { return(wxBitmap::LoadFile(name, type)); }; }; /* Example handlers. TODO: write your own handlers for relevant types. diff --git a/include/wx/os2/listbox.h b/include/wx/os2/listbox.h index b97fb5a7e7..d95db4379b 100644 --- a/include/wx/os2/listbox.h +++ b/include/wx/os2/listbox.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: listbox.h // Purpose: wxListBox class -// Author: Julian Smart +// Author: AUTHOR // Modified by: -// Created: 01/02/97 +// Created: ??/??/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart +// Copyright: (c) AUTHOR // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,131 +18,79 @@ #include "wx/control.h" -WXDLLEXPORT_DATA(extern const wxChar*) wxListBoxNameStr; - -#if wxUSE_OWNER_DRAWN - class WXDLLEXPORT wxOwnerDrawn; - - // define the array of list box items - #include - - WX_DEFINE_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray); - -#endif +WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr; // forward decl for GetSelections() -class wxArrayInt; +class WXDLLEXPORT wxArrayInt; -WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; +WXDLLEXPORT_DATA(extern const char*) wxEmptyString; // List box item -class WXDLLEXPORT wxListBox : public wxControl +class WXDLLEXPORT wxListBox: public wxControl { - DECLARE_DYNAMIC_CLASS(wxListBox) - -public: - wxListBox(); - wxListBox(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, id, pos, size, n, choices, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - int n = 0, const wxString choices[] = NULL, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - ~wxListBox(); - - bool MSWCommand(WXUINT param, WXWORD id); - -#if wxUSE_OWNER_DRAWN - bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); - bool MSWOnDraw(WXDRAWITEMSTRUCT *item); - - // plug-in for derived classes - virtual wxOwnerDrawn *CreateItem(size_t n); - - // allows to get the item and use SetXXX functions to set it's appearance - wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } - - // get the index of the given item - int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } -#endif // wxUSE_OWNER_DRAWN - - virtual void Append(const wxString& item); - virtual void Append(const wxString& item, void *clientData); - virtual void Set(int n, const wxString* choices, void **clientData = NULL); - virtual int FindString(const wxString& s) const ; - virtual void Clear(); - virtual void SetSelection(int n, bool select = TRUE); - - virtual void Deselect(int n); - - // For single choice list item only - virtual int GetSelection() const ; - virtual void Delete(int n); - virtual void *GetClientData(int n) const ; - virtual void SetClientData(int n, void *clientData); - virtual void SetString(int n, const wxString& s); - - // For single or multiple choice list item - virtual int GetSelections(wxArrayInt& aSelections) const; - virtual bool Selected(int n) const ; - virtual wxString GetString(int n) const ; - - // Set the specified item at the first visible item - // or scroll to max range. - virtual void SetFirstItem(int n) ; - virtual void SetFirstItem(const wxString& s) ; - - virtual void InsertItems(int nItems, const wxString items[], int pos); - - virtual wxString GetStringSelection() const ; - virtual bool SetStringSelection(const wxString& s, bool flag = TRUE); - virtual int Number() const ; - - void Command(wxCommandEvent& event); - - // Windows-specific code to set the horizontal extent of - // the listbox, if necessary. If s is non-NULL, it's - // used to calculate the horizontal extent. - // Otherwise, all strings are used. - virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); - - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual void SetupColours(); - -protected: - int m_noItems; - int m_selected; - -#if wxUSE_OWNER_DRAWN - // control items - wxListBoxItemsArray m_aItems; -#endif -private: - // Virtual function hiding warning - virtual wxControl *CreateItem(const wxItemResource* childResource, - const wxItemResource* parentResource, - const wxResourceTable *table = (const wxResourceTable *) NULL) - { return(wxWindowBase::CreateItem(childResource, parentResource, table)); } - virtual void *GetClientData() const - {return (wxWindowBase::GetClientData()); } - virtual void SetClientData( void *data ) - { wxWindowBase::SetClientData(data); } + DECLARE_DYNAMIC_CLASS(wxListBox) + public: + + wxListBox(); + inline wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + ~wxListBox(); + + virtual void Append(const wxString& item); + virtual void Append(const wxString& item, char *clientData); + virtual void Set(int n, const wxString* choices, char **clientData = NULL); + virtual int FindString(const wxString& s) const ; + virtual void Clear(); + virtual void SetSelection(int n, bool select = TRUE); + + virtual void Deselect(int n); + + // For single choice list item only + virtual int GetSelection() const ; + virtual void Delete(int n); + virtual char *GetClientData(int n) const ; + virtual void SetClientData(int n, char *clientData); + virtual void SetString(int n, const wxString& s); + + // For single or multiple choice list item + 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. + virtual void SetFirstItem(int n) ; + virtual void SetFirstItem(const wxString& s) ; + + virtual void InsertItems(int nItems, const wxString items[], int pos); + + virtual wxString GetStringSelection() const ; + virtual bool SetStringSelection(const wxString& s, bool flag = TRUE); + virtual int Number() const ; + + void Command(wxCommandEvent& event); + + protected: + int m_noItems; + int m_selected; }; #endif diff --git a/include/wx/os2/mdi.h b/include/wx/os2/mdi.h index c27d937e39..841156c16f 100644 --- a/include/wx/os2/mdi.h +++ b/include/wx/os2/mdi.h @@ -128,8 +128,8 @@ public: virtual void Restore(); virtual void Activate(); private: - // Supress VA's hidden function warning - void Maximize(bool maximize) {wxFrame::Maximize(maximize);} + // supress virtual function hiding warning + virtual void Maximize(bool maximize) { wxFrame::Maximize(maximize); }; }; /* The client window is a child of the parent MDI frame, and itself diff --git a/include/wx/os2/printdlg.h b/include/wx/os2/printdlg.h index bef41cccb0..7704c3f15d 100644 --- a/include/wx/os2/printdlg.h +++ b/include/wx/os2/printdlg.h @@ -1,14 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: printdlg.h -// Purpose: wxPrintDialog, wxPageSetupDialog classes. -// Use generic, PostScript version if no -// platform-specific implementation. -// Author: AUTHOR +// Purpose: wxPrintDialog, wxPageSetupDialog classes +// 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_PRINTDLG_H_ @@ -18,57 +16,61 @@ #pragma interface "printdlg.h" #endif +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/dialog.h" #include "wx/cmndata.h" -/* - * wxPrinterDialog - * The common dialog for printing. - */ - class WXDLLEXPORT wxDC; -class WXDLLEXPORT wxPrintDialog: public wxDialog + +// --------------------------------------------------------------------------- +// wxPrinterDialog: the common dialog for printing. +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintDialog : public wxDialog { - DECLARE_DYNAMIC_CLASS(wxPrintDialog) - - public: - wxPrintDialog(); - wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); - wxPrintDialog(wxWindow *parent, wxPrintData* data); - ~wxPrintDialog(); - - bool Create(wxWindow *parent, wxPrintData* data = NULL); - virtual int ShowModal(); - - wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } - inline wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } - virtual wxDC *GetPrintDC(); - - private: - wxPrintDialogData m_printDialogData; - wxDC* m_printerDC; - bool m_destroyDC; - wxWindow* m_dialogParent; + DECLARE_DYNAMIC_CLASS(wxPrintDialog) + +public: + wxPrintDialog(); + wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal(); + + wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } + virtual wxDC *GetPrintDC(); + +private: + wxPrintDialogData m_printDialogData; + wxDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; }; class WXDLLEXPORT wxPageSetupDialog: public wxDialog { - DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) + DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) - public: - wxPageSetupDialog(); - wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL); - ~wxPageSetupDialog(); +public: + wxPageSetupDialog(); + wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL); + virtual ~wxPageSetupDialog(); - bool Create(wxWindow *parent, wxPageSetupData *data = NULL); - virtual int ShowModal(); + bool Create(wxWindow *parent, wxPageSetupData *data = NULL); + virtual int ShowModal(); - inline wxPageSetupData& GetPageSetupData() { return m_pageSetupData; } + wxPageSetupData& GetPageSetupData() { return m_pageSetupData; } - private: - wxPageSetupData m_pageSetupData; - wxWindow* m_dialogParent; +private: + wxPageSetupData m_pageSetupData; + wxWindow* m_dialogParent; }; +#endif // wxUSE_PRINTING_ARCHITECTURE + #endif // _WX_PRINTDLG_H_ diff --git a/include/wx/os2/radiobox.h b/include/wx/os2/radiobox.h index df575b4ccd..7150b569f5 100644 --- a/include/wx/os2/radiobox.h +++ b/include/wx/os2/radiobox.h @@ -1,11 +1,11 @@ ///////////////////////////////////////////////////////////////////////////// // Name: radiobox.h // Purpose: wxRadioBox class -// Author: Julian Smart +// Author: AUTHOR // Modified by: -// Created: 01/02/97 +// Created: ??/??/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart +// Copyright: (c) AUTHOR // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -18,105 +18,69 @@ #include "wx/control.h" -WXDLLEXPORT_DATA(extern const wxChar*) wxRadioBoxNameStr; +WXDLLEXPORT_DATA(extern const char*) wxRadioBoxNameStr; // List box item -class WXDLLEXPORT wxBitmap; +class WXDLLEXPORT wxBitmap ; -class WXDLLEXPORT wxRadioBox : public wxControl +class WXDLLEXPORT wxRadioBox: public wxControl { - DECLARE_DYNAMIC_CLASS(wxRadioBox) - + DECLARE_DYNAMIC_CLASS(wxRadioBox) public: - wxRadioBox(); - -#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 - - 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(); - - 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); - - virtual bool MSWCommand(WXUINT param, WXWORD id); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); - - int FindString(const wxString& s) const; - void SetSelection(int N); - int GetSelection() const; - wxString GetString(int N) const; - - 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 - WXHWND *GetRadioButtons() const { return m_radioButtons; } - bool ContainsHWND(WXHWND hWnd) const; - void SendNotificationEvent(); - - long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // get the number of buttons per column/row - inline int GetNumVer() const; - inline int GetNumHor() const; + 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(); + + 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(); + bool 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); } + + 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; } protected: - 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); -private: - // Virtual function hiding warning - virtual wxString GetLabel() const - { return(wxControl::GetLabel()); } - virtual void SetLabel(const wxString& label) - { wxControl::SetLabel(label); } +/* TODO: implementation + WXHWND * m_radioButtons; +*/ + int m_majorDim ; + int m_noItems; + int m_noRowsOrCols; + int m_selectedButton; }; diff --git a/include/wx/os2/slider.h b/include/wx/os2/slider.h index 4df175c6a5..239e914e5c 100644 --- a/include/wx/os2/slider.h +++ b/include/wx/os2/slider.h @@ -85,8 +85,6 @@ public: int m_lineSize; int m_tickFreq; DECLARE_EVENT_TABLE() -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/spinbutt.h b/include/wx/os2/spinbutt.h index afdb978c3f..7cd3cd7862 100644 --- a/include/wx/os2/spinbutt.h +++ b/include/wx/os2/spinbutt.h @@ -69,16 +69,6 @@ protected: int m_max; }; -class WXDLLEXPORT wxSpinEvent: public wxScrollEvent -{ - DECLARE_DYNAMIC_CLASS(wxSpinEvent) - - public: - wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0); -}; - -typedef void (wxEvtHandler::*wxSpinEventFunction)(wxSpinEvent&); - // Spin events #define EVT_SPIN_UP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSpinEventFunction) & func } diff --git a/include/wx/os2/statbmp.h b/include/wx/os2/statbmp.h index f4aa0ba405..f371fddd2d 100644 --- a/include/wx/os2/statbmp.h +++ b/include/wx/os2/statbmp.h @@ -57,8 +57,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl protected: wxBitmap m_messageBitmap; -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} + }; #endif diff --git a/include/wx/os2/statbox.h b/include/wx/os2/statbox.h index bd03d34794..1aa4a6f88a 100644 --- a/include/wx/os2/statbox.h +++ b/include/wx/os2/statbox.h @@ -51,8 +51,6 @@ class WXDLLEXPORT wxStaticBox: public wxControl void SetLabel(const wxString& label); DECLARE_EVENT_TABLE() -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/stattext.h b/include/wx/os2/stattext.h index 0cc438e9b6..aa8eaf229e 100644 --- a/include/wx/os2/stattext.h +++ b/include/wx/os2/stattext.h @@ -50,8 +50,6 @@ class WXDLLEXPORT wxStaticText: public wxControl // operations virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/textctrl.h b/include/wx/os2/textctrl.h index e8089a9f64..09c11e063e 100644 --- a/include/wx/os2/textctrl.h +++ b/include/wx/os2/textctrl.h @@ -42,7 +42,7 @@ class WXDLLEXPORT wxTextCtrl: public wxControl { DECLARE_DYNAMIC_CLASS(wxTextCtrl) - + public: // creation // -------- @@ -59,14 +59,14 @@ public: { Create(parent, id, value, pos, size, style, validator, name); } - + bool Create(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxTextCtrlNameStr); - + // accessors // --------- virtual wxString GetValue() const ; @@ -79,12 +79,12 @@ public: // operations // ---------- virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - + // Clipboard operations virtual void Copy(); virtual void Cut(); virtual void Paste(); - + virtual bool CanCopy() const; virtual bool CanCut() const; virtual bool CanPaste() const; @@ -116,26 +116,26 @@ public: int sync(); int underflow(); #endif - + wxTextCtrl& operator<<(const wxString& s); wxTextCtrl& operator<<(int i); wxTextCtrl& operator<<(long i); wxTextCtrl& operator<<(float f); wxTextCtrl& operator<<(double d); wxTextCtrl& operator<<(const char c); - + virtual bool LoadFile(const wxString& file); virtual bool SaveFile(const wxString& file); virtual void WriteText(const wxString& text); virtual void AppendText(const wxString& text); virtual void DiscardEdits(); virtual bool IsModified() const; - + virtual long XYToPosition(long x, long y) const ; virtual void PositionToXY(long pos, long *x, long *y) const ; virtual void ShowPosition(long pos); virtual void Clear(); - + // callbacks // --------- void OnDropFiles(wxDropFilesEvent& event); @@ -159,10 +159,8 @@ public: protected: wxString m_fileName; - + DECLARE_EVENT_TABLE() -private: - void SetSize(int width, int height) {wxWindow::SetSize(width, height);} }; #endif diff --git a/include/wx/os2/toolbar.h b/include/wx/os2/toolbar.h index 83b3a222e0..e9fa1e679a 100644 --- a/include/wx/os2/toolbar.h +++ b/include/wx/os2/toolbar.h @@ -62,7 +62,7 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase // Add all the buttons virtual bool CreateTools(); - virtual bool Layout() {return TRUE;} + virtual bool Layout() { return TRUE; } // The post-tool-addition call. TODO: do here whatever's // necessary for completing the toolbar construction. diff --git a/include/wx/os2/window.h b/include/wx/os2/window.h index e7e3812265..860eb58ef2 100644 --- a/include/wx/os2/window.h +++ b/include/wx/os2/window.h @@ -1,67 +1,65 @@ ///////////////////////////////////////////////////////////////////////////// // Name: window.h // Purpose: wxWindow class -// Author: Julian Smart +// Author: David Webster // Modified by: -// Created: 01/02/97 +// Created: ??/??/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Copyright: (c) AUTHOR +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_WINDOW_H_ #define _WX_WINDOW_H_ -// --------------------------------------------------------------------------- -// headers -// --------------------------------------------------------------------------- - #ifdef __GNUG__ - #pragma interface "window.h" +#pragma interface "window.h" #endif -// #include "wx/msw/winundef.h" +#define INCL_DOS +#define INCL_PM +#include -// VZ: apparently some version of Windows send extra mouse move messages after -// a mouse click. My tests under NT 4.0 and 95 didn't show it so I'm -// tempted to think that it was just an effect of a poor mouse and so the -// code to work around this is currently disabled - just define this as 1 -// to reenable it -#define wxUSE_MOUSEEVENT_HACK 0 +#define wxKEY_SHIFT 1 +#define wxKEY_CTRL 2 // --------------------------------------------------------------------------- // forward declarations // --------------------------------------------------------------------------- +class WXDLLEXPORT wxWindow; class WXDLLEXPORT wxButton; -// --------------------------------------------------------------------------- -// constants -// --------------------------------------------------------------------------- +#if wxUSE_DRAG_AND_DROP +class WXDLLEXPORT wxDropTarget; +#endif -// FIXME does anybody use those? they're unused by wxWindows... -enum -{ - wxKEY_SHIFT = 1, - wxKEY_CTRL = 2 -}; +#if wxUSE_WX_RESOURCES +class WXDLLEXPORT wxResourceTable; +class WXDLLEXPORT wxItemResource; +#endif -// --------------------------------------------------------------------------- -// wxWindow declaration for MSW -// --------------------------------------------------------------------------- -class WXDLLEXPORT wxWindow : public wxWindowBase +WXDLLEXPORT_DATA(extern const char*) wxPanelNameStr; + +WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize; +WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition; + +class WXDLLEXPORT wxWindow: public wxWindowBase { - DECLARE_DYNAMIC_CLASS(wxWindow); + DECLARE_ABSTRACT_CLASS(wxWindow) + + friend class wxDC; + friend class wxPaintDC; public: - wxWindow() { Init(); } - - wxWindow(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) + wxWindow() { Init(); }; + inline 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); @@ -69,121 +67,160 @@ public: virtual ~wxWindow(); - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); + bool Create( wxWindow* parent + ,wxWindowID id + ,const wxPoint& pos = wxDefaultPosition + ,const wxSize& size = wxDefaultSize + ,long style = 0 + ,const wxString& name = wxPanelNameStr + ); - // implement base class pure virtuals - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; +// --------------------------------------------------------------------------- +// wxWindowBase pure virtual implementations +// --------------------------------------------------------------------------- + // Z order virtual void Raise(); virtual void Lower(); + // Set the focus to this window + virtual void SetFocus(); + // Warp the pointer the given position + virtual void WarpPointer(int x_pos, int y_pos) ; + // Capture/release mouse + virtual void CaptureMouse(); + virtual void ReleaseMouse(); + // Send the window a refresh event + virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); + // Clear the window + virtual void Clear(); + // Set window's font + virtual bool SetFont(const wxFont& f); + // Get character size + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent( const wxString& string + ,int* x + ,int* y + ,int* descent = NULL + ,int* externalLeading = NULL + ,const wxFont* theFont = NULL + ) const; + + // Configure the window's scrollbar + 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 GetScrollRange(int orient) const; + virtual int GetScrollThumb(int orient) const; + virtual void ScrollWindow( int dx + ,int dy + ,const wxRect* rect = NULL + ); +#if wxUSE_DRAG_AND_DROP + void SetDropTarget(wxDropTarget *pDropTarget); +#endif + // coordinates translation + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; - virtual bool Show( bool show = TRUE ); - virtual bool Enable( bool enable = TRUE ); + // retrieve the position/size of the window + 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 SetFocus(); + // this is the virtual function to be overriden in any derived class which + // wants to change how SetSize() or Move() works - it is called by all + // versions of these functions in the base class + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); - virtual bool Reparent( wxWindow *newParent ); + // same as DoSetSize() for the client size + virtual void DoSetClientSize(int width, int height); + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); - virtual void WarpPointer(int x, int y); - virtual void CaptureMouse(); - virtual void ReleaseMouse(); +// --------------------------------------------------------------------------- +// wxWindowBase virtual implementations that need to be overriden +// --------------------------------------------------------------------------- - virtual void Refresh( bool eraseBackground = TRUE, - const wxRect *rect = (const wxRect *) NULL ); - virtual void Clear(); + // Fit the window around the items + virtual void Fit(); + // Show or hide the window + virtual bool Show(bool show); // check if base implementation is OK + // Enable or disable the window + virtual bool Enable(bool enable); // check if base implementation is OK + // Set the cursor + virtual bool SetCursor(const wxCursor& cursor); // check if base implementation is OK - virtual bool SetCursor( const wxCursor &cursor ); - virtual bool SetFont( const wxFont &font ); +// --------------------------------------------------------------------------- +// additional functions +// --------------------------------------------------------------------------- - 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; + // Dialog support: override these and call + // base class members to add functionality + // that can't be done using validators. - virtual bool PopupMenu( wxMenu *menu, int x, int y ); + // Validate controls. If returns FALSE, + // validation failed: don't quit + virtual bool Validate(); - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + // Return code for dialogs + inline void SetReturnCode(int retCode); + inline int GetReturnCode(); - 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 - virtual void SetDropTarget( wxDropTarget *dropTarget ); -#endif // wxUSE_DRAG_AND_DROP + // Get the window with the focus + static wxWindow *FindFocus(); // Accept files for dragging virtual void DragAcceptFiles(bool accept); -#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; + // 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(); } + + + // 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; + - // event handlers - // Handle a control command + // Handle a control command virtual void OnCommand(wxWindow& win, wxCommandEvent& event); - // Override to define new behaviour for default action (e.g. double - // clicking on a listbox) - virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { } -#endif // WXWIN_COMPATIBILITY - -#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 - - // 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); - - // implementation from now on - // -------------------------- - - // simple accessors - // ---------------- - - WXHWND GetHWND() const { return m_hWnd; } - void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } - virtual WXWidget GetHandle() const { return GetHWND(); } - - bool GetUseCtl3D() const { return m_useCtl3D; } - bool GetTransparentBackground() const { return m_backgroundTransparent; } - void SetTransparent(bool t = TRUE) { m_backgroundTransparent = t; } - - // event handlers - // -------------- + // 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); + void OnEraseBackground(wxEraseEvent& event); + void OnChar(wxKeyEvent& event); + void OnKeyDown(wxKeyEvent& event); + void OnKeyUp(wxKeyEvent& event); + void OnPaint(wxPaintEvent& event); void OnIdle(wxIdleEvent& event); + public: +// --------------------------------------------------------------------------- +// IMPLEMENTATION +// --------------------------------------------------------------------------- + // For implementation purposes - sometimes decorations make the client area // smaller virtual wxPoint GetClientAreaOrigin() const; @@ -192,245 +229,52 @@ public: // a toolbar that it manages itself). virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags); - // Windows subclassing - void SubclassWin(WXHWND hWnd); - void UnsubclassWin(); - - WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } - void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } - - wxWindow *FindItem(int id) const; - wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; - - // Make a Windows extended style from the given wxWindows window style - virtual WXDWORD MakeExtendedStyle(long style, bool eliminateBorders = TRUE); - // Determine whether 3D effects are wanted - virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); - - // MSW only: TRUE if this control is part of the main control - virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; - - // returns TRUE if the window has been created - bool MSWCreate(int id, - wxWindow *parent, - const wxChar *wclass, - wxWindow *wx_win, - const wxChar *title, - int x, int y, int width, int height, - WXDWORD style, - const wxChar *dialog_template = NULL, - WXDWORD exendedStyle = 0); - virtual bool MSWCommand(WXUINT param, WXWORD id); - -#if WXWIN_COMPATIBILITY - wxObject *GetChild(int number) const; - virtual void MSWDeviceToLogical(float *x, float *y) const; -#endif // WXWIN_COMPATIBILITY - - // Create an appropriate wxWindow from a HWND - virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); - - // Make sure the window style reflects the HWND style (roughly) - virtual void AdoptAttributesFromHWND(); - - // Setup background and foreground colours correctly - virtual void SetupColours(); - - // ------------------------------------------------------------------------ - // helpers for message handlers: these perform the same function as the - // message crackers from - they unpack WPARAM and LPARAM into - // the correct parameters - // ------------------------------------------------------------------------ - - void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *id, WXHWND *hwnd, WXWORD *cmd); - void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *state, WXWORD *minimized, WXHWND *hwnd); - void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *code, WXWORD *pos, WXHWND *hwnd); - void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd); - void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, - WXWORD *item, WXWORD *flags, WXHMENU *hmenu); - - // ------------------------------------------------------------------------ - // internal handlers for MSW messages: all handlers return a boolen value: - // TRUE means that the handler processed the event and FALSE that it didn't - // ------------------------------------------------------------------------ - - // there are several cases where we have virtual functions for Windows - // message processing: this is because these messages often require to be - // processed in a different manner in the derived classes. For all other - // messages, however, we do *not* have corresponding MSWOnXXX() function - // and if the derived class wants to process them, it should override - // MSWWindowProc() directly. - - // scroll event (both horizontal and vertical) - virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, - WXWORD pos, WXHWND control); - - // child control notifications -#ifdef __WIN95__ - virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); -#endif // __WIN95__ - - // owner-drawn controls need to process these messages - virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item); - virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); - - // the rest are not virtual - bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); - bool HandleInitDialog(WXHWND hWndFocus); - bool HandleDestroy(); - - bool HandlePaint(); - bool HandleEraseBkgnd(WXHDC pDC); - - bool HandleMinimize(); - bool HandleMaximize(); - bool HandleSize(int x, int y, WXUINT flag); - bool HandleGetMinMaxInfo(void *mmInfo); - - bool HandleShow(bool show, int status); - bool HandleActivate(int flag, bool minimized, WXHWND activate); - - bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); - bool HandleSysCommand(WXWPARAM wParam, WXLPARAM lParam); - - bool HandleCtlColor(WXHBRUSH *hBrush, - WXHDC hdc, - WXHWND hWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - - bool HandlePaletteChanged(WXHWND hWndPalChange); - bool HandleQueryNewPalette(); - bool HandleSysColorChange(); - - bool HandleQueryEndSession(long logOff, bool *mayEnd); - bool HandleEndSession(bool endSession, long logOff); - - bool HandleSetFocus(WXHWND wnd); - bool HandleKillFocus(WXHWND wnd); - - bool HandleDropFiles(WXWPARAM wParam); - - bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); - bool HandleMouseMove(int x, int y, WXUINT flags); - - bool HandleChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE); - bool HandleKeyDown(WXWORD wParam, WXLPARAM lParam); - bool HandleKeyUp(WXWORD wParam, WXLPARAM lParam); - - bool HandleQueryDragIcon(WXHICON *hIcon); - - bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); - - // Window procedure - virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - - // Calls an appropriate default window procedure - virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual bool MSWProcessMessage(WXMSG* pMsg); - virtual bool MSWTranslateMessage(WXMSG* pMsg); - virtual void MSWDestroyWindow(); - - // Detach "Window" menu from menu bar so it doesn't get deleted - void MSWDetachWindowMenu(); - - // this function should return the brush to paint the window background - // with or 0 for the default brush - virtual WXHBRUSH OnCtlColor(WXHDC hDC, - WXHWND hWnd, - WXUINT nCtlColor, - WXUINT message, - WXWPARAM wParam, - WXLPARAM lParam); - -#if WXWIN_COMPATIBILITY - void SetShowing(bool show) { (void)Show(show); } - bool IsUserEnabled() const { return IsEnabled(); } -#endif // WXWIN_COMPATIBILITY - - // Responds to colour changes: passes event on to children. - void OnSysColourChanged(wxSysColourChangedEvent& event); - - // initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX) - void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); - -protected: - // the window handle - WXHWND m_hWnd; - - // the old window proc (we subclass all windows) - WXFARPROC m_oldWndProc; + // Executes the default message + virtual long Default(); - // 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; +/* TODO: you may need something like this + // Determine whether 3D effects are wanted + virtual WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D); +*/ - // the size of one page for scrolling - int m_xThumbSize; - int m_yThumbSize; + // Constraint implementation + void UnsetConstraints(wxLayoutConstraints *c); + // Back-pointer to other windows we're involved with, so if we delete + // this window, we must delete any constraints we're involved with. -#if wxUSE_MOUSEEVENT_HACK - // the coordinates of the last mouse event and the type of it - long m_lastMouseX, - m_lastMouseY; - int m_lastMouseEvent; -#endif // wxUSE_MOUSEEVENT_HACK + wxObject *GetChild(int number) const ; - WXHMENU m_hMenu; // Menu, if any + // Transfers data to any child controls + void OnInitDialog(wxInitDialogEvent& event); - // the return value of WM_GETDLGCODE handler - long m_lDlgCode; +protected: - // 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); + // Caret data + int m_caretWidth; + int m_caretHeight; + bool m_caretEnabled; + bool m_caretShown; - // 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(); + wxButton * m_defaultItem; -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif // wxUSE_TOOLTIPS +public: + int m_returnCode; +DECLARE_EVENT_TABLE() private: - // common part of all ctors void Init(); - - // the (non-virtual) handlers for the events - bool HandleMove(int x, int y); - bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); - - DECLARE_NO_COPY_CLASS(wxWindow); - DECLARE_EVENT_TABLE() - // Supress virtual function hiding warning - virtual bool Reparent( wxWindowBase *newParent ) - {return(wxWindowBase::Reparent(newParent));} }; -// --------------------------------------------------------------------------- -// global functions -// --------------------------------------------------------------------------- +//////////////////////////////////////////////////////////////////////// +//// INLINES + +inline wxButton *wxWindow::GetDefaultItem() const { return m_defaultItem; } +inline void wxWindow::SetDefaultItem(wxButton *but) { m_defaultItem = but; } +inline void wxWindow::SetReturnCode(int retCode) { m_returnCode = retCode; } +inline int wxWindow::GetReturnCode() { return m_returnCode; } -// kbd code translation -WXDLLEXPORT int wxCharCodeMSWToWX(int keySym); -WXDLLEXPORT int wxCharCodeWXToMSW(int id, bool *IsVirtual); +// Get the active window. +wxWindow* WXDLLEXPORT wxGetActiveWindow(); #endif // _WX_WINDOW_H_ diff --git a/include/wx/proplist.h b/include/wx/proplist.h index 87a674b2a1..2df1170cb9 100644 --- a/include/wx/proplist.h +++ b/include/wx/proplist.h @@ -159,7 +159,7 @@ class WXDLLEXPORT wxPropertyListView: public wxPropertyView inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; } inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; } inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; } - + bool OnClose(void); public: @@ -177,15 +177,18 @@ public: static wxBitmap* sm_tickBitmap; static wxBitmap* sm_crossBitmap; - + wxPanel* m_propertyWindow; // Panel that the controls will appear on wxWindow* m_managedWindow; // Frame or dialog - + wxButton* m_windowCloseButton; // Or OK wxButton* m_windowCancelButton; wxButton* m_windowHelpButton; DECLARE_EVENT_TABLE() +private: + virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *window) + { wxPropertyView::ShowView(propertySheet, window); }; }; class WXDLLEXPORT wxPropertyTextEdit: public wxTextCtrl @@ -206,7 +209,7 @@ class WXDLLEXPORT wxPropertyTextEdit: public wxTextCtrl /* * The type of validator used for property lists (Visual Basic style) */ - + class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator { DECLARE_DYNAMIC_CLASS(wxPropertyListValidator) @@ -221,7 +224,7 @@ class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator // Called when the property is double clicked. Extra functionality can be provided, such as // cycling through possible values. - inline virtual bool OnDoubleClick( + inline virtual bool OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) { return TRUE; } @@ -268,7 +271,7 @@ class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator /* * A default dialog box class to use. */ - + class WXDLLEXPORT wxPropertyListDialog: public wxDialog { DECLARE_CLASS(wxPropertyListDialog) @@ -292,7 +295,7 @@ DECLARE_EVENT_TABLE() /* * A default panel class to use. */ - + class WXDLLEXPORT wxPropertyListPanel: public wxPanel { DECLARE_CLASS(wxPropertyListPanel) @@ -325,7 +328,7 @@ DECLARE_EVENT_TABLE() /* * A default frame class to use. */ - + class WXDLLEXPORT wxPropertyListFrame: public wxFrame { DECLARE_CLASS(wxPropertyListFrame) @@ -355,7 +358,7 @@ DECLARE_EVENT_TABLE() /* * Some default validators */ - + class WXDLLEXPORT wxRealListValidator: public wxPropertyListValidator { DECLARE_DYNAMIC_CLASS(wxRealListValidator) @@ -472,7 +475,7 @@ class WXDLLEXPORT wxStringListValidator: public wxPropertyListValidator protected: wxStringList* m_strings; }; - + class WXDLLEXPORT wxFilenameListValidator: public wxPropertyListValidator { DECLARE_DYNAMIC_CLASS(wxFilenameListValidator) @@ -501,7 +504,7 @@ class WXDLLEXPORT wxFilenameListValidator: public wxPropertyListValidator protected: wxString m_filenameWildCard; wxString m_filenameMessage; - + }; class WXDLLEXPORT wxColourListValidator: public wxPropertyListValidator diff --git a/include/wx/sckipc.h b/include/wx/sckipc.h index 18e1a1908f..9cbc4735e5 100644 --- a/include/wx/sckipc.h +++ b/include/wx/sckipc.h @@ -52,7 +52,7 @@ class wxTCPClient; class wxTCPConnection: public wxConnectionBase { DECLARE_DYNAMIC_CLASS(wxTCPConnection) - + protected: wxSocketBase *m_sock; wxSocketStream *m_sockstrm; @@ -94,6 +94,9 @@ public: // To enable the compressor void Compress(bool on); +private: + // to prevent virtual function hiding warnings + virtual bool Execute(const wxString& str) { return(wxConnectionBase::Execute(str)); }; }; class wxTCPServer: public wxServerBase @@ -105,9 +108,9 @@ public: wxTCPServer(); virtual ~wxTCPServer(); - + // Returns FALSE if can't create server (e.g. port number is already in use) - virtual bool Create(const wxString& server_name); + virtual bool Create(const wxString& server_name); virtual wxConnectionBase *OnAcceptConnection(const wxString& topic); }; @@ -115,7 +118,7 @@ class wxTCPClient: public wxClientBase { DECLARE_DYNAMIC_CLASS(wxTCPClient) -public: +public: wxTCPClient(); virtual ~wxTCPClient(); @@ -125,7 +128,7 @@ public: virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic); - + // Tailor this to return own connection. virtual wxConnectionBase *OnMakeConnection(); }; diff --git a/include/wx/sckstrm.h b/include/wx/sckstrm.h index 7e5159294a..6ef70e4e91 100644 --- a/include/wx/sckstrm.h +++ b/include/wx/sckstrm.h @@ -27,9 +27,9 @@ class WXDLLEXPORT wxSocketOutputStream : public wxOutputStream wxSocketOutputStream(wxSocketBase& s); ~wxSocketOutputStream(); - off_t SeekO( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) + off_t SeekO( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) { return -1; } - off_t TellO() + off_t TellO() const { return -1; } protected: @@ -44,9 +44,9 @@ class WXDLLEXPORT wxSocketInputStream : public wxInputStream wxSocketInputStream(wxSocketBase& s); ~wxSocketInputStream(); - off_t SeekI( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) + off_t SeekI( off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode) ) { return -1; } - off_t TellI() + off_t TellI() const { return -1; } protected: diff --git a/include/wx/window.h b/include/wx/window.h index 5ae7d448c9..900f841e20 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -646,7 +646,7 @@ public: // get the haqndle of the window for the underlying window system: this // is only used for wxWin itself or for user code which wants to call // platform-specific APIs - virtual WXWidget GetHandle() const = 0; + virtual WXWidget GetHandle() const; protected: // the window id - a number which uniquely identifies a window among -- 2.45.2