From 8cf73271dd6f442a98e86b559d4a55c37e25b99f Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 23 Mar 2004 17:35:05 +0000 Subject: [PATCH] classic git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/mac/carbon/accel.h | 53 ++ include/wx/mac/carbon/aga.h | 13 + include/wx/mac/carbon/app.h | 207 +++++++ include/wx/mac/carbon/apptbase.h | 39 ++ include/wx/mac/carbon/apptrait.h | 42 ++ include/wx/mac/carbon/bitmap.h | 225 +++++++ include/wx/mac/carbon/bmpbuttn.h | 65 ++ include/wx/mac/carbon/brush.h | 82 +++ include/wx/mac/carbon/button.h | 55 ++ include/wx/mac/carbon/checkbox.h | 84 +++ include/wx/mac/carbon/checklst.h | 105 ++++ include/wx/mac/carbon/chkconf.h | 30 + include/wx/mac/carbon/choice.h | 111 ++++ include/wx/mac/carbon/clipbrd.h | 81 +++ include/wx/mac/carbon/colordlg.h | 46 ++ include/wx/mac/carbon/colour.h | 101 ++++ include/wx/mac/carbon/combobox.h | 136 +++++ include/wx/mac/carbon/control.h | 109 ++++ include/wx/mac/carbon/cursor.h | 85 +++ include/wx/mac/carbon/dataform.h | 61 ++ include/wx/mac/carbon/dataobj.h | 35 ++ include/wx/mac/carbon/dataobj2.h | 86 +++ include/wx/mac/carbon/dc.h | 293 +++++++++ include/wx/mac/carbon/dcclient.h | 74 +++ include/wx/mac/carbon/dcmemory.h | 37 ++ include/wx/mac/carbon/dcprint.h | 49 ++ include/wx/mac/carbon/dcscreen.h | 39 ++ include/wx/mac/carbon/dialog.h | 105 ++++ include/wx/mac/carbon/dirdlg.h | 50 ++ include/wx/mac/carbon/display.h | 46 ++ include/wx/mac/carbon/dnd.h | 114 ++++ include/wx/mac/carbon/filedlg.h | 50 ++ include/wx/mac/carbon/font.h | 116 ++++ include/wx/mac/carbon/fontdlg.h | 46 ++ include/wx/mac/carbon/frame.h | 124 ++++ include/wx/mac/carbon/gauge.h | 67 +++ include/wx/mac/carbon/gdiobj.h | 48 ++ include/wx/mac/carbon/glcanvas.h | 134 +++++ include/wx/mac/carbon/gsockmac.h | 93 +++ include/wx/mac/carbon/helpxxxx.h | 53 ++ include/wx/mac/carbon/icon.h | 95 +++ include/wx/mac/carbon/imaglist.h | 147 +++++ include/wx/mac/carbon/joystick.h | 93 +++ include/wx/mac/carbon/listbox.h | 181 ++++++ include/wx/mac/carbon/listctrl.h | 451 ++++++++++++++ include/wx/mac/carbon/macnotfy.h | 33 + include/wx/mac/carbon/macsock.h | 0 include/wx/mac/carbon/mdi.h | 180 ++++++ include/wx/mac/carbon/menu.h | 169 ++++++ include/wx/mac/carbon/menuitem.h | 81 +++ include/wx/mac/carbon/metafile.h | 166 +++++ include/wx/mac/carbon/mimetype.h | 122 ++++ include/wx/mac/carbon/minifram.h | 46 ++ include/wx/mac/carbon/msgdlg.h | 55 ++ include/wx/mac/carbon/notebook.h | 157 +++++ include/wx/mac/carbon/palette.h | 68 +++ include/wx/mac/carbon/pen.h | 103 ++++ include/wx/mac/carbon/pnghand.h | 37 ++ include/wx/mac/carbon/pngread.h | 290 +++++++++ include/wx/mac/carbon/printdlg.h | 73 +++ include/wx/mac/carbon/printmac.h | 64 ++ include/wx/mac/carbon/private.h | 238 ++++++++ include/wx/mac/carbon/radiobox.h | 108 ++++ include/wx/mac/carbon/radiobut.h | 94 +++ include/wx/mac/carbon/region.h | 177 ++++++ include/wx/mac/carbon/scrolbar.h | 71 +++ include/wx/mac/carbon/setup.h | 938 +++++++++++++++++++++++++++++ include/wx/mac/carbon/setup0.h | 933 ++++++++++++++++++++++++++++ include/wx/mac/carbon/slider.h | 110 ++++ include/wx/mac/carbon/sound.h | 53 ++ include/wx/mac/carbon/spinbutt.h | 79 +++ include/wx/mac/carbon/spinctrl.h | 188 ++++++ include/wx/mac/carbon/statbmp.h | 68 +++ include/wx/mac/carbon/statbox.h | 57 ++ include/wx/mac/carbon/statline.h | 61 ++ include/wx/mac/carbon/stattext.h | 62 ++ include/wx/mac/carbon/statusbr.h | 53 ++ include/wx/mac/carbon/tabctrl.h | 138 +++++ include/wx/mac/carbon/taskbarosx.h | 48 ++ include/wx/mac/carbon/textctrl.h | 184 ++++++ include/wx/mac/carbon/tglbtn.h | 59 ++ include/wx/mac/carbon/timer.h | 48 ++ include/wx/mac/carbon/toolbar.h | 96 +++ include/wx/mac/carbon/tooltip.h | 48 ++ include/wx/mac/carbon/toplevel.h | 146 +++++ include/wx/mac/carbon/treectrl.h | 295 +++++++++ include/wx/mac/carbon/uma.h | 131 ++++ include/wx/mac/carbon/window.h | 269 +++++++++ 88 files changed, 10752 insertions(+) create mode 100644 include/wx/mac/carbon/accel.h create mode 100644 include/wx/mac/carbon/aga.h create mode 100644 include/wx/mac/carbon/app.h create mode 100644 include/wx/mac/carbon/apptbase.h create mode 100644 include/wx/mac/carbon/apptrait.h create mode 100644 include/wx/mac/carbon/bitmap.h create mode 100644 include/wx/mac/carbon/bmpbuttn.h create mode 100644 include/wx/mac/carbon/brush.h create mode 100644 include/wx/mac/carbon/button.h create mode 100644 include/wx/mac/carbon/checkbox.h create mode 100644 include/wx/mac/carbon/checklst.h create mode 100644 include/wx/mac/carbon/chkconf.h create mode 100644 include/wx/mac/carbon/choice.h create mode 100644 include/wx/mac/carbon/clipbrd.h create mode 100644 include/wx/mac/carbon/colordlg.h create mode 100644 include/wx/mac/carbon/colour.h create mode 100644 include/wx/mac/carbon/combobox.h create mode 100644 include/wx/mac/carbon/control.h create mode 100644 include/wx/mac/carbon/cursor.h create mode 100644 include/wx/mac/carbon/dataform.h create mode 100644 include/wx/mac/carbon/dataobj.h create mode 100644 include/wx/mac/carbon/dataobj2.h create mode 100644 include/wx/mac/carbon/dc.h create mode 100644 include/wx/mac/carbon/dcclient.h create mode 100644 include/wx/mac/carbon/dcmemory.h create mode 100644 include/wx/mac/carbon/dcprint.h create mode 100644 include/wx/mac/carbon/dcscreen.h create mode 100644 include/wx/mac/carbon/dialog.h create mode 100644 include/wx/mac/carbon/dirdlg.h create mode 100644 include/wx/mac/carbon/display.h create mode 100644 include/wx/mac/carbon/dnd.h create mode 100644 include/wx/mac/carbon/filedlg.h create mode 100644 include/wx/mac/carbon/font.h create mode 100644 include/wx/mac/carbon/fontdlg.h create mode 100644 include/wx/mac/carbon/frame.h create mode 100644 include/wx/mac/carbon/gauge.h create mode 100644 include/wx/mac/carbon/gdiobj.h create mode 100644 include/wx/mac/carbon/glcanvas.h create mode 100644 include/wx/mac/carbon/gsockmac.h create mode 100644 include/wx/mac/carbon/helpxxxx.h create mode 100644 include/wx/mac/carbon/icon.h create mode 100644 include/wx/mac/carbon/imaglist.h create mode 100644 include/wx/mac/carbon/joystick.h create mode 100644 include/wx/mac/carbon/listbox.h create mode 100644 include/wx/mac/carbon/listctrl.h create mode 100644 include/wx/mac/carbon/macnotfy.h create mode 100644 include/wx/mac/carbon/macsock.h create mode 100644 include/wx/mac/carbon/mdi.h create mode 100644 include/wx/mac/carbon/menu.h create mode 100644 include/wx/mac/carbon/menuitem.h create mode 100644 include/wx/mac/carbon/metafile.h create mode 100644 include/wx/mac/carbon/mimetype.h create mode 100644 include/wx/mac/carbon/minifram.h create mode 100644 include/wx/mac/carbon/msgdlg.h create mode 100644 include/wx/mac/carbon/notebook.h create mode 100644 include/wx/mac/carbon/palette.h create mode 100644 include/wx/mac/carbon/pen.h create mode 100644 include/wx/mac/carbon/pnghand.h create mode 100644 include/wx/mac/carbon/pngread.h create mode 100644 include/wx/mac/carbon/printdlg.h create mode 100644 include/wx/mac/carbon/printmac.h create mode 100644 include/wx/mac/carbon/private.h create mode 100644 include/wx/mac/carbon/radiobox.h create mode 100644 include/wx/mac/carbon/radiobut.h create mode 100644 include/wx/mac/carbon/region.h create mode 100644 include/wx/mac/carbon/scrolbar.h create mode 100644 include/wx/mac/carbon/setup.h create mode 100644 include/wx/mac/carbon/setup0.h create mode 100644 include/wx/mac/carbon/slider.h create mode 100644 include/wx/mac/carbon/sound.h create mode 100644 include/wx/mac/carbon/spinbutt.h create mode 100755 include/wx/mac/carbon/spinctrl.h create mode 100644 include/wx/mac/carbon/statbmp.h create mode 100644 include/wx/mac/carbon/statbox.h create mode 100644 include/wx/mac/carbon/statline.h create mode 100644 include/wx/mac/carbon/stattext.h create mode 100644 include/wx/mac/carbon/statusbr.h create mode 100644 include/wx/mac/carbon/tabctrl.h create mode 100644 include/wx/mac/carbon/taskbarosx.h create mode 100644 include/wx/mac/carbon/textctrl.h create mode 100644 include/wx/mac/carbon/tglbtn.h create mode 100644 include/wx/mac/carbon/timer.h create mode 100644 include/wx/mac/carbon/toolbar.h create mode 100644 include/wx/mac/carbon/tooltip.h create mode 100644 include/wx/mac/carbon/toplevel.h create mode 100644 include/wx/mac/carbon/treectrl.h create mode 100644 include/wx/mac/carbon/uma.h create mode 100644 include/wx/mac/carbon/window.h diff --git a/include/wx/mac/carbon/accel.h b/include/wx/mac/carbon/accel.h new file mode 100644 index 0000000000..25acc73bea --- /dev/null +++ b/include/wx/mac/carbon/accel.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: accel.h +// Purpose: wxAcceleratorTable class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_ +#define _WX_ACCEL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "accel.h" +#endif + +#include "wx/string.h" +#include "wx/event.h" + +class WXDLLEXPORT wxAcceleratorTable: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) +public: + wxAcceleratorTable(); + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array + + // Copy constructors + wxAcceleratorTable(const wxAcceleratorTable& accel) + : wxObject() + { Ref(accel); } + wxAcceleratorTable(const wxAcceleratorTable* accel) + { if (accel) Ref(*accel); } + + ~wxAcceleratorTable(); + + wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) + { if (*this == accel) return (*this); Ref(accel); return *this; } + bool operator == (const wxAcceleratorTable& accel) + { return m_refData == accel.m_refData; } + bool operator != (const wxAcceleratorTable& accel) + { return m_refData != accel.m_refData; } + + bool Ok() const; + + int GetCommand( wxKeyEvent &event ); +}; + +// WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable; + +#endif + // _WX_ACCEL_H_ diff --git a/include/wx/mac/carbon/aga.h b/include/wx/mac/carbon/aga.h new file mode 100644 index 0000000000..5868b3f8ee --- /dev/null +++ b/include/wx/mac/carbon/aga.h @@ -0,0 +1,13 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: aga.h +// Purpose: Gray Controls implementation +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +// NOT NEEDED ANYMORE \ No newline at end of file diff --git a/include/wx/mac/carbon/app.h b/include/wx/mac/carbon/app.h new file mode 100644 index 0000000000..efc50cbea2 --- /dev/null +++ b/include/wx/mac/carbon/app.h @@ -0,0 +1,207 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: app.h +// Purpose: wxApp class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_ +#define _WX_APP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "app.h" +#endif + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdicmn.h" +#include "wx/event.h" + +class WXDLLEXPORT wxFrame; +class WXDLLEXPORT wxWindowMac; +class WXDLLEXPORT wxApp ; +class WXDLLEXPORT wxKeyEvent; +class WXDLLEXPORT wxLog; + +#define wxPRINT_WINDOWS 1 +#define wxPRINT_POSTSCRIPT 2 + +WXDLLEXPORT_DATA(extern wxApp*) wxTheApp; + +// Force an exit from main loop +void WXDLLEXPORT wxExit(); + +// Yield to other apps/messages +bool WXDLLEXPORT wxYield(); + +// Represents the application. Derive OnInit and declare +// a new App object to start application +class WXDLLEXPORT wxApp: public wxAppBase +{ + DECLARE_DYNAMIC_CLASS(wxApp) + + wxApp(); + virtual ~wxApp() {} + + virtual int MainLoop(); + virtual void ExitMainLoop(); + virtual bool Pending() ; + virtual bool Dispatch() ; + + virtual void Exit(); + + virtual bool Yield(bool onlyIfNeeded = FALSE); + virtual void WakeUpIdle(); + + virtual void SetPrintMode(int mode) { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } + +#if wxUSE_GUI + // setting up all MacOS Specific Event-Handlers etc + virtual bool OnInitGui(); +#endif // wxUSE_GUI + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + + // Windows only, but for compatibility... + inline void SetAuto3D(bool flag) { m_auto3D = flag; } + inline bool GetAuto3D() const { return m_auto3D; } + +protected: + bool m_showOnInit; + int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT + bool m_auto3D ; // Always use 3D controls, except + // where overriden +public: + + static bool sm_isEmbedded; + // Implementation + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + bool IsExiting() { return !m_keepGoing ; } +#if TARGET_CARBON + // the installed application event handler + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } + WXEVENTHANDLERREF MacGetCurrentEventHandlerCallRef() { return m_macCurrentEventHandlerCallRef ; } + void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler ) + { m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; } +#endif + +public: + static long sm_lastMessageTime; + static wxWindow* s_captureWindow ; + static int s_lastMouseDown ; // 0 = none , 1 = left , 2 = right + static WXHRGN s_macCursorRgn ; + static long s_lastModifiers ; + + int m_nCmdShow; + +private: + bool m_keepGoing ; + + // mac specifics +#if TARGET_CARBON + WXEVENTHANDLERREF m_macEventHandler ; + WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ; +#endif + WXEVENTREF m_macCurrentEvent ; + +public: + static bool s_macSupportPCMenuShortcuts ; + static long s_macAboutMenuItemId ; + static long s_macPreferencesMenuItemId ; + static long s_macExitMenuItemId ; + static wxString s_macHelpMenuTitleName ; + + static bool s_macHasAppearance ; + static long s_macAppearanceVersion ; + static bool s_macHasNavigation ; + static bool s_macNavigationVersion ; + static bool s_macHasWindowManager ; + static long s_macWindowManagerVersion ; + static bool s_macHasMenuManager ; + static long s_macMenuManagerVersion ; + static bool s_macHasDialogManager ; + static long s_macDialogManagerVersion ; + + WXHRGN m_macCursorRgn ; + WXHRGN m_macSleepRgn ; + WXHRGN m_macHelpRgn ; + + virtual void MacSuspend( bool convertClipboard ) ; + virtual void MacResume( bool convertClipboard ) ; + virtual void MacConvertPrivateToPublicScrap() ; + virtual void MacConvertPublicToPrivateScrap() ; + + void MacDoOneEvent() ; + WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; } + void MacHandleOneEvent( WXEVENTREF ev ) ; + + // For embedded use. By default does nothing. + virtual void MacHandleUnhandledEvent( WXEVENTREF ev ); + +#if !TARGET_CARBON + virtual void MacHandleMenuSelect( int menuid , int menuitem ) ; + virtual void MacHandleMouseUpEvent( WXEVENTREF ev ) ; + virtual void MacHandleOSEvent( WXEVENTREF ev ) ; + virtual void MacHandleDiskEvent( WXEVENTREF ev ) ; + virtual void MacHandleActivateEvent( WXEVENTREF ev ) ; + virtual void MacHandleUpdateEvent( WXEVENTREF ev ) ; + virtual void MacHandleMouseDownEvent( WXEVENTREF ev ) ; + + void MacHandleModifierEvents( WXEVENTREF ev ) ; + + virtual void MacHandleKeyDownEvent( WXEVENTREF ev ) ; + virtual void MacHandleKeyUpEvent( WXEVENTREF ev ) ; + virtual void MacHandleHighLevelEvent( WXEVENTREF ev ) ; + +#else + virtual void MacHandleMouseMovedEvent( wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp ) ; +#endif + + void MacHandleMenuCommand( wxUint32 command ) ; + bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ; + bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey ) ; + + virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + virtual short MacHandleAEPDoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + virtual short MacHandleAEOApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + virtual short MacHandleAEQuit(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + virtual short MacHandleAERApp(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + + // in response of an open-document apple event + virtual void MacOpenFile(const wxString &fileName) ; + // in response of a print-document apple event + virtual void MacPrintFile(const wxString &fileName) ; + // in response of a open-application apple event + virtual void MacNewFile() ; + // in response of a reopen-application apple event + virtual void MacReopenApp() ; + + DECLARE_EVENT_TABLE() +}; + +class WXDLLEXPORT wxStAppResource +{ +public: + wxStAppResource() ; + ~wxStAppResource() ; + + // opaque pointer for CFragInitBlock + static void OpenSharedLibraryResource(const void *) ; + static void CloseSharedLibraryResource() ; + +private: + short m_currentRefNum ; +} ; + +#endif + // _WX_APP_H_ + diff --git a/include/wx/mac/carbon/apptbase.h b/include/wx/mac/carbon/apptbase.h new file mode 100644 index 0000000000..84c68cd0ee --- /dev/null +++ b/include/wx/mac/carbon/apptbase.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/apptbase.h +// Purpose: declaration of wxAppTraits for Mac systems +// Author: Vadim Zeitlin +// Modified by: Stefan Csomor +// Created: 23.06.2003 +// RCS-ID: $Id$ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_APPTBASE_H_ +#define _WX_MAC_APPTBASE_H_ + +// ---------------------------------------------------------------------------- +// wxAppTraits: the Mac version adds extra hooks needed by Mac code +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAppTraits : public wxAppTraitsBase +{ +public: + // wxExecute() support methods + // --------------------------- + + // TODO + + // wxThread helpers + // ---------------- + + + // TODO + + // other miscellaneous helpers + // --------------------------- + +}; + +#endif // _WX_MAC_APPTBASE_H_ + diff --git a/include/wx/mac/carbon/apptrait.h b/include/wx/mac/carbon/apptrait.h new file mode 100644 index 0000000000..88b424ab1a --- /dev/null +++ b/include/wx/mac/carbon/apptrait.h @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/apptrait.h +// Purpose: standard implementations of wxAppTraits for MacOS +// Author: Vadim Zeitlin +// Modified by: Stefan Csomor +// Created: 23.06.2003 +// RCS-ID: $Id$ +// Copyright: (c) 2003 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_APPTRAIT_H_ +#define _WX_MAC_APPTRAIT_H_ + +// ---------------------------------------------------------------------------- +// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: + // other miscellaneous helpers + // --------------------------- + + virtual wxToolkitInfo& GetToolkitInfo(); +}; + +#if wxUSE_GUI + +class WXDLLEXPORT wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + // other miscellaneous helpers + // --------------------------- + + virtual wxToolkitInfo& GetToolkitInfo(); +}; + +#endif // wxUSE_GUI + +#endif // _WX_MAC_APPTRAIT_H_ + diff --git a/include/wx/mac/carbon/bitmap.h b/include/wx/mac/carbon/bitmap.h new file mode 100644 index 0000000000..a8e2439362 --- /dev/null +++ b/include/wx/mac/carbon/bitmap.h @@ -0,0 +1,225 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bitmap.h +// Purpose: wxBitmap class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "bitmap.h" +#endif + +#include "wx/palette.h" + +// Bitmap +class WXDLLEXPORT wxBitmap; +class WXDLLEXPORT wxBitmapHandler; +class WXDLLEXPORT wxControl; +class WXDLLEXPORT wxCursor; +class WXDLLEXPORT wxDC; +class WXDLLEXPORT wxIcon; +class WXDLLEXPORT wxImage; +class WXDLLEXPORT wxPixelDataBase; + +// A mask is a bitmap used for drawing bitmaps +// it can be a monochrome bitmap or a multi-bit bitmap which transfers to alpha channels +// transparently. +class WXDLLEXPORT wxMask: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxMask) + DECLARE_NO_COPY_CLASS(wxMask) + +public: + wxMask(); + + // Construct a mask from a bitmap and a colour indicating + // the transparent area + wxMask(const wxBitmap& bitmap, const wxColour& colour); + + // Construct a mask from a bitmap and a palette index indicating + // the transparent area + wxMask(const wxBitmap& bitmap, int paletteIndex); + + // Construct a mask from a mono bitmap (copies the bitmap). + wxMask(const wxBitmap& bitmap); + + ~wxMask(); + + bool Create(const wxBitmap& bitmap, const wxColour& colour); + bool Create(const wxBitmap& bitmap, int paletteIndex); + bool Create(const wxBitmap& bitmap); + + // Implementation + bool PointMasked(int x, int y); + inline WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } + inline void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; } + int GetDepth() const { return m_depth ; } + void SetDepth( int depth ) { m_depth = depth ; } +protected: + WXHBITMAP m_maskBitmap; + int m_depth ; +}; + +enum { kMacBitmapTypeUnknownType , kMacBitmapTypeGrafWorld, kMacBitmapTypePict , kMacBitmapTypeIcon } ; + +class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData +{ + DECLARE_NO_COPY_CLASS(wxBitmapRefData) + + friend class WXDLLEXPORT wxBitmap; + friend class WXDLLEXPORT wxIcon; + friend class WXDLLEXPORT wxCursor; +public: + wxBitmapRefData(); + ~wxBitmapRefData(); + +public: + int m_width; + int m_height; + int m_depth; + bool m_ok; + int m_numColors; +#if wxUSE_PALETTE + wxPalette m_bitmapPalette; +#endif // wxUSE_PALETTE + int m_quality; + + int m_bitmapType ; + WXHMETAFILE m_hPict ; + WXHBITMAP m_hBitmap; + WXHICON m_hIcon ; + wxMask * m_bitmapMask; // Optional mask + bool m_hasAlpha; +}; + +#define M_BITMAPDATA ((wxBitmapRefData *)m_refData) + +class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase +{ + DECLARE_DYNAMIC_CLASS(wxBitmapHandler) +public: + wxBitmapHandler() : m_name(), m_extension(), m_type(0) { } + virtual ~wxBitmapHandler(); + + virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); + + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(long type) { m_type = type; } + wxString GetName() const { return m_name; } + wxString GetExtension() const { return m_extension; } + long GetType() const { return m_type; } + +protected: + wxString m_name; + wxString m_extension; + long m_type; +}; + +#define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData()) + +class WXDLLEXPORT wxBitmap: public wxBitmapBase +{ + DECLARE_DYNAMIC_CLASS(wxBitmap) + + friend class WXDLLEXPORT wxBitmapHandler; + +public: + wxBitmap(); // Platform-specific + + // Copy constructors + wxBitmap(const wxBitmap& bitmap) + : wxBitmapBase() + { Ref(bitmap); } + + // Initialize with raw data. + wxBitmap(const char bits[], int width, int height, int depth = 1); + + // Initialize with XPM data + bool CreateFromXpm(const char **bits); + wxBitmap(const char **bits); + wxBitmap(char **bits); + + // Load a file or resource + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_PICT_RESOURCE); + + // Constructor for generalised creation from data + wxBitmap(void *data, wxBitmapType type, int width, int height, int depth = 1); + + // If depth is omitted, will create a bitmap compatible with the display + wxBitmap(int width, int height, int depth = -1); + + // Convert from wxImage: + wxBitmap(const wxImage& image, int depth = -1); + + ~wxBitmap(); + + wxImage ConvertToImage() const; + + // get the given part of bitmap + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(void *data, wxBitmapType type, int width, int height, int depth = 1); + virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; + + // copies the contents and mask of the given (colour) icon to the bitmap + virtual bool CopyFromIcon(const wxIcon& icon); + + bool Ok() const; + int GetWidth() const; + int GetHeight() const; + int GetDepth() const; + int GetQuality() const; + void SetWidth(int w); + void SetHeight(int h); + void SetDepth(int d); + void SetQuality(int q); + void SetOk(bool isOk); + +#if wxUSE_PALETTE + wxPalette* GetPalette() const; + void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + wxMask *GetMask() const; + void SetMask(wxMask *mask) ; + + int GetBitmapType() const; + + inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; } + inline bool operator == (const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; } + inline bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; } + + static void InitStandardHandlers(); + + // raw bitmap access support functions, for internal use only + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + void UseAlpha(); + +public: + WXHBITMAP GetHBITMAP() const; + inline WXHICON GetHICON() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hIcon : 0); } + WXHMETAFILE GetPict(bool *created = NULL ) const; + + void SetHBITMAP(WXHBITMAP bmp); + void SetHICON(WXHICON ico); + void SetPict( WXHMETAFILE pict ) ; + + bool FreeResource(bool force = FALSE); +}; +#endif + // _WX_BITMAP_H_ diff --git a/include/wx/mac/carbon/bmpbuttn.h b/include/wx/mac/carbon/bmpbuttn.h new file mode 100644 index 0000000000..28a91ed93f --- /dev/null +++ b/include/wx/mac/carbon/bmpbuttn.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bmpbuttn.h +// Purpose: wxBitmapButton class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTN_H_ +#define _WX_BMPBUTTN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "bmpbuttn.h" +#endif + +#include "wx/button.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr; + +#define wxDEFAULT_BUTTON_MARGIN 4 + +class WXDLLEXPORT wxBitmapButton: public wxBitmapButtonBase +{ + DECLARE_DYNAMIC_CLASS(wxBitmapButton) + +public: + wxBitmapButton() + { + SetMargins(wxDEFAULT_BUTTON_MARGIN, wxDEFAULT_BUTTON_MARGIN); + } + + wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, bitmap, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual void SetBitmapLabel(const wxBitmap& bitmap); + +/* + // TODO: Implementation + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); +*/ + +protected: + virtual wxSize DoGetBestSize() const; +}; + +#endif + // _WX_BMPBUTTN_H_ diff --git a/include/wx/mac/carbon/brush.h b/include/wx/mac/carbon/brush.h new file mode 100644 index 0000000000..12e60e06d1 --- /dev/null +++ b/include/wx/mac/carbon/brush.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: brush.h +// Purpose: wxBrush class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "brush.h" +#endif + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +class WXDLLEXPORT wxBrush; + +typedef enum +{ + kwxMacBrushColour , + kwxMacBrushTheme , + kwxMacBrushThemeBackground +} wxMacBrushKind ; + +// Brush +class WXDLLEXPORT wxBrush: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxBrush) + +public: + wxBrush(); + wxBrush(short macThemeBrush ) ; + wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxBitmap& stipple); + wxBrush(const wxBrush& brush) + : wxGDIObject() + { Ref(brush); } + ~wxBrush(); + + virtual void SetColour(const wxColour& col) ; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ; + virtual void SetStyle(int style) ; + virtual void SetStipple(const wxBitmap& stipple) ; + virtual void SetMacTheme(short macThemeBrush) ; + virtual void SetMacThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ; + + wxBrush& operator = (const wxBrush& brush) + { if (*this == brush) return (*this); Ref(brush); return *this; } + bool operator == (const wxBrush& brush) + { return m_refData == brush.m_refData; } + bool operator != (const wxBrush& brush) + { return m_refData != brush.m_refData; } + + wxMacBrushKind MacGetBrushKind() const ; + + unsigned long GetMacThemeBackground(WXRECTPTR extent) const ; + short GetMacTheme() const ; + wxColour& GetColour() const ; + int GetStyle() const ; + wxBitmap *GetStipple() const ; + + virtual bool Ok() const { return (m_refData != NULL) ; } + +// Implementation + + // Useful helper: create the brush resource + bool RealizeResource(); + + // When setting properties, we must make sure we're not changing + // another object + void Unshare(); +}; + +#endif + // _WX_BRUSH_H_ diff --git a/include/wx/mac/carbon/button.h b/include/wx/mac/carbon/button.h new file mode 100644 index 0000000000..23e9044f00 --- /dev/null +++ b/include/wx/mac/carbon/button.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: button.h +// Purpose: wxButton class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTON_H_ +#define _WX_BUTTON_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "button.h" +#endif + +#include "wx/control.h" +#include "wx/gdicmn.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr; + +// Pushbutton +class WXDLLEXPORT wxButton: public wxButtonBase +{ + DECLARE_DYNAMIC_CLASS(wxButton) + public: + inline wxButton() {} + inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + static wxSize GetDefaultSize(); + + virtual void SetDefault(); + virtual void Command(wxCommandEvent& event); +protected: + virtual wxSize DoGetBestSize() const ; +}; + +#endif + // _WX_BUTTON_H_ diff --git a/include/wx/mac/carbon/checkbox.h b/include/wx/mac/carbon/checkbox.h new file mode 100644 index 0000000000..a426cb734b --- /dev/null +++ b/include/wx/mac/carbon/checkbox.h @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: checkbox.h +// Purpose: wxCheckBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_ +#define _WX_CHECKBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "checkbox.h" +#endif + +// Checkbox item (single checkbox) +class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox() { } + wxCheckBox(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + virtual void SetValue(bool); + virtual bool GetValue() const; + + void DoSet3StateValue(wxCheckBoxState val); + virtual wxCheckBoxState DoGet3StateValue() const; + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ); + virtual void Command(wxCommandEvent& event); + + DECLARE_DYNAMIC_CLASS(wxCheckBox) +}; + +class WXDLLEXPORT wxBitmap; +class WXDLLEXPORT wxBitmapCheckBox: public wxCheckBox +{ +public: + int checkWidth; + int checkHeight; + + wxBitmapCheckBox() + : checkWidth(-1), checkHeight(-1) + { } + + wxBitmapCheckBox(wxWindow *parent, wxWindowID id, const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, const wxBitmap *bitmap, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + virtual void SetValue(bool); + virtual bool GetValue() const; + virtual void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); + virtual void SetLabel(const wxBitmap *bitmap); + virtual void SetLabel( const wxString & WXUNUSED(name) ) {} + + DECLARE_DYNAMIC_CLASS(wxBitmapCheckBox) +}; +#endif + // _WX_CHECKBOX_H_ diff --git a/include/wx/mac/carbon/checklst.h b/include/wx/mac/carbon/checklst.h new file mode 100644 index 0000000000..35f3bd885d --- /dev/null +++ b/include/wx/mac/carbon/checklst.h @@ -0,0 +1,105 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Note: this is an optional class. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKLST_H_ +#define _WX_CHECKLST_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "checklst.h" +#endif + +#if !defined(__MWERKS__) && !defined(__UNIX__) +typedef unsigned int size_t; +#endif + +class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase +{ + DECLARE_DYNAMIC_CLASS(wxCheckListBox) +public: + // ctors + wxCheckListBox() { Init(); } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Init(); + + Create(parent, id, pos, size, nStrings, choices, style, validator, name); + } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Init(); + + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int nStrings = 0, + const wxString *choices = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + // items may be checked + bool IsChecked(size_t uiIndex) const; + void Check(size_t uiIndex, bool bCheck = TRUE); + void OnChar(wxKeyEvent& event) ; + void OnLeftClick(wxMouseEvent& event) ; + + // metrics + wxInt32 m_checkBoxWidth; + wxInt32 m_checkBoxHeight; + wxInt32 m_TextBaseLineOffset; + + // the array containing the checked status of the items + wxArrayInt m_checks; + + // override all methods which add/delete items to update m_checks array as + // well + virtual void Delete(int n); +protected: + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + virtual void DoClear(); + // common part of all ctors + void Init(); +private: + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_CHECKLST_H_ diff --git a/include/wx/mac/carbon/chkconf.h b/include/wx/mac/carbon/chkconf.h new file mode 100644 index 0000000000..e7c5d596c5 --- /dev/null +++ b/include/wx/mac/carbon/chkconf.h @@ -0,0 +1,30 @@ +/* + * Name: wx/mac/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * RCS-ID: $Id$ + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +#ifndef _WX_MAC_CHKCONF_H_ +#define _WX_MAC_CHKCONF_H_ + +/* + * disable the settings which don't work for some compilers + */ + +/* + * wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior + */ + +#if defined(__MWERKS__) + #undef wxUSE_DEBUG_NEW_ALWAYS + #define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +#endif + /* _WX_MAC_CHKCONF_H_ */ + diff --git a/include/wx/mac/carbon/choice.h b/include/wx/mac/carbon/choice.h new file mode 100644 index 0000000000..4c10bab315 --- /dev/null +++ b/include/wx/mac/carbon/choice.h @@ -0,0 +1,111 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: choice.h +// Purpose: wxChoice class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_ +#define _WX_CHOICE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "choice.h" +#endif + +#include "wx/control.h" + +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr; + +WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; + +// Choice item +class WXDLLEXPORT wxChoice: public wxChoiceBase +{ + DECLARE_DYNAMIC_CLASS(wxChoice) + +public: + wxChoice() + : m_strings(), m_datas(), m_macPopUpMenuHandle(NULL) + {} + + virtual ~wxChoice() ; + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + // implement base class pure virtuals + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, int pos); + virtual void Delete(int n); + virtual void Clear(); + + virtual int GetCount() const ; + virtual int GetSelection() const ; + virtual void SetSelection(int n); + + virtual int FindString(const wxString& s) const; + virtual wxString GetString(int n) const ; + virtual void SetString( int , const wxString& s ) ; + void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + +protected: + virtual wxSize DoGetBestSize() const ; + +public: // for wxComboBox only + virtual void DoSetItemClientData( int n, void* clientData ); + virtual void* DoGetItemClientData( int n ) const; + virtual void DoSetItemClientObject( int n, wxClientData* clientData ); + virtual wxClientData* DoGetItemClientObject( int n ) const; + +protected: + // free all memory we have (used by Clear() and dtor) + // prevent collision with some BSD definitions of macro Free() + void FreeData(); + + wxArrayString m_strings; + wxChoiceDataArray m_datas ; + WXHMENU m_macPopUpMenuHandle ; +}; + +#endif + // _WX_CHOICE_H_ diff --git a/include/wx/mac/carbon/clipbrd.h b/include/wx/mac/carbon/clipbrd.h new file mode 100644 index 0000000000..34bb3e3129 --- /dev/null +++ b/include/wx/mac/carbon/clipbrd.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: clipbrd.h +// Purpose: Clipboard functionality. +// Note: this functionality is under review, and +// is derived from wxWindows 1.xx code. Please contact +// the wxWindows developers for further information. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_ +#define _WX_CLIPBRD_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "clipbrd.h" +#endif + +#if wxUSE_CLIPBOARD + +#include "wx/list.h" +#include "wx/module.h" +#include "wx/dataobj.h" // for wxDataFormat + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataObject; +class WXDLLEXPORT wxClipboard : public wxClipboardBase +{ + DECLARE_DYNAMIC_CLASS(wxClipboard) + +public: + wxClipboard(); + ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // query whether the clipboard is opened + virtual bool IsOpened() const; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ); + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ); + + // ask if data in correct format is available + virtual bool IsSupported( const wxDataFormat& format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush(); + + // X11 has two clipboards which get selected by this call. Empty on MSW. + void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { } + +private: + wxDataObject *m_data; + bool m_open; +}; + +#endif // wxUSE_CLIPBOARD + +#endif + // _WX_CLIPBRD_H_ diff --git a/include/wx/mac/carbon/colordlg.h b/include/wx/mac/carbon/colordlg.h new file mode 100644 index 0000000000..443ba6fd68 --- /dev/null +++ b/include/wx/mac/carbon/colordlg.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: colordlg.h +// Purpose: wxColourDialog class. Use generic version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_ +#define _WX_COLORDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "colordlg.h" +#endif + +#include "wx/setup.h" +#include "wx/dialog.h" +#include "wx/cmndata.h" + +/* + * Platform-specific colour dialog implementation + */ + +class WXDLLEXPORT wxColourDialog: public wxDialog +{ +DECLARE_DYNAMIC_CLASS(wxColourDialog) +public: + wxColourDialog(); + wxColourDialog(wxWindow *parent, wxColourData *data = NULL); + + bool Create(wxWindow *parent, wxColourData *data = NULL); + + int ShowModal(); + wxColourData& GetColourData() { return m_colourData; } + +protected: + wxColourData m_colourData; + wxWindow* m_dialogParent; +}; + +#endif + // _WX_COLORDLG_H_ diff --git a/include/wx/mac/carbon/colour.h b/include/wx/mac/carbon/colour.h new file mode 100644 index 0000000000..158e631d64 --- /dev/null +++ b/include/wx/mac/carbon/colour.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: colour.h +// Purpose: wxColour class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "colour.h" +#endif + +#include "wx/object.h" +#include "wx/string.h" + +// Colour +class WXDLLEXPORT wxColour: public wxObject +{ +public: + // ctors + // default + wxColour() { Init(); } + // from RGB + wxColour( unsigned char red, unsigned char green, unsigned char blue ) + { Set(red, green, blue); } + wxColour( unsigned long colRGB ) + { Set(colRGB); } + + // implicit conversion from the colour name + wxColour( const wxString &colourName ) + { InitFromName(colourName); } + wxColour( const wxChar *colourName ) + { InitFromName(colourName); } + + // copy ctors and assignment operators + wxColour( const wxColour& col ); + wxColour( const wxColour* col ); + wxColour& operator = ( const wxColour& col ); + + // dtor + ~wxColour(); + + // Set() functions + void Set( unsigned char red, unsigned char green, unsigned char blue ); + void Set( unsigned long colRGB ) + { + // we don't need to know sizeof(long) here because we assume that the three + // least significant bytes contain the R, G and B values + Set((unsigned char)colRGB, + (unsigned char)(colRGB >> 8), + (unsigned char)(colRGB >> 16)); + } + + // accessors + bool Ok() const {return m_isInit; } + + unsigned char Red() const { return m_red; } + unsigned char Green() const { return m_green; } + unsigned char Blue() const { return m_blue; } + + // comparison + bool operator == (const wxColour& colour) const + { + return (m_isInit == colour.m_isInit + && m_red == colour.m_red + && m_green == colour.m_green + && m_blue == colour.m_blue); + } + bool operator != (const wxColour& colour) const { return !(*this == colour); } + + const WXCOLORREF& GetPixel() const { return m_pixel; }; + + void InitFromName(const wxString& col); + +protected : + + // Helper function + void Init(); + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + +public: + WXCOLORREF m_pixel ; + void Set( const WXCOLORREF* color ) ; + +private: + DECLARE_DYNAMIC_CLASS(wxColour) +}; + +#endif + // _WX_COLOUR_H_ diff --git a/include/wx/mac/carbon/combobox.h b/include/wx/mac/carbon/combobox.h new file mode 100644 index 0000000000..68b3b02820 --- /dev/null +++ b/include/wx/mac/carbon/combobox.h @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: combobox.h +// Purpose: wxComboBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_ +#define _WX_COMBOBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "combobox.h" +#endif + +#include "wx/textctrl.h" +#include "wx/choice.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; + +// Combobox item +class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase +{ + DECLARE_DYNAMIC_CLASS(wxComboBox) + + public: + inline wxComboBox() {} + virtual ~wxComboBox(); + // override the base class virtuals involved in geometry calculations + virtual wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = TRUE); + virtual bool Show(bool show = TRUE); + virtual void SetFocus(); + + // callback functions + virtual void DelegateTextChanged( const wxString& value ); + virtual void DelegateChoice( const wxString& value ); + + 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 wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, 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 wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + // List functions + virtual void Delete(int n); + virtual void Clear(); + + virtual int GetSelection() const ; + virtual void SetSelection(int n); + virtual void Select(int n) { SetSelection(n) ; } + virtual int FindString(const wxString& s) const; + virtual wxString GetString(int n) const ; + virtual wxString GetStringSelection() const ; + virtual void SetString(int n, const wxString& s) ; + virtual bool SetStringSelection(const wxString& sel); + + // Text field functions + virtual wxString GetValue() const ; + virtual void SetValue(const wxString& value); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const ; + virtual long GetLastPosition() const ; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + virtual int GetCount() const { return m_choice->GetCount() ; } + void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + +protected: + virtual int DoAppend(const wxString& item) ; + virtual int DoInsert(const wxString& item, int pos) ; + + virtual void DoSetItemClientData(int n, void* clientData) ; + virtual void* DoGetItemClientData(int n) const ; + virtual void DoSetItemClientObject(int n, wxClientData* clientData) ; + virtual wxClientData* DoGetItemClientObject(int n) const ; + + void FreeData(); + + // the subcontrols + wxTextCtrl* m_text; + wxChoice* m_choice; +}; + +#endif + // _WX_COMBOBOX_H_ diff --git a/include/wx/mac/carbon/control.h b/include/wx/mac/carbon/control.h new file mode 100644 index 0000000000..cc588f3861 --- /dev/null +++ b/include/wx/mac/carbon/control.h @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: control.h +// Purpose: wxControl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_ +#define _WX_CONTROL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "control.h" +#endif + +WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr; + +// General item class +class WXDLLEXPORT wxControl : public wxControlBase +{ + DECLARE_ABSTRACT_CLASS(wxControl) + +public: + wxControl(); + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr); + virtual ~wxControl(); + + // Simulates an event + virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } + + // implementation from now on + // -------------------------- + + // Calls the callback and appropriate event handlers + bool ProcessCommand(wxCommandEvent& event); + virtual void SetLabel(const wxString& title) ; + + wxList& GetSubcontrols() { return m_subControls; } + + void OnEraseBackground(wxEraseEvent& event); + + virtual bool Enable(bool enable = TRUE) ; + virtual bool Show(bool show = TRUE) ; + virtual void DoSetWindowVariant( wxWindowVariant variant ) ; + + virtual void MacRedrawControl () ; + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label , + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& validator, + const wxString& name , + WXRECTPTR outBounds , + unsigned char* maclabel ) ; + virtual void MacPostControlCreate() ; + virtual void MacAdjustControlRect() ; + virtual WXWidget MacGetContainerForEmbedding() ; + virtual void MacSuperChangedPosition() ; + virtual void MacSuperEnabled( bool enabled ) ; + virtual void MacSuperShown( bool show ) ; + virtual bool MacCanFocus() const ; + virtual void MacUpdateDimensions() ; + void* MacGetControlAction() { return m_macControlAction ; } + + virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ; + void OnKeyDown( wxKeyEvent &event ) ; + void OnMouseEvent( wxMouseEvent &event ) ; + void OnPaint(wxPaintEvent& event) ; + virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ; + WXWidget GetMacControl() { return m_macControl ;} + +protected: + // For controls like radiobuttons which are really composite + WXWidget m_macControl ; + void* m_macControlAction ; + bool m_macControlIsShown ; + wxList m_subControls; + int m_macHorizontalBorder ; + int m_macVerticalBorder ; + + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_EVENT_TABLE() +}; + + +wxControl *wxFindControlFromMacControl(WXWidget inControl ) ; +void wxAssociateControlWithMacControl(WXWidget inControl, wxControl *control) ; +void wxRemoveMacControlAssociation(wxControl *control) ; + +#endif + // _WX_CONTROL_H_ diff --git a/include/wx/mac/carbon/cursor.h b/include/wx/mac/carbon/cursor.h new file mode 100644 index 0000000000..c8414a4ee0 --- /dev/null +++ b/include/wx/mac/carbon/cursor.h @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: cursor.h +// Purpose: wxCursor class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "cursor.h" +#endif + +#include "wx/bitmap.h" + +class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData +{ + DECLARE_NO_COPY_CLASS(wxCursorRefData) + + friend class WXDLLEXPORT wxBitmap; + friend class WXDLLEXPORT wxCursor; +public: + wxCursorRefData(); + ~wxCursorRefData(); + +protected: + WXHCURSOR m_hCursor; + bool m_disposeHandle; + bool m_releaseHandle; + bool m_isColorCursor ; + long m_themeCursor ; +}; + +#define M_CURSORDATA ((wxCursorRefData *)m_refData) +#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) + +// Cursor +class WXDLLEXPORT wxCursor: public wxBitmap +{ + DECLARE_DYNAMIC_CLASS(wxCursor) + +public: + wxCursor(); + + // Copy constructors + wxCursor(const wxCursor& cursor) + : wxBitmap() + { Ref(cursor); } + + wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL); + + wxCursor(const wxImage & image) ; + wxCursor(const char **bits) ; + wxCursor(char **bits) ; + wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE, + int hotSpotX = 0, int hotSpotY = 0); + + wxCursor(int cursor_type); + ~wxCursor(); + + bool CreateFromXpm(const char **bits) ; + virtual bool Ok() const { return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; } + + inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; } + inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; } + inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; } + + void MacInstall() const ; + + void SetHCURSOR(WXHCURSOR cursor); + inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } +private : + void CreateFromImage(const wxImage & image) ; +}; + +extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor); + +#endif + // _WX_CURSOR_H_ diff --git a/include/wx/mac/carbon/dataform.h b/include/wx/mac/carbon/dataform.h new file mode 100644 index 0000000000..6e8846c6da --- /dev/null +++ b/include/wx/mac/carbon/dataform.h @@ -0,0 +1,61 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: mac/dataform.h +// Purpose: declaration of the wxDataFormat class +// Author: Stefan Csomor (lifted from dnd.h) +// Modified by: +// Created: 10/21/99 +// RCS-ID: $Id$ +// Copyright: (c) 1999 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_DATAFORM_H +#define _WX_MAC_DATAFORM_H + +class WXDLLEXPORT wxDataFormat +{ +public: + typedef unsigned long NativeFormat; + + wxDataFormat(); + wxDataFormat(wxDataFormatId vType); + wxDataFormat(const wxString& rId); + wxDataFormat(const wxChar* pId); + wxDataFormat(NativeFormat vFormat); + + wxDataFormat& operator=(NativeFormat vFormat) + { SetId(vFormat); return *this; } + + // comparison (must have both versions) + bool operator==(NativeFormat format) const + { return m_format == (NativeFormat)format; } + bool operator!=(NativeFormat format) const + { return m_format != (NativeFormat)format; } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + // explicit and implicit conversions to NativeFormat which is one of + // standard data types (implicit conversion is useful for preserving the + // compatibility with old code) + NativeFormat GetFormatId() const { return m_format; } + operator NativeFormat() const { return m_format; } + + void SetId(NativeFormat format); + + // string ids are used for custom types - this SetId() must be used for + // application-specific formats + wxString GetId() const; + void SetId(const wxChar* pId); + + // implementation + wxDataFormatId GetType() const { return m_type; } + void SetType( wxDataFormatId type ); + +private: + wxDataFormatId m_type; + NativeFormat m_format; +}; + +#endif // _WX_MAC_DATAFORM_H diff --git a/include/wx/mac/carbon/dataobj.h b/include/wx/mac/carbon/dataobj.h new file mode 100644 index 0000000000..15b58e3a37 --- /dev/null +++ b/include/wx/mac/carbon/dataobj.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: mac/dataobj.h +// Purpose: declaration of the wxDataObject +// Author: Stefan Csomor (adapted from Robert Roebling's gtk port) +// Modified by: +// Created: 10/21/99 +// RCS-ID: $Id$ +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_DATAOBJ_H_ +#define _WX_MAC_DATAOBJ_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxGTK +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); +#ifdef __DARWIN__ + ~wxDataObject() { } +#endif + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; +}; + +#endif // _WX_MAC_DATAOBJ_H_ + diff --git a/include/wx/mac/carbon/dataobj2.h b/include/wx/mac/carbon/dataobj2.h new file mode 100644 index 0000000000..64b0ac084a --- /dev/null +++ b/include/wx/mac/carbon/dataobj2.h @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: os2/dataobj2.h +// Purpose: declaration of standard wxDataObjectSimple-derived classes +// Author: David Webster (adapted from Robert Roebling's gtk port +// Modified by: +// Created: 10/21/99 +// RCS-ID: $Id$ +// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GTK_DATAOBJ2_H_ +#define _WX_GTK_DATAOBJ2_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // destr + ~wxBitmapDataObject(); + + // override base class virtual to update PNG data too + virtual void SetBitmap(const wxBitmap& bitmap); + + // implement base class pure virtuals + // ---------------------------------- + + virtual size_t GetDataSize() const ; + virtual bool GetDataHere(void *buf) const ; + virtual bool SetData(size_t len, const void *buf); + +protected : + void Init() ; + void Clear() ; + + void* m_pictHandle ; + bool m_pictCreated ; +private: + // Virtual function hiding supression + size_t GetDataSize(const wxDataFormat& rFormat) const + { return(wxDataObjectSimple::GetDataSize(rFormat)); } + bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const + { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); } + bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf) + { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDataObject : public wxFileDataObjectBase +{ +public: + // implement base class pure virtuals + // ---------------------------------- + + void AddFile( const wxString &filename ); + + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + +private: + // Virtual function hiding supression + size_t GetDataSize(const wxDataFormat& rFormat) const + { return(wxDataObjectSimple::GetDataSize(rFormat)); } + bool GetDataHere(const wxDataFormat& rFormat, void* pBuf) const + { return(wxDataObjectSimple::GetDataHere(rFormat, pBuf)); } + bool SetData(const wxDataFormat& rFormat, size_t nLen, const void* pBuf) + { return(wxDataObjectSimple::SetData(rFormat, nLen, pBuf)); } +}; + +#endif // _WX_GTK_DATAOBJ2_H_ + diff --git a/include/wx/mac/carbon/dc.h b/include/wx/mac/carbon/dc.h new file mode 100644 index 0000000000..5fc2601e55 --- /dev/null +++ b/include/wx/mac/carbon/dc.h @@ -0,0 +1,293 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dc.h +// Purpose: wxDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_ +#define _WX_DC_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dc.h" +#endif + +#include "wx/pen.h" +#include "wx/brush.h" +#include "wx/icon.h" +#include "wx/font.h" +#include "wx/gdicmn.h" + +//----------------------------------------------------------------------------- +// constants +//----------------------------------------------------------------------------- + +#ifndef MM_TEXT +#define MM_TEXT 0 +#define MM_ISOTROPIC 1 +#define MM_ANISOTROPIC 2 +#define MM_LOMETRIC 3 +#define MM_HIMETRIC 4 +#define MM_TWIPS 5 +#define MM_POINTS 6 +#define MM_METRIC 7 +#endif + +//----------------------------------------------------------------------------- +// global variables +//----------------------------------------------------------------------------- + +extern int wxPageNumber; + +class wxMacPortStateHelper ; +//----------------------------------------------------------------------------- +// wxDC +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxDC: public wxDCBase +{ + DECLARE_DYNAMIC_CLASS(wxDC) + DECLARE_NO_COPY_CLASS(wxDC) + + public: + + wxDC(); + ~wxDC(); + + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; } + virtual void EndDoc(void) {}; + + virtual void StartPage(void) {}; + virtual void EndPage(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 SetBackgroundMode(int mode); + virtual void SetPalette(const wxPalette& palette); + + virtual void DestroyClippingRegion(); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + + virtual bool CanDrawBitmap() const; + virtual bool CanGetTextExtent() const; + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void SetMapMode(int mode); + virtual void SetUserScale(double x, double y); + + virtual void SetLogicalScale(double x, double y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + virtual void SetLogicalFunction(int function); + + virtual void SetTextForeground(const wxColour& colour) ; + virtual void SetTextBackground(const wxColour& colour) ; + + void ComputeScaleAndOrigin(void); + public: + + + wxCoord XDEV2LOG(wxCoord x) const + { + long new_x = x - m_deviceOriginX ; + if (new_x > 0) + return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; + else + return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; + } + wxCoord XDEV2LOGREL(wxCoord x) const + { + if (x > 0) + return (wxCoord)((double)(x) / m_scaleX + 0.5); + else + return (wxCoord)((double)(x) / m_scaleX - 0.5); + } + wxCoord YDEV2LOG(wxCoord y) const + { + long new_y = y - m_deviceOriginY ; + if (new_y > 0) + return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; + else + return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; + } + wxCoord YDEV2LOGREL(wxCoord y) const + { + if (y > 0) + return (wxCoord)((double)(y) / m_scaleY + 0.5); + else + return (wxCoord)((double)(y) / m_scaleY - 0.5); + } + wxCoord XLOG2DEV(wxCoord x) const + { + long new_x = x - m_logicalOriginX; + if (new_x > 0) + return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX ; + else + return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX ; + } + wxCoord XLOG2DEVREL(wxCoord x) const + { + if (x > 0) + return (wxCoord)((double)(x) * m_scaleX + 0.5); + else + return (wxCoord)((double)(x) * m_scaleX - 0.5); + } + wxCoord YLOG2DEV(wxCoord y) const + { + long new_y = y - m_logicalOriginY ; + if (new_y > 0) + return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY ; + else + return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY ; + } + wxCoord YLOG2DEVREL(wxCoord y) const + { + if (y > 0) + return (wxCoord)((double)(y) * m_scaleY + 0.5); + else + return (wxCoord)((double)(y) * m_scaleY - 0.5); + } + wxCoord XLOG2DEVMAC(wxCoord x) const + { + long new_x = x - m_logicalOriginX; + if (new_x > 0) + return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.x ; + else + return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.x ; + } + wxCoord YLOG2DEVMAC(wxCoord y) const + { + long new_y = y - m_logicalOriginY ; + if (new_y > 0) + return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.y ; + else + return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.y ; + } + + WXHRGN MacGetCurrentClipRgn() { return m_macCurrentClipRgn ; } + static void MacSetupBackgroundForCurrentPort(const wxBrush& background ) ; +// + +protected: + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = FALSE); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + // this is gnarly - we can't even call this function DoSetClippingRegion() + // because of virtual function hiding + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, + wxCoord *width, wxCoord *height) + { + GetClippingBox(x, y, width, height); + } + + virtual void DoGetSizeMM(int* width, int* height) const; + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + + protected: + //begin wxmac + // Variables used for scaling + double m_mm_to_pix_x,m_mm_to_pix_y; + // not yet used + bool m_needComputeScaleX,m_needComputeScaleY; + // If un-scrolled is non-zero or d.o. changes with scrolling. + // Set using SetInternalDeviceOrigin(). + long m_internalDeviceOriginX,m_internalDeviceOriginY; + // To be set by external classes such as wxScrolledWindow + // using SetDeviceOrigin() + long m_externalDeviceOriginX,m_externalDeviceOriginY; + + // Begin implementation for Mac + public: + + WXHDC m_macPort ; + WXHBITMAP m_macMask ; + + // in order to preserve the const inheritance of the virtual functions, we have to + // use mutable variables starting from CWPro 5 + + void MacInstallFont() const ; + void MacInstallPen() const ; + void MacInstallBrush() const ; + + mutable bool m_macFontInstalled ; + mutable bool m_macPenInstalled ; + mutable bool m_macBrushInstalled ; + + WXHRGN m_macBoundaryClipRgn ; + WXHRGN m_macCurrentClipRgn ; + wxPoint m_macLocalOrigin ; + void MacSetupPort( wxMacPortStateHelper* ph ) const ; + void MacCleanupPort( wxMacPortStateHelper* ph ) const ; + mutable void* m_macATSUIStyle ; + mutable wxMacPortStateHelper* m_macCurrentPortStateHelper ; + mutable bool m_macFormerAliasState ; + mutable short m_macFormerAliasSize ; + mutable bool m_macAliasWasEnabled ; + mutable void* m_macForegroundPixMap ; + mutable void* m_macBackgroundPixMap ; +}; + +#endif + // _WX_DC_H_ diff --git a/include/wx/mac/carbon/dcclient.h b/include/wx/mac/carbon/dcclient.h new file mode 100644 index 0000000000..8e01314084 --- /dev/null +++ b/include/wx/mac/carbon/dcclient.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcclient.h +// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dcclient.h" +#endif + +#include "wx/dc.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxPaintDC; +class WXDLLEXPORT wxWindow; + +class WXDLLEXPORT wxWindowDC: public wxDC +{ + DECLARE_DYNAMIC_CLASS(wxWindowDC) + + public: + wxWindowDC(void); + + // Create a DC corresponding to a canvas + wxWindowDC(wxWindow *win); + + ~wxWindowDC(void); + virtual void DoGetSize( int *width, int *height ) const; + protected : + wxWindow *m_window; +}; + + +class WXDLLEXPORT wxClientDC: public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxClientDC) + + public: + wxClientDC(void); + + // Create a DC corresponding to a canvas + wxClientDC(wxWindow *win); + + ~wxClientDC(void); + virtual void DoGetSize( int *width, int *height ) const; +}; + +class WXDLLEXPORT wxPaintDC: public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxPaintDC) + + public: + wxPaintDC(void); + + // Create a DC corresponding to a canvas + wxPaintDC(wxWindow *win); + + ~wxPaintDC(void); + virtual void DoGetSize( int *width, int *height ) const; +}; + +#endif + // _WX_DCCLIENT_H_ diff --git a/include/wx/mac/carbon/dcmemory.h b/include/wx/mac/carbon/dcmemory.h new file mode 100644 index 0000000000..c8ea44e5ad --- /dev/null +++ b/include/wx/mac/carbon/dcmemory.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcmemory.h +// Purpose: wxMemoryDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dcmemory.h" +#endif + +#include "wx/dcclient.h" + +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 ); + virtual void DoGetSize( int *width, int *height ) const; + wxBitmap GetSelectedObject() { return m_selected ; } + private: + wxBitmap m_selected; +}; + +#endif + // _WX_DCMEMORY_H_ diff --git a/include/wx/mac/carbon/dcprint.h b/include/wx/mac/carbon/dcprint.h new file mode 100644 index 0000000000..0e2b5bcf0d --- /dev/null +++ b/include/wx/mac/carbon/dcprint.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcprint.h +// Purpose: wxPrinterDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_ +#define _WX_DCPRINT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dcprint.h" +#endif + +#include "wx/dc.h" +#include "wx/cmndata.h" + +class wxNativePrinterDC ; + +class WXDLLEXPORT wxPrinterDC: public wxDC +{ + public: + DECLARE_CLASS(wxPrinterDC) + +#if wxUSE_PRINTING_ARCHITECTURE + // Create a printer DC + wxPrinterDC(const wxPrintData& printdata ); + ~wxPrinterDC(); + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) ; + virtual void EndDoc(void) ; + virtual void StartPage(void) ; + virtual void EndPage(void) ; + wxPrintData& GetPrintData() { return m_printData; } + virtual void DoGetSize( int *width, int *height ) const; + + protected: + wxPrintData m_printData ; + wxNativePrinterDC* m_nativePrinterDC ; +#endif // wxUSE_PRINTING_ARCHITECTURE +}; + +#endif + // _WX_DCPRINT_H_ + diff --git a/include/wx/mac/carbon/dcscreen.h b/include/wx/mac/carbon/dcscreen.h new file mode 100644 index 0000000000..ab83b37618 --- /dev/null +++ b/include/wx/mac/carbon/dcscreen.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcscreen.h +// Purpose: wxScreenDC class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_ +#define _WX_DCSCREEN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dcscreen.h" +#endif + +#include "wx/dcclient.h" + +class WXDLLEXPORT wxScreenDC: public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxScreenDC) + + public: + // Create a DC representing the whole screen + wxScreenDC(); + ~wxScreenDC(); + + // Compatibility with X's requirements for + // drawing on top of all windows + static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; } + static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; } + static bool EndDrawingOnTop() { return TRUE; } +}; + +#endif + // _WX_DCSCREEN_H_ + diff --git a/include/wx/mac/carbon/dialog.h b/include/wx/mac/carbon/dialog.h new file mode 100644 index 0000000000..e6834011c5 --- /dev/null +++ b/include/wx/mac/carbon/dialog.h @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dialog.h +// Purpose: wxDialog class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_ +#define _WX_DIALOG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dialog.h" +#endif + +#include "wx/panel.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; + +WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; + +class WXDLLEXPORT wxMacToolTip ; + +// Dialog boxes +class WXDLLEXPORT wxDialog : public wxDialogBase +{ + DECLARE_DYNAMIC_CLASS(wxDialog) + +public: + wxDialog(); + + // Constructor with a modal flag, but no window id - the old convention + wxDialog(wxWindow *parent, + const wxString& title, bool modal, + int x = -1, int y= -1, int width = 500, int height = 500, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; + Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), + style | modalStyle, name); + } + + // Constructor with no modal flag - the new convention. + wxDialog(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + + ~wxDialog(); + +// virtual bool Destroy(); + bool Show(bool show = true); + + void SetModal(bool flag); + virtual bool IsModal() const; + + // For now, same as Show(TRUE) but returns return code + virtual int ShowModal(); + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode); + + // returns TRUE if we're in a modal loop + bool IsModalShowing() const; + + // implementation + // -------------- + + // event handlers + void OnCharHook(wxKeyEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + // Standard buttons + void OnOK(wxCommandEvent& event); + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // show modal dialog and enter modal loop + void DoShowModal(); + +private: + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_DIALOG_H_ diff --git a/include/wx/mac/carbon/dirdlg.h b/include/wx/mac/carbon/dirdlg.h new file mode 100644 index 0000000000..734292ade3 --- /dev/null +++ b/include/wx/mac/carbon/dirdlg.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dirdlg.h +// Purpose: wxDirDialog class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_ +#define _WX_DIRDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dirdlg.h" +#endif + +class WXDLLEXPORT wxDirDialog : public wxDialog +{ +public: + wxDirDialog(wxWindow *parent, + const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = _T(""), + long style = 0, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); + + void SetMessage(const wxString& message) { m_message = message; } + void SetPath(const wxString& path) { m_path = path; } + void SetStyle(long style) { m_dialogStyle = style; } + + wxString GetMessage() const { return m_message; } + wxString GetPath() const { return m_path; } + long GetStyle() const { return m_dialogStyle; } + + virtual int ShowModal(); + +protected: + wxString m_message; + long m_dialogStyle; + wxWindow * m_parent; + wxString m_path; + + DECLARE_DYNAMIC_CLASS(wxDirDialog) +}; + +#endif + // _WX_DIRDLG_H_ diff --git a/include/wx/mac/carbon/display.h b/include/wx/mac/carbon/display.h new file mode 100644 index 0000000000..060c9c7ef4 --- /dev/null +++ b/include/wx/mac/carbon/display.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: display.h +// Purpose: wxDisplay class customization for Mac +// Author: Brian Victor +// Modified by: Royce Mitchell III +// Created: 06/21/02 +// RCS-ID: $Id$ +// Copyright: (c) wxWindows team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_DISPLAY_H_ +#define _WX_MAC_DISPLAY_H_ + +#include "wx/object.h" +#include "wx/display.h" + +class wxDisplayMacPriv; +class wxRect; +class wxString; + +class WXDLLEXPORT wxDisplay : public wxDisplayBase +{ +public: + wxDisplay ( size_t index = 0 ); + + ~wxDisplay(); + + virtual wxRect GetGeometry() const; + virtual int GetDepth() const; + virtual wxString GetName() const; + + virtual wxArrayVideoModes + GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const; + + virtual wxVideoMode GetCurrentMode() const; + + virtual bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode); + +private: + wxDisplayMacPriv* m_priv; + + DECLARE_NO_COPY_CLASS(wxDisplay) +}; + +#endif // _WX_MAC_DISPLAY_H_ diff --git a/include/wx/mac/carbon/dnd.h b/include/wx/mac/carbon/dnd.h new file mode 100644 index 0000000000..989a977628 --- /dev/null +++ b/include/wx/mac/carbon/dnd.h @@ -0,0 +1,114 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: dnd.h +// Purpose: Declaration of the wxDropTarget, wxDropSource class etc. +// Author: Stefan Csomor +// RCS-ID: $Id$ +// Copyright: (c) 1998 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DND_H_ +#define _WX_DND_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dnd.h" +#endif + +#if wxUSE_DRAG_AND_DROP + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/string.h" +#include "wx/string.h" +#include "wx/dataobj.h" +#include "wx/cursor.h" + +//------------------------------------------------------------------------- +// classes +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindow; + +class WXDLLEXPORT wxDropTarget; +class WXDLLEXPORT wxTextDropTarget; +class WXDLLEXPORT wxFileDropTarget; + +class WXDLLEXPORT wxDropSource; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// this macro may be used instead for wxDropSource ctor arguments: it will use +// the icon 'name' from an XPM file under GTK, but will expand to something +// else under MSW. If you don't use it, you will have to use #ifdef in the +// application code. +#define wxDROP_ICON(X) wxCursor( (const char**) X##_xpm ) + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxDropTarget: public wxDropTargetBase +{ + public: + + wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL ); + + virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def); + virtual bool OnDrop(wxCoord x, wxCoord y); + virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def); + virtual bool GetData(); + + bool CurrentDragHasSupportedFormat() ; + void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; } + void* GetCurrentDrag() { return m_currentDrag ; } + protected : + void* m_currentDrag ; +}; + +//------------------------------------------------------------------------- +// wxDropSource +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxDropSource: public wxDropSourceBase +{ +public: + // ctors: if you use default ctor you must call SetData() later! + // + // NB: the "wxWindow *win" parameter is unused and is here only for wxGTK + // compatibility, as well as both icon parameters + wxDropSource( wxWindow *win = (wxWindow *)NULL, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + + /* constructor for setting one data object */ + wxDropSource( wxDataObject& data, + wxWindow *win, + const wxCursor &cursorCopy = wxNullCursor, + const wxCursor &cursorMove = wxNullCursor, + const wxCursor &cursorStop = wxNullCursor); + + ~wxDropSource(); + + // do it (call this in response to a mouse button press, for example) + // params: if bAllowMove is false, data can be only copied + virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly); + + wxWindow* GetWindow() { return m_window ; } + void SetCurrentDrag( void* drag ) { m_currentDrag = drag ; } + void* GetCurrentDrag() { return m_currentDrag ; } + bool MacInstallDefaultCursor(wxDragResult effect) ; + protected : + + wxWindow *m_window; + void* m_currentDrag ; +}; + +#endif + // D&D + +#endif + //_WX_DND_H_ + diff --git a/include/wx/mac/carbon/filedlg.h b/include/wx/mac/carbon/filedlg.h new file mode 100644 index 0000000000..4cc0387a08 --- /dev/null +++ b/include/wx/mac/carbon/filedlg.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: filedlg.h +// Purpose: wxFileDialog class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_ +#define _WX_FILEDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "filedlg.h" +#endif + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDialog: public wxFileDialogBase +{ +DECLARE_DYNAMIC_CLASS(wxFileDialog) +protected: + wxArrayString m_fileNames; + wxArrayString m_paths; + +public: + wxFileDialog(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = 0, + const wxPoint& pos = wxDefaultPosition); + + virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; } + virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; } + + virtual int ShowModal(); + + // not supported for file dialog, RR + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} +}; + +#endif // _WX_FILEDLG_H_ diff --git a/include/wx/mac/carbon/font.h b/include/wx/mac/carbon/font.h new file mode 100644 index 0000000000..78aa2f4d5f --- /dev/null +++ b/include/wx/mac/carbon/font.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: font.h +// Purpose: wxFont class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "font.h" +#endif + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { Init(); } + wxFont(const wxFont& font) + : wxFontBase() + { + Init(); + Ref(font); + } + + wxFont(int size, + int family, + int style, + int weight, + bool underlined = FALSE, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Init(); + + (void)Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxNativeFontInfo& info) + { + Init(); + + (void)Create(info); + } + + wxFont(const wxString& fontDesc); + + bool Create(int size, + int family, + int style, + int weight, + bool underlined = FALSE, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + bool Create(const wxNativeFontInfo& info); + + virtual ~wxFont(); + + // assignment + wxFont& operator=(const wxFont& font); + + // implement base class pure virtuals + virtual int GetPointSize() const; + virtual int GetFamily() const; + virtual int GetStyle() const; + virtual int GetWeight() const; + virtual bool GetUnderlined() const; + virtual wxString GetFaceName() const; + virtual wxFontEncoding GetEncoding() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + virtual void SetPointSize(int pointSize); + virtual void SetFamily(int family); + virtual void SetStyle(int style); + virtual void SetWeight(int weight); + virtual void SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + // implementation only from now on + // ------------------------------- + + virtual bool RealizeResource(); + + // Unofficial API, don't use + virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; + virtual bool GetNoAntiAliasing() ; + + // Mac-specific, risks to change, don't use in portable code + short GetMacFontNum() const; + short GetMacFontSize() const; + wxByte GetMacFontStyle() const; + wxUint32 GetMacATSUFontID() const; + +protected: + // common part of all ctors + void Init(); + + void Unshare(); + +private: + DECLARE_DYNAMIC_CLASS(wxFont) +}; + +#endif + // _WX_FONT_H_ diff --git a/include/wx/mac/carbon/fontdlg.h b/include/wx/mac/carbon/fontdlg.h new file mode 100644 index 0000000000..3d654b56c8 --- /dev/null +++ b/include/wx/mac/carbon/fontdlg.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: fontdlg.h +// Purpose: wxFontDialog class. Use generic version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTDLG_H_ +#define _WX_FONTDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "fontdlg.h" +#endif + +#include "wx/dialog.h" +#include "wx/cmndata.h" + +/* + * Font dialog + */ + +class WXDLLEXPORT wxFontDialog: public wxDialog +{ +DECLARE_DYNAMIC_CLASS(wxFontDialog) +public: + wxFontDialog(); + wxFontDialog(wxWindow *parent, const wxFontData& data); + + bool Create(wxWindow *parent, const wxFontData& data); + + int ShowModal(); + wxFontData& GetFontData() { return m_fontData; } + +protected: + wxWindow* m_dialogParent; + wxFontData m_fontData; +}; + +#endif + // _WX_FONTDLG_H_ + diff --git a/include/wx/mac/carbon/frame.h b/include/wx/mac/carbon/frame.h new file mode 100644 index 0000000000..f92f7196fc --- /dev/null +++ b/include/wx/mac/carbon/frame.h @@ -0,0 +1,124 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: frame.h +// Purpose: wxFrame class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_ +#define _WX_FRAME_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "frame.h" +#endif + +#include "wx/window.h" +#include "wx/toolbar.h" +#include "wx/accel.h" +#include "wx/icon.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; +WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; + +class WXDLLEXPORT wxMenuBar; +class WXDLLEXPORT wxStatusBar; +class WXDLLEXPORT wxMacToolTip ; + +class WXDLLEXPORT wxFrame: public wxFrameBase +{ +public: + // construction + wxFrame() { Init(); } + 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) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxFrame(); + + // implementation only from now on + // ------------------------------- + + // override some more virtuals + virtual bool Enable(bool enable = TRUE) ; + + // get the origin of the client area (which may be different from (0, 0) + // if the frame has a toolbar) in client coordinates + virtual wxPoint GetClientAreaOrigin() const; + + // event handlers + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Toolbar +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = -1, + const wxString& name = wxToolBarNameStr); + + virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR + + // Status bar +#if wxUSE_STATUSBAR + virtual wxStatusBar* OnCreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP, + wxWindowID id = 0, + const wxString& name = wxStatusLineNameStr); + + virtual void PositionStatusBar(); +#endif // wxUSE_STATUSBAR + + // tooltip management +#if wxUSE_TOOLTIPS + wxMacToolTip* GetToolTipCtrl() const { return m_hwndToolTip; } + void SetToolTipCtrl(wxMacToolTip *tt) { m_hwndToolTip = tt; } + wxMacToolTip* m_hwndToolTip ; +#endif // tooltips + + // called by wxWindow whenever it gets focus + void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } + wxWindow *GetLastFocus() const { return m_winLastFocused; } + +protected: + // common part of all ctors + void Init(); + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + + virtual void DetachMenuBar(); + virtual void AttachMenuBar(wxMenuBar *menubar); + +protected: + // the last focused child: we restore focus to it on activation + wxWindow *m_winLastFocused; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxFrame) +}; + +#endif + // _WX_FRAME_H_ diff --git a/include/wx/mac/carbon/gauge.h b/include/wx/mac/carbon/gauge.h new file mode 100644 index 0000000000..4eb5db3a69 --- /dev/null +++ b/include/wx/mac/carbon/gauge.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gauge.h +// Purpose: wxGauge class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GAUGE_H_ +#define _WX_GAUGE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "gauge.h" +#endif + +#include "wx/control.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr; + +// Group box +class WXDLLEXPORT wxGauge: public wxGaugeBase +{ + DECLARE_DYNAMIC_CLASS(wxGauge) + public: + inline wxGauge() { m_rangeMax = 0; m_gaugePos = 0; } + + inline wxGauge(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr) + { + Create(parent, id, range, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + int range, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxGA_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxGaugeNameStr); + + void SetShadowWidth(int w); + void SetBezelFace(int w); + void SetRange(int r); + void SetValue(int pos); + + int GetShadowWidth() const ; + int GetBezelFace() const ; + int GetRange() const ; + int GetValue() const ; + + virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ; + + protected: + int m_rangeMax; + int m_gaugePos; +}; + +#endif + // _WX_GAUGE_H_ diff --git a/include/wx/mac/carbon/gdiobj.h b/include/wx/mac/carbon/gdiobj.h new file mode 100644 index 0000000000..1ad618bf84 --- /dev/null +++ b/include/wx/mac/carbon/gdiobj.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gdiobj.h +// Purpose: wxGDIObject class: base class for other GDI classes +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GDIOBJ_H_ +#define _WX_GDIOBJ_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "gdiobj.h" +#endif + +#include "wx/object.h" + +class WXDLLEXPORT wxGDIRefData: public wxObjectRefData { +public: + inline wxGDIRefData() + { + } +}; + +#define M_GDIDATA ((wxGDIRefData *)m_refData) + +class WXDLLEXPORT wxGDIObject: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxGDIObject) + public: + wxGDIObject() : m_visible(FALSE) { } + ~wxGDIObject() { } + + bool IsNull() const { return (m_refData == 0); } + + virtual bool GetVisible() { 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 + // _WX_GDIOBJ_H_ diff --git a/include/wx/mac/carbon/glcanvas.h b/include/wx/mac/carbon/glcanvas.h new file mode 100644 index 0000000000..6f044609c3 --- /dev/null +++ b/include/wx/mac/carbon/glcanvas.h @@ -0,0 +1,134 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Macintosh +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +# pragma interface "glcanvas.h" +#endif + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/setup.h" + +#if wxUSE_GLCANVAS + +#include "wx/palette.h" +#include "wx/scrolwin.h" +#include "wx/app.h" + +#ifdef __DARWIN__ +# include +# include +#else +# include +# include +#endif + +//--------------------------------------------------------------------------- +// Constants for attriblist +//--------------------------------------------------------------------------- + +enum +{ + WX_GL_RGBA=1, /* use true color palette */ + WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */ + WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */ + WX_GL_DOUBLEBUFFER, /* use doublebuffer */ + WX_GL_STEREO, /* use stereoscopic display */ + WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */ + WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */ + WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */ + WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */ + WX_GL_MIN_ALPHA, /* use blue buffer with most bits (> MIN_ALPHA bits) */ + WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */ + WX_GL_STENCIL_SIZE, /* bits for stencil buffer */ + WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */ + WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */ + WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */ + WX_GL_MIN_ACCUM_ALPHA /* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */ +}; + +class WXDLLEXPORT wxGLCanvas; /* forward reference */ + +class WXDLLEXPORT wxGLContext: public wxObject +{ +public: + wxGLContext(AGLPixelFormat fmt, wxGLCanvas *win, + const wxPalette& WXUNUSED(palette), + const wxGLContext *other /* for sharing display lists */ + ); + ~wxGLContext(); + + void SetCurrent(); + void Update(); // must be called after window drag/grows/zoom or clut change + void SetColour(const wxChar *colour); + void SwapBuffers(); + + + inline wxWindow* GetWindow() const { return m_window; } + inline AGLDrawable GetDrawable() const { return m_drawable; } + +public: + AGLContext m_glContext; + AGLDrawable m_drawable; + wxWindow* m_window; +}; + +class WXDLLEXPORT wxGLCanvas: public wxWindow +{ + DECLARE_CLASS(wxGLCanvas) + public: + wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxT("GLCanvas") , int *attribList = 0, const wxPalette& palette = wxNullPalette); + wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL, + wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT("GLCanvas"), + int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette ); + + wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxT("GLCanvas"), int *attribList = 0, const wxPalette& palette = wxNullPalette ); + + ~wxGLCanvas(); + + bool Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id, + const wxPoint& pos, const wxSize& size, long style, const wxString& name, + int *attribList, const wxPalette& palette); + + void SetCurrent(); + void SetColour(const wxChar *colour); + void SwapBuffers(); + void UpdateContext(); + void SetViewport(); + virtual bool Show(bool show = TRUE) ; + + // Unlike some other platforms, this must get called if you override it. + // It sets the viewport correctly and update the context. + // You shouldn't call glViewport yourself either (use SetViewport if you must reset it.) + void OnSize(wxSizeEvent& event); + + virtual void MacSuperChangedPosition() ; + virtual void MacTopLevelWindowChangedPosition() ; + virtual void MacSuperShown( bool show ) ; + + void MacUpdateView() ; + + inline wxGLContext* GetContext() const { return m_glContext; } + +protected: + wxGLContext* m_glContext; + bool m_macCanvasIsShown ; +DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_GLCANVAS +#endif // _WX_GLCANVAS_H_ diff --git a/include/wx/mac/carbon/gsockmac.h b/include/wx/mac/carbon/gsockmac.h new file mode 100644 index 0000000000..6bb4a2aa71 --- /dev/null +++ b/include/wx/mac/carbon/gsockmac.h @@ -0,0 +1,93 @@ +/* ------------------------------------------------------------------------- + * Project: GSocket (Generic Socket) for WX + * Name: gsockunx.h + * Purpose: GSocket Macintosh header + * CVSID: $Id$ + * ------------------------------------------------------------------------- + */ + +#ifndef __GSOCK_UNX_H +#define __GSOCK_UNX_H + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/setup.h" +#endif + +#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) + +#ifndef __GSOCKET_STANDALONE__ +#include "wx/gsocket.h" +#else +#include "gsocket.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef GSocket* GSocketPtr ; + +/* Definition of GSocket */ +struct _GSocket +{ + wxMacNotifierTableRef m_mac_events ; + EndpointRef m_endpoint; + GAddress *m_local; + GAddress *m_peer; + GSocketError m_error; + + int m_non_blocking; + int m_server; + int m_stream; + int m_oriented; + unsigned long m_timeout; + + /* Callbacks */ + GSocketEventFlags m_detected; + GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; + char *m_data[GSOCK_MAX_EVENT]; + int m_takesEvents ; +}; + +/* Definition of GAddress */ + +struct _GAddress +{ + UInt32 m_host ; + UInt16 m_port ; + GAddressType m_family; + GSocketError m_error; +}; + +/* Input / Output */ + +GSocketError _GSocket_Input_Timeout(GSocket *socket); +GSocketError _GSocket_Output_Timeout(GSocket *socket); +int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size); +int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size); +int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size); +int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size); + +/* Callbacks */ + +void _GSocket_Enable_Events(GSocket *socket); +void _GSocket_Disable_Events(GSocket *socket); +void _GSocket_Internal_Proc(unsigned long e , void* data ) ; + +/* GAddress */ + +GSocketError _GAddress_translate_from(GAddress *address, + InetAddress *addr ); +GSocketError _GAddress_translate_to(GAddress *address, + InetAddress *addr); + +GSocketError _GAddress_Init_INET(GAddress *address); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + +#endif /* __GSOCK_UNX_H */ diff --git a/include/wx/mac/carbon/helpxxxx.h b/include/wx/mac/carbon/helpxxxx.h new file mode 100644 index 0000000000..a33c0737a5 --- /dev/null +++ b/include/wx/mac/carbon/helpxxxx.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: helpxxxx.h +// Purpose: Help system: native implementation for your system. Replace +// XXXX with suitable name. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELPXXXX_H_ +#define _WX_HELPXXXX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "helpxxxx.h" +#endif + +#include "wx/wx.h" + +#include "wx/helpbase.h" + +class WXDLLEXPORT wxXXXXHelpController: public wxHelpControllerBase +{ + DECLARE_CLASS(wxXXXXHelpController) + + public: + wxXXXXHelpController(); + ~wxXXXXHelpController(); + + // Must call this to set the filename and server name + virtual bool Initialize(const wxString& file); + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = ""); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplayBlock(long blockNo); + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + + virtual bool Quit(); + virtual void OnQuit(); + + inline wxString GetHelpFile() const { return m_helpFile; } + +protected: + wxString m_helpFile; +}; + +#endif + // _WX_HELPXXXX_H_ diff --git a/include/wx/mac/carbon/icon.h b/include/wx/mac/carbon/icon.h new file mode 100644 index 0000000000..bdc0ff755f --- /dev/null +++ b/include/wx/mac/carbon/icon.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: icon.h +// Purpose: wxIcon class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_ +#define _WX_ICON_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "icon.h" +#endif + +#include "wx/bitmap.h" + +// Icon +class WXDLLEXPORT wxIcon: public wxBitmap +{ +public: + wxIcon(); + + // Copy constructors + wxIcon(const wxIcon& icon) + : wxBitmap() + { Ref(icon); } + + wxIcon(const char **data); + wxIcon(char **data); + wxIcon(const char bits[], int width , int height ); + wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, + int desiredWidth = -1, int desiredHeight = -1); + wxIcon(const wxIconLocation& loc) + { + LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); + } + ~wxIcon(); + + bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , + int desiredWidth /* = -1 */ , int desiredHeight = -1); + bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) + { return LoadFile( name , flags , -1 , -1 ) ; } + + wxIcon& operator=(const wxIcon& icon) + { if (this != &icon) Ref(icon); return *this; } + bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } + bool operator!=(const wxIcon& icon) const { return !(*this == icon); } + + // create from bitmap (which should have a mask unless it's monochrome): + // there shouldn't be any implicit bitmap -> icon conversion (i.e. no + // ctors, assignment operators...), but it's ok to have such function + void CopyFromBitmap(const wxBitmap& bmp); + + DECLARE_DYNAMIC_CLASS(wxIcon) +}; + +/* +class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler +{ + DECLARE_DYNAMIC_CLASS(wxICONFileHandler) +public: + inline wxICONFileHandler() + { + m_name = "ICO icon file"; + m_extension = "ico"; + m_type = wxBITMAP_TYPE_ICO; + }; + + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth = -1, int desiredHeight = -1); +}; +*/ + +class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler +{ + DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) +public: + inline wxICONResourceHandler() + { + m_name = wxT("ICON resource"); + m_extension = wxEmptyString; + m_type = wxBITMAP_TYPE_ICON_RESOURCE; + }; + + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth = -1, int desiredHeight = -1); + +}; + +#endif + // _WX_ICON_H_ diff --git a/include/wx/mac/carbon/imaglist.h b/include/wx/mac/carbon/imaglist.h new file mode 100644 index 0000000000..e8fbf6e713 --- /dev/null +++ b/include/wx/mac/carbon/imaglist.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: imaglist.h +// Purpose: wxImageList class. Note: if your GUI doesn't have +// an image list equivalent, you can use the generic class +// in src/generic. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_ +#define _WX_IMAGLIST_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "imaglist.h" +#endif + +#include "wx/bitmap.h" + +/* + * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to + * images for their items by an index into an image list. + * A wxImageList is capable of creating images with optional masks from + * a variety of sources - a single bitmap plus a colour to indicate the mask, + * two bitmaps, or an icon. + * + */ + +// Flags for Draw +#define wxIMAGELIST_DRAW_NORMAL 0x0001 +#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 +#define wxIMAGELIST_DRAW_SELECTED 0x0004 +#define wxIMAGELIST_DRAW_FOCUSED 0x0008 + +// Flag values for Set/GetImageList +enum { + wxIMAGE_LIST_NORMAL, // Normal icons + wxIMAGE_LIST_SMALL, // Small icons + wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) +}; + +// Eventually we'll make this a reference-counted wxGDIObject. For +// now, the app must take care of ownership issues. That is, the +// image lists must be explicitly deleted after the control(s) that uses them +// is (are) deleted, or when the app exits. +class WXDLLEXPORT wxImageList: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxImageList) + public: + /* + * Public interface + */ + + wxImageList(); + + // Creates an image list. + // Specify the width and height of the images in the list, + // whether there are masks associated with them (e.g. if creating images + // from icons), and the initial size of the list. + inline wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1) + { + Create(width, height, mask, initialCount); + } + ~wxImageList(); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Returns the number of images in the image list. + int GetImageCount() const; + + bool GetSize(int index, int&width, int &height) const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Creates an image list + // width, height specify the size of the images in the list (all the same). + // mask specifies whether the images have masks or not. + // initialNumber is the initial number of images to reserve. + bool Create(int width, int height, bool mask = TRUE, int initialNumber = 1); + + // Adds a bitmap, and optionally a mask bitmap. + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Add. + int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + + // Adds a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' after calling Add. + int Add(const wxBitmap& bitmap, const wxColour& maskColour); + + // Adds a bitmap and mask from an icon. + int Add(const wxIcon& icon); + + // Replaces a bitmap, optionally passing a mask bitmap. + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Replace. + bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + +/* Not supported by Win95 + // Replacing a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap'. + bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour); +*/ + + // Replaces a bitmap and mask from an icon. + // You can delete 'icon' after calling Replace. + bool Replace(int index, const wxIcon& icon); + + // Removes the image at the given index. + bool Remove(int index); + + // Remove all images + bool RemoveAll(); + + // Draws the given image on a dc at the specified position. + // If 'solidBackground' is TRUE, Draw sets the image list background + // colour to the background colour of the wxDC, to speed up + // drawing by eliminating masked drawing where possible. + bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE); + +/* TODO (optional?) + wxIcon *MakeIcon(int index); +*/ + +/* TODO + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Returns the native image list handle + inline WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +protected: + WXHIMAGELIST m_hImageList; +*/ + +}; + +#endif + // _WX_IMAGLIST_H_ diff --git a/include/wx/mac/carbon/joystick.h b/include/wx/mac/carbon/joystick.h new file mode 100644 index 0000000000..6db596e3b3 --- /dev/null +++ b/include/wx/mac/carbon/joystick.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.h +// Purpose: wxJoystick class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "joystick.h" +#endif + +#include "wx/event.h" + +class WXDLLEXPORT wxJoystick: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; }; + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetZPosition() const; + int GetButtonState() const; + int GetPOVPosition() const; + int GetPOVCTSPosition() const; + int GetRudderPosition() const; + int GetUPosition() const; + int GetVPosition() const; + int GetMovementThreshold() const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + bool IsOk() const; // Checks that the joystick is functioning + int GetNumberJoysticks() const ; + int GetManufacturerId() const ; + int GetProductId() const ; + wxString GetProductName() const ; + int GetXMin() const; + int GetYMin() const; + int GetZMin() const; + int GetXMax() const; + int GetYMax() const; + int GetZMax() const; + int GetNumberButtons() const; + int GetNumberAxes() const; + int GetMaxButtons() const; + int GetMaxAxes() const; + int GetPollingMin() const; + int GetPollingMax() const; + int GetRudderMin() const; + int GetRudderMax() const; + int GetUMin() const; + int GetUMax() const; + int GetVMin() const; + int GetVMax() const; + + bool HasRudder() const; + bool HasZ() const; + bool HasU() const; + bool HasV() const; + bool HasPOV() const; + bool HasPOV4Dir() const; + bool HasPOVCTS() 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(); + +protected: + int m_joystick; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/include/wx/mac/carbon/listbox.h b/include/wx/mac/carbon/listbox.h new file mode 100644 index 0000000000..77c0f27209 --- /dev/null +++ b/include/wx/mac/carbon/listbox.h @@ -0,0 +1,181 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: listbox.h +// Purpose: wxListBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_LISTBOX_H_ +#define _WX_LISTBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "listbox.h" +#endif + +// ---------------------------------------------------------------------------- +// simple types +// ---------------------------------------------------------------------------- +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +#if wxUSE_OWNER_DRAWN + class WXDLLEXPORT wxOwnerDrawn; + + // define the array of list box items + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray); +#endif // wxUSE_OWNER_DRAWN + +// forward decl for GetSelections() +class wxArrayInt; + +// List box item + +WX_DEFINE_ARRAY( char * , wxListDataArray ) ; + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + virtual ~wxListBox(); + virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); + + // implement base class pure virtuals + virtual void Clear(); + virtual void Delete(int n); + + virtual int GetCount() const; + virtual wxString GetString(int n) const; + virtual void SetString(int n, const wxString& s); + virtual int FindString(const wxString& s) const; + + virtual bool IsSelected(int n) const; + virtual void SetSelection(int n, bool select = TRUE); + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + + virtual void DoSetFirstItem(int n); + + virtual void DoSetItemClientData(int n, void* clientData); + virtual void* DoGetItemClientData(int n) const; + virtual void DoSetItemClientObject(int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(int n) const; + virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ; + + // wxCheckListBox support +#if wxUSE_OWNER_DRAWN + // plug-in for derived classes + virtual wxOwnerDrawn *CreateItem(size_t n); + + // allows to get the item and use SetXXX functions to set it's appearance + wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } + + // get the index of the given item + int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } +#endif // wxUSE_OWNER_DRAWN + + // Windows callbacks + + virtual void SetupColours(); + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + virtual bool MacCanFocus() const { return true ; } + void OnChar(wxKeyEvent& event); + + void* m_macList ; + wxArrayString m_stringArray ; + wxListDataArray m_dataArray ; + wxArrayInt m_selectionPreImage ; + void MacSetRedraw( bool doDraw ) ; +protected: + void MacDestroy() ; + void MacDelete( int n ) ; + void MacInsert( int n , const wxString& item) ; + void MacAppend( const wxString& item) ; + void MacSet( int n , const wxString& item ) ; + void MacClear() ; + void MacSetSelection( int n , bool select ) ; + int MacGetSelection() const ; + int MacGetSelections(wxArrayInt& aSelections) const ; + bool MacIsSelected( int n ) const ; + void MacScrollTo( int n ) ; + void OnSize( wxSizeEvent &size ) ; + void MacDoClick() ; + void MacDoDoubleClick() ; + + // do we have multiple selections? + bool HasMultipleSelection() const; + + // free memory (common part of Clear() and dtor) + // prevent collision with some BSD definitions of macro Free() + void FreeData(); + + int m_noItems; + int m_selected; + wxString m_typeIn ; + long m_lastTypeIn ; + + virtual wxSize DoGetBestSize() const; + +#if wxUSE_OWNER_DRAWN + // control items + wxListBoxItemsArray m_aItems; +#endif + +private: + DECLARE_DYNAMIC_CLASS(wxListBox) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_LISTBOX_H_ diff --git a/include/wx/mac/carbon/listctrl.h b/include/wx/mac/carbon/listctrl.h new file mode 100644 index 0000000000..196f97add1 --- /dev/null +++ b/include/wx/mac/carbon/listctrl.h @@ -0,0 +1,451 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: listctrl.h +// Purpose: wxListCtrl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTCTRL_H_ +#define _WX_LISTCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "listctrl.h" +#endif + +#include "wx/control.h" +#include "wx/event.h" +#include "wx/imaglist.h" + +/* + The wxListCtrl can show lists of items in four different modes: + wxLC_LIST: multicolumn list view, with optional small icons (icons could be + optional for some platforms). Columns are computed automatically, + i.e. you don't set columns as in wxLC_REPORT. In other words, + the list wraps, unlike a wxListBox. + wxLC_REPORT: single or multicolumn report view (with optional header) + wxLC_ICON: large icon view, with optional labels + wxLC_SMALL_ICON: small icon view, with optional labels + + You can change the style dynamically, either with SetSingleStyle or + SetWindowStyleFlag. + + Further window styles: + + wxLC_ALIGN_TOP icons align to the top (default) + wxLC_ALIGN_LEFT icons align to the left + wxLC_AUTOARRANGE icons arrange themselves + wxLC_USER_TEXT the app provides label text on demand, except for column headers + wxLC_EDIT_LABELS labels are editable: app will be notified. + wxLC_NO_HEADER no header in report mode + wxLC_NO_SORT_HEADER can't click on header + wxLC_SINGLE_SEL single selection + wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) + wxLC_SORT_DESCENDING sort descending (ditto) + + Items are referred to by their index (position in the list starting from zero). + + Label text is supplied via insertion/setting functions and is stored by the + control, unless the wxLC_USER_TEXT style has been specified, in which case + the app will be notified when text is required (see sample). + + Images are dealt with by (optionally) associating 3 image lists with the control. + Zero-based indexes into these image lists indicate which image is to be used for + which item. Each image in an image list can contain a mask, and can be made out + of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. + + Notifications are passed via the wxWindows 2.0 event system. + + See the sample wxListCtrl app for API usage. + + */ + +// Mask flags to tell app/GUI what fields of wxListItem are valid +#define wxLIST_MASK_STATE 0x0001 +#define wxLIST_MASK_TEXT 0x0002 +#define wxLIST_MASK_IMAGE 0x0004 +#define wxLIST_MASK_DATA 0x0008 +#define wxLIST_SET_ITEM 0x0010 +#define wxLIST_MASK_WIDTH 0x0020 +#define wxLIST_MASK_FORMAT 0x0040 + +// State flags for indicating the state of an item +#define wxLIST_STATE_DONTCARE 0x0000 +#define wxLIST_STATE_DROPHILITED 0x0001 +#define wxLIST_STATE_FOCUSED 0x0002 +#define wxLIST_STATE_SELECTED 0x0004 +#define wxLIST_STATE_CUT 0x0008 + +// Hit test flags, used in HitTest +#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area. +#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area. +#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. +#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. +#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. +#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. +#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. +#define wxLIST_HITTEST_TOLEFT 0x0400 // To the left of the client area. +#define wxLIST_HITTEST_TORIGHT 0x0800 // To the right of the client area. + +#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL wxLIST_HITTEST_ONITEMSTATEICON) + +// Flags for GetNextItem +enum { + wxLIST_NEXT_ABOVE, // Searches for an item above the specified item + wxLIST_NEXT_ALL, // Searches for subsequent item by index + wxLIST_NEXT_BELOW, // Searches for an item below the specified item + wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item + wxLIST_NEXT_RIGHT, // Searches for an item to the right of the specified item +}; + +// Alignment flags for Arrange +enum { + wxLIST_ALIGN_DEFAULT, + wxLIST_ALIGN_LEFT, + wxLIST_ALIGN_TOP, + wxLIST_ALIGN_SNAP_TO_GRID +}; + +// Column format +enum { + wxLIST_FORMAT_LEFT, + wxLIST_FORMAT_RIGHT, + wxLIST_FORMAT_CENTRE, + wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE +}; + +// Autosize values for SetColumnWidth +enum { + wxLIST_AUTOSIZE = -1, + wxLIST_AUTOSIZE_USEHEADER = -2 +}; + +// Flag values for GetItemRect +enum { + wxLIST_RECT_BOUNDS, + wxLIST_RECT_ICON, + wxLIST_RECT_LABEL +}; + +// Flag values for FindItem +enum { + wxLIST_FIND_UP, + wxLIST_FIND_DOWN, + wxLIST_FIND_LEFT, + wxLIST_FIND_RIGHT +}; + +// wxListItem: data representing an item, or report field. +// It also doubles up to represent entire column information +// when inserting or setting a column. +class WXDLLEXPORT wxListItem: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxListItem) +public: + long m_mask; // Indicates what fields are valid + long m_itemId; // The zero-based item position + int m_col; // Zero-based column, if in report mode + long m_state; // The state of the item + long m_stateMask; // Which flags of m_state are valid (uses same flags) + wxString m_text; // The label/header text + int m_image; // The zero-based index into an image list + long m_data; // App-defined data + + // For columns only + int m_format; // left, right, centre + int m_width; // width of column + + wxListItem(); +}; + +// type of compare function for wxListCtrl sort operation +typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData); + +class WXDLLEXPORT wxListCtrl: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxListCtrl) + public: + /* + * Public interface + */ + + wxListCtrl(); + + inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, + const wxString& name = "listCtrl") + { + Create(parent, id, pos, size, style, validator, name); + } + ~wxListCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl"); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Gets information about this column + bool GetColumn(int col, wxListItem& item) const; + + // Sets information about this column + bool SetColumn(int col, wxListItem& item) ; + + // Gets the column width + int GetColumnWidth(int col) const; + + // Sets the column width + bool SetColumnWidth(int col, int width) ; + + // Gets the number of items that can fit vertically in the + // visible area of the list control (list or report view) + // or the total number of items in the list control (icon + // or small icon view) + int GetCountPerPage() const; + + // Gets the edit control for editing labels. + wxTextCtrl* GetEditControl() const; + + // Gets information about the item + bool GetItem(wxListItem& info) const ; + + // Sets information about the item + bool SetItem(wxListItem& info) ; + + // Sets a string field at a particular column + long SetItem(long index, int col, const wxString& label, int imageId = -1); + + // Gets the item state + int GetItemState(long item, long stateMask) const ; + + // Sets the item state + bool SetItemState(long item, long state, long stateMask) ; + + // Sets the item image + bool SetItemImage(long item, int image, int selImage) ; + + // Gets the item text + wxString GetItemText(long item) const ; + + // Sets the item text + void SetItemText(long item, const wxString& str) ; + + // Gets the item data + long GetItemData(long item) const ; + + // Sets the item data + bool SetItemData(long item, long data) ; + + // Gets the item rectangle + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; + + // Gets the item position + bool GetItemPosition(long item, wxPoint& pos) const ; + + // Sets the item position + bool SetItemPosition(long item, const wxPoint& pos) ; + + // Gets the number of items in the list control + int GetItemCount() const; + + // Gets the number of columns in the list control + int GetColumnCount() const; + + // Retrieves the spacing between icons in pixels. + // If small is TRUE, gets the spacing for the small icon + // view, otherwise the large icon view. + int GetItemSpacing(bool isSmall) const; + + // Gets the number of selected items in the list control + int GetSelectedItemCount() const; + + // Gets the text colour of the listview + wxColour GetTextColour() const; + + // Sets the text colour of the listview + void SetTextColour(const wxColour& col); + + // Gets the index of the topmost visible item when in + // list or report view + long GetTopItem() const ; + + // Add or remove a single window style + void SetSingleStyle(long style, bool add = TRUE) ; + + // Set the whole window style + void SetWindowStyleFlag(long style) ; + + // Searches for an item, starting from 'item'. + // item can be -1 to find the first item that matches the + // specified flags. + // Returns the item or -1 if unsuccessful. + long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; + + // Implementation: converts wxWindows style to MSW style. + // Can be a single style flag or a bit list. + // oldStyle is 'normalised' so that it doesn't contain + // conflicting styles. + long ConvertToMSWStyle(long& oldStyle, long style) const; + + // Gets one of the three image lists + wxImageList *GetImageList(int which) const ; + + // Sets the image list + // N.B. There's a quirk in the Win95 list view implementation. + // If in wxLC_LIST mode, it'll *still* display images by the labels if + // there's a small-icon image list set for the control - even though you + // haven't specified wxLIST_MASK_IMAGE when inserting. + // So you have to set a NULL small-icon image list to be sure that + // the wxLC_LIST mode works without icons. Of course, you may want icons... + void SetImageList(wxImageList *imageList, int which) ; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Arranges the items + bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); + + // Deletes an item + bool DeleteItem(long item); + + // Deletes all items + bool DeleteAllItems() ; + + // Deletes a column + bool DeleteColumn(int col); + + // Deletes all columns + bool DeleteAllColumns(); + + // Clears items, and columns if there are any. + void ClearAll(); + + // Edit the label + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + // Ensures this item is visible + bool EnsureVisible(long item) ; + + // Find an item whose label matches this string, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, const wxString& str, bool partial = FALSE); + + // Find an item whose data matches this data, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, long data); + + // Find an item nearest this position in the specified direction, starting from + // the item after 'start' or the beginning if 'start' is -1. + long FindItem(long start, const wxPoint& pt, int direction); + + // Determines which item (if any) is at the specified point, + // giving details in 'flags' (see wxLIST_HITTEST_... flags above) + long HitTest(const wxPoint& point, int& flags); + + // Inserts an item, returning the index of the new item if successful, + // -1 otherwise. + // TOD: Should also have some further convenience functions + // which don't require setting a wxListItem object + long InsertItem(wxListItem& info); + + // Insert a string item + long InsertItem(long index, const wxString& label); + + // Insert an image item + long InsertItem(long index, int imageIndex); + + // Insert an image/string item + long InsertItem(long index, const wxString& label, int imageIndex); + + // For list view mode (only), inserts a column. + long InsertColumn(long col, wxListItem& info); + + long InsertColumn(long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT, + int width = -1); + + // Scrolls the list control. If in icon, small icon or report view mode, + // x specifies the number of pixels to scroll. If in list view mode, x + // specifies the number of columns to scroll. + // If in icon, small icon or list view mode, y specifies the number of pixels + // to scroll. If in report view mode, y specifies the number of lines to scroll. + bool ScrollList(int dx, int dy); + + // Sort items. + + // fn is a function which takes 3 long arguments: item1, item2, data. + // item1 is the long data associated with a first item (NOT the index). + // item2 is the long data associated with a second item (NOT the index). + // data is the same value as passed to SortItems. + // The return value is a negative number if the first item should precede the second + // item, a positive number of the second item should precede the first, + // or zero if the two items are equivalent. + + // data is arbitrary data to be passed to the sort function. + bool SortItems(wxListCtrlCompare fn, long data); + +/* Why should we need this function? Leave for now. + * We might need it because item data may have changed, + * but the display needs refreshing (in string callback mode) + // Updates an item. If the list control has the wxLI_AUTO_ARRANGE style, + // the items will be rearranged. + bool Update(long item); +*/ + + void Command(wxCommandEvent& event) { ProcessCommand(event); }; + +protected: + wxTextCtrl* m_textCtrl; // The control used for editing a label + wxImageList * m_imageListNormal; // The image list for normal icons + wxImageList * m_imageListSmall; // The image list for small icons + wxImageList * m_imageListState; // The image list state icons (not implemented yet) + + long m_baseStyle; // Basic Windows style flags, for recreation purposes + wxStringList m_stringPool; // Pool of 3 strings to satisfy Windows callback + // requirements + int m_colCount; // Windows doesn't have GetColumnCount so must + // keep track of inserted/deleted columns + +}; + +class WXDLLEXPORT wxListEvent: public wxCommandEvent +{ + DECLARE_DYNAMIC_CLASS(wxListEvent) + + public: + wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); + + int m_code; + long m_itemIndex; + long m_oldItemIndex; + int m_col; + bool m_cancelled; + wxPoint m_pointDrag; + + wxListItem m_item; +}; + +typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&); + +#define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, +#define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, NULL }, + +#endif + // _WX_LISTCTRL_H_ diff --git a/include/wx/mac/carbon/macnotfy.h b/include/wx/mac/carbon/macnotfy.h new file mode 100644 index 0000000000..ae8a24e6de --- /dev/null +++ b/include/wx/mac/carbon/macnotfy.h @@ -0,0 +1,33 @@ +/* ------------------------------------------------------------------------- + * Project: Mac Notifier Support + * Name: macnotfy.h + * Author: Stefan CSomor + * Purpose: Mac Notifier include file + * CVSID: $Id$ + * ------------------------------------------------------------------------- + */ + +#ifndef MAC_NOTIFYERS +#define MAC_NOTIFYERS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef void (*wxMacNotificationProcPtr)(unsigned long event , void* data ) ; + +typedef void *wxMacNotifierTableRef ; +void wxMacCreateNotifierTable() ; +void wxMacDestroyNotifierTable() ; +wxMacNotifierTableRef wxMacGetNotifierTable() ; +void wxMacAddEvent( wxMacNotifierTableRef table , wxMacNotificationProcPtr handler , unsigned long event , void* data , short wakeUp ) ; +void wxMacWakeUp() ; +void wxMacProcessNotifierEvents() ; +void wxMacProcessNotifierAndPendingEvents() ; +void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data ) ; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* MAC_NOTIFYERS */ \ No newline at end of file diff --git a/include/wx/mac/carbon/macsock.h b/include/wx/mac/carbon/macsock.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/include/wx/mac/carbon/mdi.h b/include/wx/mac/carbon/mdi.h new file mode 100644 index 0000000000..1114ee525d --- /dev/null +++ b/include/wx/mac/carbon/mdi.h @@ -0,0 +1,180 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: mdi.h +// Purpose: MDI (Multiple Document Interface) classes. +// This doesn't have to be implemented just like Windows, +// it could be a tabbed design as in wxGTK. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDI_H_ +#define _WX_MDI_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "mdi.h" +#endif + +#include "wx/frame.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; +WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr; + +class WXDLLEXPORT wxMDIClientWindow; +class WXDLLEXPORT wxMDIChildFrame; + +class WXDLLEXPORT wxMDIParentFrame: public wxFrame +{ + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + +public: + + wxMDIParentFrame(); + inline wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + ~wxMDIParentFrame(); + + 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); + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating); + + // wxWindows activate event + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void SetMenuBar(wxMenuBar *menu_bar); + + // Get the active MDI child window (Windows only) + wxMDIChildFrame *GetActiveChild() const ; + + // Get the client window + inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }; + + // Create the client window class (don't Create the window, + // just return a new class) + virtual wxMDIClientWindow *OnCreateClient() ; + + // MDI operations + virtual void Cascade(); + virtual void Tile(); + virtual void ArrangeIcons(); + virtual void ActivateNext(); + virtual void ActivatePrevious(); + +protected: + + // TODO maybe have this member + wxMDIClientWindow *m_clientWindow; + wxMDIChildFrame * m_currentChild; + wxMenu* m_windowMenu; + + // TRUE if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + +private: + friend class WXDLLEXPORT wxMDIChildFrame; +DECLARE_EVENT_TABLE() +}; + +class WXDLLEXPORT wxMDIChildFrame: public wxFrame +{ +DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) +public: + + wxMDIChildFrame(); + inline 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) + { + Init() ; + Create(parent, id, title, pos, size, style, name); + } + + ~wxMDIChildFrame(); + + 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); + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating); + + // Set menu bar + void SetMenuBar(wxMenuBar *menu_bar); + + // MDI operations + virtual void Maximize(); + virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame + virtual void Restore(); + virtual void Activate(); +protected: + + // common part of all ctors + void Init(); +}; + +/* The client window is a child of the parent MDI frame, and itself + * contains the child MDI frames. + * However, you create the MDI children as children of the MDI parent: + * only in the implementation does the client window become the parent + * of the children. Phew! So the children are sort of 'adopted'... + */ + +class WXDLLEXPORT wxMDIClientWindow: public wxWindow +{ + DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) + public: + + wxMDIClientWindow() ; + inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + CreateClient(parent, style); + } + + ~wxMDIClientWindow(); + + // Note: this is virtual, to allow overridden behaviour. + virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); + + // Gets the size available for subwindows after menu size, toolbar size + // and status bar size have been subtracted. If you want to manage your own + // toolbar(s), don't call SetToolBar. + void DoGetClientSize(int *width, int *height) const; + + // Explicitly call default scroll behaviour + void OnScroll(wxScrollEvent& event); + +protected: + +DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_MDI_H_ diff --git a/include/wx/mac/carbon/menu.h b/include/wx/mac/carbon/menu.h new file mode 100644 index 0000000000..854a70d107 --- /dev/null +++ b/include/wx/mac/carbon/menu.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: menu.h +// Purpose: wxMenu, wxMenuBar classes +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_ +#define _WX_MENU_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "menu.h" +#endif + +class WXDLLEXPORT wxFrame; + +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + // implement base class virtuals + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + virtual void Attach(wxMenuBarBase *menubar) ; + + virtual void Break(); + + virtual void SetTitle(const wxString& title); + + // MSW-specific + bool ProcessCommand(wxCommandEvent& event); + + // implementation only from now on + // ------------------------------- + + int MacGetIndexFromId( int id ) ; + int MacGetIndexFromItem( wxMenuItem *pItem ) ; + void MacEnableMenu( bool bDoEnable ) ; + // MacOS needs to know about submenus somewhere within this menu + // before it can be displayed , also hide special menu items like preferences + // that are handled by the OS + void MacBeforeDisplay( bool isSubMenu ) ; + // undo all changes from the MacBeforeDisplay call + void MacAfterDisplay( bool isSubMenu ) ; + + // semi-private accessors + // get the window which contains this menu + wxWindow *GetWindow() const; + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + + short MacGetMenuId() { return m_macMenuId ; } + +private: + // common part of all ctors + void Init(); + + // common part of Append/Insert (behaves as Append is pos == (size_t)-1) + bool DoInsertOrAppend(wxMenuItem *item, size_t pos = (size_t)-1); + + // terminate the current radio group, if any + void EndRadioGroup(); + + // if TRUE, insert a breal before appending the next item + bool m_doBreak; + + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + + // the menu handle of this menu + WXHMENU m_hMenu; + + short m_macMenuId; + + static short s_macNextMenuId ; + + DECLARE_DYNAMIC_CLASS(wxMenu) +}; + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuBar : public wxMenuBarBase +{ +public: + // ctors & dtor + // default constructor + wxMenuBar(); + // unused under MSW + wxMenuBar(long style); + // menubar takes ownership of the menus arrays but copies the titles + wxMenuBar(int n, wxMenu *menus[], const wxString titles[]); + virtual ~wxMenuBar(); + + // menubar construction + virtual bool Append( wxMenu *menu, const wxString &title ); + virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title); + virtual wxMenu *Remove(size_t pos); + + virtual int FindMenuItem(const wxString& menuString, + const wxString& itemString) const; + virtual wxMenuItem* FindItem( int id, wxMenu **menu = NULL ) const; + + virtual void EnableTop( size_t pos, bool flag ); + virtual void SetLabelTop( size_t pos, const wxString& label ); + virtual wxString GetLabelTop( size_t pos ) const; + + // implementation from now on + WXHMENU Create(); + int FindMenu(const wxString& title); + void Detach(); + + // returns TRUE if we're attached to a frame + bool IsAttached() const { return m_menuBarFrame != NULL; } + // get the frame we live in + wxFrame *GetFrame() const { return m_menuBarFrame; } + // attach to a frame + void Attach(wxFrame *frame); + + // clear the invoking window for all menus and submenus + void UnsetInvokingWindow() ; + + // set the invoking window for all menus and submenus + void SetInvokingWindow( wxFrame* frame ) ; + + // if the menubar is modified, the display is not updated automatically, + // call this function to update it (m_menuBarFrame should be !NULL) + void Refresh(bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL); + + void MacInstallMenuBar() ; + static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } + static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; } + static wxMenuBar* MacGetCommonMenuBar() { return s_macCommonMenuBar; } + +protected: + // common part of all ctors + void Init(); + wxWindow *m_invokingWindow; + + wxArrayString m_titles; + +private: + static wxMenuBar* s_macInstalledMenuBar ; + static wxMenuBar* s_macCommonMenuBar ; + + DECLARE_DYNAMIC_CLASS(wxMenuBar) +}; + +#endif // _WX_MENU_H_ diff --git a/include/wx/mac/carbon/menuitem.h b/include/wx/mac/carbon/menuitem.h new file mode 100644 index 0000000000..7e78a57f63 --- /dev/null +++ b/include/wx/mac/carbon/menuitem.h @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: menuitem.h +// Purpose: wxMenuItem class +// Author: Vadim Zeitlin +// Modified by: +// Created: 11.11.97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MENUITEM_H +#define _MENUITEM_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "menuitem.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/setup.h" + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- +class WXDLLEXPORT wxMenuItem: public wxMenuItemBase +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = (wxMenu *)NULL); + virtual ~wxMenuItem(); + + // override base class virtuals + virtual void SetText(const wxString& strName); + + virtual void Enable(bool bDoEnable = TRUE); + virtual void Check(bool bDoCheck = TRUE); + + virtual void SetBitmap(const wxBitmap& bitmap) ; + virtual const wxBitmap& GetBitmap() const { return m_bitmap; } + + // update the os specific representation + void UpdateItemBitmap() ; + void UpdateItemText() ; + void UpdateItemStatus() ; + + // mark item as belonging to the given radio group + void SetAsRadioGroupStart(); + void SetRadioGroupStart(int start); + void SetRadioGroupEnd(int end); + +private: + void UncheckRadio() ; + + // the positions of the first and last items of the radio group this item + // belongs to or -1: start is the radio group start and is valid for all + // but first radio group items (m_isRadioGroupStart == FALSE), end is valid + // only for the first one + union + { + int start; + int end; + } m_radioGroup; + + // does this item start a radio group? + bool m_isRadioGroupStart; + + wxBitmap m_bitmap; // Bitmap for menuitem, if any + void* m_menu ; // the appropriate menu , may also be a system menu + + DECLARE_DYNAMIC_CLASS(wxMenuItem) +}; + +#endif //_MENUITEM_H diff --git a/include/wx/mac/carbon/metafile.h b/include/wx/mac/carbon/metafile.h new file mode 100644 index 0000000000..2b528efeca --- /dev/null +++ b/include/wx/mac/carbon/metafile.h @@ -0,0 +1,166 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: metafile.h +// Purpose: wxMetaFile, wxMetaFileDC classes. +// This probably should be restricted to Windows platforms, +// but if there is an equivalent on your platform, great. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + +#ifndef _WX_METAFIILE_H_ +#define _WX_METAFIILE_H_ + +#if wxUSE_METAFILE +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DATAOBJ +#include "wx/dataobj.h" +#endif + +/* + * Metafile and metafile device context classes + * + */ + +#define wxMetaFile wxMetafile +#define wxMetaFileDC wxMetafileDC + +class WXDLLEXPORT wxMetafile; + +class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData +{ + friend class WXDLLEXPORT wxMetafile; +public: + wxMetafileRefData(void); + ~wxMetafileRefData(void); + +public: + WXHMETAFILE m_metafile; +}; + +#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) + +class WXDLLEXPORT wxMetafile: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxMetafile) +public: + // Copy constructor + wxMetafile(const wxMetafile& metafile) + : wxGDIObject() + { Ref(metafile); } + + wxMetafile(const wxString& file = wxEmptyString); + ~wxMetafile(void); + + // After this is called, the metafile cannot be used for anything + // since it is now owned by the clipboard. + virtual bool SetClipboard(int width = 0, int height = 0); + + virtual bool Play(wxDC *dc); + inline bool Ok(void) const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; + + wxSize GetSize() const; + int GetWidth() const { return GetSize().x; } + int GetHeight() const { return GetSize().y; } + + // Implementation + inline WXHMETAFILE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; } + void SetHMETAFILE(WXHMETAFILE mf) ; + + // Operators + inline wxMetafile& operator = (const wxMetafile& metafile) { if (*this == metafile) return (*this); Ref(metafile); return *this; } + inline bool operator == (const wxMetafile& metafile) { return m_refData == metafile.m_refData; } + inline bool operator != (const wxMetafile& metafile) { return m_refData != metafile.m_refData; } + +protected: +}; + +class WXDLLEXPORT wxMetafileDC: public wxDC +{ + DECLARE_DYNAMIC_CLASS(wxMetafileDC) + + public: + // the ctor parameters specify the filename (empty for memory metafiles), + // the metafile picture size and the optional description/comment + wxMetafileDC(const wxString& filename = wxEmptyString, + int width = 0, int height = 0, + const wxString& description = wxEmptyString); + + ~wxMetafileDC(void); + + // Should be called at end of drawing + virtual wxMetafile *Close(void); + virtual void DoGetSize(int *width, int *height) const ; + + // Implementation + inline wxMetafile *GetMetaFile(void) const { return m_metaFile; } + inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + +protected: + wxMetafile* m_metaFile; +}; + +/* + * Pass filename of existing non-placeable metafile, and bounding box. + * Adds a placeable metafile header, sets the mapping mode to anisotropic, + * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode. + * + */ + +// No origin or extent +#define wxMakeMetaFilePlaceable wxMakeMetafilePlaceable +bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); + +// Optional origin and extent +bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE); + +// ---------------------------------------------------------------------------- +// wxMetafileDataObject is a specialization of wxDataObject for metafile data +// ---------------------------------------------------------------------------- + +#if wxUSE_DATAOBJ +class WXDLLEXPORT wxMetafileDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxMetafileDataObject() + : wxDataObjectSimple(wxDF_METAFILE) { }; + wxMetafileDataObject(const wxMetafile& metafile) + : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxMetafile& metafile) + { m_metafile = metafile; } + virtual wxMetafile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + + virtual size_t GetDataSize(const wxDataFormat& WXUNUSED(format)) const + { return GetDataSize(); } + virtual bool GetDataHere(const wxDataFormat& WXUNUSED(format), + void *buf) const + { return GetDataHere(buf); } + virtual bool SetData(const wxDataFormat& WXUNUSED(format), + size_t len, const void *buf) + { return SetData(len, buf); } +protected: + wxMetafile m_metafile; +}; +#endif + +#endif // wxUSE_METAFILE + + +#endif + // _WX_METAFIILE_H_ diff --git a/include/wx/mac/carbon/mimetype.h b/include/wx/mac/carbon/mimetype.h new file mode 100644 index 0000000000..a65acd964c --- /dev/null +++ b/include/wx/mac/carbon/mimetype.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "mimetype.h" +#endif + +#include "wx/defs.h" +#include "wx/mimetype.h" + + +class wxMimeTypesManagerImpl +{ +public : + wxMimeTypesManagerImpl() { } +#ifdef __DARWIN__ + ~wxMimeTypesManagerImpl() { } +#endif + + // load all data into memory - done when it is needed for the first time + void Initialize(int mailcapStyles = wxMAILCAP_STANDARD, + const wxString& extraDir = wxEmptyString); + + // and delete the data here + void ClearData(); + + // implement containing class functions + wxFileType *GetFileTypeFromExtension(const wxString& ext); + wxFileType *GetOrAllocateFileTypeFromExtension(const wxString& ext) ; + wxFileType *GetFileTypeFromMimeType(const wxString& mimeType); + + size_t EnumAllFileTypes(wxArrayString& mimetypes); + + // this are NOPs under MacOS + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = TRUE) { return TRUE; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) { return TRUE; } + + void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } + + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + // remove association + bool Unassociate(wxFileType *ft); + + // create a new filetype with the given name and extension + wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); + +private: + wxArrayFileTypeInfo m_fallbacks; +}; + +class wxFileTypeImpl +{ +public: + // initialization functions + // this is used to construct a list of mimetypes which match; + // if built with GetFileTypeFromMimetype index 0 has the exact match and + // index 1 the type / * match + // if built with GetFileTypeFromExtension, index 0 has the mimetype for + // the first extension found, index 1 for the second and so on + + void Init(wxMimeTypesManagerImpl *manager, size_t index) + { m_manager = manager; m_index.Add(index); } + + // initialize us with our file type name + void SetFileType(const wxString& strFileType) + { m_strFileType = strFileType; } + void SetExt(const wxString& ext) + { m_ext = ext; } + + // implement accessor functions + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + bool GetDescription(wxString *desc) const; + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters&) const + { return GetCommand(openCmd, "open"); } + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters&) const + { return GetCommand(printCmd, "print"); } + + size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, + const wxFileType::MessageParameters& params) const; + + // remove the record for this file type + // probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead + bool Unassociate(wxFileType *ft) + { + return m_manager->Unassociate(ft); + } + + // set an arbitrary command, ask confirmation if it already exists and + // overwriteprompt is TRUE + bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); + bool SetDefaultIcon(const wxString& strIcon = wxEmptyString, int index = 0); + + private: + // helper function + bool GetCommand(wxString *command, const char *verb) const; + + wxMimeTypesManagerImpl *m_manager; + wxArrayInt m_index; // in the wxMimeTypesManagerImpl arrays + wxString m_strFileType, m_ext; +}; + +#endif + //_MIMETYPE_H + +/* vi: set cin tw=80 ts=4 sw=4: */ diff --git a/include/wx/mac/carbon/minifram.h b/include/wx/mac/carbon/minifram.h new file mode 100644 index 0000000000..7f43f953b3 --- /dev/null +++ b/include/wx/mac/carbon/minifram.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: minifram.h +// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars. +// If there is no equivalent on your platform, just make it a +// normal frame. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "minifram.h" +#endif + +#include "wx/frame.h" + +class WXDLLEXPORT wxMiniFrame: public wxFrame { + + DECLARE_DYNAMIC_CLASS(wxMiniFrame) + +public: + inline wxMiniFrame() {} + inline wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE|wxTINY_CAPTION_HORIZ, + const wxString& name = wxFrameNameStr) + { + // Use wxFrame constructor in absence of more specific code. + Create(parent, id, title, pos, size, style | wxFRAME_TOOL_WINDOW | wxFRAME_FLOAT_ON_PARENT , name); + } + + ~wxMiniFrame() {} +protected: +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/include/wx/mac/carbon/msgdlg.h b/include/wx/mac/carbon/msgdlg.h new file mode 100644 index 0000000000..1a869f0855 --- /dev/null +++ b/include/wx/mac/carbon/msgdlg.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: msgdlg.h +// Purpose: wxMessageDialog class. Use generic version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGBOXDLG_H_ +#define _WX_MSGBOXDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "msgdlg.h" +#endif + +#include "wx/setup.h" +#include "wx/dialog.h" + +/* + * Message box dialog + */ + +WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr; + +class WXDLLEXPORT wxMessageDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxMessageDialog) + +protected: + wxString m_caption; + wxString m_message; + long m_dialogStyle; + wxWindow * m_parent; +public: + wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + + int ShowModal(); + + // not supported for message dialog, RR + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + +}; + +#endif + // _WX_MSGBOXDLG_H_ diff --git a/include/wx/mac/carbon/notebook.h b/include/wx/mac/carbon/notebook.h new file mode 100644 index 0000000000..7f3724805c --- /dev/null +++ b/include/wx/mac/carbon/notebook.h @@ -0,0 +1,157 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: notebook.h +// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) +// Author: Stefan Csomor +// Modified by: +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_NOTEBOOK_H_ +#define _WX_NOTEBOOK_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "notebook.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// fwd declarations +class WXDLLEXPORT wxImageList; +class WXDLLEXPORT wxWindow; + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +// @@@ this class should really derive from wxTabCtrl, but the interface is not +// exactly the same, so I can't do it right now and instead we reimplement +// part of wxTabCtrl here +class wxNotebook : public wxNotebookBase +{ +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 = wxT("notebook")); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxT("notebook")); + // dtor + ~wxNotebook(); + + // accessors + // --------- + // 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(size_t nPage); + // get the currently selected page + int GetSelection() const { return m_nSelection; } + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText); + wxString GetPageText(size_t nPage) const; + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const; + bool SetPageImage(size_t nPage, int nImage); + + // control the appearance of the notebook pages + // set the size (the same for all pages) + virtual void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + virtual void SetPadding(const wxSize& padding); + // sets the size of the tabs (assumes all tabs are the same size) + virtual void SetTabSize(const wxSize& sz); + + // calculate size for wxNotebookSizer + wxSize CalcSizeFromPage(const wxSize& sizePage) const; + wxRect GetPageRect() const ; +/* + // get number of pages in the dialog + int GetPageCount() const; + + // cycle thru the tabs + void AdvanceSelection(bool bForward = TRUE); + + + // currently it's always 1 because wxGTK doesn't support multi-row + // tab controls + int GetRowCount() const; +*/ + // operations + // ---------- + // remove all pages + bool DeleteAllPages(); + // the same as AddPage(), but adds it at the specified position + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = FALSE, + int imageId = -1); +/* + // get the panel which represents the given page + wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; } +*/ + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnSelChange(wxNotebookEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + void OnMouse(wxMouseEvent &event); + + // implementation + // -------------- + +#if wxUSE_CONSTRAINTS + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool DoPhase(int nPhase); + +#endif + + // base class virtuals + // ------------------- + virtual void Command(wxCommandEvent& event); +protected: + virtual wxSize DoGetBestSize() const ; + virtual wxNotebookPage *DoRemovePage(size_t page) ; + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + // common part of all ctors + void Init(); + + // helper functions + void ChangePage(int nOldSel, int nSel); // change pages + void MacSetupTabs(); + + // the icon indices + wxArrayInt m_images; + + int m_nSelection; // the current selection (-1 if none) + + DECLARE_DYNAMIC_CLASS(wxNotebook) + DECLARE_EVENT_TABLE() +}; + + +#endif // _WX_NOTEBOOK_H_ diff --git a/include/wx/mac/carbon/palette.h b/include/wx/mac/carbon/palette.h new file mode 100644 index 0000000000..74f9a4dd30 --- /dev/null +++ b/include/wx/mac/carbon/palette.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palette.h +// Purpose: wxPalette class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "palette.h" +#endif + +#include "wx/colour.h" +#include "wx/gdiobj.h" + +class WXDLLEXPORT wxPalette; + +class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData +{ + DECLARE_NO_COPY_CLASS(wxPaletteRefData) + + friend class WXDLLEXPORT wxPalette; +public: + wxPaletteRefData(); + ~wxPaletteRefData(); +protected: + wxColour* m_palette; + wxInt32 m_count ; +}; + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLEXPORT wxPalette: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxPalette) + +public: + wxPalette(); + wxPalette(const wxPalette& palette) + : wxGDIObject() + { Ref(palette); } + + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + ~wxPalette(); + 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; + + virtual bool Ok() const { return (m_refData != NULL) ; } + + inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; } + inline bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; } + inline bool operator != (const wxPalette& palette) { return m_refData != palette.m_refData; } + +/* TODO: implementation + inline WXHPALETTE GetHPALETTE() const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } + void SetHPALETTE(WXHPALETTE pal); +*/ +}; + +#endif + // _WX_PALETTE_H_ diff --git a/include/wx/mac/carbon/pen.h b/include/wx/mac/carbon/pen.h new file mode 100644 index 0000000000..50afa0d9c4 --- /dev/null +++ b/include/wx/mac/carbon/pen.h @@ -0,0 +1,103 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/pen.h +// Purpose: wxPen class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "pen.h" +#endif + +#include "wx/gdiobj.h" +#include "wx/colour.h" +#include "wx/bitmap.h" + +class WXDLLEXPORT wxPen; + +class WXDLLEXPORT wxPenRefData: public wxGDIRefData +{ + friend class WXDLLEXPORT wxPen; +public: + wxPenRefData(); + wxPenRefData(const wxPenRefData& data); + ~wxPenRefData(); + + wxPenRefData& operator=(const wxPenRefData& data); + +protected: + int m_width; + int m_style; + int m_join ; + int m_cap ; + wxBitmap m_stipple ; + int m_nbDash ; + wxDash * m_dash ; + wxColour m_colour; +/* TODO: implementation + WXHPEN m_hPen; +*/ +}; + +#define M_PENDATA ((wxPenRefData *)m_refData) + +// Pen +class WXDLLEXPORT wxPen: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxPen) +public: + wxPen(); + wxPen(const wxColour& col, int width = 1, int style = wxSOLID); + wxPen(const wxBitmap& stipple, int width); + wxPen(const wxPen& pen) + : wxGDIObject() + { Ref(pen); } + ~wxPen(); + + inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; } + inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; } + inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; } + + virtual bool Ok() const { return (m_refData != NULL) ; } + + // Override in order to recreate the pen + void SetColour(const wxColour& col) ; + void SetColour(unsigned char r, unsigned char g, unsigned char b) ; + + void SetWidth(int width) ; + void SetStyle(int style) ; + void SetStipple(const wxBitmap& stipple) ; + void SetDashes(int nb_dashes, const wxDash *dash) ; + void SetJoin(int join) ; + void SetCap(int cap) ; + + inline wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); }; + inline int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); }; + inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); }; + inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); }; + inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); }; + inline int GetDashes(wxDash **ptr) const { + *ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + } + + inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); }; + +// Implementation + + // Useful helper: create the brush resource + bool RealizeResource(); + + // When setting properties, we must make sure we're not changing + // another object + void Unshare(); +}; + +#endif + // _WX_PEN_H_ diff --git a/include/wx/mac/carbon/pnghand.h b/include/wx/mac/carbon/pnghand.h new file mode 100644 index 0000000000..19271c4705 --- /dev/null +++ b/include/wx/mac/carbon/pnghand.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: pnghand.h +// Purpose: PNG bitmap handler +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "pnghand.h" +#endif + +#ifndef _WX_PNGHAND_H_ +#define _WX_PNGHAND_H_ + +class WXDLLEXPORT wxPNGFileHandler: public wxBitmapHandler +{ + DECLARE_DYNAMIC_CLASS(wxPNGFileHandler) +public: + inline wxPNGFileHandler(void) + { + m_name = wxT("PNG bitmap file"); + m_extension = wxT("bmp"); + m_type = wxBITMAP_TYPE_PNG; + }; + + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); +}; + +#endif + // _WX_PNGHAND_H_ + diff --git a/include/wx/mac/carbon/pngread.h b/include/wx/mac/carbon/pngread.h new file mode 100644 index 0000000000..d1a8b96a5a --- /dev/null +++ b/include/wx/mac/carbon/pngread.h @@ -0,0 +1,290 @@ +/* + * File: pngread.h + * Purpose: PNG file reader + * Author: Alejandro Aguilar Sierra/Julian Smart + * Created: 1995 + * Copyright: (c) 1995, Alejandro Aguilar Sierra + * + * + */ + +#ifndef _WX_PNGREAD__ +#define _WX_PNGREAD__ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "pngread.h" +#endif + +#ifndef byte +typedef unsigned char byte; +#endif + +#define WXIMA_COLORS DIB_PAL_COLORS + +typedef byte * ImagePointerType; + +typedef struct +{ + byte red; + byte green; + byte blue; +} rgb_color_struct; + + +#define COLORTYPE_PALETTE 1 +#define COLORTYPE_COLOR 2 +#define COLORTYPE_ALPHA 4 + +class wxPNGReader +{ +protected: + int filetype; + char filename[255]; + ImagePointerType RawImage; // Image data + + int Width, Height; // Dimensions + int Depth; // (bits x pixel) + int ColorType; // Bit 1 = Palette used + // Bit 2 = Color used + // Bit 3 = Alpha used + + long EfeWidth; // Efective Width + + void *lpbi; + int bgindex; + wxPalette* m_palette; + bool imageOK; +friend class wxPNGReaderIter; +public: + wxPNGReader(void); + wxPNGReader (char* ImageFileName); // Read an image file + virtual ~wxPNGReader (); + + void Create(int width, int height, int deep, int colortype=-1); + + bool ReadFile( char* ImageFileName=0 ); + bool SaveFile( char* ImageFileName=0 ); + bool SaveXPM(char *filename, char *name = 0); + int GetWidth( void ) const { return Width; }; + int GetHeight( void ) const { return Height; }; + int GetDepth( void ) const { return Depth; }; + int GetColorType( void ) const { return ColorType; }; + + int GetIndex(int x, int y); + bool GetRGB(int x, int y, byte* r, byte* g, byte* b); + + bool SetIndex(int x, int y, int index); + bool SetRGB(int x, int y, byte r, byte g, byte b); + + // ColorMap settings + bool SetPalette(wxPalette* colourmap); + bool SetPalette(int n, rgb_color_struct *rgb_struct); + bool SetPalette(int n, byte *r, byte *g=0, byte *b=0); + wxPalette* GetPalette() const { return m_palette; } + + void NullData(); + inline int GetBGIndex(void) { return bgindex; } + + inline bool Inside(int x, int y) + { return (0<=y && yRawImage; + Itx = Ity = 0; + Stepx = Stepy = 0; +} + +inline +wxPNGReaderIter::operator wxPNGReader* () +{ + return ima; +} + +inline +bool wxPNGReaderIter::ItOK () +{ + if (ima) + return ima->Inside(Itx, Ity); + else + return FALSE; +} + + +inline void wxPNGReaderIter::reset() +{ + IterImage = ima->RawImage; + Itx = Ity = 0; +} + +inline void wxPNGReaderIter::upset() +{ + Itx = 0; + Ity = ima->Height-1; + IterImage = ima->RawImage + ima->EfeWidth*(ima->Height-1); +} + +inline bool wxPNGReaderIter::NextRow() +{ + if (++Ity >= ima->Height) return 0; + IterImage += ima->EfeWidth; + return 1; +} + +inline bool wxPNGReaderIter::PrevRow() +{ + if (--Ity < 0) return 0; + IterImage -= ima->EfeWidth; + return 1; +} + +////////////////////////// AD - for interlace /////////////////////////////// +inline void wxPNGReaderIter::SetY(int y) +{ + if ((y < 0) || (y > ima->Height)) return; + Ity = y; + IterImage = ima->RawImage + ima->EfeWidth*y; +} + +///////////////////////////////////////////////////////////////////////////// + +inline void wxPNGReaderIter::SetRow(byte *buf, int n) +{ +// Here should be bcopy or memcpy + //_fmemcpy(IterImage, (void far *)buf, n); + if (n<0) + n = ima->GetWidth(); + + for (int i=0; iEfeWidth) + return 1; + else + if (++Ity < ima->Height) + { + IterImage += ima->EfeWidth; + Itx = 0; + return 1; + } else + return 0; +} + +inline bool wxPNGReaderIter::PrevByte() +{ + if (--Itx >= 0) + return 1; + else + if (--Ity >= 0) + { + IterImage -= ima->EfeWidth; + Itx = 0; + return 1; + } else + return 0; +} + +inline bool wxPNGReaderIter::NextStep() +{ + Itx += Stepx; + if (Itx < ima->EfeWidth) + return 1; + else { + Ity += Stepy; + if (Ity < ima->Height) + { + IterImage += ima->EfeWidth; + Itx = 0; + return 1; + } else + return 0; + } +} + +inline bool wxPNGReaderIter::PrevStep() +{ + Itx -= Stepx; + if (Itx >= 0) + return 1; + else { + Ity -= Stepy; + if (Ity >= 0 && Ity < ima->Height) + { + IterImage -= ima->EfeWidth; + Itx = 0; + return 1; + } else + return 0; + } +} + +#endif + diff --git a/include/wx/mac/carbon/printdlg.h b/include/wx/mac/carbon/printdlg.h new file mode 100644 index 0000000000..6bb45dad2f --- /dev/null +++ b/include/wx/mac/carbon/printdlg.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: printdlg.h +// Purpose: wxPrintDialog, wxPageSetupDialog classes. +// Use generic, PostScript version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_ +#define _WX_PRINTDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "printdlg.h" +#endif + +#include "wx/dialog.h" +#include "wx/cmndata.h" + +/* + * wxPrinterDialog + * The common dialog for printing. + */ + +class WXDLLEXPORT wxDC; +class WXDLLEXPORT wxPrintDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxPrintDialog) + + public: + wxPrintDialog(); + wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow *parent, wxPrintData* data ); + ~wxPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal(); + + wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } + virtual wxDC *GetPrintDC(); + + private: + wxPrintDialogData m_printDialogData; + wxDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; +}; + +class WXDLLEXPORT wxPageSetupDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) + + public: + wxPageSetupDialog(); + wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL); + ~wxPageSetupDialog(); + + bool Create(wxWindow *parent, wxPageSetupData *data = NULL); + virtual int ShowModal(); + + inline wxPageSetupData& GetPageSetupData() { return m_pageSetupData; } + private: + wxPageSetupData m_pageSetupData; + wxWindow* m_dialogParent; +}; + +#endif + // _WX_PRINTDLG_H_ diff --git a/include/wx/mac/carbon/printmac.h b/include/wx/mac/carbon/printmac.h new file mode 100644 index 0000000000..c5eb431026 --- /dev/null +++ b/include/wx/mac/carbon/printmac.h @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: printwin.h +// Purpose: wxWindowsPrinter, wxWindowsPrintPreview classes +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTWIN_H_ +#define _WX_PRINTWIN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "printwin.h" +#endif + +#include "wx/prntbase.h" + +/* + * Represents the printer: manages printing a wxPrintout object + */ + +class WXDLLEXPORT wxMacPrinter: public wxPrinterBase +{ + DECLARE_DYNAMIC_CLASS(wxMacPrinter) + + public: + wxMacPrinter(wxPrintDialogData *data = NULL); + virtual ~wxMacPrinter(); + + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = TRUE); + virtual wxDC* PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); + +}; + +/* + * wxPrintPreview + * Programmer creates an object of this class to preview a wxPrintout. + */ + +class WXDLLEXPORT wxMacPrintPreview: public wxPrintPreviewBase +{ + DECLARE_CLASS(wxMacPrintPreview) + + public: + wxMacPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxMacPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxMacPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); +}; + +#endif + // _WX_PRINTWIN_H_ diff --git a/include/wx/mac/carbon/private.h b/include/wx/mac/carbon/private.h new file mode 100644 index 0000000000..97c0680bcf --- /dev/null +++ b/include/wx/mac/carbon/private.h @@ -0,0 +1,238 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: private.h +// Purpose: Private declarations: as this header is only included by +// wxWindows itself, it may contain identifiers which don't start +// with "wx". +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/defs.h" +#include "wx/app.h" + +#ifdef __DARWIN__ +# include +#else +# include +# include +# include +# include +# include +# include +# include +#endif + +#if UNIVERSAL_INTERFACES_VERSION < 0x0340 + #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/" +#endif + +#if wxUSE_GUI + +#include "wx/window.h" + +class wxMacPortStateHelper +{ + DECLARE_NO_COPY_CLASS(wxMacPortStateHelper) + +public: + wxMacPortStateHelper( GrafPtr newport) ; + wxMacPortStateHelper() ; + ~wxMacPortStateHelper() ; + + void Setup( GrafPtr newport ) ; + void Clear() ; + bool IsCleared() { return m_clip == NULL ; } + GrafPtr GetCurrentPort() { return m_currentPort ; } + +private: + GrafPtr m_currentPort ; + GrafPtr m_oldPort ; + RgnHandle m_clip ; + ThemeDrawingState m_drawingState ; + short m_textFont ; + short m_textSize ; + short m_textStyle ; + short m_textMode ; +} ; + +class WXDLLEXPORT wxMacPortSetter +{ + DECLARE_NO_COPY_CLASS(wxMacPortSetter) + +public: + wxMacPortSetter( const wxDC* dc ) ; + ~wxMacPortSetter() ; +private: + wxMacPortStateHelper m_ph ; + const wxDC* m_dc ; +} ; + +class WXDLLEXPORT wxMacWindowClipper +{ + DECLARE_NO_COPY_CLASS(wxMacWindowClipper) + +public: + wxMacWindowClipper( const wxWindow* win ) ; + ~wxMacWindowClipper() ; +private: + RgnHandle m_formerClip ; + RgnHandle m_newClip ; +} ; + +class wxMacDrawingHelper +{ + DECLARE_NO_COPY_CLASS(wxMacDrawingHelper) + +public: + wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ; + ~wxMacDrawingHelper() ; + bool Ok() { return m_ok ; } + void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; } + void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; } + void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; } + const Point& GetOrigin() { return m_origin ; } +private: + Point m_origin ; + GrafPtr m_formerPort ; + GrafPtr m_currentPort ; + PenState m_savedPenState ; + bool m_ok ; +} ; + +// app.h +bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ; + +#endif // wxUSE_GUI + +// filefn.h +WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ; +WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ; +WXDLLEXPORT void wxMacFilename2FSSpec( const wxChar *path , FSSpec *spec ) ; +# ifndef __DARWIN__ +// Mac file names are POSIX (Unix style) under Darwin, so these are not needed +WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ; +WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ; +WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ; +WXDLLEXPORT wxString wxUnix2MacFilename( const char *s); +# endif + +// utils.h +WXDLLEXPORT wxString wxMacFindFolder(short vRefNum, + OSType folderType, + Boolean createFolder); + +#if wxUSE_GUI + +GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ; +void wxMacDestroyGWorld( GWorldPtr gw ) ; +PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ; +CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ; +void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ; +CTabHandle wxMacCreateColorTable( int numColors ) ; +void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ; + +#define MAC_WXCOLORREF(a) (*((RGBColor*)&(a))) +#define MAC_WXHBITMAP(a) (GWorldPtr(a)) +#define MAC_WXHMETAFILE(a) (PicHandle(a)) +#define MAC_WXHICON(a) (CIconHandle(a)) +#define MAC_WXHCURSOR(a) (CursHandle(a)) +#define MAC_WXHRGN(a) (RgnHandle(a)) +#define MAC_WXHWND(a) (WindowPtr(a)) +#define MAC_WXRECPTR(a) ((Rect*)a) +#define MAC_WXPOINTPTR(a) ((Point*)a) +#define MAC_WXHMENU(a) ((MenuHandle)a) + +#endif // wxUSE_GUI + +//--------------------------------------------------------------------------- +// wxMac string conversions +//--------------------------------------------------------------------------- + +void wxMacSetupConverters() ; +void wxMacCleanupConverters() ; + +void wxMacStringToPascal( const wxString&from , StringPtr to ) ; +wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ; + +void wxMacConvertNewlines13To10( char * data ) ; +void wxMacConvertNewlines10To13( char * data ) ; +void wxMacConvertNewlines13To10( wxString *data ) ; +void wxMacConvertNewlines10To13( wxString *data ) ; + +#if wxUSE_UNICODE +void wxMacConvertNewlines13To10( wxChar * data ) ; +void wxMacConvertNewlines10To13( wxChar * data ) ; +#endif + +#if TARGET_CARBON + +class wxMacCFStringHolder +{ +public: + wxMacCFStringHolder() + { + m_cfs = NULL ; + m_release = false ; + } + + wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding ) + { + m_cfs = NULL ; + m_release = false ; + Assign( str , encoding ) ; + } + + wxMacCFStringHolder(CFStringRef ref , bool release = true ) + { + m_cfs = ref ; + m_release = release ; + } + + ~wxMacCFStringHolder() + { + Release() ; + } + + CFStringRef Detach() + { + CFStringRef retval = m_cfs ; + m_release = false ; + m_cfs = NULL ; + return retval ; + } + + void Release() + { + if ( m_release && m_cfs) + CFRelease( m_cfs ) ; + m_cfs = NULL ; + } + + void Assign( const wxString &str , wxFontEncoding encoding ) ; + + operator CFStringRef () { return m_cfs; } + wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; + +private: + + CFStringRef m_cfs; + bool m_release ; +} ; + +#endif + + + +wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; +wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; + + +#endif + // _WX_PRIVATE_H_ diff --git a/include/wx/mac/carbon/radiobox.h b/include/wx/mac/carbon/radiobox.h new file mode 100644 index 0000000000..c9642e2deb --- /dev/null +++ b/include/wx/mac/carbon/radiobox.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobox.h +// Purpose: wxRadioBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_ +#define _WX_RADIOBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "radiobox.h" +#endif + +// List box item +class WXDLLEXPORT wxBitmap ; + +class WXDLLEXPORT wxRadioButton ; + +class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase +{ + DECLARE_DYNAMIC_CLASS(wxRadioBox) +public: +// Constructors & destructor + wxRadioBox(); + inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr) + { + Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); + } + inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Create(parent, id, title, pos, size, choices, + majorDim, style, val, name); + } + ~wxRadioBox(); + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + +// Specific functions (in wxWindows2 reference) + virtual void SetSelection(int item); + virtual int GetSelection() const; + + inline virtual int GetCount() const { return m_noItems; } ; + + virtual wxString GetString(int item) const; + virtual void SetString(int item, const wxString& label) ; + + virtual void Enable(int item, bool enable); + virtual void Show(int item, bool show) ; + + virtual int GetColumnCount() const ; + virtual int GetRowCount() const ; + + + virtual bool Enable(bool enable = TRUE); + virtual wxString GetLabel() const; + virtual void SetLabel(const wxString& label) ; + virtual bool Show(bool show = TRUE); + +// Other external functions + void Command(wxCommandEvent& event); + void SetFocus(); + +// Other variable access functions + inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + + void OnRadioButton( wxCommandEvent& event ) ; +protected: + wxRadioButton *m_radioButtonCycle; + + int m_majorDim ; + int m_noItems; + int m_noRowsOrCols; + +// Internal functions + virtual wxSize DoGetBestSize() const ; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_RADIOBOX_H_ diff --git a/include/wx/mac/carbon/radiobut.h b/include/wx/mac/carbon/radiobut.h new file mode 100644 index 0000000000..22fe9c1bda --- /dev/null +++ b/include/wx/mac/carbon/radiobut.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobut.h +// Purpose: wxRadioButton class +// Author: Stefan Csomor +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_ +#define _WX_RADIOBUT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "radiobut.h" +#endif + +class WXDLLEXPORT wxRadioButton: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxRadioButton) + protected: +public: + inline wxRadioButton() {} + inline wxRadioButton(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr); + + virtual void SetValue(bool val); + virtual bool GetValue() const ; + + // implementation + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ); + void Command(wxCommandEvent& event); + wxRadioButton *AddInCycle(wxRadioButton *cycle); + inline wxRadioButton *NextInCycle() {return m_cycle;} + + protected: + + wxRadioButton *m_cycle; +}; + +// Not implemented +#if 0 +class WXDLLEXPORT wxBitmap ; + +WXDLLEXPORT_DATA(extern const char*) wxBitmapRadioButtonNameStr; + +class WXDLLEXPORT wxBitmapRadioButton: public wxRadioButton +{ + DECLARE_DYNAMIC_CLASS(wxBitmapRadioButton) + protected: + wxBitmap *theButtonBitmap; + public: + inline wxBitmapRadioButton() { theButtonBitmap = NULL; } + inline wxBitmapRadioButton(wxWindow *parent, wxWindowID id, + const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapRadioButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxBitmap *label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxBitmapRadioButtonNameStr); + + virtual void SetLabel(const wxBitmap *label); + virtual void SetValue(bool val) ; + virtual bool GetValue() const ; +}; +#endif + +#endif + // _WX_RADIOBUT_H_ diff --git a/include/wx/mac/carbon/region.h b/include/wx/mac/carbon/region.h new file mode 100644 index 0000000000..ab04dd8975 --- /dev/null +++ b/include/wx/mac/carbon/region.h @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: region.h +// Purpose: wxRegion class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGION_H_ +#define _WX_REGION_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "region.h" +#endif + +#include "wx/list.h" +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +class WXDLLEXPORT wxRect; +class WXDLLEXPORT wxPoint; + +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. +}; + +class WXDLLEXPORT wxRegion : public wxGDIObject { +DECLARE_DYNAMIC_CLASS(wxRegion); + friend class WXDLLEXPORT wxRegionIterator; +public: + wxRegion(long x, long y, long w, long h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion( WXHRGN hRegion ); + wxRegion(); + wxRegion( const wxBitmap& bmp, + const wxColour& transColour = wxNullColour, + int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + ~wxRegion(); + + //# Copying + wxRegion(const wxRegion& r) + : wxGDIObject() + { Ref(r); } + wxRegion& operator = (const wxRegion& r) + { Ref(r); return (*this); } + + //# Modify region + // Clear current region + void Clear(); + + // Union rectangle or region with this. + bool Union(long x, long y, long width, long height) + { return Combine(x, y, width, height, wxRGN_OR); } + bool Union(const wxRect& rect) + { return Combine(rect, wxRGN_OR); } + bool Union(const wxRegion& region) + { return Combine(region, wxRGN_OR); } + + // Intersect rectangle or region with this. + bool Intersect(long x, long y, long width, long height) + { return Combine(x, y, width, height, wxRGN_AND); } + bool Intersect(const wxRect& rect) + { return Combine(rect, wxRGN_AND); } + bool Intersect(const wxRegion& region) + { return Combine(region, wxRGN_AND); } + + // Subtract rectangle or region from this: + // Combines the parts of 'this' that are not part of the second region. + bool Subtract(long x, long y, long width, long height) + { return Combine(x, y, width, height, wxRGN_DIFF); } + bool Subtract(const wxRect& rect) + { return Combine(rect, wxRGN_DIFF); } + bool Subtract(const wxRegion& region) + { return Combine(region, wxRGN_DIFF); } + + // XOR: the union of two combined regions except for any overlapping areas. + bool Xor(long x, long y, long width, long height) + { return Combine(x, y, width, height, wxRGN_XOR); } + bool Xor(const wxRect& rect) + { return Combine(rect, wxRGN_XOR); } + bool Xor(const wxRegion& region) + { return Combine(region, wxRGN_XOR); } + + //# Information on region + // Outer bounds of region + void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const; + wxRect GetBox() const ; + + // Is region empty? + bool Empty() const; + inline bool IsEmpty() const { return Empty(); } + + //# Tests + // Does the region contain the point (x,y)? + wxRegionContain Contains(long x, long y) const; + // Does the region contain the point pt? + wxRegionContain Contains(const wxPoint& pt) const; + // Does the region contain the rectangle (x, y, w, h)? + wxRegionContain Contains(long x, long y, long w, long h) const; + // Does the region contain the rectangle rect? + wxRegionContain Contains(const wxRect& rect) const; + + // Convert the region to a B&W bitmap with the white pixels being inside + // the region. + wxBitmap ConvertToBitmap() const; + + // Use the non-transparent pixels of a wxBitmap for the region to combine + // with this region. If the bitmap has a mask then it will be used, + // otherwise the colour to be treated as transparent may be specified, + // along with an optional tolerance value. + bool Union(const wxBitmap& bmp, + const wxColour& transColour = wxNullColour, + int tolerance = 0); + + // Internal + bool Combine(long x, long y, long width, long height, wxRegionOp op); + bool Combine(const wxRegion& region, wxRegionOp op); + bool Combine(const wxRect& rect, wxRegionOp op); + const WXHRGN GetWXHRGN() const ; +}; + +class WXDLLEXPORT wxRegionIterator : public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxRegionIterator) + +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& iterator); + ~wxRegionIterator(); + + wxRegionIterator& operator=(const wxRegionIterator& iterator); + + void Reset() { m_current = 0; } + void Reset(const wxRegion& region); + + operator bool () const { return m_current < m_numRects; } + bool HaveRects() const { return m_current < m_numRects; } + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + long GetX() const; + long GetY() const; + long GetW() const; + long GetWidth() const { return GetW(); } + long GetH() const; + long GetHeight() const { return GetH(); } + wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } +private: + void SetRects(long numRects, wxRect *rects); + + long m_current; + long m_numRects; + wxRegion m_region; + wxRect* m_rects; +}; + +#endif + // _WX_REGION_H_ diff --git a/include/wx/mac/carbon/scrolbar.h b/include/wx/mac/carbon/scrolbar.h new file mode 100644 index 0000000000..633b615ced --- /dev/null +++ b/include/wx/mac/carbon/scrolbar.h @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: scrollbar.h +// Purpose: wxScrollBar class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_ +#define _WX_SCROLBAR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "scrolbar.h" +#endif + +#include "wx/control.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr; + +// Scrollbar item +class WXDLLEXPORT wxScrollBar: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxScrollBar) + +public: + inline wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + ~wxScrollBar(); + + inline wxScrollBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSB_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxScrollBarNameStr); + + int GetThumbPosition() const ; + inline int GetThumbSize() const { return m_viewSize; } + inline int GetPageSize() const { return m_pageSize; } + inline int GetRange() const { return m_objectSize; } + + bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; } + + virtual void SetThumbPosition(int viewStart); + virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize, + bool refresh = TRUE); + + void Command(wxCommandEvent& event); + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + +protected: + int m_pageSize; + int m_viewSize; + int m_objectSize; + +DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_SCROLBAR_H_ diff --git a/include/wx/mac/carbon/setup.h b/include/wx/mac/carbon/setup.h new file mode 100644 index 0000000000..b67d2f2c52 --- /dev/null +++ b/include/wx/mac/carbon/setup.h @@ -0,0 +1,938 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: setup.h +// Purpose: Configuration for the library +// Author: Stefan Csomor +// Modified by: Stefan Csomor +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +#define wxUSE_LIBMSPACK 0 +#define wxUSE_SOUND 1 +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.0 API: set it to 1 to +// enable it +// +// Default is 0. +// +// Recommended setting: 0 (please update your code instead!) +#define WXWIN_COMPATIBILITY_2_2 0 + +// This setting determines the compatibility with 2.2 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 1 + +// in wxMSW version 2.1.11 and earlier, wxIcon always derives from wxBitmap, +// but this is very dangerous because you can mistakenly pass an icon instead +// of a bitmap to a function taking "const wxBitmap&" - which will *not* work +// because an icon is not a valid bitmap +// +// Starting from 2.1.12, you have the choice under this backwards compatible +// behaviour (your code will still compile, but probably won't behave as +// expected!) and not deriving wxIcon class from wxBitmap, but providing a +// conversion ctor wxBitmap(const wxIcon&) instead. +// +// Recommended setting: 0 +#define wxICON_IS_BITMAP 0 + +// Define as 1 for font size to be backward compatible to 1.63 and earlier. +// 1.64 and later define point sizes to be compatible with Windows. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxFONT_SIZE_COMPATIBILITY 0 + +// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. +// If migrating between versions, your dialogs may seem to shrink. +// +// Default is 1 +// +// Recommended setting: 0 (the new calculations are more correct!) +#define wxDIALOG_UNIT_COMPATIBILITY 1 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWindows memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use normal memory operators. It's +// recommended to set this to 1, since you may well need to output an error log +// in a production version (or non-debugging beta). +// +// Default is 1. +// +// Recommended setting: 1 but see comment above +#ifndef __MWERKS__ +#define wxUSE_DEBUG_CONTEXT 0 +#else +#define wxUSE_DEBUG_CONTEXT 1 +#endif + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 1 +// +// Recommended setting: 1 but see comment in the beginning of this section +#define wxUSE_MEMORY_TRACING 1 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#ifdef _MSC_VER + #define wxUSE_ON_FATAL_EXCEPTION 1 +#else + #define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWindows in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000 (Windows 9x +// doesn't support it and the programs compiled in Unicode mode will not run +// under 9x). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000) +#if TARGET_CARBON && ( !defined(__MWERKS__) || !defined(__MACH__) ) +#define wxUSE_UNICODE 1 +#else +#define wxUSE_UNICODE 0 +#endif +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 (always) +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 (always) +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 (always) +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// This is ignored under Win16, threads are only supported under Win32. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled (1), compiles wxWindows streams classes +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1. If 0, use wxWin streams implementation. +#ifndef __MWERKS__ +#define wxUSE_STD_IOSTREAM 0 +#else +#define wxUSE_STD_IOSTREAM 1 +#endif + +// Use serialization (requires utils/serialize) +#define wxUSE_SERIAL 0 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental extension, use with caution. +#define wxUSE_DYNAMIC_LOADER 0 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG and wxUSE_GZSTREAM. +#define wxUSE_ZLIB 1 + +// Set to 1 to compile wxGzipInput/OutputStream classes. Requires wxUSE_ZLIB. +#define wxUSE_GZSTREAM 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWindows one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 0 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxWave class +#define wxUSE_WAVE 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is 1 +// +// Recommended setting: 1 (needed by XRC) +#define wxUSE_XML 1 + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow but doesn't work yet under Mac. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_POPUPWIN 0 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_TIPWINDOW 0 + +// Each of the settings below corresponds to one wxWindows control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// this setting is obsolete, value is ignored +#define wxUSE_BUTTONBAR 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_GRID 1 + +// wxProperty[Value/Form/List] classes, used by Dialog Editor +#define wxUSE_PROPSHEET 0 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// working with them. +// +// Default is 0 because it isn't yet implemented on all platforms +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 0 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 0 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// OpenGL canvas +#define wxUSE_GLCANVAS 0 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 0 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility +#define wxUSE_WXHTML_HELP 1 + // 0 for no MS HTML Help +#define wxUSE_RESOURCES 1 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 0 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatability with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#ifndef __MWERKS__ +#define wxUSE_IOSTREAMH 0 +#else +#define wxUSE_IOSTREAMH 1 +#endif + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// If 1, enables provision of run-time type information. +// NOW MANDATORY: don't change. +#define wxUSE_DYNAMIC_CLASSES 1 + +#endif + // _WX_SETUP_H_ diff --git a/include/wx/mac/carbon/setup0.h b/include/wx/mac/carbon/setup0.h new file mode 100644 index 0000000000..c0b2f7642e --- /dev/null +++ b/include/wx/mac/carbon/setup0.h @@ -0,0 +1,933 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: setup.h +// Purpose: Configuration for the library +// Author: Stefan Csomor +// Modified by: Stefan Csomor +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.0 API: set it to 1 to +// enable it +// +// Default is 0. +// +// Recommended setting: 0 (please update your code instead!) +#define WXWIN_COMPATIBILITY_2_2 0 + +// This setting determines the compatibility with 2.2 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 1 + +// in wxMSW version 2.1.11 and earlier, wxIcon always derives from wxBitmap, +// but this is very dangerous because you can mistakenly pass an icon instead +// of a bitmap to a function taking "const wxBitmap&" - which will *not* work +// because an icon is not a valid bitmap +// +// Starting from 2.1.12, you have the choice under this backwards compatible +// behaviour (your code will still compile, but probably won't behave as +// expected!) and not deriving wxIcon class from wxBitmap, but providing a +// conversion ctor wxBitmap(const wxIcon&) instead. +// +// Recommended setting: 0 +#define wxICON_IS_BITMAP 0 + +// Define as 1 for font size to be backward compatible to 1.63 and earlier. +// 1.64 and later define point sizes to be compatible with Windows. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxFONT_SIZE_COMPATIBILITY 0 + +// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. +// If migrating between versions, your dialogs may seem to shrink. +// +// Default is 1 +// +// Recommended setting: 0 (the new calculations are more correct!) +#define wxDIALOG_UNIT_COMPATIBILITY 1 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWindows memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use normal memory operators. It's +// recommended to set this to 1, since you may well need to output an error log +// in a production version (or non-debugging beta). +// +// Default is 1. +// +// Recommended setting: 1 but see comment above +#ifndef __MWERKS__ +#define wxUSE_DEBUG_CONTEXT 0 +#else +#define wxUSE_DEBUG_CONTEXT 1 +#endif + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 1 +// +// Recommended setting: 1 but see comment in the beginning of this section +#define wxUSE_MEMORY_TRACING 1 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#ifdef _MSC_VER + #define wxUSE_ON_FATAL_EXCEPTION 1 +#else + #define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWindows in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000 (Windows 9x +// doesn't support it and the programs compiled in Unicode mode will not run +// under 9x). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000) +#define wxUSE_UNICODE 0 + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 (always) +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 (always) +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 (always) +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// This is ignored under Win16, threads are only supported under Win32. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled (1), compiles wxWindows streams classes +#define wxUSE_STREAMS 1 + +// Use standard C++ streams if 1. If 0, use wxWin streams implementation. +#ifndef __MWERKS__ +#define wxUSE_STD_IOSTREAM 0 +#else +#define wxUSE_STD_IOSTREAM 1 +#endif + +// Use serialization (requires utils/serialize) +#define wxUSE_SERIAL 0 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental extension, use with caution. +#define wxUSE_DYNAMIC_LOADER 0 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG and wxUSE_GZSTREAM. +#define wxUSE_ZLIB 1 + +// Set to 1 to compile wxGzipInput/OutputStream classes. Requires wxUSE_ZLIB. +#define wxUSE_GZSTREAM 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWindows one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is 1 +// +// Recommended setting: 1 (needed by XRC) +#define wxUSE_XML 1 + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow but doesn't work yet under Mac. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_POPUPWIN 0 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_TIPWINDOW 0 + +// Each of the settings below corresponds to one wxWindows control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 0 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// this setting is obsolete, value is ignored +#define wxUSE_BUTTONBAR 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_GRID 1 + +// wxProperty[Value/Form/List] classes, used by Dialog Editor +#define wxUSE_PROPSHEET 0 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// working with them. +// +// Default is 0 because it isn't yet implemented on all platforms +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 0 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 0 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// OpenGL canvas +#define wxUSE_GLCANVAS 0 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 0 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility +#define wxUSE_WXHTML_HELP 1 + // 0 for no MS HTML Help +#define wxUSE_RESOURCES 1 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 0 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 1 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatability with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#ifndef __MWERKS__ +#define wxUSE_IOSTREAMH 0 +#else +#define wxUSE_IOSTREAMH 1 +#endif + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// If 1, enables provision of run-time type information. +// NOW MANDATORY: don't change. +#define wxUSE_DYNAMIC_CLASSES 1 + +#endif + // _WX_SETUP_H_ diff --git a/include/wx/mac/carbon/slider.h b/include/wx/mac/carbon/slider.h new file mode 100644 index 0000000000..9599a60c10 --- /dev/null +++ b/include/wx/mac/carbon/slider.h @@ -0,0 +1,110 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: slider.h +// Purpose: wxSlider class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SLIDER_H_ +#define _WX_SLIDER_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "slider.h" +#endif + +#include "wx/control.h" +#include "wx/slider.h" +#include "wx/stattext.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr; + +// Slider +class WXDLLEXPORT wxSlider: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxSlider) + +public: + wxSlider(); + + inline 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) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + ~wxSlider(); + + 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() const ; + virtual void SetValue(int); + + void SetRange(int minValue, int maxValue); + + inline int GetMin() const { return m_rangeMin; } + inline int GetMax() const { return m_rangeMax; } + + void SetMin(int minValue) { SetRange(minValue, m_rangeMax); } + void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); } + + // For trackbars only + void SetTickFreq(int n, int pos); + inline int GetTickFreq() const { return m_tickFreq; } + void SetPageSize(int pageSize); + int GetPageSize() const ; + void ClearSel() ; + void ClearTicks() ; + void SetLineSize(int lineSize); + int GetLineSize() const ; + int GetSelEnd() const ; + int GetSelStart() const ; + void SetSelection(int minPos, int maxPos); + void SetThumbLength(int len) ; + int GetThumbLength() const ; + void SetTick(int tickPos) ; + + + // set min/max size of the slider + virtual void SetSizeHints( int minW, int minH, + int maxW = -1, int maxH = -1, + int incW = -1, int incH = -1 ); + + protected: + virtual wxSize DoGetBestSize() const; + virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags); + virtual void DoMoveWindow(int x, int y, int w, int h); + + void Command(wxCommandEvent& event); + void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + virtual void MacUpdateDimensions() ; + + wxStaticText* m_macMinimumStatic ; + wxStaticText* m_macMaximumStatic ; + wxStaticText* m_macValueStatic ; + + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; +private : +DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_SLIDER_H_ diff --git a/include/wx/mac/carbon/sound.h b/include/wx/mac/carbon/sound.h new file mode 100644 index 0000000000..18a84d101b --- /dev/null +++ b/include/wx/mac/carbon/sound.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: sound.h +// Purpose: wxSound class (loads and plays short Windows .wav files). +// Optional on non-Windows platforms. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "sound.h" +#endif + +#if wxUSE_SOUND + +#include "wx/object.h" + +class WXDLLEXPORT wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = FALSE); + wxSound(int size, const wxByte* data); + ~wxSound(); + +public: + bool Create(const wxString& fileName, bool isResource = FALSE); + bool IsOk() const { return !m_sndname.IsEmpty(); } + +protected: + // prevent collision with some BSD definitions of macro Free() + bool FreeData(); + + bool DoPlay(unsigned flags) const; + +private: + void* m_sndChan; + + wxString m_sndname; + void* m_hSnd; + int m_waveLength; + bool m_isResource; +}; + +#endif +#endif + // _WX_SOUND_H_ diff --git a/include/wx/mac/carbon/spinbutt.h b/include/wx/mac/carbon/spinbutt.h new file mode 100644 index 0000000000..3b33a8d5ad --- /dev/null +++ b/include/wx/mac/carbon/spinbutt.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: spinbutt.h +// Purpose: wxSpinButton class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_ +#define _WX_SPINBUTT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "spinbutt.h" +#endif + +#include "wx/control.h" +#include "wx/event.h" + +/* + The wxSpinButton is like a small scrollbar than is often placed next + to a text control. + + wxSP_HORIZONTAL: horizontal spin button + wxSP_VERTICAL: vertical spin button (the default) + wxSP_ARROW_KEYS: arrow keys increment/decrement value + wxSP_WRAP: value wraps at either end + */ + +class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase +{ +public: + // construction + wxSpinButton(); + + wxSpinButton(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxT("wxSpinButton")) + { + Create(parent, id, pos, size, style, name); + } + + virtual ~wxSpinButton(); + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxT("wxSpinButton")); + + + // accessors + virtual int GetMin() const; + virtual int GetMax() const; + virtual int GetValue() const; + virtual void SetValue(int val); + virtual void SetRange(int minVal, int maxVal); + + // implementation + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + +protected: + void MacHandleValueChanged( int inc ) ; + virtual wxSize DoGetBestSize() const; + int m_value ; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinButton) +}; + +#endif + // _WX_SPINBUTT_H_ diff --git a/include/wx/mac/carbon/spinctrl.h b/include/wx/mac/carbon/spinctrl.h new file mode 100755 index 0000000000..9ffd5d1ee2 --- /dev/null +++ b/include/wx/mac/carbon/spinctrl.h @@ -0,0 +1,188 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/generic/spinctlg.h +// Purpose: generic wxSpinCtrl class +// Author: Vadim Zeitlin +// Modified by: +// Created: 28.10.99 +// RCS-ID: $Id$ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_SPINCTRL_H_ +#define _WX_MAC_SPINCTRL_H_ + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is a combination of wxSpinButton and wxTextCtrl, so if +// wxSpinButton is available, this is what we do - but if it isn't, we still +// define wxSpinCtrl class which then has the same appearance as wxTextCtrl but +// the different interface. This allows to write programs using wxSpinCtrl +// without tons of #ifdefs. +// ---------------------------------------------------------------------------- + +#if wxUSE_SPINBTN + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "spinctlg.h" +#endif + +class WXDLLEXPORT wxSpinButton; +class WXDLLEXPORT wxTextCtrl; + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSpinCtrl : public wxControl +{ +public: + wxSpinCtrl() { Init(); } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + Init(); + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")); + + // wxTextCtrl-like method + void SetSelection(long from, long to); + + virtual ~wxSpinCtrl(); + + // operations + void SetValue(int val); + void SetValue(const wxString& text); + void SetRange(int min, int max); + + // accessors + int GetValue() const; + int GetMin() const; + int GetMax() const; + + // implementation from now on + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = TRUE); + virtual bool Show(bool show = TRUE); + + // get the subcontrols + wxTextCtrl *GetText() const { return m_text; } + wxSpinButton *GetSpinButton() const { return m_btn; } + + // set the value of the text (only) + void SetTextValue(int val); + + // put the numeric value of the string in the text ctrl into val and return + // TRUE or return FALSE if the text ctrl doesn't contain a number or if the + // number is out of range + bool GetTextValue(int *val) const; + +protected: + // override the base class virtuals involved into geometry calculations + virtual wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); + + // common part of all ctors + void Init(); + +private: + // the subcontrols + wxTextCtrl *m_text; + wxSpinButton *m_btn; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) +}; + +#else // !wxUSE_SPINBTN + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is just a text control +// ---------------------------------------------------------------------------- + +#include "wx/textctrl.h" + +class WXDLLEXPORT wxSpinCtrl : public wxTextCtrl +{ +public: + wxSpinCtrl() { Init(); } + + wxSpinCtrl(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + Create(parent, id, value, pos, size, style, min, max, initial, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_ARROW_KEYS, + int min = 0, int max = 100, int initial = 0, + const wxString& name = _T("wxSpinCtrl")) + { + SetRange(min, max); + + bool ok = wxTextCtrl::Create(parent, id, value, pos, size, style, + wxDefaultValidator, name); + SetValue(initial); + + return ok; + } + + // accessors + int GetValue(int WXUNUSED(dummy) = 1) const + { + int n; + if ( (wxSscanf(wxTextCtrl::GetValue(), wxT("%d"), &n) != 1) ) + n = INT_MIN; + + return n; + } + + int GetMin() const { return m_min; } + int GetMax() const { return m_max; } + + // operations + void SetValue(const wxString& value) { wxTextCtrl::SetValue(value); } + void SetValue(int val) { wxString s; s << val; wxTextCtrl::SetValue(s); } + void SetRange(int min, int max) { m_min = min; m_max = max; } + +protected: + // initialize m_min/max with the default values + void Init() { SetRange(0, 100); } + + int m_min; + int m_max; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) +}; + +#endif // wxUSE_SPINBTN/!wxUSE_SPINBTN + +#endif // _WX_MAC_SPINCTRL_H_ + diff --git a/include/wx/mac/carbon/statbmp.h b/include/wx/mac/carbon/statbmp.h new file mode 100644 index 0000000000..8a16726c57 --- /dev/null +++ b/include/wx/mac/carbon/statbmp.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbmp.h +// Purpose: wxStaticBitmap class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "statbmp.h" +#endif + +#include "wx/icon.h" + +class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + public: + inline wxStaticBitmap() { } + + inline wxStaticBitmap(wxWindow *parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + 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); + + virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + void OnPaint( wxPaintEvent &event ) ; + + wxBitmap GetBitmap() const { return m_bitmap; } + wxIcon GetIcon() const + { + // icons and bitmaps are really the same thing in wxMac + return (const wxIcon &)m_bitmap; + } + void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; } + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return FALSE; } + virtual wxSize DoGetBestSize() const ; + + protected: + wxBitmap m_bitmap; + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_STATBMP_H_ diff --git a/include/wx/mac/carbon/statbox.h b/include/wx/mac/carbon/statbox.h new file mode 100644 index 0000000000..9f73a539ed --- /dev/null +++ b/include/wx/mac/carbon/statbox.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbox.h +// Purpose: wxStaticBox class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBOX_H_ +#define _WX_STATBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "statbox.h" +#endif + +#include "wx/control.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr; + +// Group box +class WXDLLEXPORT wxStaticBox: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxStaticBox) + + public: + inline wxStaticBox() {} + inline wxStaticBox(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBoxNameStr); + + virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + + +protected: + +DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_STATBOX_H_ diff --git a/include/wx/mac/carbon/statline.h b/include/wx/mac/carbon/statline.h new file mode 100644 index 0000000000..911e9f535c --- /dev/null +++ b/include/wx/mac/carbon/statline.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: mac/statline.h +// Purpose: a generic wxStaticLine class used for mac before adaptation +// Author: Vadim Zeitlin +// Created: 28.06.99 +// Version: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GENERIC_STATLINE_H_ +#define _WX_GENERIC_STATLINE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "statline.h" +#endif + +class wxStaticBox; + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticLine) + +public: + // constructors and pseudo-constructors + wxStaticLine() : m_statbox(NULL) { } + + wxStaticLine( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ) + : m_statbox(NULL) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ); + + // it's necessary to override this wxWindow function because we + // will want to return the main widget for m_statbox + // + WXWidget GetMainWidget() const; + +protected: + // we implement the static line using a static box + wxStaticBox *m_statbox; +}; + +#endif // _WX_GENERIC_STATLINE_H_ + diff --git a/include/wx/mac/carbon/stattext.h b/include/wx/mac/carbon/stattext.h new file mode 100644 index 0000000000..17ecf98ad0 --- /dev/null +++ b/include/wx/mac/carbon/stattext.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: stattext.h +// Purpose: wxStaticText class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_ +#define _WX_STATTEXT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "stattext.h" +#endif + +class WXDLLEXPORT wxStaticText: public wxStaticTextBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticText) + public: + inline wxStaticText() : m_label() { } + + inline wxStaticText(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticTextNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticTextNameStr); + + // accessors + void SetLabel( const wxString &str ) ; + bool SetFont( const wxFont &font ); + + // operations + virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + // events + void DrawParagraph(wxDC &dc, wxString paragraph, int &y); + void OnPaint( wxPaintEvent &event ) ; + void OnDraw( wxDC &dc ) ; + virtual wxSize DoGetBestSize() const ; + virtual bool AcceptsFocus() const { return FALSE; } + private : + wxString m_label ; + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_STATTEXT_H_ diff --git a/include/wx/mac/carbon/statusbr.h b/include/wx/mac/carbon/statusbr.h new file mode 100644 index 0000000000..959c4e618d --- /dev/null +++ b/include/wx/mac/carbon/statusbr.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: statusbr.h +// Purpose: native implementation of wxStatusBar. Optional; can use generic +// version instead. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBAR_H_ +#define _WX_STATBAR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "statbrma.h" +#endif + +class WXDLLEXPORT wxStatusBarMac : public wxStatusBarGeneric +{ + DECLARE_DYNAMIC_CLASS(wxStatusBarMac); + + wxStatusBarMac(); + wxStatusBarMac(wxWindow *parent, wxWindowID id, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Create(parent, id, style, name); + } + + ~wxStatusBarMac(); + + bool Create(wxWindow *parent, wxWindowID id, + long style , + const wxString& name = wxPanelNameStr) ; + + virtual void DrawFieldText(wxDC& dc, int i); + virtual void DrawField(wxDC& dc, int i); + virtual void SetStatusText(const wxString& text, int number = 0) ; + //////////////////////////////////////////////////////////////////////// + // Implementation + + virtual void MacSuperEnabled( bool enable ) ; + + void OnPaint(wxPaintEvent& event); +protected: + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_STATBAR_H_ diff --git a/include/wx/mac/carbon/tabctrl.h b/include/wx/mac/carbon/tabctrl.h new file mode 100644 index 0000000000..7a6e14300a --- /dev/null +++ b/include/wx/mac/carbon/tabctrl.h @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tabctrl.h +// Purpose: wxTabCtrl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TABCTRL_H_ +#define _WX_TABCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "tabctrl.h" +#endif + +class wxImageList; + +/* + * Flags returned by HitTest + */ + +#define wxTAB_HITTEST_NOWHERE 1 +#define wxTAB_HITTEST_ONICON 2 +#define wxTAB_HITTEST_ONLABEL 4 +#define wxTAB_HITTEST_ONITEM 6 + +class WXDLLEXPORT wxTabCtrl: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxTabCtrl) + public: + /* + * Public interface + */ + + wxTabCtrl(); + + inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")) + { + Create(parent, id, pos, size, style, name); + } + ~wxTabCtrl(); + +// Accessors + + // Get the selection + int GetSelection() const; + + // Get the tab with the current keyboard focus + int GetCurFocus() const; + + // Get the associated image list + wxImageList* GetImageList() const; + + // Get the number of items + int GetItemCount() const; + + // Get the rect corresponding to the tab + bool GetItemRect(int item, wxRect& rect) const; + + // Get the number of rows + int GetRowCount() const; + + // Get the item text + wxString GetItemText(int item) const ; + + // Get the item image + int GetItemImage(int item) const; + + // Get the item data + void* GetItemData(int item) const; + + // Set the selection + int SetSelection(int item); + + // Set the image list + void SetImageList(wxImageList* imageList); + + // Set the text for an item + bool SetItemText(int item, const wxString& text); + + // Set the image for an item + bool SetItemImage(int item, int image); + + // Set the data for an item + bool SetItemData(int item, void* data); + + // Set the size for a fixed-width tab control + void SetItemSize(const wxSize& size); + + // Set the padding between tabs + void SetPadding(const wxSize& padding); + +// Operations + + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")); + + // Delete all items + bool DeleteAllItems(); + + // Delete an item + bool DeleteItem(int item); + + // Hit test + int HitTest(const wxPoint& pt, long& flags); + + // Insert an item + bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); + + void Command(wxCommandEvent& event); + +protected: + wxImageList* m_imageList; + +DECLARE_EVENT_TABLE() +}; + +class WXDLLEXPORT wxTabEvent: public wxCommandEvent +{ + DECLARE_DYNAMIC_CLASS(wxTabEvent) + + public: + wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0); +}; + +typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); + +#define EVT_TAB_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGED, \ + id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL }, +#define EVT_TAB_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGING, \ + id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL }, + +#endif + // _WX_TABCTRL_H_ diff --git a/include/wx/mac/carbon/taskbarosx.h b/include/wx/mac/carbon/taskbarosx.h new file mode 100644 index 0000000000..9c921c063d --- /dev/null +++ b/include/wx/mac/carbon/taskbarosx.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////// +// File: wx/mac/taskbarosx.h +// Purpose: Defines wxTaskBarIcon class for OSX +// Author: Ryan Norton +// Modified by: +// Created: 04/04/2003 +// RCS-ID: $Id$ +// Copyright: (c) Ryan Norton, 2003 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _TASKBAR_H_ +#define _TASKBAR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "taskbarosx.h" +#endif + +class WXDLLEXPORT wxIcon; +class WXDLLEXPORT wxMenu; + +class WXDLLEXPORT wxTaskBarIcon : public wxTaskBarIconBase +{ +public: + //type of taskbar item to create (currently only DOCK is implemented) + enum wxTaskBarIconType + { + DOCK, + STATUSITEM, + MENUEXTRA + }; + + wxTaskBarIcon(const wxTaskBarIconType& nType = DOCK); + virtual ~wxTaskBarIcon(); + + // Operations: + bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); + bool RemoveIcon(); + bool PopupMenu(wxMenu *menu); + +protected: + wxTaskBarIconType m_nType; + + DECLARE_DYNAMIC_CLASS(wxTaskBarIcon) +}; + +#endif + // _TASKBAR_H_ diff --git a/include/wx/mac/carbon/textctrl.h b/include/wx/mac/carbon/textctrl.h new file mode 100644 index 0000000000..df3a964339 --- /dev/null +++ b/include/wx/mac/carbon/textctrl.h @@ -0,0 +1,184 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: textctrl.h +// Purpose: wxTextCtrl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_ +#define _WX_TEXTCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "textctrl.h" +#endif + +#include "wx/control.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr; + +// Single-line text item +class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase +{ + DECLARE_DYNAMIC_CLASS(wxTextCtrl) + +public: + // creation + // -------- + wxTextCtrl() { Init(); } + ~wxTextCtrl(); + wxTextCtrl(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr) + { + Init(); + + Create(parent, id, value, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTextCtrlNameStr); + + // accessors + // --------- + virtual wxString GetValue() const ; + virtual void SetValue(const wxString& value); + + virtual int GetLineLength(long lineNo) const; + virtual wxString GetLineText(long lineNo) const; + virtual int GetNumberOfLines() const; + + virtual bool IsModified() const; + virtual bool IsEditable() const; + + // If the return values from and to are the same, there is no selection. + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load the controls contents from the file + virtual bool LoadFile(const wxString& file); + + // sets/clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + // set the max number of characters which may be entered in a single line + // text control + virtual void SetMaxLength(unsigned long len) ; + + // text control under some platforms supports the text styles: these + // methods allow to apply the given text style to the given selection or to + // set/get the style which will be used for all appended text + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + + // writing text inserts it at the current position, appending always + // inserts it at the end + virtual void WriteText(const wxString& text); + virtual void AppendText(const wxString& text); + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // Implementation from now on + // -------------------------- + + // Implementation + // -------------- + virtual void Command(wxCommandEvent& event); + + virtual bool AcceptsFocus() const; + + // callbacks + void OnDropFiles(wxDropFilesEvent& event); + void OnChar(wxKeyEvent& event); // Process 'enter' if required + + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); + void OnUndo(wxCommandEvent& event); + void OnRedo(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + + virtual bool MacCanFocus() const { return true ; } + virtual bool MacSetupCursor( const wxPoint& pt ) ; + + virtual void MacSuperShown( bool show ) ; + virtual bool Show(bool show = TRUE) ; + +protected: + // common part of all ctors + void Init(); + + virtual wxSize DoGetBestSize() const; + + bool m_editable ; + + // flag is set to true when the user edits the controls contents + bool m_dirty; + + // one of the following objects is used for representation, the other one is NULL + void* m_macTE ; + void* m_macTXN ; + void* m_macTXNvars ; + bool m_macUsesTXN ; + unsigned long m_maxLength ; + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_TEXTCTRL_H_ diff --git a/include/wx/mac/carbon/tglbtn.h b/include/wx/mac/carbon/tglbtn.h new file mode 100644 index 0000000000..5ab29aa84c --- /dev/null +++ b/include/wx/mac/carbon/tglbtn.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under wxMac. +// Author: Stefan Csomor +// Modified by: +// Created: 08.02.01 +// RCS-ID: $Id$ +// Copyright: (c) 2004 Stefan Csomor +// License: wxWindows License +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr; + +// Checkbox item (single checkbox) +class WXDLLEXPORT wxToggleButton : public wxControl +{ +public: + wxToggleButton() {} + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const ; + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + + virtual void Command(wxCommandEvent& event); + +protected: + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) +}; + +#endif // _WX_TOGGLEBUTTON_H_ + diff --git a/include/wx/mac/carbon/timer.h b/include/wx/mac/carbon/timer.h new file mode 100644 index 0000000000..1d01ea91a4 --- /dev/null +++ b/include/wx/mac/carbon/timer.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: wxTimer class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMER_H_ +#define _WX_TIMER_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "timer.h" +#endif + +#include "wx/object.h" +#include "wx/mac/macnotfy.h" + +class wxTimer ; + +struct MacTimerInfo ; + +class WXDLLEXPORT wxTimer: public wxTimerBase +{ +public: + wxTimer() { Init(); } + wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); } + ~wxTimer(); + + virtual bool Start(int milliseconds = -1, + bool one_shot = FALSE); // Start timer + virtual void Stop(); // Stop timer + + virtual bool IsRunning() const ; + + MacTimerInfo* m_info; +protected : + void Init(); +private: + + DECLARE_ABSTRACT_CLASS(wxTimer) +}; + +#endif + // _WX_TIMER_H_ diff --git a/include/wx/mac/carbon/toolbar.h b/include/wx/mac/carbon/toolbar.h new file mode 100644 index 0000000000..1849125750 --- /dev/null +++ b/include/wx/mac/carbon/toolbar.h @@ -0,0 +1,96 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: toolbar.h +// Purpose: wxToolBar class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOOLBAR_H_ +#define _WX_TOOLBAR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "toolbar.h" +#endif + +#if wxUSE_TOOLBAR + +#include "wx/tbarbase.h" +#include "wx/dynarray.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; + +class WXDLLEXPORT wxToolBar: public wxToolBarBase +{ + DECLARE_DYNAMIC_CLASS(wxToolBar) + public: + /* + * Public interface + */ + + wxToolBar() { Init(); } + + + inline wxToolBar(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER|wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } + ~wxToolBar(); + + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxNO_BORDER|wxTB_HORIZONTAL, + const wxString& name = wxToolBarNameStr); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual bool Realize(); + + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolSize() const; + + virtual void SetRows(int nRows); + + // Add all the buttons + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + virtual wxString MacGetToolTipString( wxPoint &where ) ; + void OnPaint(wxPaintEvent& event) ; + void OnMouse(wxMouseEvent& event) ; + virtual void MacSuperChangedPosition() ; +protected: + // common part of all ctors + void Init(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TOOLBAR_H_ diff --git a/include/wx/mac/carbon/tooltip.h b/include/wx/mac/carbon/tooltip.h new file mode 100644 index 0000000000..7bf4ecf440 --- /dev/null +++ b/include/wx/mac/carbon/tooltip.h @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: mac/tooltip.h +// Purpose: wxToolTip class - tooltip control +// Author: Stefan Csomor +// Modified by: +// Created: 31.01.99 +// RCS-ID: $Id$ +// Copyright: (c) 1999 Robert Roebling, Vadim Zeitlin, Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + + +class wxToolTip : public wxObject +{ +public: + // ctor & dtor + wxToolTip(const wxString &tip); + virtual ~wxToolTip(); + + // accessors + // tip text + void SetTip(const wxString& tip); + const wxString& GetTip() const { return m_text; } + + // the window we're associated with + void SetWindow(wxWindow *win); + wxWindow *GetWindow() const { return m_window; } + + // controlling tooltip behaviour: globally change tooltip parameters + // enable or disable the tooltips globally + static void Enable(bool flag); + // set the delay after which the tooltip appears + static void SetDelay(long milliseconds); + static void NotifyWindowDelete( WXHWND win ) ; + + // implementation only from now on + // ------------------------------- + + // should be called in response to mouse events + static void RelayEvent(wxWindow *win , wxMouseEvent &event); + static void RemoveToolTips(); + +private: + wxString m_text; // tooltip text + wxWindow *m_window; // window we're associated with + DECLARE_ABSTRACT_CLASS(wxToolTip) +}; + diff --git a/include/wx/mac/carbon/toplevel.h b/include/wx/mac/carbon/toplevel.h new file mode 100644 index 0000000000..ffb0bcd288 --- /dev/null +++ b/include/wx/mac/carbon/toplevel.h @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/toplevel.h +// Purpose: wxTopLevelWindowMac is the Mac implementation of wxTLW +// Author: Stefan Csomor +// Modified by: +// Created: 20.09.01 +// RCS-ID: $Id$ +// Copyright: (c) 2001 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_TOPLEVEL_H_ +#define _WX_MSW_TOPLEVEL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "toplevel.h" +#endif + +#if wxUSE_SYSTEM_OPTIONS + #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition") +#endif + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowMac +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTopLevelWindowMac : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowMac() { Init(); } + + wxTopLevelWindowMac(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + (void)Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxTopLevelWindowMac(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = TRUE); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = TRUE); + virtual bool IsIconized() const; + virtual void SetIcon(const wxIcon& icon); + virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); } + virtual void Restore(); + + virtual bool SetShape(const wxRegion& region); + + virtual bool ShowFullScreen(bool WXUNUSED(show), long WXUNUSED(style) = wxFULLSCREEN_ALL) + { return FALSE; } + virtual bool IsFullScreen() const { return FALSE; } + + // implementation from now on + // -------------------------- + + static void MacDelayedDeactivation(long timestamp); + virtual void MacCreateRealWindow( const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ) ; + static WXWindow MacGetWindowInUpdate() { return s_macWindowInUpdate ; } + virtual void MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXWindow *window , wxWindowMac** rootwin ) ; + virtual void ClearBackground() ; + virtual WXWidget MacGetContainerForEmbedding() ; + WXWindow MacGetWindowRef() { return m_macWindow ; } + virtual void MacActivate( long timestamp , bool inIsActivating ) ; + virtual void MacUpdate( long timestamp ) ; +#if !TARGET_CARBON + virtual void MacMouseDown( WXEVENTREF ev , short windowPart ) ; + virtual void MacMouseUp( WXEVENTREF ev , short windowPart ) ; + virtual void MacMouseMoved( WXEVENTREF ev , short windowPart ) ; + virtual void MacKeyDown( WXEVENTREF ev ) ; +#endif + virtual void MacFireMouseEvent( wxUint16 kind , wxInt32 x , wxInt32 y ,wxUint32 modifiers , long timestamp ) ; + virtual void Raise(); + virtual void Lower(); + virtual void SetTitle( const wxString& title); + virtual bool Show( bool show = TRUE ); + virtual void DoMoveWindow(int x, int y, int width, int height); + void MacInvalidate( const WXRECTPTR rect, bool eraseBackground ) ; + short MacGetWindowBackgroundTheme() const { return m_macWindowBackgroundTheme ; } + static bool MacEnableCompositing( bool useCompositing ); + bool MacUsesCompositing() { return m_macUsesCompositing; } + +#if TARGET_CARBON + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } +#endif +protected: + // common part of all ctors + void Init(); + + // is the frame currently iconized? + bool m_iconized; + + // should the frame be maximized when it will be shown? set by Maximize() + // when it is called while the frame is hidden + bool m_maximizeOnShow; + bool m_macUsesCompositing ; + + short m_macWindowBackgroundTheme ; + WXWindow m_macWindow ; + WXWidget m_macRootControl ; + wxWindowMac* m_macFocus ; + WXHRGN m_macNoEraseUpdateRgn ; + bool m_macNeedsErasing ; + + static WXWindow s_macWindowInUpdate ; + static wxTopLevelWindowMac *s_macDeactivateWindow; + static bool s_macWindowCompositing ; +private : +#if TARGET_CARBON + WXEVENTHANDLERREF m_macEventHandler ; +#endif +}; + +// list of all frames and modeless dialogs +extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows; + +// associate mac windows with wx counterparts + +wxTopLevelWindowMac* wxFindWinFromMacWindow( WXWindow inWindow ) ; +void wxAssociateWinWithMacWindow(WXWindow inWindow, wxTopLevelWindowMac *win) ; +void wxRemoveMacWindowAssociation(wxTopLevelWindowMac *win) ; + + +#endif // _WX_MSW_TOPLEVEL_H_ + diff --git a/include/wx/mac/carbon/treectrl.h b/include/wx/mac/carbon/treectrl.h new file mode 100644 index 0000000000..306a0105a5 --- /dev/null +++ b/include/wx/mac/carbon/treectrl.h @@ -0,0 +1,295 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: treectrl.h +// Purpose: wxTreeCtrl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREECTRL_H_ +#define _WX_TREECTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "treectrl.h" +#endif + +#include "wx/control.h" +#include "wx/event.h" +#include "wx/imaglist.h" + +#define wxTREE_MASK_HANDLE 0x0001 +#define wxTREE_MASK_STATE 0x0002 +#define wxTREE_MASK_TEXT 0x0004 +#define wxTREE_MASK_IMAGE 0x0008 +#define wxTREE_MASK_SELECTED_IMAGE 0x0010 +#define wxTREE_MASK_CHILDREN 0x0020 +#define wxTREE_MASK_DATA 0x0040 + +#define wxTREE_STATE_BOLD 0x0001 +#define wxTREE_STATE_DROPHILITED 0x0002 +#define wxTREE_STATE_EXPANDED 0x0004 +#define wxTREE_STATE_EXPANDEDONCE 0x0008 +#define wxTREE_STATE_FOCUSED 0x0010 +#define wxTREE_STATE_SELECTED 0x0020 +#define wxTREE_STATE_CUT 0x0040 + +#define wxTREE_HITTEST_ABOVE 0x0001 // Above the client area. +#define wxTREE_HITTEST_BELOW 0x0002 // Below the client area. +#define wxTREE_HITTEST_NOWHERE 0x0004 // In the client area but below the last item. +#define wxTREE_HITTEST_ONITEMBUTTON 0x0010 // On the button associated with an item. +#define wxTREE_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item. +#define wxTREE_HITTEST_ONITEMINDENT 0x0040 // In the indentation associated with an item. +#define wxTREE_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item. +#define wxTREE_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item. +#define wxTREE_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state. +#define wxTREE_HITTEST_TOLEFT 0x0400 // To the right of the client area. +#define wxTREE_HITTEST_TORIGHT 0x0800 // To the left of the client area. + +#define wxTREE_HITTEST_ONITEM (wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMLABEL | wxTREE_HITTEST_ONITEMSTATEICON) + +// Flags for GetNextItem +enum { + wxTREE_NEXT_CARET, // Retrieves the currently selected item. + wxTREE_NEXT_CHILD, // Retrieves the first child item. The hItem parameter must be NULL. + wxTREE_NEXT_DROPHILITE, // Retrieves the item that is the target of a drag-and-drop operation. + wxTREE_NEXT_FIRSTVISIBLE, // Retrieves the first visible item. + wxTREE_NEXT_NEXT, // Retrieves the next sibling item. + wxTREE_NEXT_NEXTVISIBLE, // Retrieves the next visible item that follows the specified item. + wxTREE_NEXT_PARENT, // Retrieves the parent of the specified item. + wxTREE_NEXT_PREVIOUS, // Retrieves the previous sibling item. + wxTREE_NEXT_PREVIOUSVISIBLE, // Retrieves the first visible item that precedes the specified item. + wxTREE_NEXT_ROOT // Retrieves the first child item of the root item of which the specified item is a part. +}; + +// Flags for ExpandItem +enum { + wxTREE_EXPAND_EXPAND, + wxTREE_EXPAND_COLLAPSE, + wxTREE_EXPAND_COLLAPSE_RESET, + wxTREE_EXPAND_TOGGLE +}; + +// Flags for InsertItem +enum { + wxTREE_INSERT_LAST = -1, + wxTREE_INSERT_FIRST = -2, + wxTREE_INSERT_SORT = -3 +}; + +class WXDLLEXPORT wxTreeItem: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxTreeItem) +public: + long m_mask; + long m_itemId; + long m_state; + long m_stateMask; + wxString m_text; + int m_image; + int m_selectedImage; + int m_children; + long m_data; + + wxTreeItem(); + +// Accessors + inline long GetMask() const { return m_mask; } + inline long GetItemId() const { return m_itemId; } + inline long GetState() const { return m_state; } + inline long GetStateMask() const { return m_stateMask; } + inline wxString GetText() const { return m_text; } + inline int GetImage() const { return m_image; } + inline int GetSelectedImage() const { return m_selectedImage; } + inline int GetChildren() const { return m_children; } + inline long GetData() const { return m_data; } + + inline void SetMask(long mask) { m_mask = mask; } + inline void SetItemId(long id) { m_itemId = m_itemId = id; } + inline void SetState(long state) { m_state = state; } + inline void SetStateMask(long stateMask) { m_stateMask = stateMask; } + inline void GetText(const wxString& text) { m_text = text; } + inline void SetImage(int image) { m_image = image; } + inline void GetSelectedImage(int selImage) { m_selectedImage = selImage; } + inline void SetChildren(int children) { m_children = children; } + inline void SetData(long data) { m_data = data; } +}; + +class WXDLLEXPORT wxTreeCtrl: public wxControl +{ +public: + /* + * Public interface + */ + + // creation + // -------- + wxTreeCtrl(); + + inline wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = "wxTreeCtrl") + { + Create(parent, id, pos, size, style, validator, name); + } + ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = "wxTreeCtrl"); + + // accessors + // --------- + // + int GetCount() const; + + // indent + int GetIndent() const; + void SetIndent(int indent); + // image list + wxImageList *GetImageList(int which = wxIMAGE_LIST_NORMAL) const; + void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL); + + // navigation inside the tree + long GetNextItem(long item, int code) const; + bool ItemHasChildren(long item) const; + long GetChild(long item) const; + long GetItemParent(long item) const; + long GetFirstVisibleItem() const; + long GetNextVisibleItem(long item) const; + long GetSelection() const; + long GetRootItem() const; + + // generic function for (g|s)etting item attributes + bool GetItem(wxTreeItem& info) const; + bool SetItem(wxTreeItem& info); + // item state + int GetItemState(long item, long stateMask) const; + bool SetItemState(long item, long state, long stateMask); + // item image + bool SetItemImage(long item, int image, int selImage); + // item text + wxString GetItemText(long item) const; + void SetItemText(long item, const wxString& str); + // custom data associated with the item + long GetItemData(long item) const; + bool SetItemData(long item, long data); + // convenience function + bool IsItemExpanded(long item) + { + return (GetItemState(item, wxTREE_STATE_EXPANDED) & + wxTREE_STATE_EXPANDED) != 0; + } + + // bounding rect + bool GetItemRect(long item, wxRect& rect, bool textOnly = FALSE) const; + // + wxTextCtrl* GetEditControl() const; + + // operations + // ---------- + // adding/deleting items + bool DeleteItem(long item); + long InsertItem(long parent, wxTreeItem& info, + long insertAfter = wxTREE_INSERT_LAST); + // If image > -1 and selImage == -1, the same image is used for + // both selected and unselected items. + long InsertItem(long parent, const wxString& label, + int image = -1, int selImage = -1, + long insertAfter = wxTREE_INSERT_LAST); + + // changing item state + bool ExpandItem(long item) { return ExpandItem(item, wxTREE_EXPAND_EXPAND); } + bool CollapseItem(long item) { return ExpandItem(item, wxTREE_EXPAND_COLLAPSE); } + bool ToggleItem(long item) { return ExpandItem(item, wxTREE_EXPAND_TOGGLE); } + // common interface for {Expand|Collapse|Toggle}Item + bool ExpandItem(long item, int action); + + // + bool SelectItem(long item); + bool ScrollTo(long item); + bool DeleteAllItems(); + + // Edit the label (tree must have the focus) + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + long HitTest(const wxPoint& point, int& flags); + // wxImageList *CreateDragImage(long item); + bool SortChildren(long item); + bool EnsureVisible(long item); + + void Command(wxCommandEvent& event) { ProcessCommand(event); }; + +protected: + wxTextCtrl* m_textCtrl; + wxImageList* m_imageListNormal; + wxImageList* m_imageListState; + + DECLARE_DYNAMIC_CLASS(wxTreeCtrl) +}; + +/* + wxEVT_COMMAND_TREE_BEGIN_DRAG, + wxEVT_COMMAND_TREE_BEGIN_RDRAG, + wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, + wxEVT_COMMAND_TREE_END_LABEL_EDIT, + wxEVT_COMMAND_TREE_DELETE_ITEM, + wxEVT_COMMAND_TREE_GET_INFO, + wxEVT_COMMAND_TREE_SET_INFO, + wxEVT_COMMAND_TREE_ITEM_EXPANDED, + wxEVT_COMMAND_TREE_ITEM_EXPANDING, + wxEVT_COMMAND_TREE_ITEM_COLLAPSED, + wxEVT_COMMAND_TREE_ITEM_COLLAPSING, + wxEVT_COMMAND_TREE_SEL_CHANGED, + wxEVT_COMMAND_TREE_SEL_CHANGING, + wxEVT_COMMAND_TREE_KEY_DOWN +*/ + +class WXDLLEXPORT wxTreeEvent: public wxCommandEvent +{ + DECLARE_DYNAMIC_CLASS(wxTreeEvent) + + public: + wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0); + + int m_code; + wxTreeItem m_item; + long m_oldItem; + wxPoint m_pointDrag; + + inline long GetOldItem() const { return m_oldItem; } + inline wxTreeItem& GetItem() const { return (wxTreeItem&) m_item; } + inline wxPoint GetPoint() const { return m_pointDrag; } + inline int GetCode() const { return m_code; } +}; + +typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&); + +#define EVT_TREE_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_TREE_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_TREE_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_DELETE_ITEM(id, fn) { wxEVT_COMMAND_TREE_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_GET_INFO(id, fn) { wxEVT_COMMAND_TREE_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_SET_INFO(id, fn) { wxEVT_COMMAND_TREE_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_ITEM_EXPANDED(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_ITEM_EXPANDING(id, fn) { wxEVT_COMMAND_TREE_ITEM_EXPANDING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_ITEM_COLLAPSED(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_ITEM_COLLAPSING(id, fn) { wxEVT_COMMAND_TREE_ITEM_COLLAPSING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TREE_SEL_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, +#define EVT_TREE_KEY_DOWN(id, fn) { wxEVT_COMMAND_TREE_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTreeEventFunction) & fn, (wxObject *) NULL }, + +#endif + // _WX_TREECTRL_H_ diff --git a/include/wx/mac/carbon/uma.h b/include/wx/mac/carbon/uma.h new file mode 100644 index 0000000000..c862427f62 --- /dev/null +++ b/include/wx/mac/carbon/uma.h @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: uma.h +// Purpose: Universal MacOS API +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// RCS-ID: $Id: +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef H_UMA +#define H_UMA + +#include "wx/mac/private.h" + +void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded) ; +void UMACleanupToolbox() ; +long UMAGetSystemVersion() ; +bool UMAHasAppearance() ; +long UMAGetAppearanceVersion() ; +bool UMAHasWindowManager() ; +long UMAGetWindowManagerAttr() ; +bool UMAHasAquaLayout() ; + +bool UMASystemIsInitialized() ; +void UMASetSystemIsInitialized(bool val); + +// process manager + +long UMAGetProcessMode() ; +bool UMAGetProcessModeDoesActivateOnFGSwitch() ; + +#if wxUSE_GUI + +// menu manager + +MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding) ; +void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding encoding) ; +UInt32 UMAMenuEvent( EventRecord *inEvent ) ; +void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ; + +void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , SInt16 submenuid ) ; +void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , SInt16 submenuid ) ; +void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , wxAcceleratorEntry *entry = NULL ) ; +void UMAInsertMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ; +void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ; + +void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title , wxFontEncoding encoding ) ; + +// quickdraw + +void UMAShowWatchCursor() ; +void UMAShowArrowCursor() ; + +#if !TARGET_CARBON +OSStatus UMAPrOpen() ; +OSStatus UMAPrClose() ; +#endif + +// window manager + +GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ; +void UMADisposeWindow( WindowRef inWindowRef ) ; +void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding) ; + +void UMADrawGrowIcon( WindowRef inWindowRef ) ; +void UMAShowHide( WindowRef inWindowRef , Boolean show) ; + +// appearance manager + +void UMADrawControl( ControlHandle inControl ) ; + +void UMAEnableControl( ControlHandle inControl ) ; +void UMADisableControl( ControlHandle inControl ) ; +void UMAActivateControl( ControlHandle inControl ) ; +void UMADeactivateControl( ControlHandle inControl ) ; +// ControlPartCode hiliteState) ; +void UMAShowControl (ControlHandle theControl) ; +void UMAHideControl (ControlHandle theControl); +void UMAActivateControl (ControlHandle inControl); +void UMADeactivateControl (ControlHandle inControl); +void UMASetControlTitle( ControlHandle inControl , const wxString& title , wxFontEncoding encoding) ; + +void UMAMoveControl( ControlHandle inControl , short x , short y ) ; +void UMASizeControl( ControlHandle inControl , short x , short y ) ; +// control hierarchy + +// keyboard focus +OSErr UMASetKeyboardFocus (WindowPtr inWindow, + ControlHandle inControl, + ControlFocusPart inPart) ; + +// events + +void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ; +OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ; + +// handling control data +bool UMAIsWindowFloating( WindowRef inWindow ) ; +bool UMAIsWindowModal( WindowRef inWindow ) ; + +void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ; + +OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */ + +// Appearance Drawing + +OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) ; + +// Clipboard support + +OSStatus UMAPutScrap( Size size , OSType type , void *data ) ; + +// accessor helpers + +#if !TARGET_CARBON +#define ClearCurrentScrap() ZeroScrap() ; +#define GetApplicationScript() smSystemScript +#else + +// calls not in carbon + +#endif +#define GetWindowUpdateRgn( inWindow , updateRgn ) GetWindowRegion( inWindow , kWindowUpdateRgn, updateRgn ) + +#endif // wxUSE_GUI + +#endif diff --git a/include/wx/mac/carbon/window.h b/include/wx/mac/carbon/window.h new file mode 100644 index 0000000000..807e261863 --- /dev/null +++ b/include/wx/mac/carbon/window.h @@ -0,0 +1,269 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: window.h +// Purpose: wxWindowMac class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "window.h" +#endif + +#include "wx/brush.h" + +// --------------------------------------------------------------------------- +// forward declarations +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxButton; +class WXDLLEXPORT wxScrollBar; +class WXDLLEXPORT wxTopLevelWindowMac; + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowMac: public wxWindowBase +{ + DECLARE_DYNAMIC_CLASS(wxWindowMac) + + friend class wxDC; + friend class wxPaintDC; + +public: + + wxWindowMac() + : m_macBackgroundBrush() + , m_macVisibleRegion() + , m_x(0), m_y(0), m_width(0), m_height(0) + , m_hScrollBar(NULL), m_vScrollBar(NULL) + , m_label(wxEmptyString) + { Init(); } + + wxWindowMac(wxWindowMac *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowMac(); + + bool Create(wxWindowMac *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + + // implement base class pure virtuals + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show( bool show = TRUE ); + virtual bool Enable( bool enable = TRUE ); + + virtual void SetFocus(); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = TRUE, + const wxRect *rect = (const wxRect *) NULL ); + + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont(const wxFont& font) + { return wxWindowBase::SetFont(font); } + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL) + const; + + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = TRUE ); + virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = (wxRect *) NULL ); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); + + // Native resource loading (implemented in src/msw/nativdlg.cpp) + // FIXME: should they really be all virtual? + wxWindowMac* GetWindowChild1(wxWindowID id); + wxWindowMac* GetWindowChild(wxWindowID id); + + // implementation from now on + // -------------------------- + + void MacClientToRootWindow( int *x , int *y ) const ; + void MacRootWindowToClient( int *x , int *y ) const ; + void MacWindowToRootWindow( int *x , int *y ) const ; + void MacRootWindowToWindow( int *x , int *y ) const ; + + virtual wxString MacGetToolTipString( wxPoint &where ) ; + + // simple accessors + // ---------------- + +// WXHWND GetHWND() const { return m_hWnd; } +// void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } + virtual WXWidget GetHandle() const { return (WXWidget) NULL ; } + + bool GetTransparentBackground() const { return m_backgroundTransparent; } + void SetTransparent(bool t = TRUE) { m_backgroundTransparent = t; } + + // event handlers + // -------------- + void OnSetFocus(wxFocusEvent& event) ; + void OnNcPaint(wxNcPaintEvent& event); + void OnEraseBackground(wxEraseEvent& event); + void OnMouseEvent( wxMouseEvent &event ) ; + + void MacOnScroll(wxScrollEvent&event ) ; + + bool AcceptsFocus() const ; + +public: + void OnInternalIdle(); + + // For implementation purposes - sometimes decorations make the client area + // smaller + virtual wxPoint GetClientAreaOrigin() const; + + wxWindowMac *FindItem(long id) const; + wxWindowMac *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; + + // Make a Windows extended style from the given wxWindows window style + static WXDWORD MakeExtendedStyle(long style, + bool eliminateBorders = TRUE); + // Determine whether 3D effects are wanted + WXDWORD Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) const; + + // MSW only: TRUE if this control is part of the main control + virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; + + // Setup background and foreground colours correctly + virtual void SetupColours(); + +public: + static bool MacGetWindowFromPoint( const wxPoint &point , wxWindowMac** outWin ) ; + virtual bool MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac** outWin ) ; + virtual void MacRedraw( WXHRGN updatergn , long time , bool erase) ; + virtual bool MacCanFocus() const { return true ; } + + virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ; + // this should not be overriden in classes above wxWindowMac because it is called from its destructor via DeleteChildren + virtual void RemoveChild( wxWindowBase *child ); + virtual void MacPaintBorders( int left , int top ) ; + WXWindow MacGetRootWindow() const ; + wxTopLevelWindowMac* MacGetTopLevelWindow() const ; + + virtual WXWidget MacGetContainerForEmbedding() ; + + virtual long MacGetLeftBorderSize() const ; + virtual long MacGetRightBorderSize() const ; + virtual long MacGetTopBorderSize() const ; + virtual long MacGetBottomBorderSize() const ; + + static long MacRemoveBordersFromStyle( long style ) ; + virtual void MacSuperChangedPosition() ; + // the absolute coordinates of this item within the toplevel window may have changed + virtual void MacUpdateDimensions() {} + // the absolute coortinates of this window's root have changed + virtual void MacTopLevelWindowChangedPosition() ; + virtual void MacSuperShown( bool show ) ; + virtual void MacSuperEnabled( bool enable ) ; + bool MacIsReallyShown() const ; + virtual void Update() ; + // for compatibility + void MacUpdateImmediately() { Update() ; } + virtual bool MacSetupCursor( const wxPoint& pt ) ; + +// virtual bool MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ; +// virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ; +// virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ; + const wxBrush& MacGetBackgroundBrush() ; + const wxRegion& MacGetVisibleRegion( bool respectChildrenAndSiblings = true ) ; + bool MacIsWindowScrollbar( const wxScrollBar* sb ) + { return (m_hScrollBar == sb || m_vScrollBar == sb) ; } + static wxWindowMac* s_lastMouseWindow ; +private: +protected: + wxBrush m_macBackgroundBrush ; + wxRegion m_macVisibleRegion ; + int m_x ; + int m_y ; + int m_width ; + int m_height ; + + wxScrollBar* m_hScrollBar ; + wxScrollBar* m_vScrollBar ; + wxString m_label ; + + void MacCreateScrollBars( long style ) ; + void MacRepositionScrollBars() ; + + bool m_backgroundTransparent ; + + // implement the base class pure virtuals + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow(int x, int y, int width, int height); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + +private: + // common part of all ctors + void Init(); + + DECLARE_NO_COPY_CLASS(wxWindowMac) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_WINDOW_H_ -- 2.45.2