From 7c78e7c70271608b076b1dbed201b1204e6898d4 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 7 Aug 1998 21:32:13 +0000 Subject: [PATCH] More configure fixes /src/qt and /include/wx/qt now have stubs. Not everything compiles yet. But it's a start.. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 4 +- include/wx/filedlg.h | 2 + include/wx/gdicmn.h | 2 + include/wx/qt/app.h | 138 +++++ include/wx/qt/bitmap.h | 125 +++++ include/wx/qt/bmpbuttn.h | 62 +++ include/wx/qt/brush.h | 60 +++ include/wx/qt/button.h | 58 +++ include/wx/qt/checkbox.h | 57 +++ include/wx/qt/choice.h | 68 +++ include/wx/qt/colour.h | 75 +++ include/wx/qt/combobox.h | 100 ++++ include/wx/qt/control.h | 60 +++ include/wx/qt/cursor.h | 59 +++ include/wx/qt/dc.h | 309 +++++++++++ include/wx/qt/dcclient.h | 97 ++++ include/wx/qt/dcmemory.h | 50 ++ include/wx/qt/dcscreen.h | 32 ++ include/wx/qt/dialog.h | 91 ++++ include/wx/qt/dirdlg.h | 35 ++ include/wx/qt/dnd.h | 239 +++++++++ include/wx/qt/filedlg.h | 94 ++++ include/wx/qt/font.h | 87 ++++ include/wx/qt/frame.h | 112 ++++ include/wx/qt/gauge.h | 83 +++ include/wx/qt/gdiobj.h | 37 ++ include/wx/qt/icon.h | 51 ++ include/wx/qt/joystick.h | 102 ++++ include/wx/qt/listbox.h | 78 +++ include/wx/qt/mdi.h | 181 +++++++ include/wx/qt/menu.h | 155 ++++++ include/wx/qt/notebook.h | 181 +++++++ include/wx/qt/palette.h | 60 +++ include/wx/qt/pen.h | 68 +++ include/wx/qt/radiobox.h | 80 +++ include/wx/qt/radiobut.h | 31 ++ include/wx/qt/region.h | 96 ++++ include/wx/qt/scrolbar.h | 78 +++ include/wx/qt/settings.h | 40 ++ include/wx/qt/slider.h | 86 ++++ include/wx/qt/statbmp.h | 60 +++ include/wx/qt/statbox.h | 55 ++ include/wx/qt/stattext.h | 57 +++ include/wx/qt/tbargtk.h | 139 +++++ include/wx/qt/textctrl.h | 108 ++++ include/wx/qt/timer.h | 52 ++ include/wx/qt/window.h | 252 +++++++++ include/wx/setup.h | 8 +- src/qt/app.cpp | 366 +++++++++++++ src/qt/bdiag.xbm | 6 + src/qt/bitmap.cpp | 237 +++++++++ src/qt/bmpbuttn.cpp | 78 +++ src/qt/brush.cpp | 132 +++++ src/qt/button.cpp | 61 +++ src/qt/cdiag.xbm | 6 + src/qt/checkbox.cpp | 50 ++ src/qt/choice.cpp | 97 ++++ src/qt/colour.cpp | 164 ++++++ src/qt/combobox.cpp | 149 ++++++ src/qt/control.cpp | 59 +++ src/qt/cross.xbm | 6 + src/qt/cursor.cpp | 120 +++++ src/qt/data.cpp | 711 ++++++++++++++++++++++++++ src/qt/dc.cpp | 393 ++++++++++++++ src/qt/dcclient.cpp | 627 +++++++++++++++++++++++ src/qt/dcmemory.cpp | 63 +++ src/qt/dcscreen.cpp | 47 ++ src/qt/dialog.cpp | 191 +++++++ src/qt/dnd.cpp | 123 +++++ src/qt/fdiag.xbm | 6 + src/qt/filedlg.cpp | 125 +++++ src/qt/font.cpp | 213 ++++++++ src/qt/frame.cpp | 252 +++++++++ src/qt/gauge.cpp | 51 ++ src/qt/gdiobj.cpp | 21 + src/qt/horiz.xbm | 6 + src/qt/icon.cpp | 27 + src/qt/joystick.cpp | 358 +++++++++++++ src/qt/listbox.cpp | 137 +++++ src/qt/mdi.cpp | 229 +++++++++ src/qt/menu.cpp | 293 +++++++++++ src/qt/notebook.cpp | 185 +++++++ src/qt/palette.cpp | 103 ++++ src/qt/pen.cpp | 204 ++++++++ src/qt/radiobox.cpp | 133 +++++ src/qt/radiobut.cpp | 17 + src/qt/region.cpp | 163 ++++++ src/qt/scrolbar.cpp | 102 ++++ src/qt/settings.cpp | 144 ++++++ src/qt/slider.cpp | 147 ++++++ src/qt/statbmp.cpp | 44 ++ src/qt/statbox.cpp | 38 ++ src/qt/stattext.cpp | 49 ++ src/qt/tbargtk.cpp | 193 +++++++ src/qt/textctrl.cpp | 235 +++++++++ src/qt/threadgui.inc | 65 +++ src/qt/threadno.cpp | 165 ++++++ src/qt/threadpsx.cpp | 322 ++++++++++++ src/qt/threadsgi.cpp | 230 +++++++++ src/qt/timer.cpp | 66 +++ src/qt/utilsgtk.cpp | 367 +++++++++++++ src/qt/utilsres.cpp | 332 ++++++++++++ src/qt/verti.xbm | 6 + src/qt/window.cpp | 1048 ++++++++++++++++++++++++++++++++++++++ template.mak | 6 +- 105 files changed, 13910 insertions(+), 12 deletions(-) create mode 100644 include/wx/qt/app.h create mode 100644 include/wx/qt/bitmap.h create mode 100644 include/wx/qt/bmpbuttn.h create mode 100644 include/wx/qt/brush.h create mode 100644 include/wx/qt/button.h create mode 100644 include/wx/qt/checkbox.h create mode 100644 include/wx/qt/choice.h create mode 100644 include/wx/qt/colour.h create mode 100644 include/wx/qt/combobox.h create mode 100644 include/wx/qt/control.h create mode 100644 include/wx/qt/cursor.h create mode 100644 include/wx/qt/dc.h create mode 100644 include/wx/qt/dcclient.h create mode 100644 include/wx/qt/dcmemory.h create mode 100644 include/wx/qt/dcscreen.h create mode 100644 include/wx/qt/dialog.h create mode 100644 include/wx/qt/dirdlg.h create mode 100644 include/wx/qt/dnd.h create mode 100644 include/wx/qt/filedlg.h create mode 100644 include/wx/qt/font.h create mode 100644 include/wx/qt/frame.h create mode 100644 include/wx/qt/gauge.h create mode 100644 include/wx/qt/gdiobj.h create mode 100644 include/wx/qt/icon.h create mode 100644 include/wx/qt/joystick.h create mode 100644 include/wx/qt/listbox.h create mode 100644 include/wx/qt/mdi.h create mode 100644 include/wx/qt/menu.h create mode 100644 include/wx/qt/notebook.h create mode 100644 include/wx/qt/palette.h create mode 100644 include/wx/qt/pen.h create mode 100644 include/wx/qt/radiobox.h create mode 100644 include/wx/qt/radiobut.h create mode 100644 include/wx/qt/region.h create mode 100644 include/wx/qt/scrolbar.h create mode 100644 include/wx/qt/settings.h create mode 100644 include/wx/qt/slider.h create mode 100644 include/wx/qt/statbmp.h create mode 100644 include/wx/qt/statbox.h create mode 100644 include/wx/qt/stattext.h create mode 100644 include/wx/qt/tbargtk.h create mode 100644 include/wx/qt/textctrl.h create mode 100644 include/wx/qt/timer.h create mode 100644 include/wx/qt/window.h create mode 100644 src/qt/app.cpp create mode 100644 src/qt/bdiag.xbm create mode 100644 src/qt/bitmap.cpp create mode 100644 src/qt/bmpbuttn.cpp create mode 100644 src/qt/brush.cpp create mode 100644 src/qt/button.cpp create mode 100644 src/qt/cdiag.xbm create mode 100644 src/qt/checkbox.cpp create mode 100644 src/qt/choice.cpp create mode 100644 src/qt/colour.cpp create mode 100644 src/qt/combobox.cpp create mode 100644 src/qt/control.cpp create mode 100644 src/qt/cross.xbm create mode 100644 src/qt/cursor.cpp create mode 100644 src/qt/data.cpp create mode 100644 src/qt/dc.cpp create mode 100644 src/qt/dcclient.cpp create mode 100644 src/qt/dcmemory.cpp create mode 100644 src/qt/dcscreen.cpp create mode 100644 src/qt/dialog.cpp create mode 100644 src/qt/dnd.cpp create mode 100644 src/qt/fdiag.xbm create mode 100644 src/qt/filedlg.cpp create mode 100644 src/qt/font.cpp create mode 100644 src/qt/frame.cpp create mode 100644 src/qt/gauge.cpp create mode 100644 src/qt/gdiobj.cpp create mode 100644 src/qt/horiz.xbm create mode 100644 src/qt/icon.cpp create mode 100644 src/qt/joystick.cpp create mode 100644 src/qt/listbox.cpp create mode 100644 src/qt/mdi.cpp create mode 100644 src/qt/menu.cpp create mode 100644 src/qt/notebook.cpp create mode 100644 src/qt/palette.cpp create mode 100644 src/qt/pen.cpp create mode 100644 src/qt/radiobox.cpp create mode 100644 src/qt/radiobut.cpp create mode 100644 src/qt/region.cpp create mode 100644 src/qt/scrolbar.cpp create mode 100644 src/qt/settings.cpp create mode 100644 src/qt/slider.cpp create mode 100644 src/qt/statbmp.cpp create mode 100644 src/qt/statbox.cpp create mode 100644 src/qt/stattext.cpp create mode 100644 src/qt/tbargtk.cpp create mode 100644 src/qt/textctrl.cpp create mode 100644 src/qt/threadgui.inc create mode 100644 src/qt/threadno.cpp create mode 100644 src/qt/threadpsx.cpp create mode 100644 src/qt/threadsgi.cpp create mode 100644 src/qt/timer.cpp create mode 100644 src/qt/utilsgtk.cpp create mode 100644 src/qt/utilsres.cpp create mode 100644 src/qt/verti.xbm create mode 100644 src/qt/window.cpp diff --git a/include/wx/app.h b/include/wx/app.h index 6a92d6e28e..5bfeb5db30 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -12,14 +12,14 @@ #ifndef __APPH_BASE__ #define __APPH_BASE__ -#ifndef __WXGTK__ +#ifdef __WXMSW__ class WXDLLEXPORT wxApp; typedef wxApp* (*wxAppInitializerFunction) (void); #endif #include "wx/object.h" -#ifdef __WXGTK__ +#ifndef __WXMSW__ typedef wxObject* (*wxAppInitializerFunction) (void); // returning wxApp* won't work with gcc #endif diff --git a/include/wx/filedlg.h b/include/wx/filedlg.h index 447b3db1b4..47ed6c70d4 100644 --- a/include/wx/filedlg.h +++ b/include/wx/filedlg.h @@ -7,6 +7,8 @@ #include "wx/xt/filedlg.h" #elif defined(__WXGTK__) #include "wx/gtk/filedlg.h" +#elif defined(__WXQT__) +#include "wx/qt/filedlg.h" #endif #endif diff --git a/include/wx/gdicmn.h b/include/wx/gdicmn.h index 9ce9b66abf..93320b4b3f 100644 --- a/include/wx/gdicmn.h +++ b/include/wx/gdicmn.h @@ -27,6 +27,8 @@ #include "wx/xt/colour.h" #elif defined(__WXGTK__) #include "wx/gtk/colour.h" +#elif defined(__WXQT__) +#include "wx/qt/colour.h" #endif // Standard cursors diff --git a/include/wx/qt/app.h b/include/wx/qt/app.h new file mode 100644 index 0000000000..e8a7b10a24 --- /dev/null +++ b/include/wx/qt/app.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: app.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __GTKAPPH__ +#define __GTKAPPH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/window.h" +#include "wx/frame.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxApp; +class wxLog; +class wxConfig; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern wxApp *wxTheApp; + +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +void wxExit(void); +bool wxYield(void); + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#define wxPRINT_WINDOWS 1 +#define wxPRINT_POSTSCRIPT 2 + +//----------------------------------------------------------------------------- +// wxApp +//----------------------------------------------------------------------------- + +class wxApp: public wxEvtHandler +{ + DECLARE_DYNAMIC_CLASS(wxApp) + + public: + + wxApp(void); + ~wxApp(void); + + static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } + static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; } + + virtual bool OnInit(void); + virtual bool OnInitGui(void); + virtual int OnRun(void); + virtual int OnExit(void); + + wxWindow *GetTopWindow(void); + void SetTopWindow( wxWindow *win ); + virtual int MainLoop(void); + void ExitMainLoop(void); + bool Initialized(void); + virtual bool Pending(void); + virtual void Dispatch(void); + + inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; } + inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; } + + void OnIdle( wxIdleEvent &event ); + bool SendIdleEvents(void); + bool SendIdleEvents( wxWindow* win ); + + inline wxString GetAppName(void) const { + if (m_appName != "") + return m_appName; + else return m_className; + } + inline void SetAppName(const wxString& name) { m_appName = name; }; + inline wxString GetClassName(void) const { return m_className; } + inline void SetClassName(const wxString& name) { m_className = name; } + const wxString& GetVendorName() const { return m_vendorName; } + void SetVendorName(const wxString& name) { m_vendorName = name; } + + inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } + inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; } + + void SetPrintMode(int WXUNUSED(mode) ) {}; + int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; }; + + // override this function to create default log target of arbitrary + // user-defined classv (default implementation creates a wxLogGui object) + virtual wxLog *CreateLogTarget(); + +#if USE_WXCONFIG + // override this function to create a global wxConfig object of different + // than default type (right now the default implementation returns NULL) + virtual wxConfig *CreateConfig() { return NULL; } +#endif + + // GTK implementation + + static void CommonInit(void); + static void CommonCleanUp(void); + + bool ProcessIdle(void); + void DeletePendingObjects(void); + + bool m_initialized; + bool m_exitOnFrameDelete; + bool m_wantDebugOutput; + wxWindow *m_topWindow; + + int argc; + char **argv; + + static wxAppInitializerFunction m_appInitFn; + +private: + wxString m_vendorName, + m_appName, + m_className; + + DECLARE_EVENT_TABLE() +}; + +#endif // __GTKAPPH__ diff --git a/include/wx/qt/bitmap.h b/include/wx/qt/bitmap.h new file mode 100644 index 0000000000..63ea780ff5 --- /dev/null +++ b/include/wx/qt/bitmap.h @@ -0,0 +1,125 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bitmap.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKBITMAPH__ +#define __GTKBITMAPH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/palette.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxDC; +class wxPaintDC; +class wxMemoryDC; +class wxToolBar; +class wxBitmapButton; +class wxStaticBitmap; +class wxFrame; + +class wxMask; +class wxBitmap; + +//----------------------------------------------------------------------------- +// wxMask +//----------------------------------------------------------------------------- + +class wxMask: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxMask) + + public: + + wxMask(); + wxMask( const wxBitmap& bitmap, const wxColour& colour ); + wxMask( const wxBitmap& bitmap, int paletteIndex ); + wxMask( const wxBitmap& bitmap ); + ~wxMask(); + + private: + + friend wxBitmap; + friend wxDC; + friend wxPaintDC; + friend wxToolBar; + friend wxBitmapButton; + friend wxStaticBitmap; + friend wxFrame; + + protected: + +}; + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +// CMB 20/5/98: added xbm constructor and GetBitmap() method +class wxBitmap: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxBitmap) + + public: + + wxBitmap(); + wxBitmap( int width, int height, int depth = -1 ); + wxBitmap( const char bits[], int width, int height, int depth = 1 ); + wxBitmap( char **bits ); + wxBitmap( const wxBitmap& bmp ); + wxBitmap( const wxBitmap* bmp ); + wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM); + ~wxBitmap(); + wxBitmap& operator = ( const wxBitmap& bmp ); + bool operator == ( const wxBitmap& bmp ); + bool operator != ( const wxBitmap& bmp ); + bool Ok() const; + + int GetHeight() const; + int GetWidth() const; + int GetDepth() const; + void SetHeight( int height ); + void SetWidth( int width ); + void SetDepth( int depth ); + + wxMask *GetMask() const; + void SetMask( wxMask *mask ); + + void Resize( int height, int width ); + + bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL ); + bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM); + + wxPalette *GetPalette() const; + wxPalette *GetColourMap() const + { return GetPalette(); }; + + private: + + friend wxDC; + friend wxPaintDC; + friend wxMemoryDC; + friend wxToolBar; + friend wxBitmapButton; + friend wxStaticBitmap; + friend wxFrame; + + // no data :-) +}; + +#endif // __GTKBITMAPH__ diff --git a/include/wx/qt/bmpbuttn.h b/include/wx/qt/bmpbuttn.h new file mode 100644 index 0000000000..659e9443dc --- /dev/null +++ b/include/wx/qt/bmpbuttn.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bmpbutton.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __BMPBUTTONH__ +#define __BMPBUTTONH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxBitmapButton; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxButtonNameStr; + +//----------------------------------------------------------------------------- +// wxBitmapButton +//----------------------------------------------------------------------------- + +class wxBitmapButton: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxBitmapButton) + + public: + + wxBitmapButton(void); + wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxButtonNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxButtonNameStr ); + void SetDefault(void); + void SetLabel( const wxString &label ); + wxString GetLabel(void) const; + + public: + + wxBitmap m_bitmap; + +}; +#endif // __BMPBUTTONH__ diff --git a/include/wx/qt/brush.h b/include/wx/qt/brush.h new file mode 100644 index 0000000000..32048f67b7 --- /dev/null +++ b/include/wx/qt/brush.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: brush.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKBRUSHH__ +#define __GTKBRUSHH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxBrush; + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class wxBrush: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxBrush) + + public: + + wxBrush(void); + wxBrush( const wxColour &colour, int style ); + wxBrush( const wxString &colourName, int style ); + wxBrush( const wxBitmap &stippleBitmap ); + wxBrush( const wxBrush &brush ); + wxBrush( const wxBrush *brush ); + ~wxBrush(void); + wxBrush& operator = ( const wxBrush& brush ); + bool operator == ( const wxBrush& brush ); + bool operator != ( const wxBrush& brush ); + bool Ok(void) const; + + int GetStyle(void) const; + wxColour &GetColour(void) const; + wxBitmap *GetStipple(void) const; + + // no data :-) +}; + +#endif // __GTKBRUSHH__ diff --git a/include/wx/qt/button.h b/include/wx/qt/button.h new file mode 100644 index 0000000000..6932755578 --- /dev/null +++ b/include/wx/qt/button.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: button.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKBUTTONH__ +#define __GTKBUTTONH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxButton; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxButtonNameStr; + +//----------------------------------------------------------------------------- +// wxButton +//----------------------------------------------------------------------------- + +class wxButton: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxButton) + + public: + + wxButton(void); + wxButton( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxButtonNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxButtonNameStr ); + void SetDefault(void); + void SetLabel( const wxString &label ); + wxString GetLabel(void) const; +}; + +#endif // __GTKBUTTONH__ diff --git a/include/wx/qt/checkbox.h b/include/wx/qt/checkbox.h new file mode 100644 index 0000000000..6ff10bcecc --- /dev/null +++ b/include/wx/qt/checkbox.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: checkbox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCHECKBOXH__ +#define __GTKCHECKBOXH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxCheckBox; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxCheckBoxNameStr; + +//----------------------------------------------------------------------------- +// wxCheckBox +//----------------------------------------------------------------------------- + +class wxCheckBox: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxCheckBox) + + public: + + wxCheckBox(void); + wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxCheckBoxNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxCheckBoxNameStr ); + void SetValue( bool state ); + bool GetValue(void) const; +}; + +#endif // __GTKCHECKBOXH__ diff --git a/include/wx/qt/choice.h b/include/wx/qt/choice.h new file mode 100644 index 0000000000..99e7ec0878 --- /dev/null +++ b/include/wx/qt/choice.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: choice.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCHOICEH__ +#define __GTKCHOICEH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxChoice; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxChoiceNameStr; + +//----------------------------------------------------------------------------- +// wxChoice +//----------------------------------------------------------------------------- + +class wxChoice: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxChoice) + + public: + + wxChoice(void); + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, const wxString &name = wxChoiceNameStr ); + 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 wxString &name = wxChoiceNameStr ); + void Append( const wxString &item ); + void Clear(void); + int FindString( const wxString &string ) const; + int GetColumns(void) const; + int GetSelection(void); + wxString GetString( int n ) const; + wxString GetStringSelection(void) const; + int Number(void) const; + void SetColumns( int n = 1 ); + void SetSelection( int n ); + void SetStringSelection( const wxString &string ); +}; + +#endif // __GTKCHOICEH__ diff --git a/include/wx/qt/colour.h b/include/wx/qt/colour.h new file mode 100644 index 0000000000..f37554e841 --- /dev/null +++ b/include/wx/qt/colour.h @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: colour.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCOLOURH__ +#define __GTKCOLOURH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/palette.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxDC; +class wxPaintDC; +class wxBitmap; +class wxWindow; + +class wxColour; + +//----------------------------------------------------------------------------- +// wxColour +//----------------------------------------------------------------------------- + +class wxColour: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxColour) + + public: + + wxColour(void); + wxColour( char red, char green, char blue ); + wxColour( const wxString &colourName ); + wxColour( const wxColour& col ); + wxColour( const wxColour* col ); + ~wxColour(void); + wxColour& operator = ( const wxColour& col ); + wxColour& operator = ( const wxString& colourName ); + bool operator == ( const wxColour& col ); + bool operator != ( const wxColour& col ); + void Set( const unsigned char red, const unsigned char green, const unsigned char blue ); + unsigned char Red(void) const; + unsigned char Green(void) const; + unsigned char Blue(void) const; + bool Ok(void) const; + + private: + public: + + friend wxDC; + friend wxPaintDC; + friend wxBitmap; + friend wxWindow; + + int GetPixel(void); + + // no data :-) +}; + +#endif // __GTKCOLOURH__ diff --git a/include/wx/qt/combobox.h b/include/wx/qt/combobox.h new file mode 100644 index 0000000000..b8395f5d55 --- /dev/null +++ b/include/wx/qt/combobox.h @@ -0,0 +1,100 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combobox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCOMBOBOXH__ +#define __GTKCOMBOBOXH__ + +#ifdef __GNUG__ +#pragma interface "combobox.h" +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxComboBox; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char* wxComboBoxNameStr; +extern const char* wxEmptyString; + +//----------------------------------------------------------------------------- +// wxComboBox +//----------------------------------------------------------------------------- + +class wxComboBox: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxComboBox) + + public: + inline wxComboBox(void) {} + + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, n, choices, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxString& name = wxComboBoxNameStr); + + // List functions + void Clear(void); + void Append( const wxString &item ); + void Append( const wxString &item, char* clientData ); + void Delete( int n ); + int FindString( const wxString &item ); + char* GetClientData( int n ); + void SetClientData( int n, char * clientData ); + int GetSelection(void) const; + wxString GetString( int n ) const; + wxString GetStringSelection(void) const; + int Number(void) const; + void SetSelection( int n ); + void SetStringSelection( const wxString &string ); + + // Text field functions + wxString GetValue(void) const ; + void SetValue(const wxString& value); + + // Clipboard operations + void Copy(void); + void Cut(void); + void Paste(void); + void SetInsertionPoint(long pos); + void SetInsertionPointEnd(void); + long GetInsertionPoint(void) const ; + long GetLastPosition(void) const ; + void Replace(long from, long to, const wxString& value); + void Remove(long from, long to); + void SetSelection(long from, long to); + void SetEditable(bool editable); + +}; + +#endif // __GTKCOMBOBOXH__ diff --git a/include/wx/qt/control.h b/include/wx/qt/control.h new file mode 100644 index 0000000000..5aa8a1b39a --- /dev/null +++ b/include/wx/qt/control.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: control.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCONTROLH__ +#define __GTKCONTROLH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxControl; + +//----------------------------------------------------------------------------- +// wxControl +//----------------------------------------------------------------------------- + +class wxControl: public wxWindow +{ +DECLARE_DYNAMIC_CLASS(wxControl) + +public: + // construction + wxControl(); + wxControl( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxPanelNameStr ); + + // overridables + virtual void Command( wxCommandEvent &event ); + + // accessors + // this function will filter out '&' characters and will put the accelerator + // char (the one immediately after '&') into m_chAccel (@@ not yet) + virtual void SetLabel( const wxString &label ); + virtual wxString GetLabel() const; + +protected: + wxString m_label; + // when we implement keyboard interface we will make use of this, but not yet + //char m_chAccel; +}; + +#endif // __GTKCONTROLH__ diff --git a/include/wx/qt/cursor.h b/include/wx/qt/cursor.h new file mode 100644 index 0000000000..e6b3451b8a --- /dev/null +++ b/include/wx/qt/cursor.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: cursor.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKCURSORH__ +#define __GTKCURSORH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxWindow; + +class wxCursor; + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class wxCursor: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxCursor) + + public: + + wxCursor(void); + wxCursor( int cursorId ); + wxCursor( const wxCursor &cursor ); + wxCursor( const wxCursor *cursor ); + ~wxCursor(void); + wxCursor& operator = ( const wxCursor& cursor ); + bool operator == ( const wxCursor& cursor ); + bool operator != ( const wxCursor& cursor ); + bool Ok(void) const; + + private: + public: + + friend wxWindow; + + // no data :-) +}; + +#endif // __GTKCURSORH__ diff --git a/include/wx/qt/dc.h b/include/wx/qt/dc.h new file mode 100644 index 0000000000..9678e6d693 --- /dev/null +++ b/include/wx/qt/dc.h @@ -0,0 +1,309 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dc.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKDCH__ +#define __GTKDCH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdicmn.h" +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/icon.h" +#include "wx/font.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxDC; + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#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 + +//----------------------------------------------------------------------------- +// global variables +//----------------------------------------------------------------------------- + +extern int wxPageNumber; + +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +class wxDC: public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxDC) + + public: + + wxDC(void); + ~wxDC(void); + + void BeginDrawing(void) {}; + void EndDrawing(void) {}; + + virtual bool Ok(void) const { return m_ok; }; + + virtual void FloodFill( long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE ) = 0; + virtual bool GetPixel( long x1, long y1, wxColour *col ) const = 0; + + virtual void DrawLine( long x1, long y1, long x2, long y2 ) = 0; + virtual void CrossHair( long x, long y ) = 0; + virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); + virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) = 0; + 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; + virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ) = 0; + virtual void DrawEllipse( long x, long y, long width, long height ) = 0; + + virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ); + virtual void DrawSpline( wxList *points ); + virtual void DrawSpline( int n, wxPoint points[] ); + + virtual bool CanDrawBitmap(void) const = 0; + virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); + void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE ) + { DrawIcon( *((wxIcon*)(&bmp)), x, y, useMask ); } + 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; + + virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ) = 0; + 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) { return &m_font; }; + + virtual void SetPen( const wxPen &pen ) = 0; + virtual wxPen *GetPen(void) { return &m_pen; }; + + virtual void SetBrush( const wxBrush &brush ) = 0; + virtual wxBrush *GetBrush(void) { return &m_brush; }; + + virtual void SetBackground( const wxBrush &brush ) = 0; + virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; }; + + virtual void SetLogicalFunction( int function ) = 0; + virtual int GetLogicalFunction(void) { 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) { 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); + } + + virtual void DrawOpenSpline( wxList *points ) = 0; + + 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 // __GTKDCH__ diff --git a/include/wx/qt/dcclient.h b/include/wx/qt/dcclient.h new file mode 100644 index 0000000000..8090743758 --- /dev/null +++ b/include/wx/qt/dcclient.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcclient.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKDCCLIENTH__ +#define __GTKDCCLIENTH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/dc.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxPaintDC; +typedef wxPaintDC wxClientDC; +typedef wxPaintDC wxWindowDC; + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +class wxPaintDC: public wxDC +{ + DECLARE_DYNAMIC_CLASS(wxPaintDC) + + public: + + wxPaintDC(void); + wxPaintDC( wxWindow *win ); + + ~wxPaintDC(void); + + virtual void FloodFill( long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE ); + virtual bool GetPixel( long x1, long y1, wxColour *col ) const; + + virtual void DrawLine( long x1, long y1, long x2, long y2 ); + virtual void CrossHair( long x, long y ); + virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); + virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); + virtual void DrawPoint( long x, long y ); + + virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); + virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); + virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, + int fillStyle=wxODDEVEN_RULE ); + virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, + int fillStyle=wxODDEVEN_RULE ); + + virtual void DrawRectangle( long x, long y, long width, long height ); + virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); + virtual void DrawEllipse( long x, long y, long width, long height ); + + virtual bool CanDrawBitmap(void) const; + virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); + virtual bool Blit( long xdest, long ydest, long width, long height, + wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ); + + virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ); + virtual bool CanGetTextExtent(void) const; + virtual void GetTextExtent( const wxString &string, long *width, long *height, + long *descent = NULL, long *externalLeading = NULL, + wxFont *theFont = NULL, bool use16 = FALSE ); + virtual long GetCharWidth(void); + virtual long GetCharHeight(void); + + virtual void Clear(void); + + virtual void SetFont( const wxFont &font ); + virtual void SetPen( const wxPen &pen ); + virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); + virtual void SetLogicalFunction( int function ); + virtual void SetTextForeground( const wxColour &col ); + virtual void SetTextBackground( const wxColour &col ); + virtual void SetBackgroundMode( int mode ); + virtual void SetPalette( const wxPalette& palette ); + + virtual void SetClippingRegion( long x, long y, long width, long height ); + virtual void DestroyClippingRegion(void); + + virtual void DrawOpenSpline( wxList *points ); + +}; + +#endif // __GTKDCCLIENTH__ diff --git a/include/wx/qt/dcmemory.h b/include/wx/qt/dcmemory.h new file mode 100644 index 0000000000..c5854c5110 --- /dev/null +++ b/include/wx/qt/dcmemory.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcmemory.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKDCMEMORYH__ +#define __GTKDCMEMORYH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/dcclient.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxMemoryDC; + +//----------------------------------------------------------------------------- +// wxMemoryDC +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxMemoryDC: public wxPaintDC +{ + DECLARE_DYNAMIC_CLASS(wxMemoryDC) + + public: + wxMemoryDC(void); + wxMemoryDC( wxDC *dc ); // Create compatible DC + ~wxMemoryDC(void); + virtual void SelectObject( const wxBitmap& bitmap ); + void GetSize( int *width, int *height ) const; + + private: + friend wxPaintDC; + wxBitmap m_selected; +}; + +#endif + // __GTKDCMEMORYH__ + diff --git a/include/wx/qt/dcscreen.h b/include/wx/qt/dcscreen.h new file mode 100644 index 0000000000..5cb1991fe9 --- /dev/null +++ b/include/wx/qt/dcscreen.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcscreen.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKDCSCREENH__ +#define __GTKDCSCREENH__ + +#include "wx/dcclient.h" + +class WXDLLEXPORT wxScreenDC: public wxPaintDC +{ + DECLARE_DYNAMIC_CLASS(wxScreenDC) + + public: + wxScreenDC(void); + ~wxScreenDC(void); + + static bool StartDrawingOnTop( wxWindow *window ); + static bool StartDrawingOnTop( wxRectangle *rect = NULL ); + static bool EndDrawingOnTop(void); +}; + +#endif + // __GTKDCSCREENH__ + diff --git a/include/wx/qt/dialog.h b/include/wx/qt/dialog.h new file mode 100644 index 0000000000..db28c7772b --- /dev/null +++ b/include/wx/qt/dialog.h @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dialog.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKDIALOGH__ +#define __GTKDIALOGH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/event.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// forward decls +//----------------------------------------------------------------------------- + +class wxRadioBox; + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxDialog; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxDialogNameStr; + +//----------------------------------------------------------------------------- +// wxDialog +//----------------------------------------------------------------------------- + +class wxDialog: public wxWindow +{ + DECLARE_DYNAMIC_CLASS(wxDialog) + + public: + + wxDialog(void); + 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 ); + 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 ); + ~wxDialog(void); + void SetTitle(const wxString& title); + wxString GetTitle(void) const; + bool OnClose(void); + void OnApply( wxCommandEvent &event ); + void OnCancel( wxCommandEvent &event ); + void OnOk( wxCommandEvent &event ); + void OnPaint(wxPaintEvent& event); + bool Destroy(void); + void OnCloseWindow(wxCloseEvent& event); +/* + void OnCharHook(wxKeyEvent& event); +*/ + virtual bool Show( bool show ); + virtual int ShowModal(void); + virtual void EndModal(int retCode); + virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } + virtual void InitDialog(void); + + private: + + friend wxWindow; + friend wxDC; + friend wxRadioBox; + bool m_modalShowing; + wxString m_title; + + DECLARE_EVENT_TABLE() + +}; + +#endif // __GTKDIALOGH__ diff --git a/include/wx/qt/dirdlg.h b/include/wx/qt/dirdlg.h new file mode 100644 index 0000000000..7d8829f55b --- /dev/null +++ b/include/wx/qt/dirdlg.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dirdlg.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __DIRDIALOGH__ +#define __DIRDIALOGH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" +#include "wx/dialog.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxDirDialog; + +//----------------------------------------------------------------------------- +// wxDirDialog +//----------------------------------------------------------------------------- + +#endif // __DIRDIALOGH__ diff --git a/include/wx/qt/dnd.h b/include/wx/qt/dnd.h new file mode 100644 index 0000000000..9a83f6e0cd --- /dev/null +++ b/include/wx/qt/dnd.h @@ -0,0 +1,239 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: dnd.h +// Purpose: declaration of the wxDropTarget class +// Author: Robert Roebling +// RCS-ID: +// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKDNDH__ +#define __GTKDNDH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/cursor.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class wxWindow; + +class wxDataObject; +class wxTextDataObject; +class wxFileDataObject; + +class wxDropTarget; +class wxTextDropTarget; +class wxFileDropTarget; + +class wxDropSource; + +//------------------------------------------------------------------------- +// wxDataObject +//------------------------------------------------------------------------- + +class wxDataObject: public wxObject +{ +public: + // all data formats (values are the same as in windows.h, do not change!) + enum StdFormat + { + Invalid, + Text, + Bitmap, + MetafilePict, + Sylk, + Dif, + Tiff, + OemText, + Dib, + Palette, + Pendata, + Riff, + Wave, + UnicodeText, + EnhMetafile, + Hdrop, + Locale, + Max + }; + + // function to return symbolic name of clipboard format (debug messages) + static const char *GetFormatName(wxDataFormat format); + + // ctor & dtor + wxDataObject() {}; + ~wxDataObject() {}; + + // pure virtuals to override + // get the best suited format for our data + virtual wxDataFormat GetPreferredFormat() const = 0; + // decide if we support this format (should be one of values of + // StdFormat enumerations or a user-defined format) + virtual bool IsSupportedFormat(wxDataFormat format) const = 0; + // get the (total) size of data + virtual uint GetDataSize() const = 0; + // copy raw data to provided pointer + virtual void GetDataHere(void *pBuf) const = 0; + +}; + +// ---------------------------------------------------------------------------- +// wxTextDataObject is a specialization of wxDataObject for text data +// ---------------------------------------------------------------------------- + +class wxTextDataObject : public wxDataObject +{ +public: + // ctors + wxTextDataObject() { } + wxTextDataObject(const wxString& strText) : m_strText(strText) { } + void Init(const wxString& strText) { m_strText = strText; } + + // implement base class pure virtuals + virtual wxDataFormat GetPreferredFormat() const + { return wxDF_TEXT; } + virtual bool IsSupportedFormat(wxDataFormat format) const + { return format == wxDF_TEXT; } + virtual uint GetDataSize() const + { return m_strText.Len() + 1; } // +1 for trailing '\0'of course + virtual void GetDataHere(void *pBuf) const + { memcpy(pBuf, m_strText.c_str(), GetDataSize()); } + +private: + wxString m_strText; + +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class wxFileDataObject : public wxDataObject +{ +public: + + wxFileDataObject(void) { } + void AddFile( const wxString &file ) + { m_files += file; m_files += ";"; } + + // implement base class pure virtuals + virtual wxDataFormat GetPreferredFormat() const + { return wxDF_FILENAME; } + virtual bool IsSupportedFormat(wxDataFormat format) const + { return format == wxDF_FILENAME; } + virtual uint GetDataSize() const + { return m_files.Len() + 1; } // +1 for trailing '\0'of course + virtual void GetDataHere(void *pBuf) const + { memcpy(pBuf, m_files.c_str(), GetDataSize()); } + +private: + wxString m_files; + +}; +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class wxDropTarget: public wxObject +{ + public: + + wxDropTarget(); + ~wxDropTarget(); + + virtual void OnEnter() { } + virtual void OnLeave() { } + virtual bool OnDrop( long x, long y, const void *pData ) = 0; + +// protected: + + friend wxWindow; + + // Override these to indicate what kind of data you support: + + virtual size_t GetFormatCount() const = 0; + virtual wxDataFormat GetFormat(size_t n) const = 0; +}; + +//------------------------------------------------------------------------- +// wxTextDropTarget +//------------------------------------------------------------------------- + +class wxTextDropTarget: public wxDropTarget +{ + public: + + wxTextDropTarget() {}; + virtual bool OnDrop( long x, long y, const void *pData ); + virtual bool OnDropText( long x, long y, const char *psz ); + + protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +// ---------------------------------------------------------------------------- +// A drop target which accepts files (dragged from File Manager or Explorer) +// ---------------------------------------------------------------------------- + +class wxFileDropTarget: public wxDropTarget +{ + public: + + wxFileDropTarget() {}; + + virtual bool OnDrop(long x, long y, const void *pData); + virtual bool OnDropFiles( long x, long y, + size_t nFiles, const char * const aszFiles[]); + + protected: + + virtual size_t GetFormatCount() const; + virtual wxDataFormat GetFormat(size_t n) const; +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +class wxDropSource: public wxObject +{ + public: + + enum DragResult + { + Error, // error prevented the d&d operation from completing + None, // drag target didn't accept the data + Copy, // the data was successfully copied + Move, // the data was successfully moved + Cancel // the operation was cancelled by user (not an error) + }; + + wxDropSource( wxWindow *win ); + wxDropSource( wxDataObject &data, wxWindow *win ); + + ~wxDropSource(void); + + void SetData( wxDataObject &data ); + DragResult DoDragDrop( bool bAllowMove = FALSE ); + + virtual bool GiveFeedback( DragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; }; + + protected: + + wxDataObject *m_data; +}; + +#endif + //__GTKDNDH__ + diff --git a/include/wx/qt/filedlg.h b/include/wx/qt/filedlg.h new file mode 100644 index 0000000000..cca27d47d8 --- /dev/null +++ b/include/wx/qt/filedlg.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: filedlg.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKFILEDLGH__ +#define __GTKFILEDLGH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/dialog.h" + +//------------------------------------------------------------------------- +// File selector +//------------------------------------------------------------------------- + +extern const char *wxFileSelectorPromptStr; +extern const char *wxFileSelectorDefaultWildcardStr; + +class wxFileDialog: public wxDialog +{ + + DECLARE_DYNAMIC_CLASS(wxFileDialog) + + public: + + wxFileDialog() {}; + + wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = "", const wxString& defaultFile = "", + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = 0, const wxPoint& pos = wxDefaultPosition); + + inline void SetMessage(const wxString& message) { m_message = message; } + inline void SetPath(const wxString& path) { m_path = path; } + inline void SetDirectory(const wxString& dir) { m_dir = dir; } + inline void SetFilename(const wxString& name) { m_fileName = name; } + inline void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; } + inline void SetStyle(long style) { m_dialogStyle = style; } + inline void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; } + + inline wxString GetMessage(void) const { return m_message; } + inline wxString GetPath(void) const { return m_path; } + inline wxString GetDirectory(void) const { return m_dir; } + inline wxString GetFilename(void) const { return m_fileName; } + inline wxString GetWildcard(void) const { return m_wildCard; } + inline long GetStyle(void) const { return m_dialogStyle; } + inline int GetFilterIndex(void) const { return m_filterIndex ; } + + int ShowModal(void); + + protected: + + wxString m_message; + long m_dialogStyle; + wxWindow * m_parent; + wxString m_dir; + wxString m_path; // Full path + wxString m_fileName; + wxString m_wildCard; + int m_filterIndex; +}; + +#define wxOPEN 1 +#define wxSAVE 2 +#define wxOVERWRITE_PROMPT 4 +#define wxHIDE_READONLY 8 +#define wxFILE_MUST_EXIST 16 + +// File selector - backward compatibility + +char* wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL, + const char *default_filename = NULL, const char *default_extension = NULL, + const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0, + wxWindow *parent = NULL, int x = -1, int y = -1); + +char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name = NULL, + wxWindow *parent = NULL); + +char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name = NULL, + wxWindow *parent = NULL); + + + +#endif + // __GTKFILEDLGH__ diff --git a/include/wx/qt/font.h b/include/wx/qt/font.h new file mode 100644 index 0000000000..f60894b75e --- /dev/null +++ b/include/wx/qt/font.h @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: font.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKFONTH__ +#define __GTKFONTH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/hash.h" +#include "wx/gdiobj.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxDC; +class wxPaintDC; +class wxWindow; + +class wxFont; +class wxFontNameDirectory; + +//----------------------------------------------------------------------------- +// global variables +//----------------------------------------------------------------------------- + +// extern wxFontNameDirectory wxTheFontNameDirectory; // defined below + +//----------------------------------------------------------------------------- +// wxFont +//----------------------------------------------------------------------------- + +class wxFont: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxFont) + + public: + wxFont(void); + wxFont( int PointSize, int FontIdOrFamily, int Style, int Weight, + bool underlined = FALSE, const char *Face=NULL ); + wxFont( int PointSize, const char *Face, int Family, int Style, int Weight, + bool underlined = FALSE ); + wxFont( const wxFont& font ); + wxFont( const wxFont* font ); + ~wxFont(void); + wxFont& operator = ( const wxFont& font ); + bool operator == ( const wxFont& font ); + bool operator != ( const wxFont& font ); + bool Ok(); + + int GetPointSize(void) const; + wxString GetFaceName(void) const; + int GetFamily(void) const; + wxString GetFamilyString(void) const; + int GetFontId(void) const; + wxString GetFaceString(void) const; + int GetStyle(void) const; + wxString GetStyleString(void) const; + int GetWeight(void) const; + wxString GetWeightString(void) const; + bool GetUnderlined(void) const; + + wxFont( char *xFontName ); + + private: + + friend wxDC; + friend wxPaintDC; + friend wxWindow; + + // no data :-) +}; + +#endif // __GTKFONTH__ diff --git a/include/wx/qt/frame.h b/include/wx/qt/frame.h new file mode 100644 index 0000000000..03ca33c386 --- /dev/null +++ b/include/wx/qt/frame.h @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: frame.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKFRAMEH__ +#define __GTKFRAMEH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxMDIChildFrame; +class wxMDIClientWindow; +class wxMenu; +class wxMenuBar; +class wxToolBar; +class wxStatusBar; + +class wxFrame; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxFrameNameStr; +extern const char *wxToolBarNameStr; + +//----------------------------------------------------------------------------- +// wxFrame +//----------------------------------------------------------------------------- + +class wxFrame: public wxWindow +{ + DECLARE_DYNAMIC_CLASS(wxFrame) +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 ); + 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 ); + ~wxFrame(); + bool Destroy(); + + virtual bool Show( bool show ); + virtual void Enable( bool enable ); + + virtual void GetClientSize( int *width, int *height ) const; + + // set minimal/maxmimal size for the frame + virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 ); + + virtual wxStatusBar* CreateStatusBar(int number=1, long style = wxST_SIZEGRIP, wxWindowID id = 0, + const wxString& name = "statusBar"); + virtual wxStatusBar *GetStatusBar(); + virtual void SetStatusText( const wxString &text, int number = 0 ); + virtual void SetStatusWidths( int n, int *width ); + + virtual wxToolBar* CreateToolBar( long style = wxNO_BORDER|wxTB_HORIZONTAL, wxWindowID id = -1, + const wxString& name = wxToolBarNameStr); + virtual wxToolBar *GetToolBar(); + + virtual void SetMenuBar( wxMenuBar *menuBar ); + virtual wxMenuBar *GetMenuBar(); + + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const { return m_title; } + + virtual void SetIcon( const wxIcon &icon ); + + void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp + void OnSize( wxSizeEvent &event ); + void OnCloseWindow( wxCloseEvent& event ); + void OnIdle(wxIdleEvent& event); + +private: + friend wxWindow; + friend wxMDIChildFrame; + friend wxMDIClientWindow; + + // update frame's menus (called from OnIdle) + void DoMenuUpdates(); + void DoMenuUpdates(wxMenu* menu); + + wxMenuBar *m_frameMenuBar; + wxStatusBar *m_frameStatusBar; + wxToolBar *m_frameToolBar; + int m_toolBarHeight; + wxString m_title; + wxIcon m_icon; + + DECLARE_EVENT_TABLE() +}; + +#endif // __GTKFRAMEH__ diff --git a/include/wx/qt/gauge.h b/include/wx/qt/gauge.h new file mode 100644 index 0000000000..2aa81557e1 --- /dev/null +++ b/include/wx/qt/gauge.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gauge.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKGAUGEH__ +#define __GTKGAUGEH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxGauge; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char* wxGaugeNameStr; + +//----------------------------------------------------------------------------- +// wxGaugeBox +//----------------------------------------------------------------------------- + +class wxGauge: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxGauge) + + public: + inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; } + + inline wxGauge(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxString& name = wxGaugeNameStr) + { + Create(parent, id, range, pos, size, style, name); + }; + + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxString& name = wxGaugeNameStr ); + + void SetShadowWidth( int WXUNUSED(w) ) {}; + void SetBezelFace( int WXUNUSED(w) ) {}; + void SetRange( int r ); + void SetValue( int pos ); + int GetShadowWidth(void) const { return 0; }; + int GetBezelFace(void) const { return 0; }; + int GetRange(void) const; + int GetValue(void) const; + + // Are we a Win95/GTK progress bar, or a normal gauge? + inline bool GetProgressBar(void) const { return m_useProgressBar; } + + protected: + + int m_rangeMax; + int m_gaugePos; + bool m_useProgressBar; +}; + +#endif // __GTKGAUGEH__ diff --git a/include/wx/qt/gdiobj.h b/include/wx/qt/gdiobj.h new file mode 100644 index 0000000000..2b6a5d1921 --- /dev/null +++ b/include/wx/qt/gdiobj.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gdiobj.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GDIOBJH__ +#define __GDIOBJH__ + +#include "wx/object.h" + +#ifdef __GNUG__ +#pragma interface +#endif + +class WXDLLEXPORT wxGDIObject: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxGDIObject) + public: + inline wxGDIObject(void) { m_visible = FALSE; }; + inline ~wxGDIObject(void) {}; + + virtual bool GetVisible(void) { return m_visible; } + virtual void SetVisible(bool v) { m_visible = v; } + +protected: + bool m_visible; // Can a pointer to this object be safely taken? + // - only if created within FindOrCreate... +}; + +#endif + // __GDIOBJH__ diff --git a/include/wx/qt/icon.h b/include/wx/qt/icon.h new file mode 100644 index 0000000000..a79e4906ef --- /dev/null +++ b/include/wx/qt/icon.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: icon.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKICONH__ +#define __GTKICONH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxIcon; + +//----------------------------------------------------------------------------- +// wxIcon +//----------------------------------------------------------------------------- + +class wxIcon: public wxBitmap +{ + DECLARE_DYNAMIC_CLASS(wxIcon) + +public: + + wxIcon(void) {}; + + inline wxIcon(const wxIcon& icon) { Ref(icon); } + inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); } + wxIcon( char **bits, int width=-1, int height=-1 ); + + inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } + inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } + inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } +}; + + +#endif // __GTKICONH__ diff --git a/include/wx/qt/joystick.h b/include/wx/qt/joystick.h new file mode 100644 index 0000000000..957c16581a --- /dev/null +++ b/include/wx/qt/joystick.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.h +// Purpose: wxJoystick class +// Author: Guilhem Lavaux +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __JOYSTICKH__ +#define __JOYSTICKH__ + +#ifdef __GNUG__ +#pragma interface "joystick.h" +#endif + +#include "wx/event.h" +#include "wx/thread.h" + +class WXDLLEXPORT wxJoystick: public wxObject, public wxThread +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition(void) const; + int GetZPosition(void) const; + int GetButtonState(void) const; + int GetPOVPosition(void) const; + int GetPOVCTSPosition(void) const; + int GetRudderPosition(void) const; + int GetUPosition(void) const; + int GetVPosition(void) const; + int GetMovementThreshold(void) const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk(void) const; // Checks that the joystick is functioning + int GetNumberJoysticks(void) const ; + int GetManufacturerId(void) const ; + int GetProductId(void) const ; + wxString GetProductName(void) const ; + int GetXMin(void) const; + int GetYMin(void) const; + int GetZMin(void) const; + int GetXMax(void) const; + int GetYMax(void) const; + int GetZMax(void) const; + int GetNumberButtons(void) const; + int GetNumberAxes(void) const; + int GetMaxButtons(void) const; + int GetMaxAxes(void) const; + int GetPollingMin(void) const; + int GetPollingMax(void) const; + int GetRudderMin(void) const; + int GetRudderMax(void) const; + int GetUMin(void) const; + int GetUMax(void) const; + int GetVMin(void) const; + int GetVMax(void) const; + + bool HasRudder(void) const; + bool HasZ(void) const; + bool HasU(void) const; + bool HasV(void) const; + bool HasPOV(void) const; + bool HasPOV4Dir(void) const; + bool HasPOVCTS(void) const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(void); + +protected: + int m_joystick; + wxPoint m_lastposition; + int m_axe[15]; + int m_buttons; + wxWindow *m_catchwin; + int m_polling; + + void *Entry(void); +}; + +#endif + // __JOYSTICKH__ + diff --git a/include/wx/qt/listbox.h b/include/wx/qt/listbox.h new file mode 100644 index 0000000000..20518701e7 --- /dev/null +++ b/include/wx/qt/listbox.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: listbox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKLISTBOXH__ +#define __GTKLISTBOXH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxListBox; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxListBoxNameStr; + +//----------------------------------------------------------------------------- +// wxListBox +//----------------------------------------------------------------------------- + +class wxListBox: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxListBox) + + public: + + wxListBox(void); + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, const wxString &name = wxListBoxNameStr ); + 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 wxString &name = wxListBoxNameStr ); + void Append( const wxString &item ); + void Append( const wxString &item, char *clientData ); + void Clear(void); + void Delete( int n ); + void Deselect( int n ); + int FindString( const wxString &item ) const; + char *GetClientData( int n ) const; + int GetSelection(void) const; + int GetSelections( class wxArrayInt &) const; + wxString GetString( int n ) const; + wxString GetStringSelection(void) const; + int Number(void); + bool Selected( int n ); + void Set( int n, const wxString *choices ); + void SetClientData( int n, char *clientData ); + void SetFirstItem( int n ); + void SetFirstItem( const wxString &item ); + void SetSelection( int n, bool select = TRUE ); + void SetString( int n, const wxString &string ); + void SetStringSelection( const wxString &string, bool select = TRUE ); + +}; + +#endif // __GTKLISTBOXH__ diff --git a/include/wx/qt/mdi.h b/include/wx/qt/mdi.h new file mode 100644 index 0000000000..31fde37aa4 --- /dev/null +++ b/include/wx/qt/mdi.h @@ -0,0 +1,181 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: mdi.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __MDIH__ +#define __MDIH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" +#include "wx/panel.h" +#include "wx/frame.h" +#include "wx/toolbar.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxMDIParentFrame; +class wxMDIClientWindow; +class wxMDIChildFrame; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char* wxFrameNameStr; +extern const char* wxStatusLineNameStr; + +//----------------------------------------------------------------------------- +// wxMDIParentFrame +//----------------------------------------------------------------------------- + +class wxMDIParentFrame: public wxFrame +{ + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + + friend class wxMDIChildFrame; + + public: + + wxMDIParentFrame(void); + wxMDIParentFrame( wxWindow *parent, + wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr ); + ~wxMDIParentFrame(void); + bool Create( wxWindow *parent, + wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr ); + + + void GetClientSize(int *width, int *height) const; + wxMDIChildFrame *GetActiveChild(void) const; + + wxMDIClientWindow *GetClientWindow(void) const; + virtual wxMDIClientWindow *OnCreateClient(void); + + virtual void Cascade(void) {}; + virtual void Tile(void) {}; + virtual void ArrangeIcons(void) {}; + virtual void ActivateNext(void); + virtual void ActivatePrevious(void); + + void OnActivate( wxActivateEvent& event ); + void OnSysColourChanged( wxSysColourChangedEvent& event ); + + //private: + + wxMDIChildFrame *m_currentChild; + + void SetMDIMenuBar( wxMenuBar *menu_bar ); + + private: + + wxMDIClientWindow *m_clientWindow; + bool m_parentFrameActive; + wxMenuBar *m_mdiMenuBar; + + DECLARE_EVENT_TABLE() +}; + +//----------------------------------------------------------------------------- +// wxMDIChildFrame +//----------------------------------------------------------------------------- + +class wxMDIChildFrame: public wxFrame +{ + DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) + + public: + + wxMDIChildFrame(void); + wxMDIChildFrame( wxMDIParentFrame *parent, + wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr ); + ~wxMDIChildFrame(void); + bool Create( wxMDIParentFrame *parent, + wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr ); + + virtual void SetMenuBar( wxMenuBar *menu_bar ); + virtual wxMenuBar *GetMenuBar(); + + virtual void GetClientSize( int *width, int *height ) const; + virtual void AddChild( wxWindow *child ); + + virtual void Activate(void); + + // no status bars + virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number), long WXUNUSED(style), + wxWindowID WXUNUSED(id), const wxString& WXUNUSED(name) ) {return (wxStatusBar*)NULL; } + virtual wxStatusBar *GetStatusBar() { return (wxStatusBar*)NULL; } + virtual void SetStatusText( const wxString &WXUNUSED(text), int WXUNUSED(number) ) {} + virtual void SetStatusWidths( int WXUNUSED(n), int *WXUNUSED(width) ) {} + + // no size hints + virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW), + int WXUNUSED(maxH), int WXUNUSED(incW) ) {} + + // no toolbar bars + virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id), + const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; } + virtual wxToolBar *GetToolBar() { return (wxToolBar*)NULL; } + + // no icon + void SetIcon( const wxIcon &icon ) { m_icon = icon; } + + // no title + void SetTitle( const wxString &title ) { m_title = title; } + wxString GetTitle() const { return m_title; } + + // no maximize etc + virtual void Maximize(void) {} + virtual void Restore(void) {} + + void OnActivate( wxActivateEvent &event ); + + public: + + wxMenuBar *m_menuBar; + + DECLARE_EVENT_TABLE() +}; + +//----------------------------------------------------------------------------- +// wxMDIClientWindow +//----------------------------------------------------------------------------- + +class wxMDIClientWindow: public wxWindow +{ + DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) + + public: + + wxMDIClientWindow(void); + wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 ); + ~wxMDIClientWindow(void); + virtual bool CreateClient( wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL ); + void AddChild( wxWindow *child ); +}; + +#endif // __MDIH__ + diff --git a/include/wx/qt/menu.h b/include/wx/qt/menu.h new file mode 100644 index 0000000000..98103fe21d --- /dev/null +++ b/include/wx/qt/menu.h @@ -0,0 +1,155 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: menu.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKMENUH__ +#define __GTKMENUH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxMenuBar; +class wxMenuItem; +class wxMenu; + +//----------------------------------------------------------------------------- +// const +//----------------------------------------------------------------------------- + +#define ID_SEPARATOR (-1) + +//----------------------------------------------------------------------------- +// wxMenuBar +//----------------------------------------------------------------------------- + +class wxMenuBar: public wxWindow +{ +DECLARE_DYNAMIC_CLASS(wxMenuBar) + +public: + wxMenuBar(); + void Append( wxMenu *menu, const wxString &title ); + + int FindMenuItem( const wxString &menuString, const wxString &itemString ) const; + wxMenuItem* FindMenuItemById( int id ) const; + + void Check( int id, bool check ); + bool Checked( int id ) const; + void Enable( int id, bool enable ); + bool Enabled( int id ) const; + inline bool IsEnabled(int Id) const { return Enabled(Id); }; + inline bool IsChecked(int Id) const { return Checked(Id); }; + + int GetMenuCount() const { return m_menus.Number(); } + wxMenu *GetMenu(int n) const { return (wxMenu *)m_menus.Nth(n)->Data(); } + + wxList m_menus; +}; + +//----------------------------------------------------------------------------- +// wxMenu +//----------------------------------------------------------------------------- + +class wxMenuItem: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxMenuItem) + +public: + wxMenuItem(); + + // accessors + // id + void SetId(int id) { m_id = id; } + int GetId() const { return m_id; } + bool IsSeparator() const { return m_id == ID_SEPARATOR; } + + // the item's text + void SetText(const wxString& str); + const wxString& GetText() const { return m_text; } + + // what kind of menu item we are + void SetCheckable(bool checkable) { m_isCheckMenu = checkable; } + bool IsCheckable() const { return m_isCheckMenu; } + void SetSubMenu(wxMenu *menu) { m_subMenu = menu; } + wxMenu *GetSubMenu() const { return m_subMenu; } + bool IsSubMenu() const { return m_subMenu != NULL; } + + // state + void Enable(bool enable = TRUE) { m_isEnabled = enable; } + bool IsEnabled() const { return m_isEnabled; } + void Check(bool check = TRUE); + bool IsChecked() const; + + // help string (displayed in the status bar by default) + void SetHelpString(const wxString& str) { m_helpStr = str; } + + +private: + int m_id; + wxString m_text; + bool m_isCheckMenu; + bool m_isChecked; + bool m_isEnabled; + wxMenu *m_subMenu; + wxString m_helpStr; +}; + +class wxMenu: public wxEvtHandler +{ +DECLARE_DYNAMIC_CLASS(wxMenu) + +public: + // construction + wxMenu( const wxString &title = "" ); + + // operations + // menu creation + void AppendSeparator(); + void Append(int id, const wxString &item, + const wxString &helpStr = "", bool checkable = FALSE); + void Append(int id, const wxString &item, + wxMenu *subMenu, const wxString &helpStr = "" ); + void Break() {}; + + // find item by name/id + int FindItem( const wxString itemString ) const; + wxMenuItem *FindItem(int id) const; + + // get/set item's state + void Enable( int id, bool enable ); + bool IsEnabled( int id ) const; + void Check( int id, bool check ); + bool IsChecked( int id ) const; + + void SetLabel( int id, const wxString &label ); + + // accessors + wxList& GetItems() { return m_items; } + +public: + void SetInvokingWindow( wxWindow *win ); + wxWindow *GetInvokingWindow(); + + wxString m_title; + wxList m_items; + wxWindow *m_invokingWindow; +}; + +#endif // __GTKMENUH__ diff --git a/include/wx/qt/notebook.h b/include/wx/qt/notebook.h new file mode 100644 index 0000000000..a3a2a9df04 --- /dev/null +++ b/include/wx/qt/notebook.h @@ -0,0 +1,181 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: notebook.h +// Purpose: wxNotebook class +// Author: Robert Roebling +// Modified by: +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef __NOTEBOOKH__ +#define __NOTEBOOKH__ + +#ifdef __GNUG__ +#pragma interface "notebook.h" +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxImageList; +class wxNotebook; +class wxNotebookPage; + +// ---------------------------------------------------------------------------- +// notebook events +// ---------------------------------------------------------------------------- + +class wxNotebookEvent : public wxCommandEvent +{ +public: + wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = -1, int nOldSel = -1) + : wxCommandEvent(commandType, id) { m_nSel = nSel; m_nOldSel = nOldSel; } + + // accessors + int GetSelection() const { return m_nSel; } + int GetOldSelection() const { return m_nOldSel; } + +private: + int m_nSel, // currently selected page + m_nOldSel; // previously selected page + + DECLARE_DYNAMIC_CLASS(wxNotebookEvent) +}; + +//----------------------------------------------------------------------------- +// wxNotebook +//----------------------------------------------------------------------------- + +class wxNotebook : public wxControl +{ +public: + // ctors + // ----- + // default for dynamic class + wxNotebook(); + // the same arguments as for wxControl (@@@ any special styles?) + wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = "notebook"); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = "notebook"); + // dtor + ~wxNotebook(); + + // accessors + // --------- + // get number of pages in the dialog + int GetPageCount() const; + + // set the currently selected page, return the index of the previously + // selected one (or -1 on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(int nPage); + // cycle thru the tabs + void AdvanceSelection(bool bForward = TRUE); + // get the currently selected page + int GetSelection() const; + + // set/get the title of a page + bool SetPageText(int nPage, const wxString& strText); + wxString GetPageText(int nPage) const; + + // image list stuff: each page may have an image associated with it. All + // the images belong to an image list, so you have to + // 1) create an image list + // 2) associate it with the notebook + // 3) set for each page it's image + // associate image list with a control + void SetImageList(wxImageList* imageList); + // get pointer (may be NULL) to the associated image list + wxImageList* GetImageList() const { return m_imageList; } + + // sets/returns item's image index in the current image list + int GetPageImage(int nPage) const; + bool SetPageImage(int nPage, int nImage); + + // currently it's always 1 because wxGTK doesn't support multi-row + // tab controls + int GetRowCount() const; + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + + // operations + // ---------- + // remove one page from the notebook + bool DeletePage(int nPage); + // remove all pages + bool DeleteAllPages(); + // adds a new page to the notebook (it will be deleted ny the notebook, + // don't delete it yourself). If bSelect, this page becomes active. + bool AddPage(wxWindow *pPage, + const wxString& strText, + bool bSelect = FALSE, + int imageId = -1); + // @@@@ VZ: I don't know how to implement InsertPage() + + // get the panel which represents the given page + wxWindow *GetPage(int nPage) const; + + // implementation + // -------------- + // base class virtuals + virtual void AddChild(wxWindow *child); + virtual void SetConstraintSizes(bool recurse); + virtual bool DoPhase(int phase); + +private: + // common part of all ctors + void Init(); + + wxImageList* m_imageList; + wxList m_pages; + + DECLARE_DYNAMIC_CLASS(wxNotebook) +}; + +// ---------------------------------------------------------------------------- +// event macros +// ---------------------------------------------------------------------------- +typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&); + +#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \ + { \ + wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \ + id, \ + -1, \ + (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \ + NULL \ + }, + +#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \ + { \ + wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \ \ + id, \ + -1, \ + (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \ + NULL \ + }, + +#endif + // __NOTEBOOKH__ diff --git a/include/wx/qt/palette.h b/include/wx/qt/palette.h new file mode 100644 index 0000000000..d6b7bbb64b --- /dev/null +++ b/include/wx/qt/palette.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palette.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKPALETTEH__ +#define __GTKPALETTEH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxPalette; + +//----------------------------------------------------------------------------- +// wxPalette +//----------------------------------------------------------------------------- + +class wxPalette: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxPalette) + + public: + + wxPalette(void); + wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); + wxPalette( const wxPalette& palette ); + wxPalette( const wxPalette* palette ); + ~wxPalette(void); + wxPalette& operator = ( const wxPalette& palette ); + bool operator == ( const wxPalette& palette ); + bool operator != ( const wxPalette& palette ); + bool Ok(void) const; + + bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const; + bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; + + // no data +}; + +#define wxColorMap wxPalette +#define wxColourMap wxPalette + +#endif // __GTKPALETTEH__ diff --git a/include/wx/qt/pen.h b/include/wx/qt/pen.h new file mode 100644 index 0000000000..a0eaa2a59b --- /dev/null +++ b/include/wx/qt/pen.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pen.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKPENH__ +#define __GTKPENH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxPen; + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class wxPen: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxPen) + + public: + + wxPen(void); + wxPen( const wxColour &colour, int width, int style ); + wxPen( const wxString &colourName, int width, int style ); + wxPen( const wxPen& pen ); + wxPen( const wxPen* pen ); + ~wxPen(void); + wxPen& operator = ( const wxPen& pen ); + bool operator == ( const wxPen& pen ); + bool operator != ( const wxPen& pen ); + + void SetColour( const wxColour &colour ); + void SetColour( const wxString &colourName ); + void SetColour( int red, int green, int blue ); + void SetCap( int capStyle ); + void SetJoin( int joinStyle ); + void SetStyle( int style ); + void SetWidth( int width ); + wxColour &GetColour(void) const; + int GetCap(void) const; + int GetJoin(void) const; + int GetStyle(void) const; + int GetWidth(void) const; + bool Ok(void) const; + + // no data :-) +}; + +#endif // __GTKPENH__ diff --git a/include/wx/qt/radiobox.h b/include/wx/qt/radiobox.h new file mode 100644 index 0000000000..a8fdd1ebe3 --- /dev/null +++ b/include/wx/qt/radiobox.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKRADIOBOXH__ +#define __GTKRADIOBOXH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" +#include "wx/bitmap.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxRadioBox; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxRadioBoxNameStr; + +//----------------------------------------------------------------------------- +// wxRadioBox +//----------------------------------------------------------------------------- + +class wxRadioBox: public wxControl +{ + + DECLARE_DYNAMIC_CLASS(wxRadioBox) + + public: + + wxRadioBox(void); + 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 wxString &name = wxRadioBoxNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxString &name = wxRadioBoxNameStr ); + int FindString( const wxString& s) const; + void SetSelection( int n ); + int GetSelection(void) const; + wxString GetString( int n ) const; + wxString GetLabel(void) const; + void SetLabel( const wxString& label ); + void SetLabel( int item, const wxString& label ); + void SetLabel( int item, wxBitmap *bitmap ); + wxString GetLabel( int item ) const; + bool Show( bool show ); + void Enable( bool enable ); + void Enable( int item, bool enable ); + void Show( int item, bool show ); + virtual wxString GetStringSelection(void) const; + virtual bool SetStringSelection( const wxString& s ); + virtual int Number(void) const; + int GetNumberOfRowsOrCols(void) const; + void SetNumberOfRowsOrCols( int n ); + +}; + +#endif // __GTKRADIOBOXH__ diff --git a/include/wx/qt/radiobut.h b/include/wx/qt/radiobut.h new file mode 100644 index 0000000000..337264fe5a --- /dev/null +++ b/include/wx/qt/radiobut.h @@ -0,0 +1,31 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobut.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKRADIOBUTTONH__ +#define __GTKRADIOBUTTONH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxRadioButton; + + +#endif // __GTKRADIOBUTTONH__ diff --git a/include/wx/qt/region.h b/include/wx/qt/region.h new file mode 100644 index 0000000000..8bcb8858c7 --- /dev/null +++ b/include/wx/qt/region.h @@ -0,0 +1,96 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: region.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __REGIONH__ +#define __REGIONH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/list.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxRegion; + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +enum wxRegionContain +{ + wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2 +}; + +// So far, for internal use only +enum wxRegionOp { +wxRGN_AND, // Creates the intersection of the two combined regions. +wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1. +wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2. +wxRGN_OR, // Creates the union of two combined regions. +wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas. +}; + +//----------------------------------------------------------------------------- +// wxRegion +//----------------------------------------------------------------------------- + +class wxRegion : public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxRegion); + + public: + + wxRegion( long x, long y, long w, long h ); + wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ); + wxRegion( const wxRect& rect ); + wxRegion(void); + ~wxRegion(void); + + inline wxRegion( const wxRegion& r ) + { Ref(r); } + inline wxRegion& operator = ( const wxRegion& r ) + { Ref(r); return (*this); } + + void Clear(void); + + bool Union( long x, long y, long width, long height ); + bool Union( const wxRect& rect ); + bool Union( const wxRegion& region ); + + bool Intersect( long x, long y, long width, long height ); + bool Intersect( const wxRect& rect ); + bool Intersect( const wxRegion& region ); + + bool Subtract( long x, long y, long width, long height ); + bool Subtract( const wxRect& rect ); + bool Subtract( const wxRegion& region ); + + bool Xor( long x, long y, long width, long height ); + bool Xor( const wxRect& rect ); + bool Xor( const wxRegion& region ); + + void GetBox( long& x, long& y, long&w, long &h ) const; + wxRect GetBox(void) const ; + + bool Empty(void) const; + + wxRegionContain Contains( long x, long y ) const; + wxRegionContain Contains( long x, long y, long w, long h ) const; + +}; + +#endif + // __REGIONH__ diff --git a/include/wx/qt/scrolbar.h b/include/wx/qt/scrolbar.h new file mode 100644 index 0000000000..34041abc09 --- /dev/null +++ b/include/wx/qt/scrolbar.h @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: scrolbar.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKSCROLLBARH__ +#define __GTKSCROLLBARH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxScrollBar; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxScrollBarNameStr; + +//----------------------------------------------------------------------------- +// wxScrollBar +//----------------------------------------------------------------------------- + +class wxScrollBar: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxScrollBar) + + public: + + wxScrollBar(void) { }; + wxScrollBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxString& name = wxScrollBarNameStr ); + ~wxScrollBar(void); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxString& name = wxScrollBarNameStr); + int GetPosition(void) const; + int GetThumbSize() const; + int GetPageSize() const; + int GetRange() const; + virtual void SetPosition( int viewStart ); + virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, + bool refresh = TRUE ); + + // Backward compatibility + int GetValue(void) const; + void SetValue( int viewStart ); + void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const; + int GetViewLength() const; + int GetObjectLength() const; + void SetPageSize( int pageLength ); + void SetObjectLength( int objectLength ); + void SetViewLength( int viewLength ); + +}; + +#endif + // __GTKSCROLLBARH__ diff --git a/include/wx/qt/settings.h b/include/wx/qt/settings.h new file mode 100644 index 0000000000..7b801bbb81 --- /dev/null +++ b/include/wx/qt/settings.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: settings.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKSETTINGSH__ +#define __GTKSETTINGSH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/gdicmn.h" +#include "wx/pen.h" +#include "wx/font.h" + +class WXDLLEXPORT wxSystemSettings: public wxObject +{ +public: + inline wxSystemSettings(void) {} + + // Get a system colour + static wxColour GetSystemColour(int index); + + // Get a system font + static wxFont GetSystemFont(int index); + + // Get a system metric, e.g. scrollbar size + static int GetSystemMetric(int index); +}; + +#endif + // __GTKSETTINGSH__ diff --git a/include/wx/qt/slider.h b/include/wx/qt/slider.h new file mode 100644 index 0000000000..32b61d4f75 --- /dev/null +++ b/include/wx/qt/slider.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: slider.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKSLIDERH__ +#define __GTKSLIDERH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxSlider; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxSliderNameStr; + +//----------------------------------------------------------------------------- +// wxSlider +//----------------------------------------------------------------------------- + +class wxSlider: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxSlider) + + public: + wxSlider(void); + wxSlider( wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, +/* const wxValidator& validator = wxDefaultValidator, */ + const wxString& name = wxSliderNameStr); + ~wxSlider(void); + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, +/* const wxValidator& validator = wxDefaultValidator, */ + const wxString& name = wxSliderNameStr); + virtual int GetValue(void) const; + virtual void SetValue( int ); + void GetSize( int *x, int *y ) const; + void SetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); + void GetPosition( int *x, int *y ) const; + void SetRange( int minValue, int maxValue ); + int GetMin(void) const; + int GetMax(void) const; + void SetTickFreq( int n, int pos ); + int GetTickFreq(void) const; + void SetPageSize( int pageSize ); + int GetPageSize(void) const; + void ClearSel(void); + void ClearTicks(void); + void SetLineSize( int lineSize ); + int GetLineSize(void) const; + int GetSelEnd(void) const; + int GetSelStart(void) const; + void SetSelection( int minPos, int maxPos ); + void SetThumbLength( int len ); + int GetThumbLength(void) const; + void SetTick( int tickPos ); + +}; + +#endif // __GTKSLIDERH__ diff --git a/include/wx/qt/statbmp.h b/include/wx/qt/statbmp.h new file mode 100644 index 0000000000..b534110b1d --- /dev/null +++ b/include/wx/qt/statbmp.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbmp.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKSTATICBITMAPH__ +#define __GTKSTATICBITMAPH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxStaticBitmap; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char* wxStaticBitmapNameStr; + +//----------------------------------------------------------------------------- +// wxStaticBitmap +//----------------------------------------------------------------------------- + +class wxStaticBitmap: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + + public: + + wxStaticBitmap(void); + wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxStaticBitmapNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxStaticBitmapNameStr); + virtual void SetBitmap( const wxBitmap& bitmap ); + wxBitmap& GetBitmap(void) const { return (wxBitmap&)m_bitmap; } + + private: + + wxBitmap m_bitmap; +}; + +#endif // __GTKSTATICBITMAPH__ diff --git a/include/wx/qt/statbox.h b/include/wx/qt/statbox.h new file mode 100644 index 0000000000..a6248a6bc9 --- /dev/null +++ b/include/wx/qt/statbox.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: stabox.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKSTATICBOXH__ +#define __GTKSTATICBOXH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxStaticBox; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxStaticBoxNameStr; + +//----------------------------------------------------------------------------- +// wxStaticBox +//----------------------------------------------------------------------------- + +class wxStaticBox: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxStaticBox) + + public: + + wxStaticBox(void); + wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxStaticBoxNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxStaticBoxNameStr ); +}; + +#endif // __GTKSTATICBOXH__ diff --git a/include/wx/qt/stattext.h b/include/wx/qt/stattext.h new file mode 100644 index 0000000000..e60303c890 --- /dev/null +++ b/include/wx/qt/stattext.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: stattext.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKSTATICTEXTH__ +#define __GTKSTATICTEXTH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxStaticText; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxStaticTextNameStr; + +//----------------------------------------------------------------------------- +// wxStaticText +//----------------------------------------------------------------------------- + +class wxStaticText: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxStaticText) + + public: + + wxStaticText(void); + wxStaticText( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxStaticTextNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxStaticTextNameStr ); + wxString GetLabel(void) const; + void SetLabel( const wxString &label ); +}; + +#endif // __GTKSTATICTEXTH__ diff --git a/include/wx/qt/tbargtk.h b/include/wx/qt/tbargtk.h new file mode 100644 index 0000000000..f6a3636927 --- /dev/null +++ b/include/wx/qt/tbargtk.h @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tbargtk.h +// Purpose: GTK toolbar +// Author: Robert Roebling +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef __TBARGTKH__ +#define __TBARGTKH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxToolBarTool; +class wxToolBar; + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#define wxTOOL_STYLE_BUTTON 1 +#define wxTOOL_STYLE_SEPARATOR 2 + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxToolBarNameStr; + +//----------------------------------------------------------------------------- +// wxToolBarTool +//----------------------------------------------------------------------------- + +class wxToolBarTool: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxToolBarTool) + + public: + + wxToolBarTool(void) {}; + wxToolBarTool( wxToolBar *owner, int theIndex = 0, + const wxBitmap& bitmap1 = wxNullBitmap, const wxBitmap& bitmap2 = wxNullBitmap, + bool toggle = FALSE, wxObject *clientData = NULL, + const wxString& shortHelpString = "", const wxString& longHelpString = ""); + ~wxToolBarTool(void); + + public: + + int m_toolStyle; + wxObject *m_clientData; + int m_index; + bool m_toggleState; + bool m_isToggle; + bool m_deleteSecondBitmap; + bool m_enabled; + wxBitmap m_bitmap1; + wxBitmap m_bitmap2; + bool m_isMenuCommand; + wxString m_shortHelpString; + wxString m_longHelpString; + wxToolBar *m_owner; +}; + +//----------------------------------------------------------------------------- +// wxToolBar +//----------------------------------------------------------------------------- + +class wxToolBar: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxToolBar) + + public: + + wxToolBar(void); + wxToolBar( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxToolBarNameStr ); + ~wxToolBar(void); + + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxToolBarNameStr); + + // Only allow toggle if returns TRUE. Call when left button up. + virtual bool OnLeftClick(int toolIndex, bool toggleDown); + + // Call when right button down. + virtual void OnRightClick(int toolIndex, float x, float y); + + // Called when the mouse cursor enters a tool bitmap. + // Argument is -1 if mouse is exiting the toolbar. + virtual void OnMouseEnter(int toolIndex); + + // If pushedBitmap is NULL, a reversed version of bitmap is + // created and used as the pushed/toggled image. + // If toggle is TRUE, the button toggles between the two states. + virtual wxToolBarTool *AddTool( int toolIndex, const wxBitmap& bitmap, + const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE, + float xPos = -1, float yPos = -1, wxObject *clientData = NULL, + const wxString& helpString1 = "", const wxString& helpString2 = ""); + virtual void AddSeparator(void); + virtual void ClearTools(void); + + virtual void Realize(void); + + virtual void EnableTool(int toolIndex, bool enable); + virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on + virtual wxObject *GetToolClientData(int index) const; + + virtual bool GetToolState(int toolIndex) const; + virtual bool GetToolEnabled(int toolIndex) const; + + virtual void SetMargins(int x, int y); + void SetMargins(const wxSize& size) { SetMargins(size.x, size.y); }; + virtual void SetToolPacking(int packing); + virtual void SetToolSeparation(int separation); + + public: + + wxList m_tools; + + DECLARE_EVENT_TABLE() +}; + +#endif + // __TBARGTKH__ + diff --git a/include/wx/qt/textctrl.h b/include/wx/qt/textctrl.h new file mode 100644 index 0000000000..b1867509f3 --- /dev/null +++ b/include/wx/qt/textctrl.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: textctrl.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKTEXTCTRLH__ +#define __GTKTEXTCTRLH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/control.h" + +#if USE_IOSTREAMH +#include +#else +#include +#endif + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxTextCtrl; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxTextCtrlNameStr; + +//----------------------------------------------------------------------------- +// wxTextCtrl +//----------------------------------------------------------------------------- + +class wxTextCtrl: public wxControl, public streambuf +{ + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxTextCtrl); + +public: + wxTextCtrl(); + wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "", + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + int style = 0, const wxString &name = wxTextCtrlNameStr ); + bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "", + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + int style = 0, const wxString &name = wxTextCtrlNameStr ); + wxString GetValue() const; + void SetValue( const wxString &value ); + void WriteText( const wxString &text ); + + bool LoadFile( const wxString &file ); + bool SaveFile( const wxString &file ); + bool IsModified() const { return m_modified; } + void SetModified() { m_modified = TRUE; } + void DiscardEdits() { m_modified = FALSE; } +/* + wxString GetLineText( long lineNo ) const; + void OnDropFiles( wxDropFilesEvent &event ); + long PositionToXY( long pos, long *x, long *y ) const; + long XYToPosition( long x, long y ); + int GetNumberOfLines(); +*/ + virtual void SetInsertionPoint( long pos ); + virtual void SetInsertionPointEnd(); + virtual void SetEditable( bool editable ); + virtual void SetSelection( long from, long to ); + void ShowPosition( long pos ); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + virtual void Remove( long from, long to ); + virtual void Replace( long from, long to, const wxString &value ); + void Cut(); + void Copy(); + void Paste(); + void Delete(); + + void OnChar( wxKeyEvent &event ); + + int overflow(int i); + int sync(); + int underflow(); + + 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); + +private: + bool m_modified; +}; + +#endif // __GTKTEXTCTRLH__ + + diff --git a/include/wx/qt/timer.h b/include/wx/qt/timer.h new file mode 100644 index 0000000000..3374012fe9 --- /dev/null +++ b/include/wx/qt/timer.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKTIMERH__ +#define __GTKTIMERH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" + +//----------------------------------------------------------------------------- +// derived classes +//----------------------------------------------------------------------------- + +class wxTimer; + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +class wxTimer: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxTimer) + + public: + + wxTimer(void); + ~wxTimer(void); + int Interval(void); + bool OneShot(void); + virtual void Notify(void); + void Start( int millisecs = -1, bool oneShot = FALSE ); + void Stop(void); + + private: + + int m_time; + bool m_oneShot; +}; + +#endif // __GTKTIMERH__ diff --git a/include/wx/qt/window.h b/include/wx/qt/window.h new file mode 100644 index 0000000000..3afeabd572 --- /dev/null +++ b/include/wx/qt/window.h @@ -0,0 +1,252 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: window.h +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef __GTKWINDOWH__ +#define __GTKWINDOWH__ + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/list.h" +#include "wx/event.h" +#include "wx/validate.h" +#include "wx/cursor.h" +#include "wx/font.h" +#include "wx/dc.h" +#include "wx/region.h" +#include "wx/dnd.h" + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxFrameNameStr; +extern wxList wxTopLevelWindows; + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxLayoutConstraints; +class wxSizer; + +class wxWindow; +class wxCanvas; + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +extern const char *wxPanelNameStr; +extern const wxSize wxDefaultSize; +extern const wxPoint wxDefaultPosition; + +//----------------------------------------------------------------------------- +// wxWindow +//----------------------------------------------------------------------------- + +class wxWindow: public wxEvtHandler +{ +public: + wxWindow(); + wxWindow( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxPanelNameStr ); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, + long style = 0, const wxString &name = wxPanelNameStr ); + virtual ~wxWindow(); + bool Close( bool force = FALSE ); + virtual bool Destroy(); + virtual bool DestroyChildren(); + + virtual void PrepareDC( wxDC &dc ); + + virtual void SetSize( int x, int y, int width, int height, + int sizeFlags = wxSIZE_AUTO ); + virtual void SetSize( int width, int height ); + virtual void Move( int x, int y ); + virtual void GetSize( int *width, int *height ) const; + virtual void SetClientSize( int const width, int const height ); + virtual void GetClientSize( int *width, int *height ) const; + virtual void GetPosition( int *x, int *y ) const; + virtual void Centre( int direction = wxHORIZONTAL ); + virtual void Fit(); + + void OnSize( wxSizeEvent &event ); + void OnIdle( wxIdleEvent& event ); + + virtual bool Show( bool show ); + virtual void Enable( bool enable ); + virtual void MakeModal( bool modal ); + virtual bool IsEnabled() const { return m_isEnabled; }; + virtual void SetFocus(); + virtual bool OnClose(); + + virtual void AddChild( wxWindow *child ); + wxList *GetChildren(); + virtual void RemoveChild( wxWindow *child ); + void SetReturnCode( int retCode ); + int GetReturnCode(); + wxWindow *GetParent(); + + wxEvtHandler *GetEventHandler(); + void SetEventhandler( wxEvtHandler *handler ); + + virtual wxValidator *GetValidator(); + virtual void SetValidator( wxValidator *validator ); + + bool IsBeingDeleted(); + + void SetId( wxWindowID id ); + wxWindowID GetId(); + + void SetCursor( const wxCursor &cursor ); + + virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = NULL ); + virtual void Clear(); + virtual bool IsExposed( long x, long y ); + virtual bool IsExposed( long x, long y, long width, long height ); + + virtual wxColour GetBackgroundColour() const; + virtual void SetBackgroundColour( const wxColour &colour ); + + virtual void SetDefaultBackgroundColour( const wxColour& col ) + { m_defaultBackgroundColour = col; }; + virtual wxColour GetDefaultBackgroundColour() const + { return m_defaultBackgroundColour; }; + virtual void SetDefaultForegroundColour( const wxColour& col ) + { m_defaultForegroundColour = col; }; + virtual wxColour GetDefaultForegroundColour() const + { return m_defaultForegroundColour; }; + + virtual void SetFont( const wxFont &font ); + virtual wxFont *GetFont(); + // For backward compatibility + inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } + inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } + inline virtual wxFont *GetLabelFont() { return GetFont(); }; + inline virtual wxFont *GetButtonFont() { return GetFont(); }; + virtual void SetWindowStyleFlag( long flag ); + virtual long GetWindowStyleFlag() const; + virtual void CaptureMouse(); + virtual void ReleaseMouse(); + virtual void SetTitle( const wxString &title ); + virtual wxString GetTitle() const; + virtual void SetName( const wxString &name ); + virtual wxString GetName() const; + virtual wxString GetLabel() const; + + void OnSysColourChanged( wxSysColourChangedEvent &WXUNUSED(event) ) {}; + + virtual bool IsShown() const; + virtual bool IsRetained(); + virtual wxWindow *FindWindow( long id ); + virtual wxWindow *FindWindow( const wxString& name ); + void AllowDoubleClick( bool WXUNUSED(allow) ) {}; + void SetDoubleClick( bool WXUNUSED(allow) ) {}; + virtual void ClientToScreen( int *x, int *y ); + virtual void ScreenToClient( int *x, int *y ); + + virtual bool Validate(); + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + void OnInitDialog( wxInitDialogEvent &event ); + virtual void InitDialog(); + + virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual wxDropTarget *GetDropTarget() const; + +public: + 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 = NULL ); + + // return FALSE from here if the window doesn't want the focus + virtual bool AcceptsFocus() const; + + // update the UI state (called from OnIdle) + void UpdateWindowUI(); + + +public: // cannot get private going yet + + + wxWindow *m_parent; + wxList m_children; + int m_x,m_y; + int m_width,m_height; + int m_retCode; + wxEvtHandler *m_eventHandler; + wxValidator *m_windowValidator; + wxDropTarget *m_pDropTarget; + wxWindowID m_windowId; + wxCursor *m_cursor; + wxFont m_font; + wxColour m_backgroundColour; + wxColour m_defaultBackgroundColour; + wxColour m_foregroundColour ; + wxColour m_defaultForegroundColour; + wxRegion m_updateRegion; + long m_windowStyle; + bool m_isShown; + bool m_isEnabled; + wxString m_windowName; + + +public: // Layout section + + wxLayoutConstraints * m_constraints; + wxList * m_constraintsInvolvedIn; + wxSizer * m_windowSizer; + wxWindow * m_sizerParent; + bool m_autoLayout; + + wxLayoutConstraints *GetConstraints() const; + void SetConstraints( wxLayoutConstraints *constraints ); + void SetAutoLayout( bool autoLayout ); + bool GetAutoLayout() const; + bool Layout(); + void SetSizer( wxSizer *sizer ); + wxSizer *GetSizer() const; + void SetSizerParent( wxWindow *win ); + wxWindow *GetSizerParent() const; + void UnsetConstraints(wxLayoutConstraints *c); + inline wxList *GetConstraintsInvolvedIn() const ; + void AddConstraintReference(wxWindow *otherWin); + void RemoveConstraintReference(wxWindow *otherWin); + void DeleteRelatedConstraints(); + virtual void ResetConstraints(); + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool LayoutPhase1(int *noChanges); + virtual bool LayoutPhase2(int *noChanges); + virtual bool DoPhase(int); + virtual void TransformSizerToActual(int *x, int *y) const ; + virtual void SizerSetSize(int x, int y, int w, int h); + virtual void SizerMove(int x, int y); + virtual void SetSizeConstraint(int x, int y, int w, int h); + virtual void MoveConstraint(int x, int y); + virtual void GetSizeConstraint(int *w, int *h) const ; + virtual void GetClientSizeConstraint(int *w, int *h) const ; + virtual void GetPositionConstraint(int *x, int *y) const ; + + DECLARE_DYNAMIC_CLASS(wxWindow) + DECLARE_EVENT_TABLE() +}; + +#endif // __GTKWINDOWH__ diff --git a/include/wx/setup.h b/include/wx/setup.h index 81b9de364c..3b60434425 100644 --- a/include/wx/setup.h +++ b/include/wx/setup.h @@ -4,15 +4,9 @@ // compatibility code, to be removed asap: -#if ! defined(__WXMSW__) && ! defined(__WXGTK__) && ! defined(__WXMOTIF__) +#if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXQT__) # if defined(__WINDOWS__) # define __WXMSW__ -# elif defined(__GTK__) -# define __WXGTK__ -# elif defined(__MOTIF__) -# define __WXMOTIF__ -# elif defined(__QT__) -# define __WXQT__ # else # error No __WXxxx__ define set! Please define __WXGTK__,__WXMSW__ or __WXMOTIF__. # endif diff --git a/src/qt/app.cpp b/src/qt/app.cpp new file mode 100644 index 0000000000..882f4b2b6a --- /dev/null +++ b/src/qt/app.cpp @@ -0,0 +1,366 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: app.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "app.h" +#endif + +#include "wx/app.h" +#include "wx/gdicmn.h" +#include "wx/utils.h" +#include "wx/postscrp.h" +#include "wx/intl.h" +#include "wx/log.h" +#include "wx/memory.h" + +#include "unistd.h" + +//----------------------------------------------------------------------------- +// global data +//----------------------------------------------------------------------------- + +wxApp *wxTheApp = NULL; +wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL; + +extern wxList wxPendingDelete; + +//----------------------------------------------------------------------------- +// local functions +//----------------------------------------------------------------------------- + +extern void wxFlushResources(void); + +//----------------------------------------------------------------------------- +// global functions +//----------------------------------------------------------------------------- + +void wxExit(void) +{ +}; + +bool wxYield(void) +{ + return TRUE; +}; + +//----------------------------------------------------------------------------- +// wxApp +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler) + +BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) + EVT_IDLE(wxApp::OnIdle) +END_EVENT_TABLE() + +wxApp::wxApp() +{ + m_topWindow = NULL; + m_exitOnFrameDelete = TRUE; +}; + +wxApp::~wxApp(void) +{ +}; + +bool wxApp::OnInit(void) +{ + return TRUE; +}; + +bool wxApp::OnInitGui(void) +{ + return TRUE; +}; + +int wxApp::OnRun(void) +{ + return MainLoop(); +}; + +bool wxApp::ProcessIdle(void) +{ + wxIdleEvent event; + event.SetEventObject( this ); + ProcessEvent( event ); + + return event.MoreRequested(); +}; + +void wxApp::OnIdle( wxIdleEvent &event ) +{ + static bool inOnIdle = FALSE; + + // Avoid recursion (via ProcessEvent default case) + if (inOnIdle) + return; + + inOnIdle = TRUE; + + // 'Garbage' collection of windows deleted with Close(). + DeletePendingObjects(); + + // flush the logged messages if any + wxLog *pLog = wxLog::GetActiveTarget(); + if ( pLog != NULL && pLog->HasPendingMessages() ) + pLog->Flush(); + + // Send OnIdle events to all windows + bool needMore = SendIdleEvents(); + + if (needMore) + event.RequestMore(TRUE); + + inOnIdle = FALSE; +}; + +bool wxApp::SendIdleEvents(void) +{ + bool needMore = FALSE; + wxNode* node = wxTopLevelWindows.First(); + while (node) + { + wxWindow* win = (wxWindow*) node->Data(); + if (SendIdleEvents(win)) + needMore = TRUE; + + node = node->Next(); + } + return needMore; +}; + +bool wxApp::SendIdleEvents( wxWindow* win ) +{ + bool needMore = FALSE; + + wxIdleEvent event; + event.SetEventObject(win); + win->ProcessEvent(event); + + if (event.MoreRequested()) + needMore = TRUE; + + wxNode* node = win->GetChildren()->First(); + while (node) + { + wxWindow* win = (wxWindow*) node->Data(); + if (SendIdleEvents(win)) + needMore = TRUE; + + node = node->Next(); + } + return needMore ; +}; + +int wxApp::OnExit(void) +{ + return 0; +}; + +int wxApp::MainLoop(void) +{ + return 0; +}; + +void wxApp::ExitMainLoop(void) +{ +}; + +bool wxApp::Initialized(void) +{ + return m_initialized; +}; + +bool wxApp::Pending(void) +{ + return FALSE; +}; + +void wxApp::Dispatch(void) +{ +}; + +void wxApp::DeletePendingObjects(void) +{ + wxNode *node = wxPendingDelete.First(); + while (node) + { + wxObject *obj = (wxObject *)node->Data(); + + delete obj; + + if (wxPendingDelete.Member(obj)) + delete node; + + node = wxPendingDelete.First(); + }; +}; + +wxWindow *wxApp::GetTopWindow(void) +{ + if (m_topWindow) return m_topWindow; + wxNode *node = wxTopLevelWindows.First(); + if (!node) return NULL; + return (wxWindow*)node->Data(); +}; + +void wxApp::SetTopWindow( wxWindow *win ) +{ + m_topWindow = win; +}; + +void wxApp::CommonInit(void) +{ + +/* +#if USE_RESOURCES + (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion); +#endif +*/ + + wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); + wxTheColourDatabase->Initialize(); + wxInitializeStockObjects(); + + // For PostScript printing +#if USE_POSTSCRIPT + wxInitializePrintSetupData(); + wxThePrintPaperDatabase = new wxPrintPaperDatabase; + wxThePrintPaperDatabase->CreateDatabase(); +#endif + + +/* + wxBitmap::InitStandardHandlers(); + + g_globalCursor = new wxCursor; +*/ + + wxInitializeStockObjects(); +}; + +void wxApp::CommonCleanUp(void) +{ + wxDeleteStockObjects(); + + wxFlushResources(); +}; + +wxLog *wxApp::CreateLogTarget() +{ + return new wxLogGui; +} + +//----------------------------------------------------------------------------- +// wxEntry +//----------------------------------------------------------------------------- + +int wxEntry( int argc, char *argv[] ) +{ + wxBuffer = new char[BUFSIZ + 512]; + + wxClassInfo::InitializeClasses(); + +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + +#if !defined(_WINDLL) + streambuf* sBuf = new wxDebugStreamBuf; +#else + streambuf* sBuf = NULL; +#endif + ostream* oStr = new ostream(sBuf) ; + wxDebugContext::SetStream(oStr, sBuf); + +#endif + + if (!wxTheApp) + { + if (!wxApp::GetInitializerFunction()) + { + printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); + return 0; + }; + + wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); + + wxObject *test_app = app_ini(); + + wxTheApp = (wxApp*) test_app; + +// wxTheApp = (wxApp*)( app_ini() ); + }; + + if (!wxTheApp) + { + printf( "wxWindows error: wxTheApp == NULL\n" ); + return 0; + }; + +// printf( "Programmstart.\n" ); + + wxTheApp->argc = argc; + wxTheApp->argv = argv; + +// Your init here !!!! + + wxApp::CommonInit(); + + wxTheApp->OnInitGui(); + + // Here frames insert themselves automatically + // into wxTopLevelWindows by getting created + // in OnInit(). + + if (!wxTheApp->OnInit()) return 0; + + wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); + + int retValue = 0; + + if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun(); + + wxTheApp->DeletePendingObjects(); + + wxTheApp->OnExit(); + + wxApp::CommonCleanUp(); + +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + // At this point we want to check if there are any memory + // blocks that aren't part of the wxDebugContext itself, + // as a special case. Then when dumping we need to ignore + // wxDebugContext, too. + if (wxDebugContext::CountObjectsLeft() > 0) + { + wxTrace("There were memory leaks.\n"); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + } + wxDebugContext::SetStream(NULL, NULL); +#endif + + return retValue; +}; + +//----------------------------------------------------------------------------- +// main() +//----------------------------------------------------------------------------- + +#if defined(AIX) || defined(AIX4) || defined(____HPUX__) + + // main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h + +#else + + int main(int argc, char *argv[]) { return wxEntry(argc, argv); } + +#endif + + diff --git a/src/qt/bdiag.xbm b/src/qt/bdiag.xbm new file mode 100644 index 0000000000..9ff0a1822f --- /dev/null +++ b/src/qt/bdiag.xbm @@ -0,0 +1,6 @@ +#define bdiag_width 16 +#define bdiag_height 16 +static char bdiag_bits[] = { + 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, + 0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, + 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01}; diff --git a/src/qt/bitmap.cpp b/src/qt/bitmap.cpp new file mode 100644 index 0000000000..4d1738355a --- /dev/null +++ b/src/qt/bitmap.cpp @@ -0,0 +1,237 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bitmap.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "bitmap.h" +#endif + +#include "wx/bitmap.h" + + +//----------------------------------------------------------------------------- +// wxMask +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject) + +wxMask::wxMask(void) +{ +}; + +wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), const wxColour& WXUNUSED(colour) ) +{ +}; + +wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), int WXUNUSED(paletteIndex) ) +{ +}; + +wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) ) +{ +}; + +wxMask::~wxMask(void) +{ +}; + +//----------------------------------------------------------------------------- +// wxBitmap +//----------------------------------------------------------------------------- + +class wxBitmapRefData: public wxObjectRefData +{ + public: + + wxBitmapRefData(void); + ~wxBitmapRefData(void); + + wxMask *m_mask; + int m_width; + int m_height; + int m_bpp; + wxPalette *m_palette; +}; + +wxBitmapRefData::wxBitmapRefData(void) +{ + m_mask = NULL; + m_width = 0; + m_height = 0; + m_bpp = 0; + m_palette = NULL; +}; + +wxBitmapRefData::~wxBitmapRefData(void) +{ + if (m_mask) delete m_mask; + if (m_palette) delete m_palette; +}; + +//----------------------------------------------------------------------------- + +#define M_BMPDATA ((wxBitmapRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) + +wxBitmap::wxBitmap(void) +{ + if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); +}; + +wxBitmap::wxBitmap( int width, int height, int depth ) +{ + m_refData = new wxBitmapRefData(); + M_BMPDATA->m_mask = NULL; + M_BMPDATA->m_width = width; + M_BMPDATA->m_height = height; + M_BMPDATA->m_bpp = depth; + + if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); +}; + +wxBitmap::wxBitmap( char **WXUNUSED(bits) ) +{ + m_refData = new wxBitmapRefData(); + + if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); +}; + +wxBitmap::wxBitmap( const wxBitmap& bmp ) +{ + Ref( bmp ); + + if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); +}; + +wxBitmap::wxBitmap( const wxBitmap* bmp ) +{ + if (bmp) Ref( *bmp ); + + if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); +}; + +wxBitmap::wxBitmap( const wxString &filename, int type ) +{ + LoadFile( filename, type ); +}; + +wxBitmap::wxBitmap( const char WXUNUSED(bits)[], int width, int height, int WXUNUSED(depth)) +{ + m_refData = new wxBitmapRefData(); + + M_BMPDATA->m_mask = NULL; + M_BMPDATA->m_width = width; + M_BMPDATA->m_height = height; + M_BMPDATA->m_bpp = 1; + + if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); +} + +wxBitmap::~wxBitmap(void) +{ + if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this); +}; + +wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp ) +{ + if (*this == bmp) return (*this); + Ref( bmp ); + return *this; +}; + +bool wxBitmap::operator == ( const wxBitmap& bmp ) +{ + return m_refData == bmp.m_refData; +}; + +bool wxBitmap::operator != ( const wxBitmap& bmp ) +{ + return m_refData != bmp.m_refData; +}; + +bool wxBitmap::Ok(void) const +{ + return m_refData != NULL; +}; + +int wxBitmap::GetHeight(void) const +{ + if (!Ok()) return 0; + return M_BMPDATA->m_height; +}; + +int wxBitmap::GetWidth(void) const +{ + if (!Ok()) return 0; + return M_BMPDATA->m_width; +}; + +int wxBitmap::GetDepth(void) const +{ + if (!Ok()) return 0; + return M_BMPDATA->m_bpp; +}; + +void wxBitmap::SetHeight( int height ) +{ + if (!Ok()) return; + M_BMPDATA->m_height = height; +}; + +void wxBitmap::SetWidth( int width ) +{ + if (!Ok()) return; + M_BMPDATA->m_width = width; +}; + +void wxBitmap::SetDepth( int depth ) +{ + if (!Ok()) return; + M_BMPDATA->m_bpp = depth; +}; + +wxMask *wxBitmap::GetMask(void) const +{ + if (!Ok()) return NULL; + + return M_BMPDATA->m_mask; +}; + +void wxBitmap::SetMask( wxMask *mask ) +{ + if (!Ok()) return; + + if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask; + M_BMPDATA->m_mask = mask; +}; + +void wxBitmap::Resize( int WXUNUSED(height), int WXUNUSED(width) ) +{ + if (!Ok()) return; + +}; + +bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), int WXUNUSED(type), + wxPalette *WXUNUSED(palette) ) +{ + return FALSE; +}; + +bool wxBitmap::LoadFile( const wxString &WXUNUSED(name), int WXUNUSED(type) ) +{ + return FALSE; +}; + +wxPalette *wxBitmap::GetPalette(void) const +{ + if (!Ok()) return NULL; + return M_BMPDATA->m_palette; +}; + diff --git a/src/qt/bmpbuttn.cpp b/src/qt/bmpbuttn.cpp new file mode 100644 index 0000000000..b704366480 --- /dev/null +++ b/src/qt/bmpbuttn.cpp @@ -0,0 +1,78 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bmpbuttn.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "bmpbuttn.h" +#endif + +#include "wx/bmpbuttn.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxBitmapButton; + +//----------------------------------------------------------------------------- +// wxBitmapButton +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl) + +wxBitmapButton::wxBitmapButton(void) +{ +}; + +wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, bitmap, pos, size, style, name ); +}; + +bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + m_needParent = TRUE; + + wxSize newSize = size; + + PreCreation( parent, id, pos, newSize, style, name ); + + m_bitmap = bitmap; + m_label = ""; + + + if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10; + if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10; + SetSize( newSize.x, newSize.y ); + + + PostCreation(); + + Show( TRUE ); + + return TRUE; +}; + +void wxBitmapButton::SetDefault(void) +{ +}; + +void wxBitmapButton::SetLabel( const wxString &label ) +{ + wxControl::SetLabel( label ); +}; + +wxString wxBitmapButton::GetLabel(void) const +{ + return wxControl::GetLabel(); +}; diff --git a/src/qt/brush.cpp b/src/qt/brush.cpp new file mode 100644 index 0000000000..155b0c400b --- /dev/null +++ b/src/qt/brush.cpp @@ -0,0 +1,132 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: brush.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "brush.h" +#endif + +#include "wx/brush.h" + +//----------------------------------------------------------------------------- +// wxBrush +//----------------------------------------------------------------------------- + +class wxBrushRefData: public wxObjectRefData +{ + public: + + wxBrushRefData(void); + + int m_style; + wxBitmap m_stipple; + wxColour m_colour; +}; + +wxBrushRefData::wxBrushRefData(void) +{ + m_style = 0; +}; + +//----------------------------------------------------------------------------- + +#define M_BRUSHDATA ((wxBrushRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) + +wxBrush::wxBrush(void) +{ + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); +}; + +wxBrush::wxBrush( const wxColour &colour, int style ) +{ + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = style; + M_BRUSHDATA->m_colour = colour; + + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); +}; + +wxBrush::wxBrush( const wxString &colourName, int style ) +{ + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = style; + M_BRUSHDATA->m_colour = colourName; + + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); +}; + +wxBrush::wxBrush( const wxBitmap &stippleBitmap ) +{ + m_refData = new wxBrushRefData(); + M_BRUSHDATA->m_style = wxSTIPPLE; + M_BRUSHDATA->m_colour = *wxBLACK; + M_BRUSHDATA->m_stipple = stippleBitmap; + + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); +}; + +wxBrush::wxBrush( const wxBrush &brush ) +{ + Ref( brush ); + + if (wxTheBrushList) wxTheBrushList->AddBrush( this ); +}; + +wxBrush::wxBrush( const wxBrush *brush ) +{ + if (brush) Ref( *brush ); + + if (wxTheBrushList) wxTheBrushList->Append( this ); +}; + +wxBrush::~wxBrush(void) +{ + if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); +}; + +wxBrush& wxBrush::operator = ( const wxBrush& brush ) +{ + if (*this == brush) return (*this); + Ref( brush ); + return *this; +}; + +bool wxBrush::operator == ( const wxBrush& brush ) +{ + return m_refData == brush.m_refData; +}; + +bool wxBrush::operator != ( const wxBrush& brush ) +{ + return m_refData != brush.m_refData; +}; + +bool wxBrush::Ok(void) const +{ + return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); +}; + +int wxBrush::GetStyle(void) const +{ + return M_BRUSHDATA->m_style; +}; + +wxColour &wxBrush::GetColour(void) const +{ + return M_BRUSHDATA->m_colour; +}; + +wxBitmap *wxBrush::GetStipple(void) const +{ + return &M_BRUSHDATA->m_stipple; +}; + + diff --git a/src/qt/button.cpp b/src/qt/button.cpp new file mode 100644 index 0000000000..438a4cfea1 --- /dev/null +++ b/src/qt/button.cpp @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: button.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "button.h" +#endif + +#include "wx/button.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class wxButton; + +//----------------------------------------------------------------------------- +// wxButton +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl) + +//----------------------------------------------------------------------------- + +wxButton::wxButton(void) +{ +}; + +wxButton::wxButton( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, label, pos, size, style, name ); +}; + +bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + return TRUE; +}; + +void wxButton::SetDefault(void) +{ +}; + +void wxButton::SetLabel( const wxString &label ) +{ + wxControl::SetLabel( label ); +}; + +wxString wxButton::GetLabel(void) const +{ + return wxControl::GetLabel(); +}; diff --git a/src/qt/cdiag.xbm b/src/qt/cdiag.xbm new file mode 100644 index 0000000000..15dc7ba86d --- /dev/null +++ b/src/qt/cdiag.xbm @@ -0,0 +1,6 @@ +#define cdiag_width 16 +#define cdiag_height 16 +static char cdiag_bits[] = { + 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, + 0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, + 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81}; diff --git a/src/qt/checkbox.cpp b/src/qt/checkbox.cpp new file mode 100644 index 0000000000..351a5338e3 --- /dev/null +++ b/src/qt/checkbox.cpp @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: checkbox.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "checkbox.h" +#endif + +#include "wx/checkbox.h" + +//----------------------------------------------------------------------------- +// wxCheckBox +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl) + +wxCheckBox::wxCheckBox(void) +{ +}; + +wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, label, pos, size, style, name ); +}; + +bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + return TRUE; +}; + +void wxCheckBox::SetValue( bool WXUNUSED(state) ) +{ +}; + +bool wxCheckBox::GetValue(void) const +{ + return FALSE; +}; + diff --git a/src/qt/choice.cpp b/src/qt/choice.cpp new file mode 100644 index 0000000000..9b9118bf9c --- /dev/null +++ b/src/qt/choice.cpp @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: choice.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "choice.h" +#endif + +#include "wx/choice.h" + +//----------------------------------------------------------------------------- +// wxChoice +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl) + +wxChoice::wxChoice(void) +{ +}; + +wxChoice::wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + int n, const wxString choices[], + long style, const wxString &name ) +{ + Create( parent, id, pos, size, n, choices, style, name ); +}; + +bool wxChoice::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + int n, const wxString choices[], + long style, const wxString &name ) +{ + return TRUE; +}; + +void wxChoice::Append( const wxString &WXUNUSED(item) ) +{ +}; + +void wxChoice::Clear(void) +{ +}; + +int wxChoice::FindString( const wxString &WXUNUSED(string) ) const +{ + return -1; +}; + +int wxChoice::GetColumns(void) const +{ + return 1; +}; + +int wxChoice::GetSelection(void) +{ + return -1; +}; + +wxString wxChoice::GetString( int WXUNUSED(n) ) const +{ + return ""; +}; + +wxString wxChoice::GetStringSelection(void) const +{ + return ""; +}; + +int wxChoice::Number(void) const +{ + return 0; +}; + +void wxChoice::SetColumns( int WXUNUSED(n) ) +{ +}; + +void wxChoice::SetSelection( int WXUNUSED(n) ) +{ +}; + +void wxChoice::SetStringSelection( const wxString &string ) +{ + int n = FindString( string ); + if (n != -1) SetSelection( n ); +}; + diff --git a/src/qt/colour.cpp b/src/qt/colour.cpp new file mode 100644 index 0000000000..404fcba3bb --- /dev/null +++ b/src/qt/colour.cpp @@ -0,0 +1,164 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: colour.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "colour.h" +#endif + +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// wxColour +//----------------------------------------------------------------------------- + +class wxColourRefData: public wxObjectRefData +{ + public: + + wxColourRefData(void); + ~wxColourRefData(void); + void FreeColour(void); + + bool m_hasPixel; + + friend wxColour; +}; + +wxColourRefData::wxColourRefData(void) +{ + m_hasPixel = FALSE; +}; + +wxColourRefData::~wxColourRefData(void) +{ + FreeColour(); +}; + +void wxColourRefData::FreeColour(void) +{ +}; + +//----------------------------------------------------------------------------- + +#define M_COLDATA ((wxColourRefData *)m_refData) + +#define SHIFT (8*(sizeof(short int)-sizeof(char))) + +IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject) + +wxColour::wxColour(void) +{ +}; + +wxColour::wxColour( char WXUNUSED(red), char WXUNUSED(green), char WXUNUSED(blue) ) +{ + m_refData = new wxColourRefData(); +}; + +wxColour::wxColour( const wxString &colourName ) +{ + wxNode *node = NULL; + if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) + { + wxColour *col = (wxColour*)node->Data(); + UnRef(); + if (col) Ref( *col ); + } + else + { + m_refData = new wxColourRefData(); + }; +}; + +wxColour::wxColour( const wxColour& col ) +{ + Ref( col ); +}; + +wxColour::wxColour( const wxColour* col ) +{ + if (col) Ref( *col ); +}; + +wxColour::~wxColour(void) +{ +}; + +wxColour& wxColour::operator = ( const wxColour& col ) +{ + if (*this == col) return (*this); + Ref( col ); + return *this; +}; + +wxColour& wxColour::operator = ( const wxString& colourName ) +{ + UnRef(); + wxNode *node = NULL; + if ((wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) + { + wxColour *col = (wxColour*)node->Data(); + if (col) Ref( *col ); + } + else + { + m_refData = new wxColourRefData(); + }; + return *this; +}; + +bool wxColour::operator == ( const wxColour& col ) +{ + return m_refData == col.m_refData; +}; + +bool wxColour::operator != ( const wxColour& col) +{ + return m_refData != col.m_refData; +}; + +void wxColour::Set( const unsigned char WXUNUSED(red), const unsigned char WXUNUSED(green), + const unsigned char WXUNUSED(blue) ) +{ + UnRef(); + m_refData = new wxColourRefData(); +}; + +unsigned char wxColour::Red(void) const +{ + if (!Ok()) return 0; + return 0; +}; + +unsigned char wxColour::Green(void) const +{ + if (!Ok()) return 0; + return 0; +}; + +unsigned char wxColour::Blue(void) const +{ + if (!Ok()) return 0; + return 0; +}; + +bool wxColour::Ok(void) const +{ + return (m_refData); + return 0; +}; + +int wxColour::GetPixel(void) +{ + if (!Ok()) return 0; + return 0; +}; + diff --git a/src/qt/combobox.cpp b/src/qt/combobox.cpp new file mode 100644 index 0000000000..7a2d9ef063 --- /dev/null +++ b/src/qt/combobox.cpp @@ -0,0 +1,149 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combobox.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "combobox.h" +#endif + +#include "wx/combobox.h" + +//----------------------------------------------------------------------------- +// wxComboBox +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl) + +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, + const wxPoint& pos, const wxSize& size, int n, const wxString choices[], + long style, const wxString& name ) +{ + return TRUE; +}; + +void wxComboBox::Clear(void) +{ +}; + +void wxComboBox::Append( const wxString &item ) +{ + Append( item, (char*)NULL ); +}; + +void wxComboBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) ) +{ +}; + +void wxComboBox::Delete( int WXUNUSED(n) ) +{ +}; + +int wxComboBox::FindString( const wxString &WXUNUSED(item) ) +{ + return -1; +}; + +char* wxComboBox::GetClientData( int WXUNUSED(n) ) +{ + return (char*)NULL; +}; + +void wxComboBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) ) +{ +}; + +int wxComboBox::GetSelection(void) const +{ + return -1; +}; + +wxString wxComboBox::GetString( int WXUNUSED(n) ) const +{ + return ""; +}; + +wxString wxComboBox::GetStringSelection(void) const +{ + return ""; +}; + +int wxComboBox::Number(void) const +{ + return 0; +}; + +void wxComboBox::SetSelection( int WXUNUSED(n) ) +{ +}; + +void wxComboBox::SetStringSelection( const wxString &string ) +{ + int res = FindString( string ); + if (res == -1) return; + SetSelection( res ); +}; + +wxString wxComboBox::GetValue(void) const +{ + return ""; +}; + +void wxComboBox::SetValue( const wxString& WXUNUSED(value) ) +{ +}; + +void wxComboBox::Copy(void) +{ +}; + +void wxComboBox::Cut(void) +{ +}; + +void wxComboBox::Paste(void) +{ +}; + +void wxComboBox::SetInsertionPoint( long WXUNUSED(pos) ) +{ +}; + +void wxComboBox::SetInsertionPointEnd(void) +{ +}; + +long wxComboBox::GetInsertionPoint(void) const +{ + return 0; +}; + +long wxComboBox::GetLastPosition(void) const +{ + return 0; +}; + +void wxComboBox::Replace( long WXUNUSED(from), long WXUNUSED(to), const wxString& WXUNUSED(value) ) +{ +}; + +void wxComboBox::Remove(long WXUNUSED(from), long WXUNUSED(to) ) +{ +}; + +void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) ) +{ +}; + +void wxComboBox::SetEditable( bool WXUNUSED(editable) ) +{ +}; + + diff --git a/src/qt/control.cpp b/src/qt/control.cpp new file mode 100644 index 0000000000..62a07ce01c --- /dev/null +++ b/src/qt/control.cpp @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: control.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "control.h" +#endif + +#include "wx/control.h" + +//----------------------------------------------------------------------------- +// wxControl +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow) + +wxControl::wxControl(void) +{ +}; + +wxControl::wxControl( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) : + wxWindow( parent, id, pos, size, style, name ) +{ +}; + +void wxControl::Command( wxCommandEvent &WXUNUSED(event) ) +{ +}; + +void wxControl::SetLabel( const wxString &label ) +{ + for ( const char *pc = label; *pc != '\0'; pc++ ) { + if ( *pc == '&' ) { + pc++; // skip it +#if 0 // it would be unused anyhow for now - kbd interface not done yet + if ( *pc != '&' ) + m_chAccel = *pc; +#endif + } + + m_label << *pc; + } +}; + +wxString wxControl::GetLabel(void) const +{ + return m_label; +}; + + + diff --git a/src/qt/cross.xbm b/src/qt/cross.xbm new file mode 100644 index 0000000000..b07cbe7fcd --- /dev/null +++ b/src/qt/cross.xbm @@ -0,0 +1,6 @@ +#define cross_width 15 +#define cross_height 15 +static char cross_bits[] = { + 0x84, 0x10, 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10}; diff --git a/src/qt/cursor.cpp b/src/qt/cursor.cpp new file mode 100644 index 0000000000..76f2454080 --- /dev/null +++ b/src/qt/cursor.cpp @@ -0,0 +1,120 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: cursor.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "cursor.h" +#endif + +#include "wx/cursor.h" + +//----------------------------------------------------------------------------- +// wxCursor +//----------------------------------------------------------------------------- + +class wxCursorRefData: public wxObjectRefData +{ + public: + + wxCursorRefData(void); + ~wxCursorRefData(void); + +}; + +wxCursorRefData::wxCursorRefData(void) +{ +}; + +wxCursorRefData::~wxCursorRefData(void) +{ +}; + +//----------------------------------------------------------------------------- + +#define M_CURSORDATA ((wxCursorRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject) + +wxCursor::wxCursor(void) +{ +}; + +wxCursor::wxCursor( int WXUNUSED(cursorId) ) +{ + m_refData = new wxCursorRefData(); +}; + +wxCursor::wxCursor( const wxCursor &cursor ) +{ + Ref( cursor ); +}; + +wxCursor::wxCursor( const wxCursor *cursor ) +{ + UnRef(); + if (cursor) Ref( *cursor ); +}; + +wxCursor::~wxCursor(void) +{ +}; + +wxCursor& wxCursor::operator = ( const wxCursor& cursor ) +{ + if (*this == cursor) return (*this); + Ref( cursor ); + return *this; +}; + +bool wxCursor::operator == ( const wxCursor& cursor ) +{ + return m_refData == cursor.m_refData; +}; + +bool wxCursor::operator != ( const wxCursor& cursor ) +{ + return m_refData != cursor.m_refData; +}; + +bool wxCursor::Ok(void) const +{ + return TRUE; +}; + +//----------------------------------------------------------------------------- +// busy cursor routines +//----------------------------------------------------------------------------- + +bool g_isBusy = FALSE; + +void wxEndBusyCursor(void) +{ + g_isBusy = FALSE; +}; + +void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) ) +{ + g_isBusy = TRUE; +}; + +bool wxIsBusy(void) +{ + return g_isBusy; +}; + +void wxSetCursor( const wxCursor& cursor ) +{ + extern wxCursor *g_globalCursor; + if (g_globalCursor) (*g_globalCursor) = cursor; + + if (cursor.Ok()) {}; +}; + + diff --git a/src/qt/data.cpp b/src/qt/data.cpp new file mode 100644 index 0000000000..1afbd94253 --- /dev/null +++ b/src/qt/data.cpp @@ -0,0 +1,711 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: data.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +// #pragma implementation +#endif + +#include "wx/wx.h" + +#define _MAXPATHLEN 500 + +// Used for X resources + +#include +#include +#include + +wxList wxResourceCache(wxKEY_STRING); +XrmDatabase wxResourceDatabase; + +// Useful buffer, initialized in wxCommonInit +char *wxBuffer = NULL; + +// Windows List +wxList wxTopLevelWindows; + +// List of windows pending deletion +wxList wxPendingDelete; + +// Current cursor, in order to hang on to +// cursor handle when setting the cursor globally +wxCursor *g_globalCursor = NULL; + +// Don't allow event propagation during drag +bool g_blockEventsOnDrag = FALSE; + +// Message Strings for Internationalization +char **wx_msg_str = (char**)NULL; + +// Custom OS version, as optionally placed in wx.ini/.wxrc +// Currently this can be Win95, Windows, Win32s, WinNT. +// For some systems, you can't tell until run-time what services you +// have. See wxGetOsVersion, which uses this string if present. +char *wxOsVersion = NULL; + +// For printing several pages +int wxPageNumber; +wxPrintPaperDatabase* wxThePrintPaperDatabase = NULL; + +// GDI Object Lists +wxBrushList *wxTheBrushList = NULL; +wxPenList *wxThePenList = NULL; +wxFontList *wxTheFontList = NULL; +wxColourDatabase *wxTheColourDatabase = NULL; +wxBitmapList *wxTheBitmapList = NULL; + + +// X only font names +// wxFontNameDirectory wxTheFontNameDirectory; + +// Stock objects +wxFont *wxNORMAL_FONT; +wxFont *wxSMALL_FONT; +wxFont *wxITALIC_FONT; +wxFont *wxSWISS_FONT; + +wxPen *wxRED_PEN; +wxPen *wxCYAN_PEN; +wxPen *wxGREEN_PEN; +wxPen *wxBLACK_PEN; +wxPen *wxWHITE_PEN; +wxPen *wxTRANSPARENT_PEN; +wxPen *wxBLACK_DASHED_PEN; +wxPen *wxGREY_PEN; +wxPen *wxMEDIUM_GREY_PEN; +wxPen *wxLIGHT_GREY_PEN; + +wxBrush *wxBLUE_BRUSH; +wxBrush *wxGREEN_BRUSH; +wxBrush *wxWHITE_BRUSH; +wxBrush *wxBLACK_BRUSH; +wxBrush *wxTRANSPARENT_BRUSH; +wxBrush *wxCYAN_BRUSH; +wxBrush *wxRED_BRUSH; +wxBrush *wxGREY_BRUSH; +wxBrush *wxMEDIUM_GREY_BRUSH; +wxBrush *wxLIGHT_GREY_BRUSH; + +wxColour *wxBLACK; +wxColour *wxWHITE; +wxColour *wxGREY; // Robert Roebling +wxColour *wxRED; +wxColour *wxBLUE; +wxColour *wxGREEN; +wxColour *wxCYAN; +wxColour *wxLIGHT_GREY; + +wxCursor *wxSTANDARD_CURSOR = NULL; +wxCursor *wxHOURGLASS_CURSOR = NULL; +wxCursor *wxCROSS_CURSOR = NULL; + +// 'Null' objects +wxBitmap wxNullBitmap; +wxIcon wxNullIcon; +wxCursor wxNullCursor; +wxPen wxNullPen; +wxBrush wxNullBrush; +wxFont wxNullFont; +wxColour wxNullColour; +wxPalette wxNullPalette; + +// Default window names +const char *wxButtonNameStr = "button"; +const char *wxCanvasNameStr = "canvas"; +const char *wxCheckBoxNameStr = "check"; +const char *wxChoiceNameStr = "choice"; +const char *wxComboBoxNameStr = "comboBox"; +const char *wxDialogNameStr = "dialog"; +const char *wxFrameNameStr = "frame"; +const char *wxGaugeNameStr = "gauge"; +const char *wxStaticBoxNameStr = "groupBox"; +const char *wxListBoxNameStr = "listBox"; +const char *wxStaticTextNameStr = "message"; +const char *wxStaticBitmapNameStr = "message"; +const char *wxMultiTextNameStr = "multitext"; +const char *wxPanelNameStr = "panel"; +const char *wxRadioBoxNameStr = "radioBox"; +const char *wxRadioButtonNameStr = "radioButton"; +const char *wxBitmapRadioButtonNameStr = "radioButton"; +const char *wxScrollBarNameStr = "scrollBar"; +const char *wxSliderNameStr = "slider"; +const char *wxStaticNameStr = "static"; +const char *wxTextCtrlWindowNameStr = "textWindow"; +const char *wxTextCtrlNameStr = "text"; +const char *wxVirtListBoxNameStr = "virtListBox"; +const char *wxButtonBarNameStr = "buttonbar"; +const char *wxEnhDialogNameStr = "Shell"; +const char *wxToolBarNameStr = "toolbar"; +const char *wxStatusLineNameStr = "status_line"; +const char *wxEmptyString = ""; +const char *wxGetTextFromUserPromptStr = "Input Text"; +const char *wxMessageBoxCaptionStr = "Message"; +const char *wxFileSelectorPromptStr = "Select a file"; +const char *wxFileSelectorDefaultWildcardStr = "*.*"; +const char *wxInternalErrorStr = "wxWindows Internal Error"; +const char *wxFatalErrorStr = "wxWindows Fatal Error"; + +// See wx/utils.h +const char *wxFloatToStringStr = "%.2f"; +const char *wxDoubleToStringStr = "%.2f"; + +#ifdef wx_msw +const char *wxUserResourceStr = "TEXT"; +#endif + + +#if USE_SHARED_LIBRARY +/* + * For wxWindows to be made into a dynamic library (e.g. Sun), + * all IMPLEMENT_... macros must be in one place. + * But normally, the definitions are in the appropriate places. + */ + +// Hand-coded IMPLEMENT... macro for wxObject (define static data) +wxClassInfo wxObject::classwxObject("wxObject", NULL, NULL, sizeof(wxObject), NULL); +wxClassInfo *wxClassInfo::first = NULL; + +#include "wx/button.h" +#include "wx/bmpbuttn.h" +IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) + +#include "wx/checkbox.h" +IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) + +#include "wx/choice.h" +IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) + +#if USE_CLIPBOARD +#include "wx/clipbrd.h" +IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject) +#endif + +#if USE_COMBOBOX +#include "wx/combobox.h" +IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) +#endif + +#include "wx/dc.h" +#include "wx/dcmemory.h" +#include "wx/dcclient.h" +#include "wx/dcscreen.h" +IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) + +#if defined(wx_msw) +#include "wx/dcprint.h" +IMPLEMENT_CLASS(wxPrinterDC, wxDC) +#endif + +#include "wx/dialog.h" +IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxWindow) + +#include "wx/frame.h" +IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) + +#include "wx/mdi.h" +IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) + +#include "wx/cmndata.h" +IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject) + +#include "wx/colordlg.h" +#include "wx/fontdlg.h" + +#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW +#include "wx/generic/colordlg.h" +#include "wx/generic/fontdlg.h" +IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog) +IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog) +#endif + +// X defines wxColourDialog to be wxGenericColourDialog +#ifndef wx_x +IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) +IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) +#endif + +#include "wx/gdicmn.h" +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/font.h" +#include "wx/palette.h" +#include "wx/icon.h" +#include "wx/cursor.h" + +IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) +IMPLEMENT_CLASS(wxColourDatabase, wxList) +IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList) +IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) +IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList) +IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList) + +/* +#if (!USE_TYPEDEFS) +IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxIntPoint, wxObject) +#endif +*/ + +#if defined(wx_x) || (defined(wx_msw) && USE_PORTABLE_FONTS_IN_MSW) +IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject) +#endif + +#include "wx/hash.h" +IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject) + +#include "wx/help.h" +IMPLEMENT_DYNAMIC_CLASS(wxHelpInstance, wxClient) +IMPLEMENT_CLASS(wxHelpConnection, wxConnection) + +#include "wx/list.h" +IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList) + +#if USE_PRINTING_ARCHITECTURE +#include "wx/print.h" +IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) +IMPLEMENT_DYNAMIC_CLASS(wxPrinterBase, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase) +IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase) +IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject) +IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow) +IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow) +IMPLEMENT_CLASS(wxPreviewFrame, wxFrame) +IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) +IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase) +IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase) +IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog) +IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog) +#endif + +#if USE_POSTSCRIPT +#include "wx/postscrp.h" +IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxPageSetupData, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList) +#endif + +#if USE_WX_RESOURCES +#include "wx/resource.h" +IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable) +#endif + +#include "wx/event.h" +IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) +IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent) +IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent) + +#include "wx/utils.h" +IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList) + +// IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject) + +#include "wx/process.h" +IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler) + +#if USE_TIMEDATE +#include "wx/date.h" +IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject) +#endif + +#if USE_DOC_VIEW_ARCHITECTURE +#include "wx/docview.h" +//IMPLEMENT_ABSTRACT_CLASS(wxDocItem, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler) +IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler) +IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler) +IMPLEMENT_CLASS(wxDocChildFrame, wxFrame) +IMPLEMENT_CLASS(wxDocParentFrame, wxFrame) +#if USE_PRINTING_ARCHITECTURE +IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout) +#endif +IMPLEMENT_CLASS(wxCommand, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject) +#endif + +#if USE_CONSTRAINTS +#include "wx/layout.h" +IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxSizer, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxRowColSizer, wxSizer) +#endif + +#if USE_TOOLBAR +#include "wx/tbarbase.h" +IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl) + +#include "wx/tbarsmpl.h" +IMPLEMENT_DYNAMIC_CLASS(wxToolBarSimple, wxToolBarBase) + +#ifdef wx_msw +#include "wx/tbarmsw.h" +IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase) + +#include "wx/tbar95.h" +IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase) +#endif + +#endif + +#include "wx/statusbr.h" + +IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) + +BEGIN_EVENT_TABLE(wxStatusBar, wxWindow) + EVT_PAINT(wxStatusBar::OnPaint) + EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged) +END_EVENT_TABLE() + +#if USE_TIMEDATE +#include "wx/time.h" +IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject) +#endif + +#if !USE_GNU_WXSTRING +#include "wx/string.h" +IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject) +#endif + +#ifdef wx_motif +IMPLEMENT_DYNAMIC_CLASS(wxXColormap, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxXFont, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject) +#endif +IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) +IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap) +IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) + +// This will presumably be implemented on other platforms too +#ifdef wx_msw +IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) +IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) +IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler) +IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler) +IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxBitmapHandler) +IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxBitmapHandler) +#endif + +#include "wx/statbox.h" +IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) + +#if USE_IPC +#include "wx/dde.h" +IMPLEMENT_ABSTRACT_CLASS(wxDDEObject, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxDDEObject) +IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxDDEObject) +IMPLEMENT_CLASS(wxDDEConnection, wxObject) +#endif + +IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) + +#include "wx/listbox.h" +IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) + +IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) + +#include "wx/menu.h" +IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow) +IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow) + +#include "wx/stattext.h" +#include "wx/statbmp.h" +IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) + +#if USE_METAFILE +#include "wx/metafile.h" +IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC) +#endif + +#include "wx/radiobox.h" +#include "wx/radiobut.h" +IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) + +IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) +// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton) + +#include "wx/scrolbar.h" +IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl) + +#if WXWIN_COMPATIBILITY +BEGIN_EVENT_TABLE(wxScrollBar, wxControl) + EVT_SCROLL(wxScrollBar::OnScroll) +END_EVENT_TABLE() +#endif + +#include "wx/slider.h" +IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl) + +#if WXWIN_COMPATIBILITY +BEGIN_EVENT_TABLE(wxSlider, wxControl) + EVT_SCROLL(wxSlider::OnScroll) +END_EVENT_TABLE() +#endif + +#include "wx/timer.h" +IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) + +#include "wx/textctrl.h" +IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl) + +#include "wx/window.h" +IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) + +#include "wx/scrolwin.h" +IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow) + +#include "wx/panel.h" +IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow) + +#include "wx/msgbxdlg.h" +#include "wx/textdlg.h" +#include "wx/filedlg.h" +#include "wx/dirdlg.h" +#include "wx/choicdlg.h" + +#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW +#include "wx/generic/msgdlgg.h" +IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog) +#endif + +IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) +IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) +IMPLEMENT_CLASS(wxFileDialog, wxDialog) +IMPLEMENT_CLASS(wxDirDialog, wxDialog) + +#ifdef wx_msw +IMPLEMENT_CLASS(wxMessageDialog) +#endif + +#if USE_GAUGE +#ifdef wx_motif +#include "../../contrib/xmgauge/gauge.h" +#endif +#include "wx_gauge.h" +IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) +#endif + +#include "wx/grid.h" +IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel) + +///// Event tables (also must be in one, statically-linked file for shared libraries) + +// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here +const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } + +const wxEventTable wxEvtHandler::sm_eventTable = + { NULL, &wxEvtHandler::sm_eventTableEntries[0] }; + +const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } }; + +BEGIN_EVENT_TABLE(wxFrame, wxWindow) + EVT_ACTIVATE(wxFrame::OnActivate) + EVT_SIZE(wxFrame::OnSize) + EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) + EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) + EVT_IDLE(wxFrame::OnIdle) + EVT_CLOSE(wxFrame::OnCloseWindow) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxDialog, wxPanel) + EVT_BUTTON(wxID_OK, wxDialog::OnOK) + EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) + EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) + EVT_CHAR_HOOK(wxDialog::OnCharHook) + EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) + EVT_CLOSE(wxDialog::OnCloseWindow) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) + EVT_CHAR(wxWindow::OnChar) + EVT_SIZE(wxWindow::Size) + EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) + EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) + EVT_INIT_DIALOG(wxWindow::OnInitDialog) + EVT_IDLE(wxWindow::OnIdle) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow) + EVT_SCROLL(wxScrolledWindow::OnScroll) + EVT_SIZE(wxScrolledWindow::OnSize) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxPanel, wxWindow) + EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) + EVT_CHAR(wxTextCtrl::OnChar) + EVT_DROP_FILES(wxTextCtrl::OnDropFiles) + EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) +END_EVENT_TABLE() + +#ifdef wx_msw +BEGIN_EVENT_TABLE(wxMDIParentWindow, wxFrame) + EVT_SIZE(wxMDIParentWindow::OnSize) + EVT_ACTIVATE(wxMDIParentWindow::OnActivate) + EVT_SYS_COLOUR_CHANGED(wxMDIParentWindow::OnSysColourChanged) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) + EVT_SCROLL(wxMDIClientWindow::OnScroll) +END_EVENT_TABLE() +#endif + +BEGIN_EVENT_TABLE(wxToolBarBase, wxControl) + EVT_SCROLL(wxToolBarBase::OnScroll) + EVT_SIZE(wxToolBarBase::OnSize) + EVT_IDLE(wxToolBarBase::OnIdle) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase) + EVT_SIZE(wxToolBarSimple::OnSize) + EVT_PAINT(wxToolBarSimple::OnPaint) + EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus) + EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent) +END_EVENT_TABLE() + +#ifdef wx_msw +BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) + EVT_SIZE(wxToolBarMSW::OnSize) + EVT_PAINT(wxToolBarMSW::OnPaint) + EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) + EVT_SIZE(wxToolBar95::OnSize) + EVT_PAINT(wxToolBar95::OnPaint) + EVT_KILL_FOCUS(wxToolBar95::OnKillFocus) + EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) + EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) +END_EVENT_TABLE() +#endif + +BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel) + EVT_SIZE(wxGenericGrid::OnSize) + EVT_PAINT(wxGenericGrid::OnPaint) + EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) + EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) + EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) + EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxControl, wxWindow) + EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground) +END_EVENT_TABLE() + +#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW +BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) + EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) + EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) + EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) + EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) + EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) + EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider) + EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) + EVT_PAINT(wxGenericColourDialog::OnPaint) + EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) + EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) + EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) + EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) + EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont) + EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) + EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) + EVT_PAINT(wxGenericFontDialog::OnPaint) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog) + EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK) + EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup) + EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange) +END_EVENT_TABLE() + +#endif + +BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) + EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) + EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) +END_EVENT_TABLE() + +#include "wx/prntbase.h" + +BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) + EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow) + EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose) + EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) + EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious) + EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext) + EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) +END_EVENT_TABLE() + +#endif + + +const wxSize wxDefaultSize(-1, -1); +const wxPoint wxDefaultPosition(-1, -1); diff --git a/src/qt/dc.cpp b/src/qt/dc.cpp new file mode 100644 index 0000000000..054ba0407c --- /dev/null +++ b/src/qt/dc.cpp @@ -0,0 +1,393 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dc.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "dc.h" +#endif + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#define mm2inches 0.0393700787402 +#define inches2mm 25.4 +#define mm2twips 56.6929133859 +#define twips2mm 0.0176388888889 +#define mm2pt 2.83464566929 +#define pt2mm 0.352777777778 + +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject) + +wxDC::wxDC(void) +{ + m_ok = FALSE; + m_optimize = FALSE; + m_autoSetting = FALSE; + m_colour = TRUE; + m_clipping = FALSE; + + m_mm_to_pix_x = 1.0; + m_mm_to_pix_y = 1.0; + + m_logicalOriginX = 0; + m_logicalOriginY = 0; + m_deviceOriginX = 0; + m_deviceOriginY = 0; + m_internalDeviceOriginX = 0; + m_internalDeviceOriginY = 0; + m_externalDeviceOriginX = 0; + m_externalDeviceOriginY = 0; + + m_logicalScaleX = 1.0; + m_logicalScaleY = 1.0; + m_userScaleX = 1.0; + m_userScaleY = 1.0; + m_scaleX = 1.0; + m_scaleY = 1.0; + + m_mappingMode = MM_TEXT; + m_needComputeScaleX = FALSE; + m_needComputeScaleY = FALSE; + + m_signX = 1; // default x-axis left to right + m_signY = 1; // default y-axis top down + + m_maxX = m_maxY = -100000; + m_minY = m_minY = 100000; + + m_logicalFunction = wxCOPY; +// m_textAlignment = wxALIGN_TOP_LEFT; + m_backgroundMode = wxTRANSPARENT; + + m_textForegroundColour = *wxBLACK; + m_textBackgroundColour = *wxWHITE; + m_pen = *wxBLACK_PEN; + m_font = *wxNORMAL_FONT; + m_brush = *wxTRANSPARENT_BRUSH; + m_backgroundBrush = *wxWHITE_BRUSH; + +// m_palette = wxAPP_COLOURMAP; +}; + +wxDC::~wxDC(void) +{ +}; + +void wxDC::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2), + double WXUNUSED(xc), double WXUNUSED(yc) ) +{ +}; + +void wxDC::DrawIcon( const wxIcon &WXUNUSED(icon), long WXUNUSED(x), long WXUNUSED(y), bool WXUNUSED(useMask) ) +{ +}; + +void wxDC::DrawPoint( wxPoint& point ) +{ + DrawPoint( point.x, point.y ); +}; + +void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle ) +{ + int n = list->Number(); + wxPoint *points = new wxPoint[n]; + + int i = 0; + for( wxNode *node = list->First(); node; node = node->Next() ) + { + wxPoint *point = (wxPoint *)node->Data(); + points[i].x = point->x; + points[i++].y = point->y; + }; + DrawPolygon( n, points, xoffset, yoffset, fillStyle ); + delete[] points; +}; + +void wxDC::DrawLines( wxList *list, long xoffset, long yoffset ) +{ + int n = list->Number(); + wxPoint *points = new wxPoint[n]; + + int i = 0; + for( wxNode *node = list->First(); node; node = node->Next() ) + { + wxPoint *point = (wxPoint *)node->Data(); + points[i].x = point->x; + points[i++].y = point->y; + }; + DrawLines( n, points, xoffset, yoffset ); + delete []points; +}; + +void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ) +{ + wxList list; + list.Append( (wxObject*)new wxPoint(x1, y1) ); + list.Append( (wxObject*)new wxPoint(x2, y2) ); + list.Append( (wxObject*)new wxPoint(x3, y3) ); + DrawSpline(&list); + wxNode *node = list.First(); + while (node) + { + wxPoint *p = (wxPoint*)node->Data(); + delete p; + node = node->Next(); + }; +}; + +void wxDC::DrawSpline( wxList *points ) +{ + DrawOpenSpline( points ); +}; + +void wxDC::DrawSpline( int n, wxPoint points[] ) +{ + wxList list; + for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] ); + DrawSpline( &list ); +}; + +void wxDC::SetClippingRegion( long x, long y, long width, long height ) +{ + m_clipping = TRUE; + m_clipX1 = x; + m_clipY1 = y; + m_clipX2 = x + width; + m_clipY2 = y + height; +}; + +void wxDC::DestroyClippingRegion(void) +{ + m_clipping = FALSE; +}; + +void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const +{ + if (m_clipping) + { + if (x) *x = m_clipX1; + if (y) *y = m_clipY1; + if (width) *width = (m_clipX2 - m_clipX1); + if (height) *height = (m_clipY2 - m_clipY1); + } + else + *x = *y = *width = *height = 0; +}; + +void wxDC::GetSize( int* width, int* height ) const +{ + *width = m_maxX-m_minX; + *height = m_maxY-m_minY; +}; + +void wxDC::GetSizeMM( long* width, long* height ) const +{ + int w = 0; + int h = 0; + GetSize( &w, &h ); + *width = long( double(w) / (m_scaleX*m_mm_to_pix_x) ); + *height = long( double(h) / (m_scaleY*m_mm_to_pix_y) ); +}; + +void wxDC::SetTextForeground( const wxColour &col ) +{ + if (!Ok()) return; + m_textForegroundColour = col; +}; + +void wxDC::SetTextBackground( const wxColour &col ) +{ + if (!Ok()) return; + m_textBackgroundColour = col; +}; + +void wxDC::SetMapMode( int mode ) +{ + switch (mode) + { + case MM_TWIPS: + SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y ); + break; + case MM_POINTS: + SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y ); + break; + case MM_METRIC: + SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y ); + break; + case MM_LOMETRIC: + SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 ); + break; + default: + case MM_TEXT: + SetLogicalScale( 1.0, 1.0 ); + break; + }; + if (mode != MM_TEXT) + { + m_needComputeScaleX = TRUE; + m_needComputeScaleY = TRUE; + }; +}; + +void wxDC::SetUserScale( double x, double y ) +{ + // allow negative ? -> no + m_userScaleX = x; + m_userScaleY = y; + ComputeScaleAndOrigin(); +}; + +void wxDC::GetUserScale( double *x, double *y ) +{ + if (x) *x = m_userScaleX; + if (y) *y = m_userScaleY; +}; + +void wxDC::SetLogicalScale( double x, double y ) +{ + // allow negative ? + m_logicalScaleX = x; + m_logicalScaleY = y; + ComputeScaleAndOrigin(); +}; + +void wxDC::GetLogicalScale( double *x, double *y ) +{ + if (x) *x = m_logicalScaleX; + if (y) *y = m_logicalScaleY; +}; + +void wxDC::SetLogicalOrigin( long x, long y ) +{ + m_logicalOriginX = x * m_signX; // is this still correct ? + m_logicalOriginY = y * m_signY; + ComputeScaleAndOrigin(); +}; + +void wxDC::GetLogicalOrigin( long *x, long *y ) +{ + if (x) *x = m_logicalOriginX; + if (y) *y = m_logicalOriginY; +}; + +void wxDC::SetDeviceOrigin( long x, long y ) +{ + m_externalDeviceOriginX = x; + m_externalDeviceOriginY = y; + ComputeScaleAndOrigin(); +}; + +void wxDC::GetDeviceOrigin( long *x, long *y ) +{ +// if (x) *x = m_externalDeviceOriginX; +// if (y) *y = m_externalDeviceOriginY; + if (x) *x = m_deviceOriginX; + if (y) *y = m_deviceOriginY; +}; + +void wxDC::SetInternalDeviceOrigin( long x, long y ) +{ + m_internalDeviceOriginX = x; + m_internalDeviceOriginY = y; + ComputeScaleAndOrigin(); +}; + +void wxDC::GetInternalDeviceOrigin( long *x, long *y ) +{ + if (x) *x = m_internalDeviceOriginX; + if (y) *y = m_internalDeviceOriginY; +}; + +void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) +{ + m_signX = (xLeftRight ? 1 : -1); + m_signY = (yBottomUp ? -1 : 1); + ComputeScaleAndOrigin(); +}; + +long wxDC::DeviceToLogicalX(long x) const +{ + return XDEV2LOG(x); +}; + +long wxDC::DeviceToLogicalY(long y) const +{ + return YDEV2LOG(y); +}; + +long wxDC::DeviceToLogicalXRel(long x) const +{ + return XDEV2LOGREL(x); +}; + +long wxDC::DeviceToLogicalYRel(long y) const +{ + return YDEV2LOGREL(y); +}; + +long wxDC::LogicalToDeviceX(long x) const +{ + return XLOG2DEV(x); +}; + +long wxDC::LogicalToDeviceY(long y) const +{ + return YLOG2DEV(y); +}; + +long wxDC::LogicalToDeviceXRel(long x) const +{ + return XLOG2DEVREL(x); +}; + +long wxDC::LogicalToDeviceYRel(long y) const +{ + return YLOG2DEVREL(y); +}; + +void wxDC::CalcBoundingBox( long x, long y ) +{ + if (x < m_minX) m_minX = x; + if (y < m_minY) m_minY = y; + if (x > m_maxX) m_maxX = x; + if (y > m_maxY) m_maxY = y; +}; + +void wxDC::ComputeScaleAndOrigin(void) +{ + // CMB: copy scale to see if it changes + double origScaleX = m_scaleX; + double origScaleY = m_scaleY; + + m_scaleX = m_logicalScaleX * m_userScaleX; + m_scaleY = m_logicalScaleY * m_userScaleY; + + m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX; + m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY; + + // CMB: if scale has changed call SetPen to recalulate the line width + if (m_scaleX != origScaleX || m_scaleY != origScaleY) + { + // this is a bit artificial, but we need to force wxDC to think + // the pen has changed + wxPen* pen = GetPen(); + wxPen tempPen; + m_pen = tempPen; + SetPen(pen); + } +}; + diff --git a/src/qt/dcclient.cpp b/src/qt/dcclient.cpp new file mode 100644 index 0000000000..3428a3e1f7 --- /dev/null +++ b/src/qt/dcclient.cpp @@ -0,0 +1,627 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcclient.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "dcclient.h" +#endif + +#include "wx/dcclient.h" +#include "wx/dcmemory.h" +#include + +//----------------------------------------------------------------------------- +// local data +//----------------------------------------------------------------------------- + +#include "bdiag.xbm" +#include "fdiag.xbm" +#include "cdiag.xbm" +#include "horiz.xbm" +#include "verti.xbm" +#include "cross.xbm" +#define num_hatches 6 + + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#define RAD2DEG 57.2957795131 + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC) + +wxPaintDC::wxPaintDC(void) +{ +}; + +wxPaintDC::wxPaintDC( wxWindow *window ) +{ +}; + +wxPaintDC::~wxPaintDC(void) +{ +}; + +void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), + wxColour *WXUNUSED(col), int WXUNUSED(style) ) +{ +}; + +bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const +{ + return FALSE; +}; + +void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 ) +{ + if (!Ok()) return; + +}; + +void wxPaintDC::CrossHair( long x, long y ) +{ + if (!Ok()) return; + +}; + +void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ) +{ + if (!Ok()) return; + + long xx1 = XLOG2DEV(x1); + long yy1 = YLOG2DEV(y1); + long xx2 = XLOG2DEV(x2); + long yy2 = YLOG2DEV(y2); + long xxc = XLOG2DEV((long)xc); + long yyc = YLOG2DEV((long)yc); + double dx = xx1 - xxc; + double dy = yy1 - yyc; + double radius = sqrt(dx*dx+dy*dy); + long r = (long)radius; + double radius1, radius2; + + if (xx1 == xx2 && yy1 == yy2) + { + radius1 = 0.0; + radius2 = 360.0; + } + else + if (radius == 0.0) + { + radius1 = radius2 = 0.0; + } + else + { + radius1 = (xx1 - xxc == 0) ? + (yy1 - yyc < 0) ? 90.0 : -90.0 : + -atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG; + radius2 = (xx2 - xxc == 0) ? + (yy2 - yyc < 0) ? 90.0 : -90.0 : + -atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG; + }; + long alpha1 = long(radius1 * 64.0); + long alpha2 = long((radius2 - radius1) * 64.0); + while (alpha2 <= 0) alpha2 += 360*64; + while (alpha1 > 360*64) alpha1 -= 360*64; + + if (m_brush.GetStyle() != wxTRANSPARENT) {}; + + if (m_pen.GetStyle() != wxTRANSPARENT) {}; + +}; + +void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) +{ + if (!Ok()) return; + + long xx = XLOG2DEV(x); + long yy = YLOG2DEV(y); + long ww = m_signX * XLOG2DEVREL(width); + long hh = m_signY * YLOG2DEVREL(height); + + // CMB: handle -ve width and/or height + if (ww < 0) { ww = -ww; xx = xx - ww; } + if (hh < 0) { hh = -hh; yy = yy - hh; } + + long start = long(sa * 64.0); + long end = long(ea * 64.0); + if (m_brush.GetStyle() != wxTRANSPARENT) {}; + + if (m_pen.GetStyle() != wxTRANSPARENT) {}; +}; + +void wxPaintDC::DrawPoint( long x, long y ) +{ + if (!Ok()) return; + + if (m_pen.GetStyle() != wxTRANSPARENT) {}; +}; + +void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) +{ + if (!Ok()) return; + + if (m_pen.GetStyle() == wxTRANSPARENT) return; + + for (int i = 0; i < n-1; i++) + { + long x1 = XLOG2DEV(points[i].x + xoffset); + long x2 = XLOG2DEV(points[i+1].x + xoffset); + long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste + long y2 = YLOG2DEV(points[i+1].y + yoffset); + }; +}; + +void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset ) +{ + if (!Ok()) return; + + if (m_pen.GetStyle() == wxTRANSPARENT) return; + + wxNode *node = points->First(); + while (node->Next()) + { + wxPoint *point = (wxPoint*)node->Data(); + wxPoint *npoint = (wxPoint*)node->Next()->Data(); + long x1 = XLOG2DEV(point->x + xoffset); + long x2 = XLOG2DEV(npoint->x + xoffset); + long y1 = YLOG2DEV(point->y + yoffset); // and again... + long y2 = YLOG2DEV(npoint->y + yoffset); + node = node->Next(); + }; +}; + +void wxPaintDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[], + long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) ) +{ + if (!Ok()) return; +}; + +void wxPaintDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset), + long WXUNUSED(yoffset), int WXUNUSED(fillStyle) ) +{ + if (!Ok()) return; +}; + +void wxPaintDC::DrawRectangle( long x, long y, long width, long height ) +{ + if (!Ok()) return; + + long xx = XLOG2DEV(x); + long yy = YLOG2DEV(y); + long ww = m_signX * XLOG2DEVREL(width); + long hh = m_signY * YLOG2DEVREL(height); + + // CMB: draw nothing if transformed w or h is 0 + if (ww == 0 || hh == 0) return; + + // CMB: handle -ve width and/or height + if (ww < 0) { ww = -ww; xx = xx - ww; } + if (hh < 0) { hh = -hh; yy = yy - hh; } + + if (m_brush.GetStyle() != wxTRANSPARENT) {}; + + if (m_pen.GetStyle() != wxTRANSPARENT) {}; +}; + +void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius ) +{ + if (!Ok()) return; + + if (radius < 0.0) radius = - radius * ((width < height) ? width : height); + + long xx = XLOG2DEV(x); + long yy = YLOG2DEV(y); + long ww = m_signX * XLOG2DEVREL(width); + long hh = m_signY * YLOG2DEVREL(height); + long rr = XLOG2DEVREL((long)radius); + + // CMB: handle -ve width and/or height + if (ww < 0) { ww = -ww; xx = xx - ww; } + if (hh < 0) { hh = -hh; yy = yy - hh; } + + // CMB: if radius is zero use DrawRectangle() instead to avoid + // X drawing errors with small radii + if (rr == 0) + { + DrawRectangle( x, y, width, height ); + return; + } + + // CMB: draw nothing if transformed w or h is 0 + if (ww == 0 || hh == 0) return; + + // CMB: adjust size if outline is drawn otherwise the result is + // 1 pixel too wide and high + if (m_pen.GetStyle() != wxTRANSPARENT) + { + ww--; + hh--; + } + + // CMB: ensure dd is not larger than rectangle otherwise we + // get an hour glass shape + long dd = 2 * rr; + if (dd > ww) dd = ww; + if (dd > hh) dd = hh; + rr = dd / 2; + + if (m_brush.GetStyle() != wxTRANSPARENT) + { + }; + + if (m_pen.GetStyle() != wxTRANSPARENT) + { + }; +}; + +void wxPaintDC::DrawEllipse( long x, long y, long width, long height ) +{ + if (!Ok()) return; + + long xx = XLOG2DEV(x); + long yy = YLOG2DEV(y); + long ww = m_signX * XLOG2DEVREL(width); + long hh = m_signY * YLOG2DEVREL(height); + + // CMB: handle -ve width and/or height + if (ww < 0) { ww = -ww; xx = xx - ww; } + if (hh < 0) { hh = -hh; yy = yy - hh; } + + if (m_brush.GetStyle() != wxTRANSPARENT) {}; + + if (m_pen.GetStyle() != wxTRANSPARENT) {}; +}; + +bool wxPaintDC::CanDrawBitmap(void) const +{ + return TRUE; +}; + +void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) +{ + if (!Ok()) return; + + if (!icon.Ok()) return; + + int xx = XLOG2DEV(x); + int yy = YLOG2DEV(y); + +}; + +bool wxPaintDC::Blit( long xdest, long ydest, long width, long height, + wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) ) +{ + if (!Ok()) return FALSE; + + // CMB 20/5/98: add blitting of bitmaps + if (source->IsKindOf(CLASSINFO(wxMemoryDC))) + { + wxMemoryDC* srcDC = (wxMemoryDC*)source; + /* + GdkBitmap* bmap = srcDC->m_selected.GetBitmap(); + if (bmap) + { + gdk_draw_bitmap ( + m_window, + m_textGC, + bmap, + source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc), + XLOG2DEV(xdest), YLOG2DEV(ydest), + source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height) + ); + return TRUE; + } + */ + } + + return TRUE; +}; + +void wxPaintDC::DrawText( const wxString &text, long x, long y, bool +WXUNUSED(use16) ) +{ + if (!Ok()) return; + +}; + + + +bool wxPaintDC::CanGetTextExtent(void) const +{ + return TRUE; +}; + +void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height, + long *WXUNUSED(descent), long *WXUNUSED(externalLeading), + wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) ) +{ + if (!Ok()) return; + +}; + +long wxPaintDC::GetCharWidth(void) +{ + if (!Ok()) return 0; + +}; + +long wxPaintDC::GetCharHeight(void) +{ + if (!Ok()) return 0; + +}; + +void wxPaintDC::Clear(void) +{ + if (!Ok()) return; + +}; + +void wxPaintDC::SetFont( const wxFont &font ) +{ + if (!Ok()) return; + + m_font = font; +}; + +void wxPaintDC::SetPen( const wxPen &pen ) +{ + if (!Ok()) return; + + if (m_pen == pen) return; + + m_pen = pen; + + if (!m_pen.Ok()) return; +}; + +void wxPaintDC::SetBrush( const wxBrush &brush ) +{ + if (!Ok()) return; + + if (m_brush == brush) return; + + m_brush = brush; + + if (!m_brush.Ok()) return; + +}; + +void wxPaintDC::SetBackground( const wxBrush &brush ) +{ + if (!Ok()) return; + + if (m_backgroundBrush == brush) return; + + m_backgroundBrush = brush; + + if (!m_backgroundBrush.Ok()) return; + +}; + +void wxPaintDC::SetLogicalFunction( int function ) +{ + if (m_logicalFunction == function) return; +}; + +void wxPaintDC::SetTextForeground( const wxColour &col ) +{ + if (!Ok()) return; + + if (m_textForegroundColour == col) return; + + m_textForegroundColour = col; + if (!m_textForegroundColour.Ok()) return; +}; + +void wxPaintDC::SetTextBackground( const wxColour &col ) +{ + if (!Ok()) return; + + if (m_textBackgroundColour == col) return; + + m_textBackgroundColour = col; + if (!m_textBackgroundColour.Ok()) return; +}; + +void wxPaintDC::SetBackgroundMode( int mode ) +{ + m_backgroundMode = mode; + + if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT) + { + } +}; + +void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) ) +{ +}; + +void wxPaintDC::SetClippingRegion( long x, long y, long width, long height ) +{ + wxDC::SetClippingRegion( x, y, width, height ); + +}; + +void wxPaintDC::DestroyClippingRegion(void) +{ + wxDC::DestroyClippingRegion(); + +}; + +// ----------------------------------- spline code ---------------------------------------- + +void wx_quadratic_spline(double a1, double b1, double a2, double b2, + double a3, double b3, double a4, double b4); +void wx_clear_stack(void); +int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3, + double *y3, double *x4, double *y4); +void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, + double x4, double y4); +static bool wx_spline_add_point(double x, double y); +static void wx_spline_draw_point_array(wxDC *dc); + +wxList wx_spline_point_list; + +#define half(z1, z2) ((z1+z2)/2.0) +#define THRESHOLD 5 + +/* iterative version */ + +void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4, + double b4) +{ + register double xmid, ymid; + double x1, y1, x2, y2, x3, y3, x4, y4; + + wx_clear_stack(); + wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4); + + while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) { + xmid = (double)half(x2, x3); + ymid = (double)half(y2, y3); + if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD && + fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) { + wx_spline_add_point( x1, y1 ); + wx_spline_add_point( xmid, ymid ); + } else { + wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3), + (double)half(x3, x4), (double)half(y3, y4), x4, y4); + wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2), + (double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid); + } + } +} + +/* utilities used by spline drawing routines */ + +typedef struct wx_spline_stack_struct { + double x1, y1, x2, y2, x3, y3, x4, y4; +} Stack; + +#define SPLINE_STACK_DEPTH 20 +static Stack wx_spline_stack[SPLINE_STACK_DEPTH]; +static Stack *wx_stack_top; +static int wx_stack_count; + +void wx_clear_stack(void) +{ + wx_stack_top = wx_spline_stack; + wx_stack_count = 0; +} + +void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) +{ + wx_stack_top->x1 = x1; + wx_stack_top->y1 = y1; + wx_stack_top->x2 = x2; + wx_stack_top->y2 = y2; + wx_stack_top->x3 = x3; + wx_stack_top->y3 = y3; + wx_stack_top->x4 = x4; + wx_stack_top->y4 = y4; + wx_stack_top++; + wx_stack_count++; +} + +int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, + double *x3, double *y3, double *x4, double *y4) +{ + if (wx_stack_count == 0) + return (0); + wx_stack_top--; + wx_stack_count--; + *x1 = wx_stack_top->x1; + *y1 = wx_stack_top->y1; + *x2 = wx_stack_top->x2; + *y2 = wx_stack_top->y2; + *x3 = wx_stack_top->x3; + *y3 = wx_stack_top->y3; + *x4 = wx_stack_top->x4; + *y4 = wx_stack_top->y4; + return (1); +} + +static bool wx_spline_add_point(double x, double y) +{ + wxPoint *point = new wxPoint ; + point->x = (int) x; + point->y = (int) y; + wx_spline_point_list.Append((wxObject*)point); + return TRUE; +} + +static void wx_spline_draw_point_array(wxDC *dc) +{ + dc->DrawLines(&wx_spline_point_list, 0, 0 ); + wxNode *node = wx_spline_point_list.First(); + while (node) + { + wxPoint *point = (wxPoint *)node->Data(); + delete point; + delete node; + node = wx_spline_point_list.First(); + } +} + +void wxPaintDC::DrawOpenSpline( wxList *points ) +{ + wxPoint *p; + double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; + double x1, y1, x2, y2; + + wxNode *node = points->First(); + p = (wxPoint *)node->Data(); + + x1 = p->x; + y1 = p->y; + + node = node->Next(); + p = (wxPoint *)node->Data(); + + x2 = p->x; + y2 = p->y; + cx1 = (double)((x1 + x2) / 2); + cy1 = (double)((y1 + y2) / 2); + cx2 = (double)((cx1 + x2) / 2); + cy2 = (double)((cy1 + y2) / 2); + + wx_spline_add_point(x1, y1); + + while ((node = node->Next()) != NULL) + { + p = (wxPoint *)node->Data(); + x1 = x2; + y1 = y2; + x2 = p->x; + y2 = p->y; + cx4 = (double)(x1 + x2) / 2; + cy4 = (double)(y1 + y2) / 2; + cx3 = (double)(x1 + cx4) / 2; + cy3 = (double)(y1 + cy4) / 2; + + wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4); + + cx1 = cx4; + cy1 = cy4; + cx2 = (double)(cx1 + x2) / 2; + cy2 = (double)(cy1 + y2) / 2; + } + + wx_spline_add_point( cx1, cy1 ); + wx_spline_add_point( x2, y2 ); + + wx_spline_draw_point_array( this ); +}; diff --git a/src/qt/dcmemory.cpp b/src/qt/dcmemory.cpp new file mode 100644 index 0000000000..c08eb72476 --- /dev/null +++ b/src/qt/dcmemory.cpp @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcmemory.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "dcmemory.h" +#endif + +#include "wx/dcmemory.h" + +//----------------------------------------------------------------------------- +// wxMemoryDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) + +wxMemoryDC::wxMemoryDC(void) +{ + m_ok = FALSE; +}; + +wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) +{ + m_ok = FALSE; +}; + +wxMemoryDC::~wxMemoryDC(void) +{ +}; + +void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) +{ + m_selected = bitmap; + if (m_selected.Ok()) + { + } + else + { + m_ok = FALSE; + }; +}; + +void wxMemoryDC::GetSize( int *width, int *height ) const +{ + if (m_selected.Ok()) + { + if (width) (*width) = m_selected.GetWidth(); + if (height) (*height) = m_selected.GetHeight(); + } + else + { + if (width) (*width) = 0; + if (height) (*height) = 0; + }; +}; + + diff --git a/src/qt/dcscreen.cpp b/src/qt/dcscreen.cpp new file mode 100644 index 0000000000..cb263fc426 --- /dev/null +++ b/src/qt/dcscreen.cpp @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcscreen.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "dcscreen.h" +#endif + +#include "wx/dcscreen.h" +#include "wx/window.h" + +//----------------------------------------------------------------------------- +// wxScreenDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC) + +wxScreenDC::wxScreenDC(void) +{ + m_ok = FALSE; +}; + +wxScreenDC::~wxScreenDC(void) +{ + EndDrawingOnTop(); +}; + +bool wxScreenDC::StartDrawingOnTop( wxWindow *WXUNUSED(window) ) +{ + return TRUE; +}; + +bool wxScreenDC::StartDrawingOnTop( wxRectangle *WXUNUSED(rect) ) +{ + return TRUE; +}; + +bool wxScreenDC::EndDrawingOnTop(void) +{ + return TRUE; +}; diff --git a/src/qt/dialog.cpp b/src/qt/dialog.cpp new file mode 100644 index 0000000000..dffc5f64a9 --- /dev/null +++ b/src/qt/dialog.cpp @@ -0,0 +1,191 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dialog.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "dialog.h" +#endif + +#include "wx/dialog.h" +#include "wx/frame.h" +#include "wx/app.h" + +//----------------------------------------------------------------------------- + +extern wxList wxPendingDelete; + +//----------------------------------------------------------------------------- +// wxDialog +//----------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(wxDialog,wxWindow) + EVT_BUTTON (wxID_OK, wxDialog::OnOk) + EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel) + EVT_BUTTON (wxID_APPLY, wxDialog::OnApply) + EVT_CLOSE (wxDialog::OnCloseWindow) +END_EVENT_TABLE() + +IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxWindow) + +wxDialog::wxDialog(void) +{ + m_title = ""; + m_modalShowing = FALSE; + wxTopLevelWindows.Insert( this ); +}; + +wxDialog::wxDialog( wxWindow *parent, + wxWindowID id, const wxString &title, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + m_modalShowing = FALSE; + wxTopLevelWindows.Insert( this ); + Create( parent, id, title, pos, size, style, name ); +}; + +bool wxDialog::Create( wxWindow *parent, + wxWindowID id, const wxString &title, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + return TRUE; +}; + +wxDialog::~wxDialog(void) +{ + wxTopLevelWindows.DeleteObject( this ); + if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop(); +}; + +void wxDialog::SetTitle(const wxString& title ) +{ + m_title = title; +}; + +wxString wxDialog::GetTitle(void) const +{ + return (wxString&)m_title; +}; + +void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) ) +{ + if (Validate()) TransferDataFromWindow(); +}; + +void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) ) +{ + if (IsModal()) + { + EndModal(wxID_CANCEL); + } + else + { + SetReturnCode(wxID_CANCEL); + this->Show(FALSE); + }; +}; + +void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) ) +{ + if ( Validate() && TransferDataFromWindow()) + { + if (IsModal()) + { + EndModal(wxID_OK); + } + else + { + SetReturnCode(wxID_OK); + this->Show(FALSE); + }; + }; +}; + +void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) ) +{ + // yes +}; + +bool wxDialog::OnClose(void) +{ + static wxList closing; + + if (closing.Member(this)) return FALSE; // no loops + + closing.Append(this); + + wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); + cancelEvent.SetEventObject( this ); + GetEventHandler()->ProcessEvent(cancelEvent); + closing.DeleteObject(this); + + return FALSE; +} + +bool wxDialog::Destroy(void) +{ + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + return TRUE; +} + +void wxDialog::OnCloseWindow(wxCloseEvent& event) +{ + if (GetEventHandler()->OnClose() || event.GetForce()) + { + this->Destroy(); + }; +}; + +bool wxDialog::Show( bool show ) +{ + if (!show && IsModal() && m_modalShowing) + { + EndModal( wxID_CANCEL ); + }; + + wxWindow::Show( show ); + + if (show) InitDialog(); + + return TRUE; +}; + +int wxDialog::ShowModal(void) +{ + if (m_modalShowing) return GetReturnCode(); + + Show( TRUE ); + + m_modalShowing = TRUE; + + // grab here + // main here + // release here + + return GetReturnCode(); +}; + +void wxDialog::EndModal( int retCode ) +{ + SetReturnCode( retCode ); + + if (!m_modalShowing) return; + m_modalShowing = FALSE; + + // quit main +}; + +void wxDialog::InitDialog(void) +{ + wxWindow::InitDialog(); +}; + diff --git a/src/qt/dnd.cpp b/src/qt/dnd.cpp new file mode 100644 index 0000000000..dd7a204423 --- /dev/null +++ b/src/qt/dnd.cpp @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: dnd.cpp +// Purpose: wxDropTarget class +// Author: Robert Roebling +// Copyright: Robert Roebling +// Licence: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "dnd.h" +#endif + +#include "wx/dnd.h" +#include "wx/window.h" +#include "wx/app.h" +#include "wx/gdicmn.h" + +// ---------------------------------------------------------------------------- +// global +// ---------------------------------------------------------------------------- + +extern bool g_blockEventsOnDrag; + +// ---------------------------------------------------------------------------- +// wxDropTarget +// ---------------------------------------------------------------------------- + +wxDropTarget::wxDropTarget() +{ +}; + +wxDropTarget::~wxDropTarget() +{ +}; + +// ---------------------------------------------------------------------------- +// wxTextDropTarget +// ---------------------------------------------------------------------------- + +bool wxTextDropTarget::OnDrop( long x, long y, const void *pData ) +{ + OnDropText( x, y, (const char*)pData ); + return TRUE; +}; + +bool wxTextDropTarget::OnDropText( long x, long y, const char *psz ) +{ + printf( "Got dropped text: %s.\n", psz ); + printf( "At x: %d, y: %d.\n", (int)x, (int)y ); + return TRUE; +}; + +size_t wxTextDropTarget::GetFormatCount() const +{ + return 1; +} + +wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const +{ + return wxDF_TEXT; +} + +// ---------------------------------------------------------------------------- +// wxFileDropTarget +// ---------------------------------------------------------------------------- + +bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] ) +{ + printf( "Got %d dropped files.\n", (int)nFiles ); + printf( "At x: %d, y: %d.\n", (int)x, (int)y ); + return TRUE; +} + +bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) ) +{ + char *str = "/this/is/a/path.txt"; + + return OnDropFiles(x, y, 1, &str ); +} + +size_t wxFileDropTarget::GetFormatCount() const +{ + return 1; +} + +wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const +{ + return wxDF_FILENAME; +} + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +wxDropSource::wxDropSource( wxWindow *WXUNUSED(win) ) +{ + g_blockEventsOnDrag = TRUE; +}; + +wxDropSource::wxDropSource( wxDataObject &data, wxWindow *WXUNUSED(win) ) +{ + g_blockEventsOnDrag = TRUE; + + m_data = &data; +}; + +void wxDropSource::SetData( wxDataObject &data ) +{ + m_data = &data; +}; + +wxDropSource::~wxDropSource(void) +{ +// if (m_data) delete m_data; + + g_blockEventsOnDrag = FALSE; +}; + +wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) ) +{ + return Copy; +}; + diff --git a/src/qt/fdiag.xbm b/src/qt/fdiag.xbm new file mode 100644 index 0000000000..67d3b4732a --- /dev/null +++ b/src/qt/fdiag.xbm @@ -0,0 +1,6 @@ +#define fdiag_width 16 +#define fdiag_height 16 +static char fdiag_bits[] = { + 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, + 0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, + 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80}; diff --git a/src/qt/filedlg.cpp b/src/qt/filedlg.cpp new file mode 100644 index 0000000000..c8b6e78720 --- /dev/null +++ b/src/qt/filedlg.cpp @@ -0,0 +1,125 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: filedlg.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "filedlg.h" +#endif + +#include "wx/filedlg.h" +#include "wx/utils.h" +#include "wx/intl.h" +#include "wx/generic/msgdlgg.h" + +//----------------------------------------------------------------------------- +// wxFileDialog +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog) + +wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, + const wxString& defaultDir, const wxString& defaultFileName, + const wxString& wildCard, + long style, const wxPoint& pos ) +{ + m_message = message; + m_path = ""; + m_fileName = defaultFileName; + m_dir = defaultDir; + m_wildCard = wildCard; + m_dialogStyle = style; + m_filterIndex = 1; + + m_path.Append(m_dir); + if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); + m_path.Append(m_fileName); + +}; + +int wxFileDialog::ShowModal(void) +{ + int ret = wxDialog::ShowModal(); + + if (ret == wxID_OK) + { + }; + return ret; +}; + + +char *wxFileSelector(const char *title, + const char *defaultDir, const char *defaultFileName, + const char *defaultExtension, const char *filter, int flags, + wxWindow *parent, int x, int y) +{ + wxString filter2(""); + if ( defaultExtension && !filter ) + filter2 = wxString("*.") + wxString(defaultExtension) ; + else if ( filter ) + filter2 = filter; + + wxString defaultDirString; + if (defaultDir) + defaultDirString = defaultDir; + else + defaultDirString = ""; + + wxString defaultFilenameString; + if (defaultFileName) + defaultFilenameString = defaultFileName; + else + defaultFilenameString = ""; + + wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, + filter2, flags, wxPoint(x, y)); + + if ( fileDialog.ShowModal() == wxID_OK ) + { + strcpy(wxBuffer, (const char *)fileDialog.GetPath()); + return wxBuffer; + } + else + return NULL; +}; + +char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name, + wxWindow *parent ) +{ + char *ext = (char *)extension; + + char prompt[50]; + wxString str = _("Load %s file"); + sprintf(prompt, str, what); + + if (*ext == '.') ext++; + char wild[60]; + sprintf(wild, "*.%s", ext); + + return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent); +}; + +char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name, + wxWindow *parent ) +{ + char *ext = (char *)extension; + + char prompt[50]; + wxString str = _("Save %s file"); + sprintf(prompt, str, what); + + if (*ext == '.') ext++; + char wild[60]; + sprintf(wild, "*.%s", ext); + + return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent); +}; + + + + diff --git a/src/qt/font.cpp b/src/qt/font.cpp new file mode 100644 index 0000000000..87c13dac55 --- /dev/null +++ b/src/qt/font.cpp @@ -0,0 +1,213 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: font.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "font.h" +#endif + +#include "wx/font.h" +#include "wx/utils.h" +#include + +//----------------------------------------------------------------------------- +// local data +//----------------------------------------------------------------------------- + +static char *wx_font_family [] = { + "wxDEFAULT", "wxDECORATIVE", "wxMODERN", "wxROMAN", "wxSCRIPT", + "wxSWISS", "wxTELETYPE", +}; +static char *wx_font_style [] = { + "wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC", +}; +static char *wx_font_weight [] = { + "wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT", +}; + +extern wxFontNameDirectory wxTheFontNameDirectory; + +//----------------------------------------------------------------------------- +// wxFont +//----------------------------------------------------------------------------- + +class wxFontRefData: public wxObjectRefData +{ + public: + + wxFontRefData(void); + ~wxFontRefData(void); + + wxList m_scaled_xfonts; + int m_pointSize; + int m_family, m_style, m_weight; + bool m_underlined; + int m_fontId; + char* m_faceName; + +}; + +wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER) +{ + m_pointSize = -1; + m_family = -1; + m_style = -1; + m_weight = -1; + m_underlined = FALSE; + m_fontId = 0; + m_faceName = NULL; +}; + +wxFontRefData::~wxFontRefData(void) +{ + wxNode *node = m_scaled_xfonts.First(); + while (node) + { + wxNode *next = node->Next(); + node = next; + }; + if (m_faceName) + { + delete m_faceName; + m_faceName = NULL; + }; +}; + +//----------------------------------------------------------------------------- + +#define M_FONTDATA ((wxFontRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) + +wxFont::wxFont(void) +{ + if (wxTheFontList) wxTheFontList->Append( this ); +}; + +wxFont::wxFont( char *xFontName ) +{ + if (!xFontName) return; + + m_refData = new wxFontRefData(); + +}; + +wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight, + bool Underlined, const char* Face) +{ + m_refData = new wxFontRefData(); + + + if (wxTheFontList) wxTheFontList->Append( this ); +}; + +wxFont::wxFont(int PointSize, const char *Face, int Family, int Style, + int Weight, bool Underlined) +{ + m_refData = new wxFontRefData(); + + + if (wxTheFontList) wxTheFontList->Append( this ); +}; + +wxFont::wxFont( const wxFont& font ) +{ + Ref( font ); +}; + +wxFont::wxFont( const wxFont* font ) +{ + UnRef(); + if (font) Ref( *font ); +}; + +wxFont::~wxFont(void) +{ + if (wxTheFontList) wxTheFontList->DeleteObject( this ); +}; + +wxFont& wxFont::operator = ( const wxFont& font ) +{ + if (*this == font) return (*this); + Ref( font ); + return *this; +}; + +bool wxFont::operator == ( const wxFont& font ) +{ + return m_refData == font.m_refData; +}; + +bool wxFont::operator != ( const wxFont& font ) +{ + return m_refData != font.m_refData; +}; + +bool wxFont::Ok() +{ + return (m_refData != NULL); +}; + +int wxFont::GetPointSize(void) const +{ + return M_FONTDATA->m_pointSize; +}; + +wxString wxFont::GetFaceString(void) const +{ + return ""; +}; + +wxString wxFont::GetFaceName(void) const +{ + return ""; +}; + +int wxFont::GetFamily(void) const +{ + return M_FONTDATA->m_family; +}; + +wxString wxFont::GetFamilyString(void) const +{ + wxString s = wx_font_family[M_FONTDATA->m_family]; + return s; +}; + +int wxFont::GetFontId(void) const +{ + return M_FONTDATA->m_fontId; // stub +}; + +int wxFont::GetStyle(void) const +{ + return M_FONTDATA->m_style; +}; + +wxString wxFont::GetStyleString(void) const +{ + wxString s = wx_font_style[M_FONTDATA->m_style]; + return s; +}; + +int wxFont::GetWeight(void) const +{ + return M_FONTDATA->m_weight; +}; + +wxString wxFont::GetWeightString(void) const +{ + wxString s = wx_font_weight[M_FONTDATA->m_weight]; + return s; +}; + +bool wxFont::GetUnderlined(void) const +{ + return M_FONTDATA->m_underlined; +}; diff --git a/src/qt/frame.cpp b/src/qt/frame.cpp new file mode 100644 index 0000000000..132a11bf55 --- /dev/null +++ b/src/qt/frame.cpp @@ -0,0 +1,252 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: frame.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "frame.h" +#endif + +#include "wx/frame.h" +#include "wx/dialog.h" +#include "wx/control.h" +#include "wx/app.h" +#include "wx/menu.h" +#include "wx/toolbar.h" +#include "wx/statusbr.h" +#include "wx/mdi.h" + +const wxMENU_HEIGHT = 28; +const wxSTATUS_HEIGHT = 25; + +extern wxList wxTopLevelWindows; +extern wxList wxPendingDelete; + +//----------------------------------------------------------------------------- +// wxFrame +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(wxFrame, wxWindow) + EVT_SIZE(wxFrame::OnSize) + EVT_CLOSE(wxFrame::OnCloseWindow) + EVT_IDLE(wxFrame::OnIdle) +END_EVENT_TABLE() + +IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow) + +wxFrame::wxFrame() +{ + wxTopLevelWindows.Insert( this ); +}; + +wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, title, pos, size, style, name ); + wxTopLevelWindows.Insert( this ); +}; + +bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + m_title = title; + + return TRUE; +}; + +wxFrame::~wxFrame() +{ + if (m_frameMenuBar) delete m_frameMenuBar; + if (m_frameStatusBar) delete m_frameStatusBar; + + wxTopLevelWindows.DeleteObject( this ); + if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop(); +}; + +bool wxFrame::Show( bool show ) +{ + if (show) + { + wxSizeEvent event( wxSize(m_width,m_height), GetId() ); + ProcessEvent( event ); + }; + return wxWindow::Show( show ); +}; + +void wxFrame::Enable( bool enable ) +{ + wxWindow::Enable( enable ); +}; + +void wxFrame::OnCloseWindow( wxCloseEvent &event ) +{ + if ( GetEventHandler()->OnClose() || event.GetForce()) + { + this->Destroy(); + } +}; + +bool wxFrame::Destroy() +{ + if (!wxPendingDelete.Member(this)) + wxPendingDelete.Append(this); + + return TRUE; +} + +void wxFrame::GetClientSize( int *width, int *height ) const +{ + wxWindow::GetClientSize( width, height ); + if (height) + { + if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT; + if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT; + if (m_frameToolBar) + { + int y = 0; + m_frameToolBar->GetSize( NULL, &y ); + (*height) -= y; + } + }; +}; + + +void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) +{ + if ( GetAutoLayout() ) + Layout(); + else { + // no child: go out ! + if (!GetChildren()->First()) + return; + + // do we have exactly one child? + wxWindow *child = NULL; + for(wxNode *node = GetChildren()->First(); node; node = node->Next()) + { + wxWindow *win = (wxWindow *)node->Data(); + if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog) +#if 0 // not in m_children anyway + && (win != m_frameMenuBar) && + (win != m_frameToolBar) && + (win != m_frameStatusBar) +#endif + ) + { + if ( child ) // it's the second one: do nothing + return; + + child = win; + }; + }; + + // yes: set it's size to fill all the frame + int client_x, client_y; + GetClientSize(&client_x, &client_y); + child->SetSize( 1, 1, client_x-2, client_y); + } +}; + +static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) +{ + menu->SetInvokingWindow( win ); + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *menuitem = (wxMenuItem*)node->Data(); + if (menuitem->IsSubMenu()) + SetInvokingWindow( menuitem->GetSubMenu(), win ); + node = node->Next(); + }; +}; + +void wxFrame::SetMenuBar( wxMenuBar *menuBar ) +{ + m_frameMenuBar = menuBar; + + if (m_frameMenuBar) + { + if (m_frameMenuBar->m_parent != this) + { + wxNode *node = m_frameMenuBar->m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + SetInvokingWindow( menu, this ); + node = node->Next(); + }; + + } + } +}; + +wxMenuBar *wxFrame::GetMenuBar(void) +{ + return m_frameMenuBar; +}; + +wxToolBar *wxFrame::CreateToolBar( long style , wxWindowID id, const wxString& name ) +{ + m_frameToolBar = new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name ); + + return m_frameToolBar; +}; + +wxToolBar *wxFrame::GetToolBar(void) +{ + return m_frameToolBar; +}; + +wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) +{ + if (m_frameStatusBar) + delete m_frameStatusBar; + + m_frameStatusBar = new wxStatusBar( this, id, wxPoint(0,0), wxSize(100,20), style, name ); + + m_frameStatusBar->SetFieldsCount( number ); + + return m_frameStatusBar; +}; + +void wxFrame::SetStatusText( const wxString &text, int number ) +{ + if (m_frameStatusBar) m_frameStatusBar->SetStatusText( text, number ); +}; + +void wxFrame::SetStatusWidths( int n, int *width ) +{ + if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width ); +}; + +wxStatusBar *wxFrame::GetStatusBar(void) +{ + return m_frameStatusBar; +}; + +void wxFrame::SetTitle( const wxString &title ) +{ + m_title = title; +}; + +void wxFrame::SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), + int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW) ) +{ +} + +void wxFrame::SetIcon( const wxIcon &icon ) +{ + m_icon = icon; + if (!icon.Ok()) return; + +} + diff --git a/src/qt/gauge.cpp b/src/qt/gauge.cpp new file mode 100644 index 0000000000..274a64d982 --- /dev/null +++ b/src/qt/gauge.cpp @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gauge.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "gauge.h" +#endif + +#include "wx/gauge.h" + +//----------------------------------------------------------------------------- +// wxGauge +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl) + +bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + return TRUE; +}; + +void wxGauge::SetRange( int r ) +{ + m_rangeMax = r; + if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; +}; + +void wxGauge::SetValue( int pos ) +{ + m_gaugePos = pos; + if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; +}; + +int wxGauge::GetRange(void) const +{ + return m_rangeMax; +}; + +int wxGauge::GetValue(void) const +{ + return m_gaugePos; +}; + diff --git a/src/qt/gdiobj.cpp b/src/qt/gdiobj.cpp new file mode 100644 index 0000000000..8df2e5ff09 --- /dev/null +++ b/src/qt/gdiobj.cpp @@ -0,0 +1,21 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gdiobj.cpp +// Purpose: wxGDIObject class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "gdiobj.h" +#endif + +#include "wx/gdiobj.h" + +#if !USE_SHARED_LIBRARIES +IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) +#endif + diff --git a/src/qt/horiz.xbm b/src/qt/horiz.xbm new file mode 100644 index 0000000000..ff3309bcc4 --- /dev/null +++ b/src/qt/horiz.xbm @@ -0,0 +1,6 @@ +#define horiz_width 15 +#define horiz_height 15 +static char horiz_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00}; diff --git a/src/qt/icon.cpp b/src/qt/icon.cpp new file mode 100644 index 0000000000..7ab4484537 --- /dev/null +++ b/src/qt/icon.cpp @@ -0,0 +1,27 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: icon.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "icon.h" +#endif + +#include "wx/icon.h" + +//----------------------------------------------------------------------------- +// wxIcon +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) + +wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : + wxBitmap( bits ) +{ +}; + diff --git a/src/qt/joystick.cpp b/src/qt/joystick.cpp new file mode 100644 index 0000000000..e783f1276d --- /dev/null +++ b/src/qt/joystick.cpp @@ -0,0 +1,358 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.cpp +// Purpose: wxJoystick class +// Author: Ported to Linux by Guilhem Lavaux +// Modified by: +// Created: 05/23/98 +// RCS-ID: $Id$ +// Copyright: (c) Guilhem Lavaux +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "joystick.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include "wx/event.h" +#include "wx/window.h" +#include "wx/gtk/joystick.h" + +#define JOYSTICK_AXE_MAX 32767 +#define JOYSTICK_AXE_MIN -32767 + +IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) + +wxJoystick::wxJoystick(int joystick) +{ + wxString dev_name; + // Assume it's the same device name on all Linux systems ... + dev_name.Printf("/dev/js%d", (joystick == wxJOYSTICK1) ? 0 : 1); + + m_joystick = open(dev_name, O_RDWR); + m_lastposition = wxPoint(-1, -1); + for (int i=0;i<15;i++) + m_axe[i] = 0; + if (m_joystick != -1) + Create(); +} + +//////////////////////////////////////////////////////////////////////////// +// Background thread +//////////////////////////////////////////////////////////////////////////// +void *wxJoystick::Entry(void) +{ + struct js_event j_evt; + wxJoystickEvent jwx_event; + fd_set read_fds; + struct timeval time_out = {0, 0}; + + FD_ZERO(&read_fds); + DeferDestroy(TRUE); + while (1) { + TestDestroy(); + + if (m_polling) { + FD_SET(m_joystick, &read_fds); + select(m_joystick+1, &read_fds, NULL, NULL, &time_out); + if (FD_ISSET(m_joystick, &read_fds)) + read(m_joystick, &j_evt, sizeof(j_evt)); + else + j_evt.type = 0; + } else { + read(m_joystick, &j_evt, sizeof(j_evt)); + } + + if ((j_evt.type & JS_EVENT_AXIS) == JS_EVENT_AXIS) { + switch (j_evt.number) { + case 1: + m_lastposition.x = j_evt.value; + jwx_event.SetEventType(wxEVT_JOY_MOVE); + break; + case 2: + m_lastposition.y = j_evt.value; + jwx_event.SetEventType(wxEVT_JOY_MOVE); + break; + case 3: + m_axe[3] = j_evt.value; + jwx_event.SetEventType(wxEVT_JOY_ZMOVE); + break; + default: + m_axe[j_evt.number] = j_evt.value; + jwx_event.SetEventType(wxEVT_JOY_MOVE); + break; + } + jwx_event.SetPosition(m_lastposition); + jwx_event.SetZPosition(m_axe[3]); + } + if ((j_evt.type & JS_EVENT_BUTTON) == JS_EVENT_BUTTON) { + register int mask = 1 << j_evt.number; + char button = m_buttons & mask; + + m_buttons &= ~mask; + if (button) { + jwx_event.SetEventType(wxEVT_JOY_BUTTON_UP); + } else { + jwx_event.SetEventType(wxEVT_JOY_BUTTON_DOWN); + m_buttons |= mask; + } + + jwx_event.SetButtonState(m_buttons); + jwx_event.SetButtonChange(j_evt.number); + } + } + if (m_catchwin) + m_catchwin->ProcessEvent(jwx_event); + if (m_polling) + usleep(m_polling*1000); +} + +//////////////////////////////////////////////////////////////////////////// +// State +//////////////////////////////////////////////////////////////////////////// + +wxPoint wxJoystick::GetPosition(void) const +{ + return m_lastposition; +} + +int wxJoystick::GetZPosition(void) const +{ + return m_axe[3]; +} + +int wxJoystick::GetButtonState(void) const +{ + return m_buttons; +} + +int wxJoystick::GetPOVPosition(void) const +{ + return 0; +} + +int wxJoystick::GetPOVCTSPosition(void) const +{ + return 0; +} + +int wxJoystick::GetRudderPosition(void) const +{ + return m_axe[4]; +} + +int wxJoystick::GetUPosition(void) const +{ + return m_axe[5]; +} + +int wxJoystick::GetVPosition(void) const +{ + return m_axe[6]; +} + +int wxJoystick::GetMovementThreshold(void) const +{ + return 0; +} + +void wxJoystick::SetMovementThreshold(int threshold) +{ +} + +//////////////////////////////////////////////////////////////////////////// +// Capabilities +//////////////////////////////////////////////////////////////////////////// + +bool wxJoystick::IsOk(void) const +{ + return (m_joystick != -1); +} + +int wxJoystick::GetNumberJoysticks(void) const +{ + wxString dev_name; + int fd, j; + + for (j=0;j<2;j++) { + dev_name.Printf("/dev/js%d", j); + fd = open(dev_name, O_RDONLY); + if (fd == -1) + return j; + close(fd); + } + return j; +} + +int wxJoystick::GetManufacturerId(void) const +{ + return 0; +} + +int wxJoystick::GetProductId(void) const +{ + return 0; +} + +wxString wxJoystick::GetProductName(void) const +{ + return ""; +} + +int wxJoystick::GetXMin(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetYMin(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetZMin(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetXMax(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetYMax(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetZMax(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetNumberButtons(void) const +{ + int nb; + + ioctl(m_joystick, JSIOCGBUTTONS, &nb); + + return nb; +} + +int wxJoystick::GetNumberAxes(void) const +{ + int nb; + + ioctl(m_joystick, JSIOCGAXES, &nb); + + return nb; +} + +int wxJoystick::GetMaxButtons(void) const +{ + return 15; // internal +} + +int wxJoystick::GetMaxAxes(void) const +{ + return 15; // internal +} + +int wxJoystick::GetPollingMin(void) const +{ + return -1; +} + +int wxJoystick::GetPollingMax(void) const +{ + return -1; +} + +int wxJoystick::GetRudderMin(void) const +{ + return JOYSTICK_AXE_MIN; +} + +int wxJoystick::GetRudderMax(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetUMin(void) const +{ + return JOYSTICK_AXE_MIN; +} + +int wxJoystick::GetUMax(void) const +{ + return JOYSTICK_AXE_MAX; +} + +int wxJoystick::GetVMin(void) const +{ + return JOYSTICK_AXE_MIN; +} + +int wxJoystick::GetVMax(void) const +{ + return JOYSTICK_AXE_MAX; +} + +bool wxJoystick::HasRudder(void) const +{ + return GetNumberAxes() >= 4; +} + +bool wxJoystick::HasZ(void) const +{ + return GetNumberAxes() >= 3; +} + +bool wxJoystick::HasU(void) const +{ + return GetNumberAxes() >= 5; +} + +bool wxJoystick::HasV(void) const +{ + return GetNumberAxes() >= 6; +} + +bool wxJoystick::HasPOV(void) const +{ + return FALSE; +} + +bool wxJoystick::HasPOV4Dir(void) const +{ + return FALSE; +} + +bool wxJoystick::HasPOVCTS(void) const +{ + return FALSE; +} + +//////////////////////////////////////////////////////////////////////////// +// Operations +//////////////////////////////////////////////////////////////////////////// + +bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq = 0) +{ + m_catchwin = win; + m_polling = pollingFreq; + return TRUE; +} + +bool wxJoystick::ReleaseCapture(void) +{ + m_catchwin = NULL; + m_polling = 0; + return TRUE; +} + diff --git a/src/qt/listbox.cpp b/src/qt/listbox.cpp new file mode 100644 index 0000000000..c1893d546f --- /dev/null +++ b/src/qt/listbox.cpp @@ -0,0 +1,137 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: listbox.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "listbox.h" +#endif + +#include "wx/dynarray.h" +#include "wx/listbox.h" +#include "wx/utils.h" + +//----------------------------------------------------------------------------- +// wxListBox +//----------------------------------------------------------------------------- + + +IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl) + +wxListBox::wxListBox(void) +{ +}; + +wxListBox::wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + int n, const wxString choices[], + long style, const wxString &name ) +{ + Create( parent, id, pos, size, n, choices, style, name ); +}; + +bool wxListBox::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + int n, const wxString choices[], + long style, const wxString &name ) +{ + return TRUE; +}; + +void wxListBox::Append( const wxString &item ) +{ + Append( item, (char*)NULL ); +}; + +void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) ) +{ +}; + +void wxListBox::Clear(void) +{ +}; + +void wxListBox::Delete( int WXUNUSED(n) ) +{ +}; + +void wxListBox::Deselect( int WXUNUSED(n) ) +{ +}; + +int wxListBox::FindString( const wxString &WXUNUSED(item) ) const +{ + return -1; +}; + +char *wxListBox::GetClientData( int WXUNUSED(n) ) const +{ + return (char*)NULL; +}; + +int wxListBox::GetSelection(void) const +{ + return -1; +}; + +int wxListBox::GetSelections( wxArrayInt& WXUNUSED(aSelections) ) const +{ + return 0; +}; + +wxString wxListBox::GetString( int WXUNUSED(n) ) const +{ + return ""; +}; + +wxString wxListBox::GetStringSelection(void) const +{ + return ""; +}; + +int wxListBox::Number(void) +{ + return 0; +}; + +bool wxListBox::Selected( int WXUNUSED(n) ) +{ + return FALSE; +}; + +void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) ) +{ +}; + +void wxListBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) ) +{ +}; + +void wxListBox::SetFirstItem( int WXUNUSED(n) ) +{ +}; + +void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) ) +{ +}; + +void wxListBox::SetSelection( int WXUNUSED(n), bool WXUNUSED(select) ) +{ +}; + +void wxListBox::SetString( int WXUNUSED(n), const wxString &WXUNUSED(string) ) +{ +}; + +void wxListBox::SetStringSelection( const wxString &WXUNUSED(string), bool WXUNUSED(select) ) +{ +}; + + + diff --git a/src/qt/mdi.cpp b/src/qt/mdi.cpp new file mode 100644 index 0000000000..f5d5573bab --- /dev/null +++ b/src/qt/mdi.cpp @@ -0,0 +1,229 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: mdi.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "mdi.h" +#endif + +#include "wx/mdi.h" +#include "wx/dialog.h" +#include "wx/menu.h" + +//----------------------------------------------------------------------------- + +extern wxList wxPendingDelete; + +//----------------------------------------------------------------------------- +// wxMDIParentFrame +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame) + +BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) +END_EVENT_TABLE() + +wxMDIParentFrame::wxMDIParentFrame(void) +{ + m_clientWindow = NULL; + m_currentChild = NULL; + m_parentFrameActive = TRUE; +}; + +wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, + wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + m_clientWindow = NULL; + m_currentChild = NULL; + m_parentFrameActive = TRUE; + Create( parent, id, title, pos, size, style, name ); +}; + +wxMDIParentFrame::~wxMDIParentFrame(void) +{ +}; + +bool wxMDIParentFrame::Create( wxWindow *parent, + wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + wxFrame::Create( parent, id, title, pos, size, style, name ); + + OnCreateClient(); + + return TRUE; +}; + +void wxMDIParentFrame::GetClientSize(int *width, int *height ) const +{ + wxFrame::GetClientSize( width, height ); +}; + +wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const +{ + return m_currentChild; +}; + +wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const +{ + return m_clientWindow; +}; + +wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void) +{ + m_clientWindow = new wxMDIClientWindow( this ); + return m_clientWindow; +}; + +void wxMDIParentFrame::ActivateNext(void) +{ +}; + +void wxMDIParentFrame::ActivatePrevious(void) +{ +}; + +void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) +{ +}; + +void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) ) +{ +}; + +//----------------------------------------------------------------------------- +// wxMDIChildFrame +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) + +BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) + EVT_ACTIVATE(wxMDIChildFrame::OnActivate) +END_EVENT_TABLE() + +wxMDIChildFrame::wxMDIChildFrame(void) +{ +}; + +wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, + wxWindowID id, const wxString& title, + const wxPoint& WXUNUSED(pos), const wxSize& size, + long style, const wxString& name ) +{ + Create( parent, id, title, wxDefaultPosition, size, style, name ); +}; + +wxMDIChildFrame::~wxMDIChildFrame(void) +{ +}; + +bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, + wxWindowID id, const wxString& title, + const wxPoint& WXUNUSED(pos), const wxSize& size, + long style, const wxString& name ) +{ + m_title = title; + return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); +}; + +void wxMDIChildFrame::GetClientSize( int *width, int *height ) const +{ + wxWindow::GetClientSize( width, height ); +} + +void wxMDIChildFrame::AddChild( wxWindow *child ) +{ + wxWindow::AddChild( child ); +} + +static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) +{ + menu->SetInvokingWindow( win ); + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *menuitem = (wxMenuItem*)node->Data(); + if (menuitem->IsSubMenu()) + SetInvokingWindow( menuitem->GetSubMenu(), win ); + node = node->Next(); + }; +}; + +void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) +{ + m_menuBar = menu_bar; + + if (m_menuBar) + { + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; + + if (m_menuBar->m_parent != this) + { + wxNode *node = m_menuBar->m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + SetInvokingWindow( menu, this ); + node = node->Next(); + }; + + m_menuBar->m_parent = mdi_frame; + } + mdi_frame->SetMDIMenuBar( m_menuBar ); + + } +}; + +wxMenuBar *wxMDIChildFrame::GetMenuBar() +{ + return m_menuBar; +}; + +void wxMDIChildFrame::Activate(void) +{ +}; + +void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) ) +{ +}; + +//----------------------------------------------------------------------------- +// wxMDIClientWindow +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow) + +wxMDIClientWindow::wxMDIClientWindow(void) +{ +}; + +wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style ) +{ + CreateClient( parent, style ); +}; + +wxMDIClientWindow::~wxMDIClientWindow(void) +{ +}; + +bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *WXUNUSED(parent), long WXUNUSED(style) ) +{ + return TRUE; +}; + +void wxMDIClientWindow::AddChild( wxWindow *WXUNUSED(child) ) +{ +}; + + diff --git a/src/qt/menu.cpp b/src/qt/menu.cpp new file mode 100644 index 0000000000..739e635d47 --- /dev/null +++ b/src/qt/menu.cpp @@ -0,0 +1,293 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: menu.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "menu.h" +#endif + +#include "wx/menu.h" +#include "wx/log.h" + +//----------------------------------------------------------------------------- +// wxMenuBar +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow) + +wxMenuBar::wxMenuBar() +{ +}; + +void wxMenuBar::Append( wxMenu *menu, const wxString &title ) +{ + m_menus.Append( menu ); + menu->m_title = title; // ?????? + + int pos; + do { + pos = menu->m_title.First( '&' ); + if (pos != -1) menu->m_title.Remove( pos, 1 ); + } while (pos != -1); + +}; + +static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) +{ + if (menu->m_title == menuString) + { + int res = menu->FindItem( itemString ); + if (res != -1) return res; + }; + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->IsSubMenu()) + return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); + node = node->Next(); + }; + return -1; +}; + +int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const +{ + wxNode *node = m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + int res = FindMenuItemRecursive( menu, menuString, itemString); + if (res != -1) return res; + node = node->Next(); + }; + return -1; +}; + +// Find a wxMenuItem using its id. Recurses down into sub-menus +static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) +{ + wxMenuItem* result = menu->FindItem(id); + + wxNode *node = menu->m_items.First(); + while ( node && result == NULL ) { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if ( item->IsSubMenu() ) + result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); + node = node->Next(); + }; + + return result; +}; + +wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const +{ + wxMenuItem* result = 0; + wxNode *node = m_menus.First(); + while (node && result == 0) + { + wxMenu *menu = (wxMenu*)node->Data(); + result = FindMenuItemByIdRecursive( menu, id ); + node = node->Next(); + } + return result; +} + +void wxMenuBar::Check( int id, bool check ) +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) item->Check(check); +}; + +bool wxMenuBar::Checked( int id ) const +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->IsChecked(); + return FALSE; +}; + +void wxMenuBar::Enable( int id, bool enable ) +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) item->Enable(enable); +}; + +bool wxMenuBar::Enabled( int id ) const +{ + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->IsEnabled(); + return FALSE; +}; + +//----------------------------------------------------------------------------- +// wxMenu +//----------------------------------------------------------------------------- + + +IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject) + +wxMenuItem::wxMenuItem() +{ + m_id = ID_SEPARATOR; + m_isCheckMenu = FALSE; + m_isChecked = FALSE; + m_isEnabled = TRUE; + m_subMenu = NULL; +}; + +void wxMenuItem::SetText(const wxString& str) +{ + for ( const char *pc = str; *pc != '\0'; pc++ ) { + if ( *pc == '&' ) + pc++; // skip it + + m_text << *pc; + } +} + +void wxMenuItem::Check( bool check ) +{ + wxCHECK_RET( IsCheckable(), "can't check uncheckable item!" ) + + m_isChecked = check; +} + +bool wxMenuItem::IsChecked() const +{ + wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item! + + return FALSE; +} + +IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) + +wxMenu::wxMenu( const wxString &title ) +{ + m_title = title; + m_items.DeleteContents( TRUE ); + m_invokingWindow = NULL; +}; + +void wxMenu::AppendSeparator() +{ + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(ID_SEPARATOR); + + m_items.Append( mitem ); +}; + +void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable ) +{ + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(id); + mitem->SetText(item); + mitem->SetHelpString(helpStr); + mitem->SetCheckable(checkable); + + m_items.Append( mitem ); +}; + +void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr ) +{ + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(id); + mitem->SetText(text); + mitem->SetHelpString(helpStr); + mitem->SetSubMenu(subMenu); + + m_items.Append( mitem ); +}; + +int wxMenu::FindItem( const wxString itemString ) const +{ + wxString s( itemString ); + + int pos; + do { + pos = s.First( '&' ); + if (pos != -1) s.Remove( pos, 1 ); + } while (pos != -1); + + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetText() == s) + return item->GetId(); + node = node->Next(); + }; + + return -1; +}; + +void wxMenu::Enable( int id, bool enable ) +{ + wxMenuItem *item = FindItem(id); + if ( item ) + item->Enable(enable); +}; + +bool wxMenu::IsEnabled( int id ) const +{ + wxMenuItem *item = FindItem(id); + if ( item ) + return item->IsEnabled(); + else + return FALSE; +}; + +void wxMenu::Check( int id, bool enable ) +{ + wxMenuItem *item = FindItem(id); + if ( item ) + item->Check(enable); +}; + +bool wxMenu::IsChecked( int id ) const +{ + wxMenuItem *item = FindItem(id); + if ( item ) + return item->IsChecked(); + else + return FALSE; +}; + +void wxMenu::SetLabel( int id, const wxString &label ) +{ + wxMenuItem *item = FindItem(id); + if ( item ) + item->SetText(label); +}; + +wxMenuItem *wxMenu::FindItem(int id) const +{ + wxNode *node = m_items.First(); + while (node) { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if ( item->GetId() == id ) + return item; + node = node->Next(); + }; + + wxLogDebug("wxMenu::FindItem: item %d not found.", id); + + return NULL; +} + +void wxMenu::SetInvokingWindow( wxWindow *win ) +{ + m_invokingWindow = win; +}; + +wxWindow *wxMenu::GetInvokingWindow() +{ + return m_invokingWindow; +}; + + diff --git a/src/qt/notebook.cpp b/src/qt/notebook.cpp new file mode 100644 index 0000000000..bb8f9c4f3c --- /dev/null +++ b/src/qt/notebook.cpp @@ -0,0 +1,185 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: notebook.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "notebook.h" +#endif + +#include "wx/notebook.h" +#include "wx/panel.h" +#include "wx/utils.h" +#include "wx/imaglist.h" +#include "wx/log.h" + +//----------------------------------------------------------------------------- +// wxNotebookPage +//----------------------------------------------------------------------------- + +class wxNotebookPage: public wxObject +{ +public: + wxNotebookPage() + { + m_id = -1; + m_text = ""; + m_image = -1; + m_page = NULL; + m_client = NULL; + m_parent = NULL; + }; + +//private: + int m_id; + wxString m_text; + int m_image; + wxWindow *m_client; +}; + +//----------------------------------------------------------------------------- +// wxNotebook +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl) + +void wxNotebook::Init() +{ + m_imageList = NULL; + m_pages.DeleteContents( TRUE ); +} + +wxNotebook::wxNotebook() +{ + Init(); +}; + +wxNotebook::wxNotebook( wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + Init(); + Create( parent, id, pos, size, style, name ); +}; + +wxNotebook::~wxNotebook() +{ + DeleteAllPages(); +}; + +bool wxNotebook::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + PreCreation( parent, id, pos, size, style, name ); + + PostCreation(); + + Show( TRUE ); + + return TRUE; +}; + +int wxNotebook::GetSelection() const +{ +}; + +int wxNotebook::GetPageCount() const +{ +}; + +int wxNotebook::GetRowCount() const +{ +}; + +wxString wxNotebook::GetPageText( int page ) const +{ +}; + +int wxNotebook::GetPageImage( int page ) const +{ +}; + +wxNotebookPage* wxNotebook::GetNotebookPage(int page) const +{ + return NULL; +}; + +int wxNotebook::SetSelection( int page ) +{ +}; + +void wxNotebook::AdvanceSelection(bool bForward) +{ +} + +void wxNotebook::SetImageList( wxImageList* imageList ) +{ + m_imageList = imageList; +}; + +bool wxNotebook::SetPageText( int page, const wxString &text ) +{ + return TRUE; +}; + +bool wxNotebook::SetPageImage( int page, int image ) +{ + return TRUE; +}; + +void wxNotebook::SetPageSize( const wxSize &WXUNUSED(size) ) +{ +}; + +void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) ) +{ +}; + +bool wxNotebook::DeleteAllPages() +{ + return TRUE; +}; + +bool wxNotebook::DeletePage( int page ) +{ + return TRUE; +}; + +bool wxNotebook::AddPage(wxWindow* win, const wxString& text, + bool bSelect, int imageId) +{ + return TRUE; +}; + +wxWindow *wxNotebook::GetPage( int page ) const +{ + return NULL; +}; + +void wxNotebook::AddChild( wxWindow *win ) +{ +}; + +// override these 2 functions to do nothing: everything is done in OnSize +void wxNotebook::SetConstraintSizes( bool WXUNUSED(recurse) ) +{ + // don't set the sizes of the pages - their correct size is not yet known + wxControl::SetConstraintSizes(FALSE); +} + +bool wxNotebook::DoPhase( int WXUNUSED(nPhase) ) +{ + return TRUE; +} + +//----------------------------------------------------------------------------- +// wxNotebookEvent +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent) diff --git a/src/qt/palette.cpp b/src/qt/palette.cpp new file mode 100644 index 0000000000..5256aa14ca --- /dev/null +++ b/src/qt/palette.cpp @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palette.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "palette.h" +#endif + +#include "wx/palette.h" + +//----------------------------------------------------------------------------- +// wxPalette +//----------------------------------------------------------------------------- + +class wxPaletteRefData: public wxObjectRefData +{ + public: + + wxPaletteRefData(void); + ~wxPaletteRefData(void); + +}; + +wxPaletteRefData::wxPaletteRefData(void) +{ +}; + +wxPaletteRefData::~wxPaletteRefData(void) +{ +}; + +//----------------------------------------------------------------------------- + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) + +wxPalette::wxPalette(void) +{ +}; + +wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ) +{ + m_refData = new wxPaletteRefData(); + Create( n, red, green, blue ); +}; + +wxPalette::wxPalette( const wxPalette& palette ) +{ + Ref( palette ); +}; + +wxPalette::wxPalette( const wxPalette* palette ) +{ + UnRef(); + if (palette) Ref( *palette ); +}; + +wxPalette::~wxPalette(void) +{ +}; + +wxPalette& wxPalette::operator = ( const wxPalette& palette ) +{ + if (*this == palette) return (*this); + Ref( palette ); + return *this; +}; + +bool wxPalette::operator == ( const wxPalette& palette ) +{ + return m_refData == palette.m_refData; +}; + +bool wxPalette::operator != ( const wxPalette& palette ) +{ + return m_refData != palette.m_refData; +}; + +bool wxPalette::Ok(void) const +{ + return (m_refData); +}; + +bool wxPalette::Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) +{ +}; + +int wxPalette::GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const +{ +}; + +bool wxPalette::GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const +{ +}; + diff --git a/src/qt/pen.cpp b/src/qt/pen.cpp new file mode 100644 index 0000000000..7ed7be02a7 --- /dev/null +++ b/src/qt/pen.cpp @@ -0,0 +1,204 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pen.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "pen.h" +#endif + +#include "wx/pen.h" + +//----------------------------------------------------------------------------- +// wxPen +//----------------------------------------------------------------------------- + +class wxPenRefData: public wxObjectRefData +{ + public: + + wxPenRefData(void); + + int m_width; + int m_style; + int m_joinStyle; + int m_capStyle; + wxColour m_colour; +}; + +wxPenRefData::wxPenRefData(void) +{ + m_width = 1; + m_style = wxSOLID; + m_joinStyle = wxJOIN_ROUND; + m_capStyle = wxCAP_ROUND; +}; + +//----------------------------------------------------------------------------- + +#define M_PENDATA ((wxPenRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject) + +wxPen::wxPen(void) +{ + if (wxThePenList) wxThePenList->AddPen( this ); +}; + +wxPen::wxPen( const wxColour &colour, int width, int style ) +{ + m_refData = new wxPenRefData(); + M_PENDATA->m_width = width; + M_PENDATA->m_style = style; + M_PENDATA->m_colour = colour; + if (wxThePenList) wxThePenList->AddPen( this ); +}; + +wxPen::wxPen( const wxString &colourName, int width, int style ) +{ + m_refData = new wxPenRefData(); + M_PENDATA->m_width = width; + M_PENDATA->m_style = style; + M_PENDATA->m_colour = colourName; + if (wxThePenList) wxThePenList->AddPen( this ); +}; + +wxPen::wxPen( const wxPen& pen ) +{ + Ref( pen ); + if (wxThePenList) wxThePenList->AddPen( this ); +}; + +wxPen::wxPen( const wxPen* pen ) +{ + UnRef(); + if (pen) Ref( *pen ); + if (wxThePenList) wxThePenList->AddPen( this ); +}; + +wxPen::~wxPen(void) +{ + if (wxThePenList) wxThePenList->RemovePen( this ); +}; + +wxPen& wxPen::operator = ( const wxPen& pen ) +{ + if (*this == pen) return (*this); + Ref( pen ); + return *this; +}; + +bool wxPen::operator == ( const wxPen& pen ) +{ + return m_refData == pen.m_refData; +}; + +bool wxPen::operator != ( const wxPen& pen ) +{ + return m_refData != pen.m_refData; +}; + +void wxPen::SetColour( const wxColour &colour ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_colour = colour; +}; + +void wxPen::SetColour( const wxString &colourName ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_colour = colourName; +}; + +void wxPen::SetColour( int red, int green, int blue ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_colour.Set( red, green, blue ); +}; + +void wxPen::SetCap( int capStyle ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_capStyle = capStyle; +}; + +void wxPen::SetJoin( int joinStyle ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_joinStyle = joinStyle; +}; + +void wxPen::SetStyle( int style ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_style = style; +}; + +void wxPen::SetWidth( int width ) +{ + if (!m_refData) + m_refData = new wxPenRefData(); + + M_PENDATA->m_width = width; +}; + +int wxPen::GetCap(void) const +{ + return M_PENDATA->m_capStyle; +}; + +int wxPen::GetJoin(void) const +{ + if (!m_refData) + return 0; + else + return M_PENDATA->m_joinStyle; +}; + +int wxPen::GetStyle(void) const +{ + if (!m_refData) + return 0; + else + return M_PENDATA->m_style; +}; + +int wxPen::GetWidth(void) const +{ + if (!m_refData) + return 0; + else + return M_PENDATA->m_width; +}; + +wxColour &wxPen::GetColour(void) const +{ + if (!m_refData) + return wxNullColour; + else + return M_PENDATA->m_colour; +}; + +bool wxPen::Ok(void) const +{ + return (m_refData); +}; + diff --git a/src/qt/radiobox.cpp b/src/qt/radiobox.cpp new file mode 100644 index 0000000000..758e70f76e --- /dev/null +++ b/src/qt/radiobox.cpp @@ -0,0 +1,133 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobox.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "radiobox.h" +#endif + +#include "wx/radiobox.h" +#include "wx/dialog.h" +#include "wx/frame.h" + +//----------------------------------------------------------------------------- +// data +//----------------------------------------------------------------------------- + +extern bool g_blockEventsOnDrag; + +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl) + +wxRadioBox::wxRadioBox(void) +{ +}; + +wxRadioBox::wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint &pos, const wxSize &size, + int n, const wxString choices[], + int majorDim, long style, + const wxString &name ) +{ + Create( parent, id, title, pos, size, n, choices, majorDim, style, name ); +}; + +bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint &pos, const wxSize &size, + int n, const wxString choices[], + int WXUNUSED(majorDim), long style, + const wxString &name ) +{ + return TRUE; +}; + +bool wxRadioBox::Show( bool show ) +{ + wxWindow::Show( show ); + return TRUE; +}; + +int wxRadioBox::FindString( const wxString &s ) const +{ + return -1; +}; + +void wxRadioBox::SetSelection( int n ) +{ +}; + +int wxRadioBox::GetSelection(void) const +{ + return -1; +}; + +wxString wxRadioBox::GetString( int n ) const +{ +}; + +wxString wxRadioBox::GetLabel(void) const +{ + return wxControl::GetLabel(); +}; + +void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) ) +{ +}; + +void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) ) +{ +}; + +void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) ) +{ +}; + +wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const +{ + return ""; +}; + +void wxRadioBox::Enable( bool WXUNUSED(enable) ) +{ +}; + +void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) ) +{ +}; + +void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) ) +{ +}; + +wxString wxRadioBox::GetStringSelection(void) const +{ + return ""; +}; + +bool wxRadioBox::SetStringSelection( const wxString&s ) +{ + return TRUE; +}; + +int wxRadioBox::Number(void) const +{ + return 0; +}; + +int wxRadioBox::GetNumberOfRowsOrCols(void) const +{ + return 1; +}; + +void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) +{ +}; + diff --git a/src/qt/radiobut.cpp b/src/qt/radiobut.cpp new file mode 100644 index 0000000000..e474873991 --- /dev/null +++ b/src/qt/radiobut.cpp @@ -0,0 +1,17 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobut.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "radiobut.h" +#endif + +#include "wx/radiobut.h" + diff --git a/src/qt/region.cpp b/src/qt/region.cpp new file mode 100644 index 0000000000..987ddeed60 --- /dev/null +++ b/src/qt/region.cpp @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: region.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/98 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "region.h" +#endif + +#include "wx/region.h" + +//----------------------------------------------------------------------------- +// wxRegion +//----------------------------------------------------------------------------- + +class wxRegionRefData: public wxObjectRefData +{ + public: + + wxRegionRefData(void); + ~wxRegionRefData(void); + + public: + +}; + +wxRegionRefData::wxRegionRefData(void) +{ +}; + +wxRegionRefData::~wxRegionRefData(void) +{ +}; + +//----------------------------------------------------------------------------- + +#define M_REGIONDATA ((wxRegionRefData *)m_refData) + +IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject); + +wxRegion::wxRegion( long x, long y, long w, long h ) +{ + m_refData = new wxRegionRefData(); +}; + +wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) +{ + m_refData = new wxRegionRefData(); +}; + +wxRegion::wxRegion( const wxRect& rect ) +{ + m_refData = new wxRegionRefData(); +}; + +wxRegion::wxRegion(void) +{ + m_refData = new wxRegionRefData(); +}; + +wxRegion::~wxRegion(void) +{ +}; + +void wxRegion::Clear(void) +{ + UnRef(); + m_refData = new wxRegionRefData(); +}; + +bool wxRegion::Union( long x, long y, long width, long height ) +{ + return TRUE; +}; + +bool wxRegion::Union( const wxRect& rect ) +{ + return TRUE; +}; + +bool wxRegion::Union( const wxRegion& region ) +{ + return TRUE; +}; + +bool wxRegion::Intersect( long x, long y, long width, long height ) +{ + return TRUE; +}; + +bool wxRegion::Intersect( const wxRect& rect ) +{ + return TRUE; +}; + +bool wxRegion::Intersect( const wxRegion& region ) +{ + return TRUE; +}; + +bool wxRegion::Subtract( long x, long y, long width, long height ) +{ + return TRUE; +}; + +bool wxRegion::Subtract( const wxRect& rect ) +{ + return TRUE; +}; + +bool wxRegion::Subtract( const wxRegion& region ) +{ + return TRUE; +}; + +bool wxRegion::Xor( long x, long y, long width, long height ) +{ + return TRUE; +}; + +bool wxRegion::Xor( const wxRect& rect ) +{ + return TRUE; +}; + +bool wxRegion::Xor( const wxRegion& region ) +{ + return TRUE; +}; + +void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const +{ + x = 0; + y = 0; + w = -1; + h = -1; +}; + +wxRect wxRegion::GetBox(void) const +{ + return wxRect( 0, 0, -1, -1 ); +}; + +bool wxRegion::Empty(void) const +{ +}; + +wxRegionContain wxRegion::Contains( long x, long y ) const +{ + return wxOutRegion; +}; + +wxRegionContain wxRegion::Contains( long x, long y, long w, long h ) const +{ + return wxOutRegion; +}; + diff --git a/src/qt/scrolbar.cpp b/src/qt/scrolbar.cpp new file mode 100644 index 0000000000..4b98a1d1b8 --- /dev/null +++ b/src/qt/scrolbar.cpp @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: scrolbar.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "scrolbar.h" +#endif + +#include "wx/scrolbar.h" +#include "wx/utils.h" + +//----------------------------------------------------------------------------- +// wxScrollBar +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl) + +wxScrollBar::wxScrollBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + Create( parent, id, pos, size, style, name ); +}; + +wxScrollBar::~wxScrollBar(void) +{ +}; + +bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + return TRUE; +}; + +int wxScrollBar::GetPosition(void) const +{ +}; + +int wxScrollBar::GetThumbSize() const +{ +}; + +int wxScrollBar::GetPageSize() const +{ +}; + +int wxScrollBar::GetRange() const +{ +}; + +void wxScrollBar::SetPosition( int viewStart ) +{ +}; + +void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize, + bool WXUNUSED(refresh) ) +{ +}; + +// Backward compatibility +int wxScrollBar::GetValue(void) const +{ + return GetPosition(); +}; + +void wxScrollBar::SetValue( int viewStart ) +{ + SetPosition( viewStart ); +}; + +void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const +{ +}; + +int wxScrollBar::GetViewLength() const +{ +}; + +int wxScrollBar::GetObjectLength() const +{ +}; + +void wxScrollBar::SetPageSize( int pageLength ) +{ +}; + +void wxScrollBar::SetObjectLength( int objectLength ) +{ +}; + +void wxScrollBar::SetViewLength( int viewLength ) +{ +}; + diff --git a/src/qt/settings.cpp b/src/qt/settings.cpp new file mode 100644 index 0000000000..69d24884a7 --- /dev/null +++ b/src/qt/settings.cpp @@ -0,0 +1,144 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: settings.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "settings.h" +#endif + +#include "wx/settings.h" + +/* +#define wxSYS_COLOUR_SCROLLBAR 0 +#define wxSYS_COLOUR_BACKGROUND 1 +#define wxSYS_COLOUR_ACTIVECAPTION 2 +#define wxSYS_COLOUR_INACTIVECAPTION 3 +#define wxSYS_COLOUR_MENU 4 +#define wxSYS_COLOUR_WINDOW 5 +#define wxSYS_COLOUR_WINDOWFRAME 6 +#define wxSYS_COLOUR_MENUTEXT 7 +#define wxSYS_COLOUR_WINDOWTEXT 8 +#define wxSYS_COLOUR_CAPTIONTEXT 9 +#define wxSYS_COLOUR_ACTIVEBORDER 10 +#define wxSYS_COLOUR_INACTIVEBORDER 11 +#define wxSYS_COLOUR_APPWORKSPACE 12 +#define wxSYS_COLOUR_HIGHLIGHT 13 +#define wxSYS_COLOUR_HIGHLIGHTTEXT 14 +#define wxSYS_COLOUR_BTNFACE 15 +#define wxSYS_COLOUR_BTNSHADOW 16 +#define wxSYS_COLOUR_GRAYTEXT 17 +#define wxSYS_COLOUR_BTNTEXT 18 +#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19 +#define wxSYS_COLOUR_BTNHIGHLIGHT 20 + +#define wxSYS_COLOUR_3DDKSHADOW 21 +#define wxSYS_COLOUR_3DLIGHT 22 +#define wxSYS_COLOUR_INFOTEXT 23 +#define wxSYS_COLOUR_INFOBK 24 + +#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND +#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE +#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW +#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT +#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT +#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT +*/ + +#define SHIFT (8*(sizeof(short int)-sizeof(char))) + +wxColour *g_systemBtnFaceColour = NULL; +wxColour *g_systemBtnShadowColour = NULL; +wxColour *g_systemBtnHighlightColour = NULL; +wxColour *g_systemHighlightColour = NULL; + +wxColour wxSystemSettings::GetSystemColour( int index ) +{ + switch (index) + { + case wxSYS_COLOUR_SCROLLBAR: + case wxSYS_COLOUR_BACKGROUND: + case wxSYS_COLOUR_ACTIVECAPTION: + case wxSYS_COLOUR_INACTIVECAPTION: + case wxSYS_COLOUR_MENU: + case wxSYS_COLOUR_WINDOW: + case wxSYS_COLOUR_WINDOWFRAME: + case wxSYS_COLOUR_ACTIVEBORDER: + case wxSYS_COLOUR_INACTIVEBORDER: + case wxSYS_COLOUR_BTNFACE: + { + return *g_systemBtnFaceColour; + }; + case wxSYS_COLOUR_BTNSHADOW: + { + return *g_systemBtnShadowColour; + }; + case wxSYS_COLOUR_GRAYTEXT: + case wxSYS_COLOUR_BTNHIGHLIGHT: + { + return *g_systemBtnHighlightColour; + }; + case wxSYS_COLOUR_HIGHLIGHT: + { + return *g_systemHighlightColour; + }; + case wxSYS_COLOUR_MENUTEXT: + case wxSYS_COLOUR_WINDOWTEXT: + case wxSYS_COLOUR_CAPTIONTEXT: + case wxSYS_COLOUR_INACTIVECAPTIONTEXT: + case wxSYS_COLOUR_INFOTEXT: + { + return *wxBLACK; + }; + case wxSYS_COLOUR_HIGHLIGHTTEXT: + { + return *wxWHITE; + }; + case wxSYS_COLOUR_INFOBK: + case wxSYS_COLOUR_APPWORKSPACE: + { + return *wxWHITE; // ? + }; + }; + return *wxWHITE; +}; + +wxFont *g_systemFont = NULL; + +wxFont wxSystemSettings::GetSystemFont( int index ) +{ + switch (index) + { + case wxSYS_OEM_FIXED_FONT: + case wxSYS_ANSI_FIXED_FONT: + case wxSYS_SYSTEM_FIXED_FONT: + { + return *wxNORMAL_FONT; + }; + case wxSYS_ANSI_VAR_FONT: + case wxSYS_SYSTEM_FONT: + case wxSYS_DEVICE_DEFAULT_FONT: + case wxSYS_DEFAULT_GUI_FONT: + { + return *g_systemFont; + }; + }; + return wxNullFont; +}; + +int wxSystemSettings::GetSystemMetric( int index ) +{ + switch (index) + { + case wxSYS_SCREEN_X: return 0; + case wxSYS_SCREEN_Y: return 0; + }; + return 0; +}; + diff --git a/src/qt/slider.cpp b/src/qt/slider.cpp new file mode 100644 index 0000000000..433179dd2b --- /dev/null +++ b/src/qt/slider.cpp @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: slider.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "slider.h" +#endif + +#include "wx/slider.h" +#include "wx/utils.h" + +//----------------------------------------------------------------------------- +// wxSlider +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl) + +wxSlider::wxSlider(void) +{ +}; + +wxSlider::wxSlider( wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos, const wxSize& size, + long style, +/* const wxValidator& validator = wxDefaultValidator, */ + const wxString& name ) +{ + Create( parent, id, value, minValue, maxValue, + pos, size, style, name ); +}; + +wxSlider::~wxSlider(void) +{ +}; + +bool wxSlider::Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos, const wxSize& size, + long style, +/* const wxValidator& validator = wxDefaultValidator, */ + const wxString& name ) +{ + return TRUE; +}; + +int wxSlider::GetValue(void) const +{ +}; + +void wxSlider::SetValue( int value ) +{ +}; + +void wxSlider::SetRange( int minValue, int maxValue ) +{ +}; + +int wxSlider::GetMin(void) const +{ +}; + +int wxSlider::GetMax(void) const +{ +}; + +void wxSlider::SetPageSize( int pageSize ) +{ +}; + +int wxSlider::GetPageSize(void) const +{ +}; + +void wxSlider::SetThumbLength( int len ) +{ +}; + +int wxSlider::GetThumbLength(void) const +{ +}; + +void wxSlider::SetLineSize( int WXUNUSED(lineSize) ) +{ +}; + +int wxSlider::GetLineSize(void) const +{ +}; + +void wxSlider::GetSize( int *x, int *y ) const +{ + wxWindow::GetSize( x, y ); +}; + +void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags ) +{ + wxWindow::SetSize( x, y, width, height, sizeFlags ); +}; + +void wxSlider::GetPosition( int *x, int *y ) const +{ + wxWindow::GetPosition( x, y ); +}; + +void wxSlider::SetTick( int WXUNUSED(tickPos) ) +{ +}; + +void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) ) +{ +}; + +int wxSlider::GetTickFreq(void) const +{ + return 0; +}; + +void wxSlider::ClearTicks(void) +{ +}; + +void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) ) +{ +}; + +int wxSlider::GetSelEnd(void) const +{ + return 0; +}; + +int wxSlider::GetSelStart(void) const +{ + return 0; +}; + +void wxSlider::ClearSel(void) +{ +}; + diff --git a/src/qt/statbmp.cpp b/src/qt/statbmp.cpp new file mode 100644 index 0000000000..e4c3e6476b --- /dev/null +++ b/src/qt/statbmp.cpp @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbmp.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "statbmp.h" +#endif + +#include "wx/statbmp.h" + +//----------------------------------------------------------------------------- +// wxStaticBitmap +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl) + +wxStaticBitmap::wxStaticBitmap(void) +{ +}; + +wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, bitmap, pos, size, style, name ); +}; + +bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + return TRUE; +}; + +void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) +{ +}; + diff --git a/src/qt/statbox.cpp b/src/qt/statbox.cpp new file mode 100644 index 0000000000..e45dc53560 --- /dev/null +++ b/src/qt/statbox.cpp @@ -0,0 +1,38 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbox.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "statbox.h" +#endif + +#include "wx/statbox.h" + +//----------------------------------------------------------------------------- +// wxStaticBox +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxStaticBox,wxControl) + +wxStaticBox::wxStaticBox(void) +{ +}; + +wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, label, pos, size, style, name ); +}; + +bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ +}; diff --git a/src/qt/stattext.cpp b/src/qt/stattext.cpp new file mode 100644 index 0000000000..e49ae65bc2 --- /dev/null +++ b/src/qt/stattext.cpp @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: stattext.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "stattext.h" +#endif + +#include "wx/stattext.h" + +//----------------------------------------------------------------------------- +// wxStaticText +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxStaticText,wxControl) + +wxStaticText::wxStaticText(void) +{ +}; + +wxStaticText::wxStaticText( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, label, pos, size, style, name ); +}; + +bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &label, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + return TRUE; +}; + +wxString wxStaticText::GetLabel(void) const +{ +}; + +void wxStaticText::SetLabel( const wxString &label ) +{ + wxControl::SetLabel(label); +}; diff --git a/src/qt/tbargtk.cpp b/src/qt/tbargtk.cpp new file mode 100644 index 0000000000..f2c8dfcd74 --- /dev/null +++ b/src/qt/tbargtk.cpp @@ -0,0 +1,193 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tbargtk.cpp +// Purpose: GTK toolbar +// Author: Robert Roebling +// Modified by: +// Created: 01/02/97 +// RCS-ID: +// Copyright: (c) Robert Roebling +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "tbargtk.h" +#endif + +#include "wx/toolbar.h" + +//----------------------------------------------------------------------------- +// wxToolBarTool +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject) + +wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex, + const wxBitmap& bitmap1, const wxBitmap& bitmap2, + bool toggle, wxObject *clientData, + const wxString& shortHelpString, const wxString& longHelpString ) +{ + m_owner = owner; + m_index = theIndex; + m_bitmap1 = bitmap1; + m_bitmap2 = bitmap2; + m_isToggle = toggle; + m_enabled = TRUE; + m_toggleState = FALSE; + m_shortHelpString = shortHelpString; + m_longHelpString = longHelpString; + m_isMenuCommand = TRUE; + m_clientData = clientData; + m_deleteSecondBitmap = FALSE; +}; + +wxToolBarTool::~wxToolBarTool(void) +{ +}; + +//----------------------------------------------------------------------------- +// wxToolBar +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl) + +BEGIN_EVENT_TABLE(wxToolBar, wxControl) +END_EVENT_TABLE() + +wxToolBar::wxToolBar(void) +{ +}; + +wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + Create( parent, id, pos, size, style, name ); +}; + +wxToolBar::~wxToolBar(void) +{ +}; + +bool wxToolBar::Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) +{ + return TRUE; +}; + +bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) +{ + wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, toolIndex ); + event.SetEventObject(this); + event.SetInt( toolIndex ); + event.SetExtraLong((long) toggleDown); + + GetEventHandler()->ProcessEvent(event); + + return TRUE; +}; + +void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) ) +{ + wxCommandEvent event( wxEVT_COMMAND_TOOL_RCLICKED, toolIndex ); + event.SetEventObject( this ); + event.SetInt( toolIndex ); + + GetEventHandler()->ProcessEvent(event); +}; + +void wxToolBar::OnMouseEnter( int toolIndex ) +{ + wxCommandEvent event( wxEVT_COMMAND_TOOL_ENTER, toolIndex ); + event.SetEventObject(this); + event.SetInt( toolIndex ); + + GetEventHandler()->ProcessEvent(event); +}; + +wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, + const wxBitmap& pushedBitmap, bool toggle, + float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData, + const wxString& helpString1, const wxString& helpString2 ) +{ +}; + +void wxToolBar::AddSeparator(void) +{ +}; + +void wxToolBar::ClearTools(void) +{ +}; + +void wxToolBar::Realize(void) +{ +}; + +void wxToolBar::EnableTool(int toolIndex, bool enable) +{ + wxNode *node = m_tools.First(); + while (node) + { + wxToolBarTool *tool = (wxToolBarTool*)node->Data(); + if (tool->m_index == toolIndex) + { + tool->m_enabled = enable; + return; + } + node = node->Next(); + }; +}; + +void wxToolBar::ToggleTool(int WXUNUSED(toolIndex), bool WXUNUSED(toggle) ) +{ +}; + +wxObject *wxToolBar::GetToolClientData(int index) const +{ + wxNode *node = m_tools.First(); + while (node) + { + wxToolBarTool *tool = (wxToolBarTool*)node->Data(); + if (tool->m_index == index) return tool->m_clientData;; + node = node->Next(); + }; + return (wxObject*)NULL; +}; + +bool wxToolBar::GetToolState(int toolIndex) const +{ + wxNode *node = m_tools.First(); + while (node) + { + wxToolBarTool *tool = (wxToolBarTool*)node->Data(); + if (tool->m_index == toolIndex) return tool->m_toggleState; + node = node->Next(); + }; + return FALSE; +}; + +bool wxToolBar::GetToolEnabled(int toolIndex) const +{ + wxNode *node = m_tools.First(); + while (node) + { + wxToolBarTool *tool = (wxToolBarTool*)node->Data(); + if (tool->m_index == toolIndex) return tool->m_enabled; + node = node->Next(); + }; + return FALSE; +}; + +void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) ) +{ +}; + +void wxToolBar::SetToolPacking( int WXUNUSED(packing) ) +{ +}; + +void wxToolBar::SetToolSeparation( int separation ) +{ +}; + diff --git a/src/qt/textctrl.cpp b/src/qt/textctrl.cpp new file mode 100644 index 0000000000..7168de80cc --- /dev/null +++ b/src/qt/textctrl.cpp @@ -0,0 +1,235 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: textctrl.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "textctrl.h" +#endif + +#include "wx/textctrl.h" +#include "wx/utils.h" + +//----------------------------------------------------------------------------- +// wxTextCtrl +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl) + + +BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) +// EVT_CHAR(wxTextCtrl::OnChar) +END_EVENT_TABLE() + +wxTextCtrl::wxTextCtrl(void) : streambuf() +{ + if( allocate() ) + setp(base(),ebuf()); + + m_modified = FALSE; +}; + +wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value, + const wxPoint &pos, const wxSize &size, + int style, const wxString &name ) : streambuf() +{ + if( allocate() ) + setp(base(),ebuf()); + + m_modified = FALSE; + Create( parent, id, value, pos, size, style, name ); +}; + +bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, + const wxPoint &pos, const wxSize &size, + int style, const wxString &name ) +{ + return TRUE; +}; + +wxString wxTextCtrl::GetValue(void) const +{ + return tmp; +}; + +void wxTextCtrl::SetValue( const wxString &value ) +{ +}; + +void wxTextCtrl::WriteText( const wxString &text ) +{ +}; + +bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) ) +{ + return FALSE; +}; + +bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) ) +{ + return FALSE; +}; + +/* +wxString wxTextCtrl::GetLineText( long lineNo ) const +{ +}; + + +void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event ) +{ +}; + +long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const +{ +}; + +long wxTextCtrl::XYToPosition( long x, long y ) +{ +}; + +int wxTextCtrl::GetNumberOfLines(void) +{ +}; + +*/ +void wxTextCtrl::SetInsertionPoint( long pos ) +{ +}; + +void wxTextCtrl::SetInsertionPointEnd(void) +{ +}; + +void wxTextCtrl::SetEditable( bool editable ) +{ +}; + +void wxTextCtrl::SetSelection( long from, long to ) +{ +}; + +void wxTextCtrl::ShowPosition( long WXUNUSED(pos) ) +{ +}; + +long wxTextCtrl::GetInsertionPoint(void) const +{ +}; + +long wxTextCtrl::GetLastPosition(void) const +{ +}; + +void wxTextCtrl::Remove( long from, long to ) +{ +}; + +void wxTextCtrl::Replace( long from, long to, const wxString &value ) +{ +}; + +void wxTextCtrl::Cut(void) +{ +}; + +void wxTextCtrl::Copy(void) +{ +}; + +void wxTextCtrl::Paste(void) +{ +}; + +void wxTextCtrl::Delete(void) +{ +}; + +void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) ) +{ +}; + +int wxTextCtrl::overflow( int WXUNUSED(c) ) +{ + int len = pptr() - pbase(); + char *txt = new char[len+1]; + strncpy(txt, pbase(), len); + txt[len] = '\0'; + (*this) << txt; + setp(pbase(), epptr()); + delete[] txt; + return EOF; +}; + +int wxTextCtrl::sync(void) +{ + int len = pptr() - pbase(); + char *txt = new char[len+1]; + strncpy(txt, pbase(), len); + txt[len] = '\0'; + (*this) << txt; + setp(pbase(), epptr()); + delete[] txt; + return 0; +}; + +int wxTextCtrl::underflow(void) +{ + return EOF; +}; + +wxTextCtrl& wxTextCtrl::operator<<(const wxString& s) +{ + WriteText(s); + return *this; +} + +wxTextCtrl& wxTextCtrl::operator<<(float f) +{ + static char buf[100]; + sprintf(buf, "%.2f", f); + WriteText(buf); + return *this; +} + +wxTextCtrl& wxTextCtrl::operator<<(double d) +{ + static char buf[100]; + sprintf(buf, "%.2f", d); + WriteText(buf); + return *this; +} + +wxTextCtrl& wxTextCtrl::operator<<(int i) +{ + static char buf[100]; + sprintf(buf, "%i", i); + WriteText(buf); + return *this; +} + +wxTextCtrl& wxTextCtrl::operator<<(long i) +{ + static char buf[100]; + sprintf(buf, "%ld", i); + WriteText(buf); + return *this; +} + +wxTextCtrl& wxTextCtrl::operator<<(const char c) +{ + char buf[2]; + + buf[0] = c; + buf[1] = 0; + WriteText(buf); + return *this; +} + + + diff --git a/src/qt/threadgui.inc b/src/qt/threadgui.inc new file mode 100644 index 0000000000..165fef3c01 --- /dev/null +++ b/src/qt/threadgui.inc @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: threadgui.inc +// Purpose: GUI thread manager for GTK +// Author: Original from Wolfram Gloger/Guilhem Lavaux +// Modified by: +// Created: 04/22/98 +// RCS-ID: $Id$ +// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include +#include + +// for select() +#include +#include +#ifdef __sgi +#include +#endif + +#include + + +///////////////////////////////////////////////////////////////////////////// +// Static variables +///////////////////////////////////////////////////////////////////////////// + +static int p_thrd_pipe[2] = { -1, -1 }; +// WorkProc in GTK +static gint p_thrd_inid; + +#define THREAD_SEND_EXIT_MSG(ptr) write(p_thrd_pipe[1], &ptr, sizeof(ptr)); + +static void +ThreadExitProc(gpointer WXUNUSED(client), gint fid, + GdkInputCondition WXUNUSED(cond)) +{ + wxThread* ptr; + + if (fid != p_thrd_pipe[0]) + return; + if (read(fid, &ptr, sizeof(ptr)) == sizeof(ptr)) { + //fprintf(stderr, "calling OnExit %p\n", ptr); + ptr->OnExit(); + } else { + //fprintf(stderr, "this should never happen\n"); + } +} + +// Global initialization +static void wxThreadGuiInit() +{ + pipe(p_thrd_pipe); + p_thrd_inid = gdk_input_add(p_thrd_pipe[0], GDK_INPUT_READ, + ThreadExitProc, 0); +} + +// Global cleanup +static void wxThreadGuiExit() +{ + gdk_input_remove(p_thrd_inid); + close(p_thrd_pipe[0]); + close(p_thrd_pipe[1]); +} diff --git a/src/qt/threadno.cpp b/src/qt/threadno.cpp new file mode 100644 index 0000000000..2cdfcd3a37 --- /dev/null +++ b/src/qt/threadno.cpp @@ -0,0 +1,165 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: thread.cpp +// Purpose: No thread support +// Author: Original from Wolfram Gloger/Guilhem Lavaux +// Modified by: +// Created: 04/22/98 +// RCS-ID: $Id$ +// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ +#pragma implementation "thread.h" +#endif + +#include "wx/wx.h" +#include "wx/module.h" +#include "wx/thread.h" + +wxMutex::wxMutex() +{ + m_locked = 0; +} + +wxMutex::~wxMutex() +{ + if (m_locked) + wxDebugMsg("wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked); +} + +wxMutexError wxMutex::Lock() +{ + m_locked++; + return MUTEX_NO_ERROR; +} + +wxMutexError wxMutex::TryLock() +{ + if (m_locked > 0) + return MUTEX_BUSY; + m_locked++; + return MUTEX_NO_ERROR; +} + +wxMutexError wxMutex::Unlock() +{ + if (m_locked == 0) + return MUTEX_UNLOCKED; + m_locked--; + return MUTEX_NO_ERROR; +} + +wxCondition::wxCondition() +{ +} + +wxCondition::~wxCondition() +{ +} + +void wxCondition::Wait(wxMutex& WXUNUSED(mutex)) +{ +} + +bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec), + unsigned long WXUNUSED(nsec)) +{ + return FALSE; +} + +void wxCondition::Signal() +{ +} + +void wxCondition::Broadcast() +{ +} + +struct wxThreadInternal { + int thread_id; + void* exit_status; +}; + +wxThreadError wxThread::Create() +{ + p_internal->exit_status = Entry(); + OnExit(); + return THREAD_NO_ERROR; +} + +wxThreadError wxThread::Destroy() +{ + return THREAD_RUNNING; +} + +void wxThread::DeferDestroy( bool WXUNUSED(on) ) +{ +} + +void wxThread::TestDestroy() +{ +} + +void *wxThread::Join() +{ + return p_internal->exit_status; +} + +unsigned long wxThread::GetID() const +{ + return 0; +} + +bool wxThread::IsMain() +{ + return TRUE; +} + +bool wxThread::IsAlive() const +{ + return FALSE; +} + +void wxThread::SetPriority(int WXUNUSED(prio)) { } +int wxThread::GetPriority() const { return 0; } + +wxMutex wxMainMutex; // controls access to all GUI functions + +wxThread::wxThread() +{ + p_internal = new wxThreadInternal(); +} + +wxThread::~wxThread() +{ + Destroy(); + Join(); + delete p_internal; +} + +// The default callback just joins the thread and throws away the result. +void wxThread::OnExit() +{ + Join(); +} + + +// Automatic initialization +class wxThreadModule : public wxModule { + DECLARE_DYNAMIC_CLASS(wxThreadModule) +public: + bool OnInit(); + void OnExit(); +}; + +bool wxThreadModule::OnInit() { + wxMainMutex.Lock(); + return TRUE; +} + +void wxThreadModule::OnExit() +{ + wxMainMutex.Unlock(); +} + +IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) diff --git a/src/qt/threadpsx.cpp b/src/qt/threadpsx.cpp new file mode 100644 index 0000000000..363f0636ea --- /dev/null +++ b/src/qt/threadpsx.cpp @@ -0,0 +1,322 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: threadpsx.cpp +// Purpose: wxThread (Posix) Implementation +// Author: Original from Wolfram Gloger/Guilhem Lavaux +// Modified by: +// Created: 04/22/98 +// RCS-ID: $Id$ +// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ +#pragma implementation "thread.h" +#endif + +#include +#include +#include +#include +#include "wx/thread.h" +#include "wx/module.h" +#include "wx/utils.h" + +enum thread_state { + STATE_IDLE = 0, + STATE_RUNNING, + STATE_CANCELED, + STATE_EXITED +}; + +///////////////////////////////////////////////////////////////////////////// +// Static variables +///////////////////////////////////////////////////////////////////////////// + +static pthread_t p_mainid; +wxMutex wxMainMutex; // controls access to all GUI functions + +///////////////////////////////////////////////////////////////////////////// +// GUI thread manager +///////////////////////////////////////////////////////////////////////////// +#include "threadgui.inc" + +///////////////////////////////////////////////////////////////////////////// +// wxThread: Posix Thread implementation (Mutex) +///////////////////////////////////////////////////////////////////////////// + +class wxMutexInternal { +public: + pthread_mutex_t p_mutex; +}; + +wxMutex::wxMutex() +{ + p_internal = new wxMutexInternal; + pthread_mutex_init(&(p_internal->p_mutex), NULL); + m_locked = 0; +} + +wxMutex::~wxMutex() +{ + if (m_locked > 0) + wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", + m_locked); + + pthread_mutex_destroy(&(p_internal->p_mutex)); + delete p_internal; +} + +wxMutexError wxMutex::Lock() +{ + int err; + + err = pthread_mutex_lock(&(p_internal->p_mutex)); + if (err == EDEADLK) + return MUTEX_DEAD_LOCK; + m_locked++; + return MUTEX_NO_ERROR; +} + +wxMutexError wxMutex::TryLock() +{ + int err; + + if (m_locked) + return MUTEX_BUSY; + err = pthread_mutex_trylock(&(p_internal->p_mutex)); + switch (err) { + case EBUSY: return MUTEX_BUSY; + } + m_locked++; + return MUTEX_NO_ERROR; +} + +wxMutexError wxMutex::Unlock() +{ + if (m_locked > 0) + m_locked--; + else + return MUTEX_UNLOCKED; + pthread_mutex_unlock(&(p_internal->p_mutex)); + return MUTEX_NO_ERROR; +} + +///////////////////////////////////////////////////////////////////////////// +// wxThread: Posix Thread implementation (Condition) +///////////////////////////////////////////////////////////////////////////// + +class wxConditionInternal { +public: + pthread_cond_t p_condition; +}; + +wxCondition::wxCondition() +{ + p_internal = new wxConditionInternal; + pthread_cond_init(&(p_internal->p_condition), NULL); +} + +wxCondition::~wxCondition() +{ + pthread_cond_destroy(&(p_internal->p_condition)); + delete p_internal; +} + +void wxCondition::Wait(wxMutex& mutex) +{ + pthread_cond_wait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex)); +} + +bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec) +{ + struct timespec tspec; + + tspec.tv_sec = time(NULL)+sec; + tspec.tv_nsec = nsec; + return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT); +} + +void wxCondition::Signal() +{ + pthread_cond_signal(&(p_internal->p_condition)); +} + +void wxCondition::Broadcast() +{ + pthread_cond_broadcast(&(p_internal->p_condition)); +} + +///////////////////////////////////////////////////////////////////////////// +// wxThread: Posix Thread implementation (Thread) +///////////////////////////////////////////////////////////////////////////// + +class wxThreadInternal { +public: + wxThreadInternal() { state = STATE_IDLE; } + ~wxThreadInternal() {} + static void *PthreadStart(void *ptr); + pthread_t thread_id; + int state; + int prio; +}; + +void *wxThreadInternal::PthreadStart(void *ptr) +{ + wxThread *thread = (wxThread *)ptr; + + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + void* status = thread->Entry(); + thread->Exit(status); + + return NULL; +} + +wxThreadError wxThread::Create() +{ + pthread_attr_t a; + int min_prio, max_prio, p; + struct sched_param sp; + + if (p_internal->state != STATE_IDLE) + return THREAD_RUNNING; + + // Change thread priority + pthread_attr_init(&a); + pthread_attr_getschedpolicy(&a, &p); + + min_prio = sched_get_priority_min(p); + max_prio = sched_get_priority_max(p); + + pthread_attr_getschedparam(&a, &sp); + sp.sched_priority = min_prio + + (p_internal->prio*(max_prio-min_prio))/100; + pthread_attr_setschedparam(&a, &sp); + + // this is the point of no return + p_internal->state = STATE_RUNNING; + if (pthread_create(&p_internal->thread_id, &a, + wxThreadInternal::PthreadStart, (void *)this) != 0) { + p_internal->state = STATE_IDLE; + pthread_attr_destroy(&a); + return THREAD_NO_RESOURCE; + } + pthread_attr_destroy(&a); + return THREAD_NO_ERROR; +} + +void wxThread::SetPriority(int prio) +{ + if (p_internal->state == STATE_RUNNING) + return; + + if (prio > 100) + prio = 100; + if (prio < 0) + prio = 0; + p_internal->prio = prio; +} + +int wxThread::GetPriority() const +{ + return p_internal->prio; +} + +void wxThread::DeferDestroy(bool on) +{ + if (on) + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + else + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); +} + +wxThreadError wxThread::Destroy() +{ + int res = 0; + + if (p_internal->state == STATE_RUNNING) { + res = pthread_cancel(p_internal->thread_id); + if (res == 0) + p_internal->state = STATE_CANCELED; + } + return THREAD_NO_ERROR; +} + +void *wxThread::Join() +{ + void* status = 0; + + if (p_internal->state != STATE_IDLE) { + bool do_unlock = wxThread::IsMain(); + + while (p_internal->state == STATE_RUNNING) + wxYield(); + + if (do_unlock) + wxMainMutex.Unlock(); + pthread_join(p_internal->thread_id, &status); + if (do_unlock) + wxMainMutex.Lock(); + p_internal->state = STATE_IDLE; + } + return status; +} + +unsigned long wxThread::GetID() const +{ + return (unsigned long)p_internal->thread_id; +} + +void wxThread::Exit(void *status) +{ + wxThread* ptr = this; + + THREAD_SEND_EXIT_MSG(ptr); + p_internal->state = STATE_EXITED; + pthread_exit(status); +} + +void wxThread::TestDestroy() +{ + pthread_testcancel(); +} + +bool wxThread::IsMain() +{ + return (bool)pthread_equal(pthread_self(), p_mainid); +} + +wxThread::wxThread() +{ + p_internal = new wxThreadInternal(); +} + +wxThread::~wxThread() +{ + Destroy(); + Join(); + delete p_internal; +} + +// The default callback just joins the thread and throws away the result. +void wxThread::OnExit() +{ +} + +// Automatic initialization +class wxThreadModule : public wxModule { + DECLARE_DYNAMIC_CLASS(wxThreadModule) +public: + virtual bool OnInit() { + wxThreadGuiInit(); + p_mainid = pthread_self(); + wxMainMutex.Lock(); + + return TRUE; + } + + virtual void OnExit() { + wxMainMutex.Unlock(); + wxThreadGuiExit(); + } +}; + +IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) diff --git a/src/qt/threadsgi.cpp b/src/qt/threadsgi.cpp new file mode 100644 index 0000000000..6f602b3324 --- /dev/null +++ b/src/qt/threadsgi.cpp @@ -0,0 +1,230 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: threadsgi.cpp +// Purpose: wxThread (SGI) Implementation +// Author: Original from Wolfram Gloger/Guilhem Lavaux +// Modified by: +// Created: 04/22/98 +// RCS-ID: $Id$ +// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// +#ifdef __GNUG__ +#pragma implementation "thread.h" +#endif + +#include +#include + +#include +#include +#include +#include "wx/thread.h" +#include "wx/module.h" +#include "wx/utils.h" + +enum thread_state { + STATE_IDLE = 0, + STATE_RUNNING, + STATE_CANCELED, + STATE_EXITED +}; + +///////////////////////////////////////////////////////////////////////////// +// Static variables +///////////////////////////////////////////////////////////////////////////// + +static int p_mainid; +wxMutex wxMainMutex; + +#include "threadgui.inc" + +///////////////////////////////////////////////////////////////////////////// +// Unix implementations (SGI threads) +///////////////////////////////////////////////////////////////////////////// + +class wxMutexInternal { +public: + abilock_t p_mutex; +}; + +wxMutex::wxMutex() +{ + m_locked = 0; + p_internal = new wxMutexInternal; + init_lock(&(p_internal->p_mutex)); +} + +wxMutex::~wxMutex() +{ + if (m_locked > 0) + wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", + m_locked); + delete p_internal; +} + +wxMutexError wxMutex::Lock() +{ + spin_lock(&(p_internal->p_mutex)); + m_locked++; + return MUTEX_NO_ERROR; +} + +wxMutexError wxMutex::TryLock() +{ + if (acquire_lock(&(p_internal->p_mutex)) != 0) + return MUTEX_BUSY; + m_locked++; + return MUTEX_NO_ERROR; +} + +wxMutexError wxMutex::Unlock() +{ + if (m_locked == 0) + return MUTEX_UNLOCKED; + release_lock(&(p_internal->p_mutex)); + m_locked--; + return MUTEX_NO_ERROR; +} + +// GL: Don't know how it works on SGI. Wolfram ? + +wxCondition::wxCondition() {} +wxCondition::~wxCondition() {} +int wxCondition::Wait(wxMutex& WXUNUSED(mutex)) { return 0;} +int wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec), + unsigned long WXUNUSED(nsec)) { return 0; } +int wxCondition::Signal() { return 0; } +int wxCondition::Broadcast() { return 0; } + +class +wxThreadPrivate { +public: + wxThreadPrivate() { thread_id = 0; state = STATE_IDLE; } + ~wxThreadPrivate() {} + static void SprocStart(void *ptr); + static void SignalHandler(int sig); +public: + int state, thread_id; + void* exit_status; +}; + +void wxThreadPrivate::SprocStart(void *ptr) +{ + void* status; + + wxThread *thr = (wxThread *)ptr; + + thr->p_internal->thread_id = getpid(); + thr->p_internal->exit_status = 0; + status = thr->Entry(); + thr->Exit(status); +} + +void wxThread::Exit(void* status) +{ + wxThread* ptr = this; + THREAD_SEND_EXIT_MSG(ptr); + p_internal->state = STATE_EXITED; + p_internal->exit_status = status; + _exit(0); +} + +wxThreadError wxThread::Create() +{ + if (p_internal->state != STATE_IDLE) + return THREAD_RUNNING; + p_internal->state = STATE_RUNNING; + if (sproc(p_internal->SprocStart, PR_SALL, this) < 0) { + p_internal->state = STATE_IDLE; + return THREAD_NO_RESOURCE; + } + return THREAD_NO_ERROR; +} + +void wxThread::Destroy() +{ + if (p_internal->state == STATE_RUNNING) + p_internal->state = STATE_CANCELED; +} + +void *wxThread::Join() +{ + if (p_internal->state != STATE_IDLE) { + bool do_unlock = wxThread::IsMain(); + int stat; + + if (do_unlock) + wxMainMutex.Unlock(); + waitpid(p_internal->thread_id, &stat, 0); + if (do_unlock) + wxMainMutex.Lock(); + if (!WIFEXITED(stat) && !WIFSIGNALED(stat)) + return 0; + p_internal->state = STATE_IDLE; + return p_internal->exit_status; + } + return 0; +} + +unsigned long wxThread::GetID() const +{ + return (unsigned long)p_internal->thread_id; +} + +void wxThread::TestDestroy() +{ + if (p_internal->state == STATE_CANCELED) { + p_internal->exit_status = 0; + _exit(0); + } +} + +void wxThread::SetPriority(int prio) +{ +} + +int wxThread::GetPriority() const +{ + return 0; +} + +bool wxThreadIsMain() +{ + return (int)getpid() == main_id; +} + +wxThread::wxThread() +{ + p_internal = new wxThreadPrivate(); +} + +wxThread::~wxThread() +{ + Cancel(); + Join(); + delete p_internal; +} + +// The default callback just joins the thread and throws away the result. +void wxThread::OnExit() +{ + Join(); +} + +// Global initialization +class wxThreadModule : public wxModule { + DECLARE_DYNAMIC_CLASS(wxThreadModule) +public: + virtual bool OnInit() { + wxThreadGuiInit(); + p_mainid = (int)getpid(); + wxMainMutex.Lock(); + } + + virtual void OnExit() { + wxMainMutex.Unlock(); + wxThreadGuiExit(); + } +}; + +IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) diff --git a/src/qt/timer.cpp b/src/qt/timer.cpp new file mode 100644 index 0000000000..e8b08d3ca4 --- /dev/null +++ b/src/qt/timer.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "timer.h" +#endif + +#include "wx/timer.h" + +//----------------------------------------------------------------------------- +// wxTimer +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxTimer,wxObject) + +gint timeout_callback( gpointer data ) +{ + wxTimer *timer = (wxTimer*)data; + timer->Notify(); + if (timer->OneShot()) timer->Stop(); + return TRUE; +}; + +wxTimer::wxTimer(void) +{ + m_time = 1000; + m_oneShot = FALSE; +}; + +wxTimer::~wxTimer(void) +{ + Stop(); +}; + +int wxTimer::Interval(void) +{ + return m_time; +}; + +bool wxTimer::OneShot(void) +{ + return m_oneShot; +}; + +void wxTimer::Notify(void) +{ +}; + +void wxTimer::Start( int millisecs, bool oneShot ) +{ + if (millisecs != -1) m_time = millisecs; + m_oneShot = oneShot; +}; + +void wxTimer::Stop(void) +{ +}; + diff --git a/src/qt/utilsgtk.cpp b/src/qt/utilsgtk.cpp new file mode 100644 index 0000000000..bf6669325c --- /dev/null +++ b/src/qt/utilsgtk.cpp @@ -0,0 +1,367 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: utils.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +//#ifdef __GNUG__ +//#pragma implementation "utils.h" +//#endif + +#include "wx/utils.h" +#include "wx/string.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __SVR4__ +#include +#endif + +//------------------------------------------------------------------------ +// misc. +//------------------------------------------------------------------------ + +void wxBell(void) +{ + gdk_beep(); +}; + +void wxSleep(int nSecs) +{ + sleep(nSecs); +}; + +int wxKill(long pid, int sig) +{ + return kill(pid, sig); +}; + +void wxDisplaySize( int *width, int *height ) +{ + if (width) *width = gdk_screen_width(); + if (height) *height = gdk_screen_height(); +} + +//------------------------------------------------------------------------ +// user and home routines +//------------------------------------------------------------------------ + +char* wxGetHomeDir( char *dest ) +{ + wxString tmp = wxGetUserHome( wxString() ); + if (tmp.IsNull()) + strcpy( wxBuffer, "/" ); + else + strcpy( wxBuffer, tmp ); + if (dest) strcpy( dest, WXSTRINGCAST tmp ); + return wxBuffer; +}; + +char *wxGetUserHome( const wxString &user ) +{ + struct passwd *who = NULL; + + if (user.IsNull() || (user== "")) + { + register char *ptr; + + if ((ptr = getenv("HOME")) != NULL) + return ptr; + if ((ptr = getenv("USER")) != NULL + || (ptr = getenv("LOGNAME")) != NULL) { + who = getpwnam(ptr); + } + // We now make sure the the user exists! + if (who == NULL) + who = getpwuid(getuid()); + } + else + who = getpwnam (user); + + return who ? who->pw_dir : (char*)NULL; +}; + +//------------------------------------------------------------------------ +// id routines +//------------------------------------------------------------------------ + +bool wxGetHostName(char *buf, int sz) +{ + *buf = '\0'; +#if defined(__SVR4__) && !defined(__sgi) + return (sysinfo(SI_HOSTNAME, buf, sz) != -1); +#else /* BSD Sockets */ + char name[255]; + struct hostent *h; + // Get hostname + if (gethostname(name, sizeof(name)/sizeof(char)-1) == -1) + return FALSE; + // Get official full name of host + strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1); + return TRUE; +#endif +} + +bool wxGetUserId(char *buf, int sz) +{ + struct passwd *who; + + *buf = '\0'; + if ((who = getpwuid(getuid ())) != NULL) { + strncpy (buf, who->pw_name, sz-1); + return TRUE; + } + return FALSE; +} + +bool wxGetUserName(char *buf, int sz) +{ + struct passwd *who; + + *buf = '\0'; + if ((who = getpwuid (getuid ())) != NULL) { + strncpy (buf, who->pw_gecos, sz - 1); + return TRUE; + } + return FALSE; +} + +//------------------------------------------------------------------------ +// error and debug output routines +//------------------------------------------------------------------------ + +void wxDebugMsg( const char *format, ... ) +{ + va_list ap; + va_start( ap, format ); + vfprintf( stderr, format, ap ); + fflush( stderr ); + va_end(ap); +}; + +void wxError( const wxString &msg, const wxString &title ) +{ + fprintf( stderr, "Error " ); + if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) ); + if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); + fprintf( stderr, ".\n" ); +}; + +void wxFatalError( const wxString &msg, const wxString &title ) +{ + fprintf( stderr, "Error " ); + if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) ); + if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) ); + fprintf( stderr, ".\n" ); + exit(1); +}; + +//------------------------------------------------------------------------ +// directory routines +//------------------------------------------------------------------------ + +bool wxDirExists( const wxString& dir ) +{ + char buf[500]; + strcpy( buf, WXSTRINGCAST(dir) ); + struct stat sbuf; + return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); +}; + +//------------------------------------------------------------------------ +// wild character routines +//------------------------------------------------------------------------ + +bool wxIsWild( const wxString& pattern ) +{ + wxString tmp = pattern; + char *pat = WXSTRINGCAST(tmp); + while (*pat) { + switch (*pat++) { + case '?': case '*': case '[': case '{': + return TRUE; + case '\\': + if (!*pat++) + return FALSE; + } + } + return FALSE; +}; + + +bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) +{ + wxString tmp1 = pat; + char *pattern = WXSTRINGCAST(tmp1); + wxString tmp2 = text; + char *str = WXSTRINGCAST(tmp2); + char c; + char *cp; + bool done = FALSE, ret_code, ok; + // Below is for vi fans + const char OB = '{', CB = '}'; + + // dot_special means '.' only matches '.' + if (dot_special && *str == '.' && *pattern != *str) + return FALSE; + + while ((*pattern != '\0') && (!done) + && (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) { + switch (*pattern) { + case '\\': + pattern++; + if (*pattern != '\0') + pattern++; + break; + case '*': + pattern++; + ret_code = FALSE; + while ((*str!='\0') + && (!(ret_code=wxMatchWild(pattern, str++, FALSE)))) + /*loop*/; + if (ret_code) { + while (*str != '\0') + str++; + while (*pattern != '\0') + pattern++; + } + break; + case '[': + pattern++; + repeat: + if ((*pattern == '\0') || (*pattern == ']')) { + done = TRUE; + break; + } + if (*pattern == '\\') { + pattern++; + if (*pattern == '\0') { + done = TRUE; + break; + } + } + if (*(pattern + 1) == '-') { + c = *pattern; + pattern += 2; + if (*pattern == ']') { + done = TRUE; + break; + } + if (*pattern == '\\') { + pattern++; + if (*pattern == '\0') { + done = TRUE; + break; + } + } + if ((*str < c) || (*str > *pattern)) { + pattern++; + goto repeat; + } + } else if (*pattern != *str) { + pattern++; + goto repeat; + } + pattern++; + while ((*pattern != ']') && (*pattern != '\0')) { + if ((*pattern == '\\') && (*(pattern + 1) != '\0')) + pattern++; + pattern++; + } + if (*pattern != '\0') { + pattern++, str++; + } + break; + case '?': + pattern++; + str++; + break; + case OB: + pattern++; + while ((*pattern != CB) && (*pattern != '\0')) { + cp = str; + ok = TRUE; + while (ok && (*cp != '\0') && (*pattern != '\0') + && (*pattern != ',') && (*pattern != CB)) { + if (*pattern == '\\') + pattern++; + ok = (*pattern++ == *cp++); + } + if (*pattern == '\0') { + ok = FALSE; + done = TRUE; + break; + } else if (ok) { + str = cp; + while ((*pattern != CB) && (*pattern != '\0')) { + if (*++pattern == '\\') { + if (*++pattern == CB) + pattern++; + } + } + } else { + while (*pattern!=CB && *pattern!=',' && *pattern!='\0') { + if (*++pattern == '\\') { + if (*++pattern == CB || *pattern == ',') + pattern++; + } + } + } + if (*pattern != '\0') + pattern++; + } + break; + default: + if (*str == *pattern) { + str++, pattern++; + } else { + done = TRUE; + } + } + } + while (*pattern == '*') + pattern++; + return ((*str == '\0') && (*pattern == '\0')); +}; + +//------------------------------------------------------------------------ +// subprocess routines +//------------------------------------------------------------------------ + +long wxExecute( char **argv, bool sync, wxProcess *process ) +{ +}; + +long wxExecute( const wxString& command, bool sync, wxProcess *process ) +{ + if (command.IsNull() || command == "") return FALSE; + + int argc = 0; + char *argv[127]; + char tmp[1024]; + const char *IFS = " \t\n"; + + strncpy (tmp, command, sizeof(tmp) / sizeof(char) - 1); + tmp[sizeof (tmp) / sizeof (char) - 1] = '\0'; + argv[argc++] = strtok (tmp, IFS); + while ((argv[argc++] = strtok(NULL, IFS)) != NULL) + /* loop */ ; + return wxExecute(argv, sync, process); +}; + + diff --git a/src/qt/utilsres.cpp b/src/qt/utilsres.cpp new file mode 100644 index 0000000000..562f0f31ca --- /dev/null +++ b/src/qt/utilsres.cpp @@ -0,0 +1,332 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: utils.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +//#ifdef __GNUG__ +//#pragma implementation "utils.h" +//#endif + +#include "wx/utils.h" +#include "wx/string.h" +#include "wx/list.h" + +#include +#include +#include +#ifdef __SVR4__ +#include +#endif + +#include +#include +#include + + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +// Yuck this is really BOTH site and platform dependent +// so we should use some other strategy! +#ifdef __SUN__ + #define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults" +#else + #define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults" +#endif + +//----------------------------------------------------------------------------- +// glabal data (data.cpp) +//----------------------------------------------------------------------------- + +extern wxList wxResourceCache; +extern XrmDatabase wxResourceDatabase; + +//----------------------------------------------------------------------------- +// utility functions for get/write resources +//----------------------------------------------------------------------------- + +static char *GetResourcePath(char *buf, char *name, bool create) +{ + if (create && FileExists(name)) { + strcpy(buf, name); + return buf; // Exists so ... + } + if (*name == '/') + strcpy(buf, name); + else { + // Put in standard place for resource files if not absolute + strcpy(buf, DEFAULT_XRESOURCE_DIR); + strcat(buf, "/"); + strcat(buf, FileNameFromPath(name)); + } + if (create) { + // Touch the file to create it + FILE *fd = fopen(buf, "w"); + if (fd) fclose(fd); + } + return buf; +} + +// Read $HOME for what it says is home, if not +// read $USER or $LOGNAME for user name else determine +// the Real User, then determine the Real home dir. +static char *GetIniFile(char *dest, const char *filename) +{ + char *home = NULL; + if (filename && wxIsAbsolutePath(filename)) + { + strcpy(dest, filename); + } + else + { + if ((home = wxGetUserHome(wxString())) != NULL) + { + strcpy(dest, home); + if (dest[strlen(dest) - 1] != '/') strcat(dest, "/"); + if (filename == NULL) + { + if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults"; + } + else + if (*filename != '.') strcat(dest, "."); + strcat(dest, filename); + } + else + { + dest[0] = '\0'; + } + } + return dest; +} + +static void wxXMergeDatabases(void) +{ + XrmDatabase homeDB, serverDB, applicationDB; + char filenamebuf[1024]; + + char *filename = &filenamebuf[0]; + char *environment; +// char *classname = gdk_progclass; // Robert Roebling ?? + printf( "Fixme.\n"); + char name[256]; + (void)strcpy(name, "/usr/lib/X11/app-defaults/"); + (void)strcat(name, classname ? classname : "wxWindows"); + + // Get application defaults file, if any + if ((applicationDB = XrmGetFileDatabase(name))) + (void)XrmMergeDatabases(applicationDB, &wxResourceDatabase); + + // Merge server defaults, created by xrdb, loaded as a property of the root + // window when the server initializes and loaded into the display + // structure on XOpenDisplay; + // if not defined, use .Xdefaults + printf( "Fixme.\n"); +/* if (XResourceManagerString(GDK_DISPLAY()) != NULL) { + serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY())); + } else { + (void)GetIniFile(filename, NULL); + serverDB = XrmGetFileDatabase(filename); + } +*/ + if (serverDB) + XrmMergeDatabases(serverDB, &wxResourceDatabase); + + // Open XENVIRONMENT file, or if not defined, the .Xdefaults, + // and merge into existing database + + if ((environment = getenv("XENVIRONMENT")) == NULL) { + size_t len; + environment = GetIniFile(filename, NULL); + len = strlen(environment); +#if !defined(SVR4) || defined(__sgi) + (void)gethostname(environment + len, 1024 - len); +#else + (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len); +#endif + } + if ((homeDB = XrmGetFileDatabase(environment))) + XrmMergeDatabases(homeDB, &wxResourceDatabase); +} + +//----------------------------------------------------------------------------- +// called on application exit +//----------------------------------------------------------------------------- + +void wxFlushResources(void) +{ + char nameBuffer[512]; + + wxNode *node = wxResourceCache.First(); + while (node) { + char *file = node->key.string; + // If file doesn't exist, create it first. + (void)GetResourcePath(nameBuffer, file, TRUE); + + XrmDatabase database = (XrmDatabase)node->Data(); + XrmPutFileDatabase(database, nameBuffer); + XrmDestroyDatabase(database); + wxNode *next = node->Next(); + delete node; + node = next; + } +} + +void wxDeleteResources(const char *file) +{ + char buffer[500]; + (void)GetIniFile(buffer, file); + + wxNode *node = wxResourceCache.Find(buffer); + if (node) { + XrmDatabase database = (XrmDatabase)node->Data(); + XrmDestroyDatabase(database); + delete node; + } +} + +//----------------------------------------------------------------------------- +// resource functions +//----------------------------------------------------------------------------- + +bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file ) +{ + char buffer[500]; + + if (!entry) return FALSE; + + (void)GetIniFile(buffer, file); + + XrmDatabase database; + wxNode *node = wxResourceCache.Find(buffer); + if (node) + database = (XrmDatabase)node->Data(); + else { + database = XrmGetFileDatabase(buffer); + wxResourceCache.Append(buffer, (wxObject *)database); + } + char resName[300]; + strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows"); + strcat(resName, "."); + strcat(resName, entry); + XrmPutStringResource(&database, resName, value); + return TRUE; +}; + +bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file ) +{ + char buf[50]; + sprintf(buf, "%.4f", value); + return wxWriteResource(section, entry, buf, file); +}; + +bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file ) +{ + char buf[50]; + sprintf(buf, "%ld", value); + return wxWriteResource(section, entry, buf, file); +}; + +bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file ) +{ + char buf[50]; + sprintf(buf, "%d", value); + return wxWriteResource(section, entry, buf, file); +}; + +bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file ) +{ + if (!wxResourceDatabase) + wxXMergeDatabases(); + + XrmDatabase database; + if (file) { + char buffer[500]; + // Is this right? Trying to get it to look in the user's + // home directory instead of current directory -- JACS + (void)GetIniFile(buffer, file); + + wxNode *node = wxResourceCache.Find(buffer); + if (node) + database = (XrmDatabase)node->Data(); + else { + database = XrmGetFileDatabase(buffer); + wxResourceCache.Append(buffer, (wxObject *)database); + } + } else + database = wxResourceDatabase; + + XrmValue xvalue; + char *str_type[20]; + char buf[150]; + strcpy(buf, section); + strcat(buf, "."); + strcat(buf, entry); + + bool success = XrmGetResource(database, buf, "*", str_type, &xvalue); + // Try different combinations of upper/lower case, just in case... + if (!success) { + buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0])); + success = XrmGetResource(database, buf, "*", str_type, &xvalue); + } + if (success) { + if (*value) + delete[] *value; + *value = new char[xvalue.size + 1]; + strncpy(*value, xvalue.addr, (int)xvalue.size); + return TRUE; + } + return FALSE; +}; + +bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file ) +{ + char *s = NULL; + bool succ = wxGetResource(section, entry, &s, file); + if (succ) { + *value = (float)strtod(s, NULL); + delete[]s; + return TRUE; + } else + return FALSE; +}; + +bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file ) +{ + char *s = NULL; + bool succ = wxGetResource(section, entry, &s, file); + if (succ) { + *value = strtol(s, NULL, 10); + delete[]s; + return TRUE; + } else + return FALSE; +}; + +bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file ) +{ + char *s = NULL; + bool succ = wxGetResource(section, entry, &s, file); + if (succ) { + // Handle True, False here + // True, Yes, Enables, Set or Activated + if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A') + *value = TRUE; + // False, No, Disabled, Reset, Cleared, Deactivated + else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C') + *value = FALSE; + // Handle as Integer + else + *value = (int)strtol(s, NULL, 10); + delete[]s; + return TRUE; + } else + return FALSE; +}; + diff --git a/src/qt/verti.xbm b/src/qt/verti.xbm new file mode 100644 index 0000000000..2dd9dc4c05 --- /dev/null +++ b/src/qt/verti.xbm @@ -0,0 +1,6 @@ +#define verti_width 15 +#define verti_height 15 +static char verti_bits[] = { + 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, + 0x84, 0x10, 0x84, 0x10, 0x84, 0x10}; diff --git a/src/qt/window.cpp b/src/qt/window.cpp new file mode 100644 index 0000000000..b2d90fbb12 --- /dev/null +++ b/src/qt/window.cpp @@ -0,0 +1,1048 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: window.cpp +// Purpose: +// Author: Robert Roebling +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifdef __GNUG__ +#pragma implementation "window.h" +#endif + +#include "wx/defs.h" +#include "wx/window.h" +#include "wx/dc.h" +#include "wx/frame.h" +#include "wx/app.h" +#include "wx/layout.h" +#include "wx/utils.h" +#include "wx/dialog.h" +#include "wx/msgdlg.h" +#include "wx/dcclient.h" +#include "wx/dnd.h" +#include "wx/mdi.h" +#include "wx/notebook.h" +#include "wx/statusbr.h" +#include + +//----------------------------------------------------------------------------- +// data +//----------------------------------------------------------------------------- + +extern wxList wxPendingDelete; +extern wxList wxTopLevelWindows; + +//----------------------------------------------------------------------------- +// wxWindow implementation +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxWindow,wxEvtHandler) + +BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) + EVT_SIZE(wxWindow::OnSize) + EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) + EVT_INIT_DIALOG(wxWindow::OnInitDialog) + EVT_IDLE(wxWindow::OnIdle) +END_EVENT_TABLE() + +wxWindow::wxWindow() +{ + m_parent = NULL; + m_children.DeleteContents( FALSE ); + m_x = 0; + m_y = 0; + m_width = 0; + m_height = 0; + m_retCode = 0; + m_eventHandler = this; + m_windowValidator = NULL; + m_windowId = -1; + m_cursor = new wxCursor( wxCURSOR_ARROW ); + m_font = *wxSWISS_FONT; + m_windowStyle = 0; + m_windowName = "noname"; + m_constraints = NULL; + m_constraintsInvolvedIn = NULL; + m_windowSizer = NULL; + m_sizerParent = NULL; + m_autoLayout = FALSE; + m_pDropTarget = NULL; +}; + +wxWindow::wxWindow( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + Create( parent, id, pos, size, style, name ); +}; + +bool wxWindow::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + long style, const wxString &name ) +{ + return TRUE; +}; + +wxWindow::~wxWindow(void) +{ + DestroyChildren(); + +// delete m_cursor; + + DeleteRelatedConstraints(); + if (m_constraints) + { + // This removes any dangling pointers to this window + // in other windows' constraintsInvolvedIn lists. + UnsetConstraints(m_constraints); + delete m_constraints; + m_constraints = NULL; + } + if (m_windowSizer) + { + delete m_windowSizer; + m_windowSizer = NULL; + } + // If this is a child of a sizer, remove self from parent + if (m_sizerParent) + m_sizerParent->RemoveChild((wxWindow *)this); + + // Just in case the window has been Closed, but + // we're then deleting immediately: don't leave + // dangling pointers. + wxPendingDelete.DeleteObject(this); + + // Just in case we've loaded a top-level window via + // wxWindow::LoadNativeDialog but we weren't a dialog + // class + wxTopLevelWindows.DeleteObject(this); + +}; + +bool wxWindow::Close( bool force ) +{ + wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId); + event.SetEventObject(this); + event.SetForce(force); + + return GetEventHandler()->ProcessEvent(event); +}; + +bool wxWindow::Destroy(void) +{ + m_hasVMT = FALSE; + delete this; + return TRUE; +}; + +bool wxWindow::DestroyChildren(void) +{ + if (GetChildren()) + { + wxNode *node; + while ((node = GetChildren()->First()) != (wxNode *)NULL) + { + wxWindow *child; + if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) + { + delete child; + if (GetChildren()->Member(child)) delete node; + }; + }; + }; + return TRUE; +}; + +void wxWindow::PrepareDC( wxDC &WXUNUSED(dc) ) +{ + // are we to set fonts here ? +}; + +void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) +{ + + int newX = x; + int newY = y; + int newW = width; + int newH = height; + + if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) + { + if (newX == -1) newX = m_x; + if (newY == -1) newY = m_y; + if (newW == -1) newW = m_width; + if (newH == -1) newH = m_height; + }; + + if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH) + { + if (newW == -1) newW = 80; + }; + + if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT) + { + if (newH == -1) newH = 26; + }; + + if ((m_x != newX) || (m_y != newY) || (!m_sizeSet)) + { + m_x = newX; + m_y = newY; + // + }; + if ((m_width != newW) || (m_height != newH) || (!m_sizeSet)) + { + m_width = newW; + m_height = newH; + // + }; + + wxSizeEvent event( wxSize(m_width,m_height), GetId() ); + event.SetEventObject( this ); + ProcessEvent( event ); +}; + +void wxWindow::SetSize( int width, int height ) +{ + SetSize( -1, -1, width, height, wxSIZE_USE_EXISTING ); +}; + +void wxWindow::Move( int x, int y ) +{ + SetSize( x, y, -1, -1, wxSIZE_USE_EXISTING ); +}; + +void wxWindow::GetSize( int *width, int *height ) const +{ + if (width) (*width) = m_width; + if (height) (*height) = m_height; +}; + +void wxWindow::SetClientSize( int width, int height ) +{ +}; + +void wxWindow::GetClientSize( int *width, int *height ) const +{ +}; + +void wxWindow::GetPosition( int *x, int *y ) const +{ + if (x) (*x) = m_x; + if (y) (*y) = m_y; +}; + +void wxWindow::ClientToScreen( int *x, int *y ) +{ +}; + +void wxWindow::ScreenToClient( int *x, int *y ) +{ +}; + +void wxWindow::Centre( int direction ) +{ +}; + +void wxWindow::Fit(void) +{ + int maxX = 0; + int maxY = 0; + wxNode *node = GetChildren()->First(); + while ( node ) + { + wxWindow *win = (wxWindow *)node->Data(); + int wx, wy, ww, wh; + win->GetPosition(&wx, &wy); + win->GetSize(&ww, &wh); + if ( wx + ww > maxX ) + maxX = wx + ww; + if ( wy + wh > maxY ) + maxY = wy + wh; + + node = node->Next(); + } + SetClientSize(maxX + 5, maxY + 10); +}; + +void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) ) +{ + //if (GetAutoLayout()) Layout(); +}; + +bool wxWindow::Show( bool show ) +{ + return TRUE; +}; + +void wxWindow::Enable( bool enable ) +{ + m_isEnabled = enable; +}; + +void wxWindow::MakeModal( bool modal ) +{ +} + +void wxWindow::SetFocus(void) +{ +}; + +bool wxWindow::OnClose(void) +{ + return TRUE; +}; + +void wxWindow::AddChild( wxWindow *child ) +{ +}; + +wxList *wxWindow::GetChildren(void) +{ + return (&m_children); +}; + +void wxWindow::RemoveChild( wxWindow *child ) +{ + if (GetChildren()) + GetChildren()->DeleteObject( child ); + child->m_parent = NULL; +}; + +void wxWindow::SetReturnCode( int retCode ) +{ + m_retCode = retCode; +}; + +int wxWindow::GetReturnCode(void) +{ + return m_retCode; +}; + +wxWindow *wxWindow::GetParent(void) +{ + return m_parent; +}; + +wxEvtHandler *wxWindow::GetEventHandler(void) +{ + return m_eventHandler; +}; + +void wxWindow::SetEventhandler( wxEvtHandler *handler ) +{ + m_eventHandler = handler; +}; + +wxValidator *wxWindow::GetValidator(void) +{ + return m_windowValidator; +}; + +void wxWindow::SetValidator( wxValidator *validator ) +{ + m_windowValidator = validator; +}; + +bool wxWindow::IsBeingDeleted(void) +{ + return FALSE; +}; + +void wxWindow::SetId( wxWindowID id ) +{ + m_windowId = id; +}; + +wxWindowID wxWindow::GetId(void) +{ + return m_windowId; +}; + +void wxWindow::SetCursor( const wxCursor &cursor ) +{ + if (*m_cursor == cursor) return; + (*m_cursor) = cursor; +}; + +void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) +{ +}; + +bool wxWindow::IsExposed( long x, long y ) +{ + return (m_updateRegion.Contains( x, y ) != wxOutRegion ); +}; + +bool wxWindow::IsExposed( long x, long y, long width, long height ) +{ + return (m_updateRegion.Contains( x, y, width, height ) != wxOutRegion ); +}; + +void wxWindow::Clear(void) +{ +}; + +wxColour wxWindow::GetBackgroundColour(void) const +{ + return m_backgroundColour; +}; + +void wxWindow::SetBackgroundColour( const wxColour &colour ) +{ + m_backgroundColour = colour; +}; + +bool wxWindow::Validate(void) +{ + wxNode *node = GetChildren()->First(); + while (node) + { + wxWindow *child = (wxWindow *)node->Data(); + if (child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->Validate(this)) + { return FALSE; } + node = node->Next(); + }; + return TRUE; +}; + +bool wxWindow::TransferDataToWindow(void) +{ + wxNode *node = GetChildren()->First(); + while (node) + { + wxWindow *child = (wxWindow *)node->Data(); + if (child->GetValidator() && /* child->GetValidator()->Ok() && */ + !child->GetValidator()->TransferToWindow() ) + { + wxMessageBox( "Application Error", "Could not transfer data to window", wxOK|wxICON_EXCLAMATION ); + return FALSE; + }; + node = node->Next(); + }; + return TRUE; +}; + +bool wxWindow::TransferDataFromWindow(void) +{ + wxNode *node = GetChildren()->First(); + while (node) + { + wxWindow *child = (wxWindow *)node->Data(); + if ( child->GetValidator() && /* child->GetValidator()->Ok() && */ !child->GetValidator()->TransferFromWindow() ) + { return FALSE; } + node = node->Next(); + } + return TRUE; +}; + +void wxWindow::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) ) +{ + TransferDataToWindow(); +}; + +void wxWindow::InitDialog(void) +{ + wxInitDialogEvent event(GetId()); + event.SetEventObject( this ); + GetEventHandler()->ProcessEvent(event); +}; + +void wxWindow::SetDropTarget( wxDropTarget *dropTarget ) +{ + if (m_pDropTarget) + { + m_pDropTarget->UnregisterWidget( dnd_widget ); + delete m_pDropTarget; + }; + m_pDropTarget = dropTarget; + if (m_pDropTarget) + { + }; +}; + +wxDropTarget *wxWindow::GetDropTarget() const +{ + return m_pDropTarget; +}; + +void wxWindow::SetFont( const wxFont &font ) +{ + m_font = font; +/* + ... +*/ +}; + +wxFont *wxWindow::GetFont(void) +{ + return &m_font; +}; + +void wxWindow::SetWindowStyleFlag( long flag ) +{ + m_windowStyle = flag; +}; + +long wxWindow::GetWindowStyleFlag(void) const +{ + return m_windowStyle; +}; + +void wxWindow::CaptureMouse(void) +{ +}; + +void wxWindow::ReleaseMouse(void) +{ +}; + +void wxWindow::SetTitle( const wxString &WXUNUSED(title) ) +{ +}; + +wxString wxWindow::GetTitle(void) const +{ + return (wxString&)m_windowName; +}; + +wxString wxWindow::GetLabel(void) const +{ + return GetTitle(); +}; + +void wxWindow::SetName( const wxString &name ) +{ + m_windowName = name; +}; + +wxString wxWindow::GetName(void) const +{ + return (wxString&)m_windowName; +}; + +bool wxWindow::IsShown(void) const +{ + return m_isShown; +}; + +bool wxWindow::IsRetained(void) +{ + return FALSE; +}; + +wxWindow *wxWindow::FindWindow( long id ) +{ + if (id == m_windowId) return this; + wxNode *node = m_children.First(); + while (node) + { + wxWindow *child = (wxWindow*)node->Data(); + wxWindow *res = child->FindWindow( id ); + if (res) return res; + node = node->Next(); + }; + return NULL; +}; + +wxWindow *wxWindow::FindWindow( const wxString& name ) +{ + if (name == m_windowName) return this; + wxNode *node = m_children.First(); + while (node) + { + wxWindow *child = (wxWindow*)node->Data(); + wxWindow *res = child->FindWindow( name ); + if (res) return res; + node = node->Next(); + }; + return NULL; +}; + +void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool WXUNUSED(refresh) ) +{ +}; + +void wxWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) +{ +}; + +int wxWindow::GetScrollThumb( int orient ) const +{ +}; + +int wxWindow::GetScrollPos( int orient ) const +{ +}; + +int wxWindow::GetScrollRange( int orient ) const +{ +}; + +void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) +{ +}; + +//------------------------------------------------------------------------------------- +// Layout +//------------------------------------------------------------------------------------- + +wxLayoutConstraints *wxWindow::GetConstraints(void) const +{ + return m_constraints; +}; + +void wxWindow::SetConstraints( wxLayoutConstraints *constraints ) +{ + if (m_constraints) + { + UnsetConstraints(m_constraints); + delete m_constraints; + } + m_constraints = constraints; + if (m_constraints) + { + // Make sure other windows know they're part of a 'meaningful relationship' + if (m_constraints->left.GetOtherWindow() && (m_constraints->left.GetOtherWindow() != this)) + m_constraints->left.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->top.GetOtherWindow() && (m_constraints->top.GetOtherWindow() != this)) + m_constraints->top.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->right.GetOtherWindow() && (m_constraints->right.GetOtherWindow() != this)) + m_constraints->right.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->bottom.GetOtherWindow() && (m_constraints->bottom.GetOtherWindow() != this)) + m_constraints->bottom.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->width.GetOtherWindow() && (m_constraints->width.GetOtherWindow() != this)) + m_constraints->width.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->height.GetOtherWindow() && (m_constraints->height.GetOtherWindow() != this)) + m_constraints->height.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->centreX.GetOtherWindow() && (m_constraints->centreX.GetOtherWindow() != this)) + m_constraints->centreX.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + if (m_constraints->centreY.GetOtherWindow() && (m_constraints->centreY.GetOtherWindow() != this)) + m_constraints->centreY.GetOtherWindow()->AddConstraintReference((wxWindow *)this); + } +; +} +; + +void wxWindow::SetAutoLayout( bool autoLayout ) +{ + m_autoLayout = autoLayout; +}; + +bool wxWindow::GetAutoLayout(void) const +{ + return m_autoLayout; +}; + +wxSizer *wxWindow::GetSizer(void) const +{ + return m_windowSizer; +}; + +void wxWindow::SetSizerParent( wxWindow *win ) +{ + m_sizerParent = win; +}; + +wxWindow *wxWindow::GetSizerParent(void) const +{ + return m_sizerParent; +}; + +// This removes any dangling pointers to this window +// in other windows' constraintsInvolvedIn lists. +void wxWindow::UnsetConstraints(wxLayoutConstraints *c) +{ + if (c) + { + if (c->left.GetOtherWindow() && (c->top.GetOtherWindow() != this)) + c->left.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->top.GetOtherWindow() && (c->top.GetOtherWindow() != this)) + c->top.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->right.GetOtherWindow() && (c->right.GetOtherWindow() != this)) + c->right.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->bottom.GetOtherWindow() && (c->bottom.GetOtherWindow() != this)) + c->bottom.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->width.GetOtherWindow() && (c->width.GetOtherWindow() != this)) + c->width.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->height.GetOtherWindow() && (c->height.GetOtherWindow() != this)) + c->height.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->centreX.GetOtherWindow() && (c->centreX.GetOtherWindow() != this)) + c->centreX.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + if (c->centreY.GetOtherWindow() && (c->centreY.GetOtherWindow() != this)) + c->centreY.GetOtherWindow()->RemoveConstraintReference((wxWindow *)this); + } +} + +// Back-pointer to other windows we're involved with, so if we delete +// this window, we must delete any constraints we're involved with. +void wxWindow::AddConstraintReference(wxWindow *otherWin) +{ + if (!m_constraintsInvolvedIn) + m_constraintsInvolvedIn = new wxList; + if (!m_constraintsInvolvedIn->Member(otherWin)) + m_constraintsInvolvedIn->Append(otherWin); +} + +// REMOVE back-pointer to other windows we're involved with. +void wxWindow::RemoveConstraintReference(wxWindow *otherWin) +{ + if (m_constraintsInvolvedIn) + m_constraintsInvolvedIn->DeleteObject(otherWin); +} + +// Reset any constraints that mention this window +void wxWindow::DeleteRelatedConstraints(void) +{ + if (m_constraintsInvolvedIn) + { + wxNode *node = m_constraintsInvolvedIn->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + wxNode *next = node->Next(); + wxLayoutConstraints *constr = win->GetConstraints(); + + // Reset any constraints involving this window + if (constr) + { + constr->left.ResetIfWin((wxWindow *)this); + constr->top.ResetIfWin((wxWindow *)this); + constr->right.ResetIfWin((wxWindow *)this); + constr->bottom.ResetIfWin((wxWindow *)this); + constr->width.ResetIfWin((wxWindow *)this); + constr->height.ResetIfWin((wxWindow *)this); + constr->centreX.ResetIfWin((wxWindow *)this); + constr->centreY.ResetIfWin((wxWindow *)this); + } + delete node; + node = next; + } + delete m_constraintsInvolvedIn; + m_constraintsInvolvedIn = NULL; + } +} + +void wxWindow::SetSizer(wxSizer *sizer) +{ + m_windowSizer = sizer; + if (sizer) + sizer->SetSizerParent((wxWindow *)this); +} + +/* + * New version + */ + +bool wxWindow::Layout(void) +{ + if (GetConstraints()) + { + int w, h; + GetClientSize(&w, &h); + GetConstraints()->width.SetValue(w); + GetConstraints()->height.SetValue(h); + } + + // If top level (one sizer), evaluate the sizer's constraints. + if (GetSizer()) + { + int noChanges; + GetSizer()->ResetConstraints(); // Mark all constraints as unevaluated + GetSizer()->LayoutPhase1(&noChanges); + GetSizer()->LayoutPhase2(&noChanges); + GetSizer()->SetConstraintSizes(); // Recursively set the real window sizes + return TRUE; + } + else + { + // Otherwise, evaluate child constraints + ResetConstraints(); // Mark all constraints as unevaluated + DoPhase(1); // Just one phase need if no sizers involved + DoPhase(2); + SetConstraintSizes(); // Recursively set the real window sizes + } + return TRUE; +} + + +// Do a phase of evaluating constraints: +// the default behaviour. wxSizers may do a similar +// thing, but also impose their own 'constraints' +// and order the evaluation differently. +bool wxWindow::LayoutPhase1(int *noChanges) +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + return constr->SatisfyConstraints((wxWindow *)this, noChanges); + } + else + return TRUE; +} + +bool wxWindow::LayoutPhase2(int *noChanges) +{ + *noChanges = 0; + + // Layout children + DoPhase(1); + DoPhase(2); + return TRUE; +} + +// Do a phase of evaluating child constraints +bool wxWindow::DoPhase(int phase) +{ + int noIterations = 0; + int maxIterations = 500; + int noChanges = 1; + int noFailures = 0; + wxList succeeded; + while ((noChanges > 0) && (noIterations < maxIterations)) + { + noChanges = 0; + noFailures = 0; + wxNode *node = GetChildren()->First(); + while (node) + { + wxWindow *child = (wxWindow *)node->Data(); + if (!child->IsKindOf(CLASSINFO(wxFrame)) && !child->IsKindOf(CLASSINFO(wxDialog))) + { + wxLayoutConstraints *constr = child->GetConstraints(); + if (constr) + { + if (succeeded.Member(child)) + { + } + else + { + int tempNoChanges = 0; + bool success = ( (phase == 1) ? child->LayoutPhase1(&tempNoChanges) : child->LayoutPhase2(&tempNoChanges) ) ; + noChanges += tempNoChanges; + if (success) + { + succeeded.Append(child); + } + } + } + } + node = node->Next(); + } + noIterations ++; + } + return TRUE; +} + +void wxWindow::ResetConstraints(void) +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + constr->left.SetDone(FALSE); + constr->top.SetDone(FALSE); + constr->right.SetDone(FALSE); + constr->bottom.SetDone(FALSE); + constr->width.SetDone(FALSE); + constr->height.SetDone(FALSE); + constr->centreX.SetDone(FALSE); + constr->centreY.SetDone(FALSE); + } + wxNode *node = GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))) + win->ResetConstraints(); + node = node->Next(); + } +} + +// Need to distinguish between setting the 'fake' size for +// windows and sizers, and setting the real values. +void wxWindow::SetConstraintSizes(bool recurse) +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr && constr->left.GetDone() && constr->right.GetDone() && + constr->width.GetDone() && constr->height.GetDone()) + { + int x = constr->left.GetValue(); + int y = constr->top.GetValue(); + int w = constr->width.GetValue(); + int h = constr->height.GetValue(); + + // If we don't want to resize this window, just move it... + if ((constr->width.GetRelationship() != wxAsIs) || + (constr->height.GetRelationship() != wxAsIs)) + { + // Calls Layout() recursively. AAAGH. How can we stop that. + // Simply take Layout() out of non-top level OnSizes. + SizerSetSize(x, y, w, h); + } + else + { + SizerMove(x, y); + } + } + else if (constr) + { + char *windowClass = this->GetClassInfo()->GetClassName(); + + wxString winName; + if (GetName() == "") + winName = "unnamed"; + else + winName = GetName(); + wxDebugMsg("Constraint(s) not satisfied for window of type %s, name %s:\n", (const char *)windowClass, (const char *)winName); + if (!constr->left.GetDone()) + wxDebugMsg(" unsatisfied 'left' constraint.\n"); + if (!constr->right.GetDone()) + wxDebugMsg(" unsatisfied 'right' constraint.\n"); + if (!constr->width.GetDone()) + wxDebugMsg(" unsatisfied 'width' constraint.\n"); + if (!constr->height.GetDone()) + wxDebugMsg(" unsatisfied 'height' constraint.\n"); + wxDebugMsg("Please check constraints: try adding AsIs() constraints.\n"); + } + + if (recurse) + { + wxNode *node = GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))) + win->SetConstraintSizes(); + node = node->Next(); + } + } +} + +// This assumes that all sizers are 'on' the same +// window, i.e. the parent of this window. +void wxWindow::TransformSizerToActual(int *x, int *y) const +{ + if (!m_sizerParent || m_sizerParent->IsKindOf(CLASSINFO(wxDialog)) || + m_sizerParent->IsKindOf(CLASSINFO(wxFrame)) ) + return; + + int xp, yp; + m_sizerParent->GetPosition(&xp, &yp); + m_sizerParent->TransformSizerToActual(&xp, &yp); + *x += xp; + *y += yp; +} + +void wxWindow::SizerSetSize(int x, int y, int w, int h) +{ + int xx = x; + int yy = y; + TransformSizerToActual(&xx, &yy); + SetSize(xx, yy, w, h); +} + +void wxWindow::SizerMove(int x, int y) +{ + int xx = x; + int yy = y; + TransformSizerToActual(&xx, &yy); + Move(xx, yy); +} + +// Only set the size/position of the constraint (if any) +void wxWindow::SetSizeConstraint(int x, int y, int w, int h) +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + if (x != -1) + { + constr->left.SetValue(x); + constr->left.SetDone(TRUE); + } + if (y != -1) + { + constr->top.SetValue(y); + constr->top.SetDone(TRUE); + } + if (w != -1) + { + constr->width.SetValue(w); + constr->width.SetDone(TRUE); + } + if (h != -1) + { + constr->height.SetValue(h); + constr->height.SetDone(TRUE); + } + } +} + +void wxWindow::MoveConstraint(int x, int y) +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + if (x != -1) + { + constr->left.SetValue(x); + constr->left.SetDone(TRUE); + } + if (y != -1) + { + constr->top.SetValue(y); + constr->top.SetDone(TRUE); + } + } +} + +void wxWindow::GetSizeConstraint(int *w, int *h) const +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + *w = constr->width.GetValue(); + *h = constr->height.GetValue(); + } + else + GetSize(w, h); +} + +void wxWindow::GetClientSizeConstraint(int *w, int *h) const +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + *w = constr->width.GetValue(); + *h = constr->height.GetValue(); + } + else + GetClientSize(w, h); +} + +void wxWindow::GetPositionConstraint(int *x, int *y) const +{ + wxLayoutConstraints *constr = GetConstraints(); + if (constr) + { + *x = constr->left.GetValue(); + *y = constr->top.GetValue(); + } + else + GetPosition(x, y); +} + +bool wxWindow::AcceptsFocus() const +{ + return IsEnabled() && IsShown(); +} + +void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event) ) +{ + UpdateWindowUI(); +} diff --git a/template.mak b/template.mak index 18028c45ef..fdf1b02314 100644 --- a/template.mak +++ b/template.mak @@ -14,10 +14,10 @@ # no need to edit below this line !!!! -RULES_DIR=$(WXBASEDIR)/src/gtk/setup/rules +RULES_DIR=$(WXBASEDIR)/install/unix/setup/rules RULES_GENERIC=$(RULES_DIR)/generic -SETUP_DIR=$(WXBASEDIR)/src/gtk/setup/$(OS) -SHARE_DIR=$(WXBASEDIR)/src/gtk/setup/shared +SETUP_DIR=$(WXBASEDIR)/install/unix/setup/$(OS) +SHARE_DIR=$(WXBASEDIR)/install/unix/setup/shared SRCDIR=$(WXBASEDIR)/src UTILS=$(WXBASEDIR)/utils -- 2.45.2