From 6762286db6cf974817dead5b88bebf0e390dbb7e Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 17 Jan 2009 10:43:43 +0000 Subject: [PATCH] headermove osx - header files git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58168 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/accel.h | 39 ++- include/wx/osx/app.h | 144 +++++++++- include/wx/osx/bitmap.h | 188 +++++++++++- include/wx/osx/bmpbuttn.h | 56 +++- include/wx/osx/button.h | 101 ++++++- include/wx/osx/carbon/accel.h | 36 --- include/wx/osx/carbon/app.h | 141 --------- include/wx/osx/carbon/bitmap.h | 185 ------------ include/wx/osx/carbon/bmpbuttn.h | 53 ---- include/wx/osx/carbon/button.h | 98 ------- include/wx/osx/carbon/checkbox.h | 83 ------ include/wx/osx/carbon/checklst.h | 94 ------ include/wx/osx/carbon/choice.h | 101 ------- include/wx/osx/carbon/clipbrd.h | 76 ----- include/wx/osx/carbon/colordlg.h | 42 --- include/wx/osx/carbon/combobox.h | 164 ----------- include/wx/osx/carbon/control.h | 53 ---- include/wx/osx/carbon/cursor.h | 55 ---- include/wx/osx/carbon/dataform.h | 69 ----- include/wx/osx/carbon/dataobj.h | 37 --- include/wx/osx/carbon/dataobj2.h | 94 ------ include/wx/osx/carbon/dc.h | 15 - include/wx/osx/carbon/dcclient.h | 72 ----- include/wx/osx/carbon/dcmemory.h | 46 --- include/wx/osx/carbon/dcprint.h | 52 ---- include/wx/osx/carbon/dcscreen.h | 35 --- include/wx/osx/carbon/dialog.h | 79 ------ include/wx/osx/carbon/dirdlg.h | 35 --- include/wx/osx/carbon/dnd.h | 108 ------- include/wx/osx/carbon/filedlg.h | 49 ---- include/wx/osx/carbon/font.h | 139 --------- include/wx/osx/carbon/fontdlg.h | 173 ----------- include/wx/osx/carbon/frame.h | 126 --------- include/wx/osx/carbon/gauge.h | 56 ---- include/wx/osx/carbon/glcanvas.h | 154 ---------- include/wx/osx/carbon/helpxxxx.h | 49 ---- include/wx/osx/carbon/icon.h | 90 ------ include/wx/osx/carbon/imaglist.h | 60 ---- include/wx/osx/carbon/joystick.h | 91 ------ include/wx/osx/carbon/listbox.h | 175 ------------ include/wx/osx/carbon/listctrl.h | 420 --------------------------- include/wx/osx/carbon/mdi.h | 154 ---------- include/wx/osx/carbon/menu.h | 198 ------------- include/wx/osx/carbon/menuitem.h | 84 ------ include/wx/osx/carbon/metafile.h | 178 ------------ include/wx/osx/carbon/mimetype.h | 118 -------- include/wx/osx/carbon/minifram.h | 42 --- include/wx/osx/carbon/msgdlg.h | 36 --- include/wx/osx/carbon/nonownedwnd.h | 128 --------- include/wx/osx/carbon/notebook.h | 145 ---------- include/wx/osx/carbon/palette.h | 41 --- include/wx/osx/carbon/pnghand.h | 39 --- include/wx/osx/carbon/pngread.h | 287 ------------------- include/wx/osx/carbon/popupwin.h | 35 --- include/wx/osx/carbon/printmac.h | 60 ---- include/wx/osx/carbon/radiobox.h | 107 ------- include/wx/osx/carbon/radiobut.h | 94 ------ include/wx/osx/carbon/scrolbar.h | 68 ----- include/wx/osx/carbon/slider.h | 110 ------- include/wx/osx/carbon/sound.h | 55 ---- include/wx/osx/carbon/spinbutt.h | 78 ----- include/wx/osx/carbon/spinctrl.h | 195 ------------- include/wx/osx/carbon/srchctrl.h | 84 ------ include/wx/osx/carbon/statbox.h | 55 ---- include/wx/osx/carbon/statline.h | 57 ---- include/wx/osx/carbon/stattext.h | 54 ---- include/wx/osx/carbon/statusbr.h | 43 --- include/wx/osx/carbon/taskbarosx.h | 49 ---- include/wx/osx/carbon/textctrl.h | 208 -------------- include/wx/osx/carbon/tglbtn.h | 107 ------- include/wx/osx/carbon/toolbar.h | 109 ------- include/wx/osx/carbon/tooltip.h | 58 ---- include/wx/osx/carbon/toplevel.h | 86 ------ include/wx/osx/carbon/treectrl.h | 291 ------------------- include/wx/osx/carbon/window.h | 344 ---------------------- include/wx/osx/checkbox.h | 86 +++++- include/wx/osx/checklst.h | 99 ++++++- include/wx/osx/choice.h | 104 ++++++- include/wx/osx/clipbrd.h | 81 +++++- include/wx/osx/colordlg.h | 46 ++- include/wx/osx/combobox.h | 169 ++++++++++- include/wx/osx/control.h | 56 +++- include/wx/osx/cursor.h | 58 +++- include/wx/osx/dataform.h | 74 ++++- include/wx/osx/dataobj.h | 40 ++- include/wx/osx/dataobj2.h | 99 ++++++- include/wx/osx/dc.h | 20 +- include/wx/osx/dcclient.h | 75 ++++- include/wx/osx/dcmemory.h | 49 +++- include/wx/osx/dcprint.h | 55 +++- include/wx/osx/dcscreen.h | 38 ++- include/wx/osx/dialog.h | 82 +++++- include/wx/osx/dirdlg.h | 38 ++- include/wx/osx/dnd.h | 111 +++++++- include/wx/osx/filedlg.h | 54 +++- include/wx/osx/font.h | 142 +++++++++- include/wx/osx/fontdlg.h | 176 +++++++++++- include/wx/osx/frame.h | 129 ++++++++- include/wx/osx/gauge.h | 59 +++- include/wx/osx/glcanvas.h | 159 ++++++++++- include/wx/osx/helpxxxx.h | 54 +++- include/wx/osx/icon.h | 93 +++++- include/wx/osx/imaglist.h | 65 ++++- include/wx/osx/joystick.h | 94 +++++- include/wx/osx/listbox.h | 180 +++++++++++- include/wx/osx/listctrl.h | 425 +++++++++++++++++++++++++++- include/wx/osx/mdi.h | 159 ++++++++++- include/wx/osx/menu.h | 201 ++++++++++++- include/wx/osx/menuitem.h | 89 +++++- include/wx/osx/metafile.h | 181 +++++++++++- include/wx/osx/mimetype.h | 121 +++++++- include/wx/osx/minifram.h | 45 ++- include/wx/osx/msgdlg.h | 41 ++- include/wx/osx/nonownedwnd.h | 133 ++++++++- include/wx/osx/notebook.h | 148 +++++++++- include/wx/osx/palette.h | 46 ++- include/wx/osx/pnghand.h | 42 ++- include/wx/osx/pngread.h | 290 ++++++++++++++++++- include/wx/osx/popupwin.h | 40 ++- include/wx/osx/printmac.h | 63 ++++- include/wx/osx/radiobox.h | 110 ++++++- include/wx/osx/radiobut.h | 97 ++++++- include/wx/osx/scrolbar.h | 71 ++++- include/wx/osx/slider.h | 113 +++++++- include/wx/osx/sound.h | 58 +++- include/wx/osx/spinbutt.h | 81 +++++- include/wx/osx/spinctrl.h | 200 ++++++++++++- include/wx/osx/srchctrl.h | 89 +++++- include/wx/osx/statbox.h | 58 +++- include/wx/osx/statline.h | 62 +++- include/wx/osx/stattext.h | 57 +++- include/wx/osx/statusbr.h | 48 +++- include/wx/osx/taskbarosx.h | 52 +++- include/wx/osx/textctrl.h | 211 +++++++++++++- include/wx/osx/tglbtn.h | 112 +++++++- include/wx/osx/toolbar.h | 112 +++++++- include/wx/osx/tooltip.h | 63 ++++- include/wx/osx/toplevel.h | 91 +++++- include/wx/osx/treectrl.h | 296 ++++++++++++++++++- include/wx/osx/window.h | 345 +++++++++++++++++++++- 140 files changed, 7157 insertions(+), 7508 deletions(-) delete mode 100644 include/wx/osx/carbon/accel.h delete mode 100644 include/wx/osx/carbon/app.h delete mode 100644 include/wx/osx/carbon/bitmap.h delete mode 100644 include/wx/osx/carbon/bmpbuttn.h delete mode 100644 include/wx/osx/carbon/button.h delete mode 100644 include/wx/osx/carbon/checkbox.h delete mode 100644 include/wx/osx/carbon/checklst.h delete mode 100644 include/wx/osx/carbon/choice.h delete mode 100644 include/wx/osx/carbon/clipbrd.h delete mode 100644 include/wx/osx/carbon/colordlg.h delete mode 100644 include/wx/osx/carbon/combobox.h delete mode 100644 include/wx/osx/carbon/control.h delete mode 100644 include/wx/osx/carbon/cursor.h delete mode 100644 include/wx/osx/carbon/dataform.h delete mode 100644 include/wx/osx/carbon/dataobj.h delete mode 100644 include/wx/osx/carbon/dataobj2.h delete mode 100644 include/wx/osx/carbon/dc.h delete mode 100644 include/wx/osx/carbon/dcclient.h delete mode 100644 include/wx/osx/carbon/dcmemory.h delete mode 100644 include/wx/osx/carbon/dcprint.h delete mode 100644 include/wx/osx/carbon/dcscreen.h delete mode 100644 include/wx/osx/carbon/dialog.h delete mode 100644 include/wx/osx/carbon/dirdlg.h delete mode 100644 include/wx/osx/carbon/dnd.h delete mode 100644 include/wx/osx/carbon/filedlg.h delete mode 100644 include/wx/osx/carbon/font.h delete mode 100644 include/wx/osx/carbon/fontdlg.h delete mode 100644 include/wx/osx/carbon/frame.h delete mode 100644 include/wx/osx/carbon/gauge.h delete mode 100644 include/wx/osx/carbon/glcanvas.h delete mode 100644 include/wx/osx/carbon/helpxxxx.h delete mode 100644 include/wx/osx/carbon/icon.h delete mode 100644 include/wx/osx/carbon/imaglist.h delete mode 100644 include/wx/osx/carbon/joystick.h delete mode 100644 include/wx/osx/carbon/listbox.h delete mode 100644 include/wx/osx/carbon/listctrl.h delete mode 100644 include/wx/osx/carbon/mdi.h delete mode 100644 include/wx/osx/carbon/menu.h delete mode 100644 include/wx/osx/carbon/menuitem.h delete mode 100644 include/wx/osx/carbon/metafile.h delete mode 100644 include/wx/osx/carbon/mimetype.h delete mode 100644 include/wx/osx/carbon/minifram.h delete mode 100644 include/wx/osx/carbon/msgdlg.h delete mode 100644 include/wx/osx/carbon/nonownedwnd.h delete mode 100644 include/wx/osx/carbon/notebook.h delete mode 100644 include/wx/osx/carbon/palette.h delete mode 100644 include/wx/osx/carbon/pnghand.h delete mode 100644 include/wx/osx/carbon/pngread.h delete mode 100644 include/wx/osx/carbon/popupwin.h delete mode 100644 include/wx/osx/carbon/printmac.h delete mode 100644 include/wx/osx/carbon/radiobox.h delete mode 100644 include/wx/osx/carbon/radiobut.h delete mode 100644 include/wx/osx/carbon/scrolbar.h delete mode 100644 include/wx/osx/carbon/slider.h delete mode 100644 include/wx/osx/carbon/sound.h delete mode 100644 include/wx/osx/carbon/spinbutt.h delete mode 100644 include/wx/osx/carbon/spinctrl.h delete mode 100644 include/wx/osx/carbon/srchctrl.h delete mode 100644 include/wx/osx/carbon/statbox.h delete mode 100644 include/wx/osx/carbon/statline.h delete mode 100644 include/wx/osx/carbon/stattext.h delete mode 100644 include/wx/osx/carbon/statusbr.h delete mode 100644 include/wx/osx/carbon/taskbarosx.h delete mode 100644 include/wx/osx/carbon/textctrl.h delete mode 100644 include/wx/osx/carbon/tglbtn.h delete mode 100644 include/wx/osx/carbon/toolbar.h delete mode 100644 include/wx/osx/carbon/tooltip.h delete mode 100644 include/wx/osx/carbon/toplevel.h delete mode 100644 include/wx/osx/carbon/treectrl.h delete mode 100644 include/wx/osx/carbon/window.h diff --git a/include/wx/osx/accel.h b/include/wx/osx/accel.h index 85996dc7a0..5a81d61840 100644 --- a/include/wx/osx/accel.h +++ b/include/wx/osx/accel.h @@ -1,5 +1,36 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/accel.h" -#else -#include "wx/osx/carbon/accel.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/string.h" +#include "wx/event.h" + +class WXDLLIMPEXP_CORE wxAcceleratorTable: public wxObject +{ +DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) +public: + wxAcceleratorTable(); + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array + + virtual ~wxAcceleratorTable(); + + bool Ok() const { return IsOk(); } + bool IsOk() const; + + int GetCommand( wxKeyEvent &event ); +}; + +// WXDLLIMPEXP_DATA_CORE(extern wxAcceleratorTable) wxNullAcceleratorTable; + #endif + // _WX_ACCEL_H_ diff --git a/include/wx/osx/app.h b/include/wx/osx/app.h index 127c195927..2ebb72cc1a 100644 --- a/include/wx/osx/app.h +++ b/include/wx/osx/app.h @@ -1,5 +1,141 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/app.h" -#else -#include "wx/osx/carbon/app.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/defs.h" +#include "wx/object.h" +#include "wx/gdicmn.h" +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxFrame; +class WXDLLIMPEXP_FWD_CORE wxWindowMac; +class WXDLLIMPEXP_FWD_CORE wxApp ; +class WXDLLIMPEXP_FWD_CORE wxKeyEvent; +class WXDLLIMPEXP_FWD_BASE wxLog; + +// Force an exit from main loop +void WXDLLIMPEXP_CORE wxExit(); + +// Yield to other apps/messages +bool WXDLLIMPEXP_CORE wxYield(); + +// Represents the application. Derive OnInit and declare +// a new App object to start application +class WXDLLIMPEXP_CORE wxApp: public wxAppBase +{ + DECLARE_DYNAMIC_CLASS(wxApp) + + wxApp(); + virtual ~wxApp() {} + + virtual bool Yield(bool onlyIfNeeded = FALSE); + virtual void WakeUpIdle(); + + virtual void SetPrintMode(int mode) { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } + + // calling OnInit with an auto-release pool ready ... + virtual bool CallOnInit(); +#if wxUSE_GUI + // setting up all MacOS Specific Event-Handlers etc + virtual bool OnInitGui(); +#endif // wxUSE_GUI + + virtual bool ProcessIdle(); + + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + +protected: + int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT + +public: + + static bool sm_isEmbedded; + // Implementation + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + // 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 ; } + + // adding a CFType object to be released only at the end of the current event cycle (increases the + // refcount of the object passed), needed in case we are in the middle of an event concering an object + // we want to delete and cannot do it immediately + // TODO change semantics to be in line with cocoa (make autrelease NOT increase the count) + void MacAddToAutorelease( void* cfrefobj ); +public: + static wxWindow* s_captureWindow ; + static long s_lastModifiers ; + + int m_nCmdShow; + +private: + // mac specifics + virtual bool DoInitGui(); + virtual void DoCleanUp(); + + WXEVENTHANDLERREF m_macEventHandler ; + WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ; + WXEVENTREF m_macCurrentEvent ; + CFRunLoopSourceRef m_macEventPosted ; + +public: + static long s_macAboutMenuItemId ; + static long s_macPreferencesMenuItemId ; + static long s_macExitMenuItemId ; + static wxString s_macHelpMenuTitleName ; + + WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; } + + // For embedded use. By default does nothing. + virtual void MacHandleUnhandledEvent( WXEVENTREF ev ); + + bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; + bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; + bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; + void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; +#if wxOSX_USE_CARBON + // we only have applescript on these + virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; + virtual short MacHandleAEGURL(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) ; #endif + // in response of an open-document apple event + virtual void MacOpenFile(const wxString &fileName) ; + // in response of a get-url apple event + virtual void MacOpenURL(const wxString &url) ; + // 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() ; + + // Hide the application windows the same as the system hide command would do it. + void MacHideApp(); + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_APP_H_ + diff --git a/include/wx/osx/bitmap.h b/include/wx/osx/bitmap.h index 8f27f20128..a9d2f3fe36 100644 --- a/include/wx/osx/bitmap.h +++ b/include/wx/osx/bitmap.h @@ -1,5 +1,185 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/bitmap.h" -#else -#include "wx/osx/carbon/bitmap.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/palette.h" + +// Bitmap +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class wxBitmapRefData ; +class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; +class WXDLLIMPEXP_FWD_CORE wxControl; +class WXDLLIMPEXP_FWD_CORE wxCursor; +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxImage; +class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; + +// A mask is a bitmap used for drawing bitmaps +// Internally it is stored as a 8 bit deep memory chunk, 0 = black means the source will be drawn +// 255 = white means the source will not be drawn, no other values will be present +// 8 bit is chosen only for performance reasons, note also that this is the inverse value range +// from alpha, where 0 = invisible , 255 = fully drawn + +class WXDLLIMPEXP_CORE wxMask: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxMask) + +public: + wxMask(); + + // Copy constructor + wxMask(const wxMask& mask); + + // 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 mono bitmap (black meaning show pixels, white meaning transparent) + wxMask(const wxBitmap& bitmap); + + // implementation helper only : construct a mask from a 32 bit memory buffer + wxMask(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ; + + virtual ~wxMask(); + + bool Create(const wxBitmap& bitmap, const wxColour& colour); + bool Create(const wxBitmap& bitmap); + bool Create(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ; + + // Implementation below + + void Init() ; + + // a 8 bit depth mask + void* GetRawAccess() const; + int GetBytesPerRow() const { return m_bytesPerRow ; } + // renders/updates native representation when necessary + void RealizeNative() ; + + WXHBITMAP GetHBITMAP() const ; + + +private: + wxMemoryBuffer m_memBuf ; + int m_bytesPerRow ; + int m_width ; + int m_height ; + + WXHBITMAP m_maskBitmap ; + +}; + +class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase +{ + DECLARE_DYNAMIC_CLASS(wxBitmap) + + friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; + +public: + wxBitmap(); // Platform-specific + + // Initialize with raw data. + wxBitmap(const char bits[], int width, int height, int depth = 1); + + // Initialize with XPM data + wxBitmap(const char* const* bits); + + // Load a file or resource + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + + // Constructor for generalised creation from data + wxBitmap(const 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); + + // Convert from wxIcon + wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } + + virtual ~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(const void* data, wxBitmapType type, int width, int height, int depth = 1); + // virtual bool Create( WXHICON icon) ; + virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); + virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; + + wxBitmapRefData *GetBitmapData() const + { return (wxBitmapRefData *)m_refData; } + + // copies the contents and mask of the given (colour) icon to the bitmap + virtual bool CopyFromIcon(const wxIcon& icon); + + int GetWidth() const; + int GetHeight() const; + int GetDepth() const; + void SetWidth(int w); + void SetHeight(int h); + void SetDepth(int d); + 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) ; + + static void InitStandardHandlers(); + + // raw bitmap access support functions, for internal use only + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + + // these functions are internal and shouldn't be used, they risk to + // disappear in the future + bool HasAlpha() const; + void UseAlpha(); + + // returns the 'native' implementation, a GWorldPtr for the content and one for the mask + WXHBITMAP GetHBITMAP( WXHBITMAP * mask = NULL ) const; + + // returns a CGImageRef which must released after usage with CGImageRelease + CGImageRef CreateCGImage() const ; + +#if wxOSX_USE_COCOA_OR_IPHONE + // returns an autoreleased version of the image + WX_NSImage GetNSImage() const; #endif + // returns a IconRef which must be retained before and released after usage + IconRef GetIconRef() const; + // returns a IconRef which must be released after usage + IconRef CreateIconRef() const; + // get read only access to the underlying buffer + void *GetRawAccess() const ; + // brackets to the underlying OS structure for read/write access + // makes sure that no cached images will be constructed until terminated + void *BeginRawAccess() ; + void EndRawAccess() ; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; +}; + +#endif // _WX_BITMAP_H_ diff --git a/include/wx/osx/bmpbuttn.h b/include/wx/osx/bmpbuttn.h index 50a7fca286..265d2757bd 100644 --- a/include/wx/osx/bmpbuttn.h +++ b/include/wx/osx/bmpbuttn.h @@ -1,5 +1,53 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/bmpbuttn.h" -#else -#include "wx/osx/carbon/bmpbuttn.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/button.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr[]; + +#define wxDEFAULT_BUTTON_MARGIN 4 + +class WXDLLIMPEXP_CORE 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); + +protected: + virtual wxSize DoGetBestSize() const; +}; + #endif + // _WX_BMPBUTTN_H_ diff --git a/include/wx/osx/button.h b/include/wx/osx/button.h index 0fcd3e030b..ccf647576f 100644 --- a/include/wx/osx/button.h +++ b/include/wx/osx/button.h @@ -1,5 +1,98 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/button.h" -#else -#include "wx/osx/carbon/button.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/control.h" +#include "wx/gdicmn.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr[]; + +// Pushbutton +class WXDLLIMPEXP_CORE wxButton: public wxButtonBase +{ +public: + wxButton() {} + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + 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 = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + static wxSize GetDefaultSize(); + + virtual wxWindow *SetDefault(); + virtual void Command(wxCommandEvent& event); + + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + +protected: + virtual wxSize DoGetBestSize() const ; + + DECLARE_DYNAMIC_CLASS(wxButton) +}; + +class WXDLLIMPEXP_CORE wxDisclosureTriangle: public wxControl +{ +public: + wxDisclosureTriangle(wxWindow *parent, + wxWindowID id, + const wxString& label = wxEmptyString, + 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 = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + void SetOpen( bool open ); + bool IsOpen() const; + + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + +protected: + virtual wxSize DoGetBestSize() const ; + +}; + #endif + // _WX_BUTTON_H_ diff --git a/include/wx/osx/carbon/accel.h b/include/wx/osx/carbon/accel.h deleted file mode 100644 index 5a81d61840..0000000000 --- a/include/wx/osx/carbon/accel.h +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/string.h" -#include "wx/event.h" - -class WXDLLIMPEXP_CORE wxAcceleratorTable: public wxObject -{ -DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) -public: - wxAcceleratorTable(); - wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); // Load from array - - virtual ~wxAcceleratorTable(); - - bool Ok() const { return IsOk(); } - bool IsOk() const; - - int GetCommand( wxKeyEvent &event ); -}; - -// WXDLLIMPEXP_DATA_CORE(extern wxAcceleratorTable) wxNullAcceleratorTable; - -#endif - // _WX_ACCEL_H_ diff --git a/include/wx/osx/carbon/app.h b/include/wx/osx/carbon/app.h deleted file mode 100644 index 2ebb72cc1a..0000000000 --- a/include/wx/osx/carbon/app.h +++ /dev/null @@ -1,141 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/defs.h" -#include "wx/object.h" -#include "wx/gdicmn.h" -#include "wx/event.h" - -class WXDLLIMPEXP_FWD_CORE wxFrame; -class WXDLLIMPEXP_FWD_CORE wxWindowMac; -class WXDLLIMPEXP_FWD_CORE wxApp ; -class WXDLLIMPEXP_FWD_CORE wxKeyEvent; -class WXDLLIMPEXP_FWD_BASE wxLog; - -// Force an exit from main loop -void WXDLLIMPEXP_CORE wxExit(); - -// Yield to other apps/messages -bool WXDLLIMPEXP_CORE wxYield(); - -// Represents the application. Derive OnInit and declare -// a new App object to start application -class WXDLLIMPEXP_CORE wxApp: public wxAppBase -{ - DECLARE_DYNAMIC_CLASS(wxApp) - - wxApp(); - virtual ~wxApp() {} - - virtual bool Yield(bool onlyIfNeeded = FALSE); - virtual void WakeUpIdle(); - - virtual void SetPrintMode(int mode) { m_printMode = mode; } - virtual int GetPrintMode() const { return m_printMode; } - - // calling OnInit with an auto-release pool ready ... - virtual bool CallOnInit(); -#if wxUSE_GUI - // setting up all MacOS Specific Event-Handlers etc - virtual bool OnInitGui(); -#endif // wxUSE_GUI - - virtual bool ProcessIdle(); - - // implementation only - void OnIdle(wxIdleEvent& event); - void OnEndSession(wxCloseEvent& event); - void OnQueryEndSession(wxCloseEvent& event); - -protected: - int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT - -public: - - static bool sm_isEmbedded; - // Implementation - virtual bool Initialize(int& argc, wxChar **argv); - virtual void CleanUp(); - - // 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 ; } - - // adding a CFType object to be released only at the end of the current event cycle (increases the - // refcount of the object passed), needed in case we are in the middle of an event concering an object - // we want to delete and cannot do it immediately - // TODO change semantics to be in line with cocoa (make autrelease NOT increase the count) - void MacAddToAutorelease( void* cfrefobj ); -public: - static wxWindow* s_captureWindow ; - static long s_lastModifiers ; - - int m_nCmdShow; - -private: - // mac specifics - virtual bool DoInitGui(); - virtual void DoCleanUp(); - - WXEVENTHANDLERREF m_macEventHandler ; - WXEVENTHANDLERCALLREF m_macCurrentEventHandlerCallRef ; - WXEVENTREF m_macCurrentEvent ; - CFRunLoopSourceRef m_macEventPosted ; - -public: - static long s_macAboutMenuItemId ; - static long s_macPreferencesMenuItemId ; - static long s_macExitMenuItemId ; - static wxString s_macHelpMenuTitleName ; - - WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; } - - // For embedded use. By default does nothing. - virtual void MacHandleUnhandledEvent( WXEVENTREF ev ); - - bool MacSendKeyDownEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; - bool MacSendKeyUpEvent( wxWindow* focus , long keyval , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; - bool MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; - void MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) ; -#if wxOSX_USE_CARBON - // we only have applescript on these - virtual short MacHandleAEODoc(const WXAPPLEEVENTREF event , WXAPPLEEVENTREF reply) ; - virtual short MacHandleAEGURL(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) ; -#endif - // in response of an open-document apple event - virtual void MacOpenFile(const wxString &fileName) ; - // in response of a get-url apple event - virtual void MacOpenURL(const wxString &url) ; - // 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() ; - - // Hide the application windows the same as the system hide command would do it. - void MacHideApp(); - - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_APP_H_ - diff --git a/include/wx/osx/carbon/bitmap.h b/include/wx/osx/carbon/bitmap.h deleted file mode 100644 index a9d2f3fe36..0000000000 --- a/include/wx/osx/carbon/bitmap.h +++ /dev/null @@ -1,185 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/palette.h" - -// Bitmap -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class wxBitmapRefData ; -class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; -class WXDLLIMPEXP_FWD_CORE wxControl; -class WXDLLIMPEXP_FWD_CORE wxCursor; -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxImage; -class WXDLLIMPEXP_FWD_CORE wxPixelDataBase; - -// A mask is a bitmap used for drawing bitmaps -// Internally it is stored as a 8 bit deep memory chunk, 0 = black means the source will be drawn -// 255 = white means the source will not be drawn, no other values will be present -// 8 bit is chosen only for performance reasons, note also that this is the inverse value range -// from alpha, where 0 = invisible , 255 = fully drawn - -class WXDLLIMPEXP_CORE wxMask: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxMask) - -public: - wxMask(); - - // Copy constructor - wxMask(const wxMask& mask); - - // 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 mono bitmap (black meaning show pixels, white meaning transparent) - wxMask(const wxBitmap& bitmap); - - // implementation helper only : construct a mask from a 32 bit memory buffer - wxMask(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ; - - virtual ~wxMask(); - - bool Create(const wxBitmap& bitmap, const wxColour& colour); - bool Create(const wxBitmap& bitmap); - bool Create(const wxMemoryBuffer& buf, int width , int height , int bytesPerRow ) ; - - // Implementation below - - void Init() ; - - // a 8 bit depth mask - void* GetRawAccess() const; - int GetBytesPerRow() const { return m_bytesPerRow ; } - // renders/updates native representation when necessary - void RealizeNative() ; - - WXHBITMAP GetHBITMAP() const ; - - -private: - wxMemoryBuffer m_memBuf ; - int m_bytesPerRow ; - int m_width ; - int m_height ; - - WXHBITMAP m_maskBitmap ; - -}; - -class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase -{ - DECLARE_DYNAMIC_CLASS(wxBitmap) - - friend class WXDLLIMPEXP_FWD_CORE wxBitmapHandler; - -public: - wxBitmap(); // Platform-specific - - // Initialize with raw data. - wxBitmap(const char bits[], int width, int height, int depth = 1); - - // Initialize with XPM data - wxBitmap(const char* const* bits); - - // Load a file or resource - wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); - - // Constructor for generalised creation from data - wxBitmap(const 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); - - // Convert from wxIcon - wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); } - - virtual ~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(const void* data, wxBitmapType type, int width, int height, int depth = 1); - // virtual bool Create( WXHICON icon) ; - virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE); - virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const; - - wxBitmapRefData *GetBitmapData() const - { return (wxBitmapRefData *)m_refData; } - - // copies the contents and mask of the given (colour) icon to the bitmap - virtual bool CopyFromIcon(const wxIcon& icon); - - int GetWidth() const; - int GetHeight() const; - int GetDepth() const; - void SetWidth(int w); - void SetHeight(int h); - void SetDepth(int d); - 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) ; - - static void InitStandardHandlers(); - - // raw bitmap access support functions, for internal use only - void *GetRawData(wxPixelDataBase& data, int bpp); - void UngetRawData(wxPixelDataBase& data); - - // these functions are internal and shouldn't be used, they risk to - // disappear in the future - bool HasAlpha() const; - void UseAlpha(); - - // returns the 'native' implementation, a GWorldPtr for the content and one for the mask - WXHBITMAP GetHBITMAP( WXHBITMAP * mask = NULL ) const; - - // returns a CGImageRef which must released after usage with CGImageRelease - CGImageRef CreateCGImage() const ; - -#if wxOSX_USE_COCOA_OR_IPHONE - // returns an autoreleased version of the image - WX_NSImage GetNSImage() const; -#endif - // returns a IconRef which must be retained before and released after usage - IconRef GetIconRef() const; - // returns a IconRef which must be released after usage - IconRef CreateIconRef() const; - // get read only access to the underlying buffer - void *GetRawAccess() const ; - // brackets to the underlying OS structure for read/write access - // makes sure that no cached images will be constructed until terminated - void *BeginRawAccess() ; - void EndRawAccess() ; - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; -}; - -#endif // _WX_BITMAP_H_ diff --git a/include/wx/osx/carbon/bmpbuttn.h b/include/wx/osx/carbon/bmpbuttn.h deleted file mode 100644 index 265d2757bd..0000000000 --- a/include/wx/osx/carbon/bmpbuttn.h +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/button.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr[]; - -#define wxDEFAULT_BUTTON_MARGIN 4 - -class WXDLLIMPEXP_CORE 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); - -protected: - virtual wxSize DoGetBestSize() const; -}; - -#endif - // _WX_BMPBUTTN_H_ diff --git a/include/wx/osx/carbon/button.h b/include/wx/osx/carbon/button.h deleted file mode 100644 index ccf647576f..0000000000 --- a/include/wx/osx/carbon/button.h +++ /dev/null @@ -1,98 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/control.h" -#include "wx/gdicmn.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxButtonNameStr[]; - -// Pushbutton -class WXDLLIMPEXP_CORE wxButton: public wxButtonBase -{ -public: - wxButton() {} - wxButton(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - 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 = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - static wxSize GetDefaultSize(); - - virtual wxWindow *SetDefault(); - virtual void Command(wxCommandEvent& event); - - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - -protected: - virtual wxSize DoGetBestSize() const ; - - DECLARE_DYNAMIC_CLASS(wxButton) -}; - -class WXDLLIMPEXP_CORE wxDisclosureTriangle: public wxControl -{ -public: - wxDisclosureTriangle(wxWindow *parent, - wxWindowID id, - const wxString& label = wxEmptyString, - 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 = wxEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxButtonNameStr); - - void SetOpen( bool open ); - bool IsOpen() const; - - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - -protected: - virtual wxSize DoGetBestSize() const ; - -}; - -#endif - // _WX_BUTTON_H_ diff --git a/include/wx/osx/carbon/checkbox.h b/include/wx/osx/carbon/checkbox.h deleted file mode 100644 index 85ea0b7739..0000000000 --- a/include/wx/osx/carbon/checkbox.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -// Checkbox item (single checkbox) -class WXDLLIMPEXP_CORE 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; - - virtual void Command(wxCommandEvent& event); - - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); -protected: - void DoSet3StateValue(wxCheckBoxState val); - virtual wxCheckBoxState DoGet3StateValue() const; - - DECLARE_DYNAMIC_CLASS(wxCheckBox) -}; - -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_CORE 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/osx/carbon/checklst.h b/include/wx/osx/carbon/checklst.h deleted file mode 100644 index 5e2fb9774b..0000000000 --- a/include/wx/osx/carbon/checklst.h +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_MAC_CHECKLST_H_ -#define _WX_MAC_CHECKLST_H_ - -class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase -{ -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(unsigned int uiIndex) const; - void Check(unsigned int uiIndex, bool bCheck = true); - - // data callbacks - virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); - virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); - -protected: - // override all methods which add/delete items to update m_checks array as - // well - virtual void OnItemInserted(unsigned int pos); - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoClear(); - - // the array containing the checked status of the items - wxArrayInt m_checks; - - wxListWidgetColumn* m_checkColumn ; - - void Init(); - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxCheckListBox) -}; - -#endif // _WX_MAC_CHECKLST_H_ diff --git a/include/wx/osx/carbon/choice.h b/include/wx/osx/carbon/choice.h deleted file mode 100644 index 829843be36..0000000000 --- a/include/wx/osx/carbon/choice.h +++ /dev/null @@ -1,101 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#include "wx/control.h" - -#include "wx/dynarray.h" -#include "wx/arrstr.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxChoiceNameStr[]; - -WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; - -// Choice item -class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase -{ - DECLARE_DYNAMIC_CLASS(wxChoice) - -public: - wxChoice() - : m_strings(), m_datas() - {} - - 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); - - virtual unsigned int GetCount() const ; - virtual int GetSelection() const ; - virtual void SetSelection(int n); - - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const ; - virtual void SetString(unsigned int pos, const wxString& s); - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - -protected: - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoClear(); - - virtual wxSize DoGetBestSize() const ; - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - - wxArrayString m_strings; - wxChoiceDataArray m_datas ; - wxMenu* m_popUpMenu ; -}; - -#endif - // _WX_CHOICE_H_ diff --git a/include/wx/osx/carbon/clipbrd.h b/include/wx/osx/carbon/clipbrd.h deleted file mode 100644 index db74c5ba46..0000000000 --- a/include/wx/osx/carbon/clipbrd.h +++ /dev/null @@ -1,76 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: clipbrd.h -// Purpose: Clipboard functionality. -// Note: this functionality is under review, and -// is derived from wxWidgets 1.xx code. Please contact -// the wxWidgets 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 wxUSE_CLIPBOARD - -#include "wx/list.h" -#include "wx/module.h" -#include "wx/dataobj.h" // for wxDataFormat - -#include "wx/osx/core/cfref.h" - -//----------------------------------------------------------------------------- -// wxClipboard -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxDataObject; -class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase -{ - DECLARE_DYNAMIC_CLASS(wxClipboard) - -public: - wxClipboard(); - virtual ~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(); - -private: - wxDataObject *m_data; - bool m_open; - wxCFRef m_pasteboard; -}; - -#endif // wxUSE_CLIPBOARD - -#endif // _WX_CLIPBRD_H_ diff --git a/include/wx/osx/carbon/colordlg.h b/include/wx/osx/carbon/colordlg.h deleted file mode 100644 index 219e1b4e19..0000000000 --- a/include/wx/osx/carbon/colordlg.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#include "wx/defs.h" -#include "wx/dialog.h" -#include "wx/cmndata.h" - -/* - * Platform-specific colour dialog implementation - */ - -class WXDLLIMPEXP_CORE 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/osx/carbon/combobox.h b/include/wx/osx/carbon/combobox.h deleted file mode 100644 index 6e0c649aaa..0000000000 --- a/include/wx/osx/carbon/combobox.h +++ /dev/null @@ -1,164 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#include "wx/containr.h" -#include "wx/choice.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr[]; - -// forward declaration of private implementation classes - -class wxComboBoxText; -class wxComboBoxChoice; - -// Combobox item -class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase -{ - DECLARE_DYNAMIC_CLASS(wxComboBox) - - public: - virtual ~wxComboBox(); - - // forward these functions to all subcontrols - virtual bool Enable(bool enable = true); - virtual bool Show(bool show = true); - - // callback functions - virtual void DelegateTextChanged( const wxString& value ); - virtual void DelegateChoice( const wxString& value ); - - wxComboBox() { Init(); } - - 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) - { - Init(); - Create(parent, id, value, pos, size, n, choices, style, validator, name); - } - - 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) - { - Init(); - 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); - - virtual int GetSelection() const; - virtual void SetSelection(int n); - virtual int FindString(const wxString& s, bool bCase = false) const; - virtual wxString GetString(unsigned int n) const; - virtual wxString GetStringSelection() const; - virtual void SetString(unsigned int n, const wxString& s); - - // Text field functions - virtual void SetValue(const wxString& value); - virtual wxString GetValue() const; - virtual void WriteText(const wxString& text); - virtual void GetSelection(long *from, long *to) const; - - // Clipboard operations - virtual void Copy(); - virtual void Cut(); - virtual void Paste(); - virtual void SetInsertionPoint(long pos); - virtual void SetInsertionPointEnd(); - virtual long GetInsertionPoint() const; - virtual wxTextPos 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 bool IsEditable() const; - - virtual unsigned int GetCount() const; - - virtual void Undo(); - virtual void Redo(); - virtual void SelectAll(); - - virtual bool CanCopy() const; - virtual bool CanCut() const; - virtual bool CanPaste() const; - virtual bool CanUndo() const; - virtual bool CanRedo() const; - - virtual wxClientDataType GetClientDataType() const; - - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - - wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST - - WX_DECLARE_CONTROL_CONTAINER(); - -protected: - // common part of all ctors - void Init(); - - // List functions - virtual void DoDeleteOneItem(unsigned int n); - virtual void DoClear(); - - // override the base class virtuals involved in geometry calculations - virtual wxSize DoGetBestSize() const; - virtual void DoMoveWindow(int x, int y, int width, int height); - - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void * DoGetItemClientData(unsigned int n) const; - - virtual void SetClientDataType(wxClientDataType clientDataItemsType); - - // the subcontrols - wxComboBoxText* m_text; - wxComboBoxChoice* m_choice; - - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_COMBOBOX_H_ diff --git a/include/wx/osx/carbon/control.h b/include/wx/osx/carbon/control.h deleted file mode 100644 index 8d7f2652c3..0000000000 --- a/include/wx/osx/carbon/control.h +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -WXDLLIMPEXP_DATA_CORE(extern const char) wxControlNameStr[]; - -// General item class -class WXDLLIMPEXP_CORE wxControl : public wxControlBase -{ - DECLARE_ABSTRACT_CLASS(wxControl) - -public: - wxControl(); - wxControl(wxWindow *parent, wxWindowID winid, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxControlNameStr) - { - Create(parent, winid, pos, size, style, validator, name); - } - - bool Create(wxWindow *parent, wxWindowID winid, - 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); - - void OnKeyDown( wxKeyEvent &event ) ; -}; - -#endif - // _WX_CONTROL_H_ diff --git a/include/wx/osx/carbon/cursor.h b/include/wx/osx/carbon/cursor.h deleted file mode 100644 index fe0c01391c..0000000000 --- a/include/wx/osx/carbon/cursor.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#include "wx/bitmap.h" - -// Cursor -class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject -{ -public: - wxCursor(); - - wxCursor(const wxImage & image) ; - wxCursor(const char* const* bits); - wxCursor(const wxString& name, - wxBitmapType type = wxCURSOR_DEFAULT_TYPE, - int hotSpotX = 0, int hotSpotY = 0); - - wxCursor(wxStockCursor id) { InitFromStock(id); } -#if WXWIN_COMPATIBILITY_2_8 - wxCursor(int id) { InitFromStock((wxStockCursor)id); } -#endif - virtual ~wxCursor(); - - bool CreateFromXpm(const char* const* bits); - - void MacInstall() const ; - - void SetHCURSOR(WXHCURSOR cursor); - WXHCURSOR GetHCURSOR() const; - -private: - void InitFromStock(wxStockCursor); - - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - - void CreateFromImage(const wxImage & image) ; - - DECLARE_DYNAMIC_CLASS(wxCursor) -}; - -extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor); - -#endif // _WX_CURSOR_H_ diff --git a/include/wx/osx/carbon/dataform.h b/include/wx/osx/carbon/dataform.h deleted file mode 100644 index 910dfc5fef..0000000000 --- a/include/wx/osx/carbon/dataform.h +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// 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 WXDLLIMPEXP_CORE wxDataFormat -{ -public: - typedef unsigned long NativeFormat; - - wxDataFormat(); - wxDataFormat(wxDataFormatId vType); - wxDataFormat(const wxDataFormat& rFormat); - wxDataFormat(const wxString& rId); - wxDataFormat(const wxChar* pId); - wxDataFormat(NativeFormat vFormat); - ~wxDataFormat(); - - wxDataFormat& operator=(NativeFormat vFormat) - { SetId(vFormat); return *this; } - - // comparison (must have both versions) - bool operator==(const wxDataFormat& format) const ; - bool operator!=(const wxDataFormat& format) const - { return ! ( *this == format ); } - bool operator==(wxDataFormatId format) const - { return m_type == (wxDataFormatId)format; } - bool operator!=(wxDataFormatId format) const - { return m_type != (wxDataFormatId)format; } - - wxDataFormat& operator=(const wxDataFormat& 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 wxString& pId); - - // implementation - wxDataFormatId GetType() const { return m_type; } - void SetType( wxDataFormatId type ); - - // returns true if the format is one of those defined in wxDataFormatId - bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; } - -private: - wxDataFormatId m_type; - NativeFormat m_format; - // indicates the type in case of wxDF_PRIVATE : - wxString m_id ; -}; - -#endif // _WX_MAC_DATAFORM_H diff --git a/include/wx/osx/carbon/dataobj.h b/include/wx/osx/carbon/dataobj.h deleted file mode 100644 index 4b027bfe13..0000000000 --- a/include/wx/osx/carbon/dataobj.h +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// 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_ - -// ---------------------------------------------------------------------------- -// wxDataObject is the same as wxDataObjectBase under wxGTK -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase -{ -public: - wxDataObject(); -#ifdef __DARWIN__ - virtual ~wxDataObject() { } -#endif - - virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; - void AddToPasteboard( void * pasteboardRef , int itemID ); - // returns true if the passed in format is present in the pasteboard - static bool IsFormatInPasteboard( void * pasteboardRef, const wxDataFormat &dataFormat ); - // returns true if any of the accepted formats of this dataobj is in the pasteboard - bool HasDataInPasteboard( void * pasteboardRef ); - bool GetFromPasteboard( void * pasteboardRef ); -}; - -#endif // _WX_MAC_DATAOBJ_H_ - diff --git a/include/wx/osx/carbon/dataobj2.h b/include/wx/osx/carbon/dataobj2.h deleted file mode 100644 index 8caa5b4e6d..0000000000 --- a/include/wx/osx/carbon/dataobj2.h +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: mac/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_MAC_DATAOBJ2_H_ -#define _WX_MAC_DATAOBJ2_H_ - -// ---------------------------------------------------------------------------- -// wxBitmapDataObject is a specialization of wxDataObject for bitmaps -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase -{ -public: - // ctors - wxBitmapDataObject(); - wxBitmapDataObject(const wxBitmap& bitmap); - - // destr - virtual ~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); - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } - -protected : - void Init() ; - void Clear() ; - - void* m_pictHandle ; - bool m_pictCreated ; -}; - -// ---------------------------------------------------------------------------- -// wxFileDataObject is a specialization of wxDataObject for file names -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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); - // Must provide overloads to avoid hiding them (and warnings about it) - virtual size_t GetDataSize(const wxDataFormat&) const - { - return GetDataSize(); - } - virtual bool GetDataHere(const wxDataFormat&, void *buf) const - { - return GetDataHere(buf); - } - virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) - { - return SetData(len, buf); - } -protected: - // translates the filenames stored into a utf8 encoded char stream - void GetFileNames(wxCharBuffer &buf) const ; -}; - -#endif // _WX_MAC_DATAOBJ2_H_ - diff --git a/include/wx/osx/carbon/dc.h b/include/wx/osx/carbon/dc.h deleted file mode 100644 index 1e66662f2c..0000000000 --- a/include/wx/osx/carbon/dc.h +++ /dev/null @@ -1,15 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#endif // _WX_DC_H_ diff --git a/include/wx/osx/carbon/dcclient.h b/include/wx/osx/carbon/dcclient.h deleted file mode 100644 index 3c677f99ad..0000000000 --- a/include/wx/osx/carbon/dcclient.h +++ /dev/null @@ -1,72 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/dc.h" -#include "wx/dcgraph.h" - -//----------------------------------------------------------------------------- -// classes -//----------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxPaintDC; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -class WXDLLIMPEXP_CORE wxWindowDCImpl: public wxGCDCImpl -{ -public: - wxWindowDCImpl( wxDC *owner ); - wxWindowDCImpl( wxDC *owner, wxWindow *window ); - virtual ~wxWindowDCImpl(); - - virtual void DoGetSize( int *width, int *height ) const; - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const; - -protected: - bool m_release; - int m_width; - int m_height; - - DECLARE_CLASS(wxWindowDCImpl) - DECLARE_NO_COPY_CLASS(wxWindowDCImpl) -}; - - -class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl -{ -public: - wxClientDCImpl( wxDC *owner ); - wxClientDCImpl( wxDC *owner, wxWindow *window ); - virtual ~wxClientDCImpl(); - -private: - DECLARE_CLASS(wxClientDCImpl) - DECLARE_NO_COPY_CLASS(wxClientDCImpl) -}; - - -class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl -{ -public: - wxPaintDCImpl( wxDC *owner ); - wxPaintDCImpl( wxDC *owner, wxWindow *win ); - virtual ~wxPaintDCImpl(); - -protected: - DECLARE_CLASS(wxPaintDCImpl) - DECLARE_NO_COPY_CLASS(wxPaintDCImpl) -}; - - -#endif - // _WX_DCCLIENT_H_ diff --git a/include/wx/osx/carbon/dcmemory.h b/include/wx/osx/carbon/dcmemory.h deleted file mode 100644 index 7c69b01f79..0000000000 --- a/include/wx/osx/carbon/dcmemory.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/osx/carbon/dcclient.h" - -class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxPaintDCImpl -{ -public: - wxMemoryDCImpl( wxMemoryDC *owner ); - wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); - wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); - - virtual ~wxMemoryDCImpl(); - - virtual void DoGetSize( int *width, int *height ) const; - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const - { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } - virtual void DoSelect(const wxBitmap& bitmap); - - virtual const wxBitmap& GetSelectedBitmap() const - { return m_selected; } - virtual wxBitmap& GetSelectedBitmap() - { return m_selected; } - -private: - void Init(); - - wxBitmap m_selected; - - DECLARE_CLASS(wxMemoryDCImpl) - DECLARE_NO_COPY_CLASS(wxMemoryDCImpl) -}; - -#endif - // _WX_DCMEMORY_H_ diff --git a/include/wx/osx/carbon/dcprint.h b/include/wx/osx/carbon/dcprint.h deleted file mode 100644 index 4380f4f4f2..0000000000 --- a/include/wx/osx/carbon/dcprint.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#include "wx/dc.h" -#include "wx/dcgraph.h" -#include "wx/cmndata.h" - -class wxNativePrinterDC ; - -class WXDLLIMPEXP_CORE wxPrinterDCImpl: public wxGCDCImpl -{ -public: -#if wxUSE_PRINTING_ARCHITECTURE - - wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printdata ); - virtual ~wxPrinterDCImpl(); - - virtual bool StartDoc( const wxString& WXUNUSED(message) ) ; - virtual void EndDoc(void) ; - virtual void StartPage(void) ; - virtual void EndPage(void) ; - - wxRect GetPaperRect() const; - - wxPrintData& GetPrintData() { return m_printData; } - virtual wxSize GetPPI() const; - -protected: - virtual void DoGetSize( int *width, int *height ) const; - - wxPrintData m_printData ; - wxNativePrinterDC* m_nativePrinterDC ; - -private: - DECLARE_CLASS(wxPrinterDC) -#endif // wxUSE_PRINTING_ARCHITECTURE -}; - -#endif - // _WX_DCPRINT_H_ - diff --git a/include/wx/osx/carbon/dcscreen.h b/include/wx/osx/carbon/dcscreen.h deleted file mode 100644 index 8bf2aa52f4..0000000000 --- a/include/wx/osx/carbon/dcscreen.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/dcclient.h" -#include "wx/osx/carbon/dcclient.h" - -class WXDLLIMPEXP_CORE wxScreenDCImpl: public wxWindowDCImpl -{ -public: - wxScreenDCImpl( wxDC *owner ); - virtual ~wxScreenDCImpl(); - - virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const; -private: - void* m_overlayWindow; - -private: - DECLARE_CLASS(wxScreenDCImpl) - DECLARE_NO_COPY_CLASS(wxScreenDCImpl) -}; - -#endif - // _WX_DCSCREEN_H_ - diff --git a/include/wx/osx/carbon/dialog.h b/include/wx/osx/carbon/dialog.h deleted file mode 100644 index 351f6b8aee..0000000000 --- a/include/wx/osx/carbon/dialog.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/panel.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; - -// Dialog boxes -class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase -{ - DECLARE_DYNAMIC_CLASS(wxDialog) - -public: - wxDialog() { Init(); } - - // 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) - { - 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_DIALOG_STYLE, - const wxString& name = wxDialogNameStr); - - virtual ~wxDialog(); - -// virtual bool Destroy(); - virtual 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); - - // implementation - // -------------- - - // show modal dialog and enter modal loop - void DoShowModal(); - -protected: - // mac also takes command-period as cancel - virtual bool IsEscapeKey(const wxKeyEvent& event); - -private: - void Init(); - - bool m_isModalStyle; -}; - -#endif - // _WX_DIALOG_H_ diff --git a/include/wx/osx/carbon/dirdlg.h b/include/wx/osx/carbon/dirdlg.h deleted file mode 100644 index 8e7761505d..0000000000 --- a/include/wx/osx/carbon/dirdlg.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase -{ -public: - wxDirDialog(wxWindow *parent, - const wxString& message = wxDirSelectorPromptStr, - const wxString& defaultPath = _T(""), - long style = wxDD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - const wxString& name = wxDirDialogNameStr); - - virtual int ShowModal(); - -protected: - wxWindow * m_parent; - - DECLARE_DYNAMIC_CLASS(wxDirDialog) -}; - -#endif - // _WX_DIRDLG_H_ diff --git a/include/wx/osx/carbon/dnd.h b/include/wx/osx/carbon/dnd.h deleted file mode 100644 index 2f0b8d48ef..0000000000 --- a/include/wx/osx/carbon/dnd.h +++ /dev/null @@ -1,108 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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 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 WXDLLIMPEXP_FWD_CORE wxWindow; - -class WXDLLIMPEXP_FWD_CORE wxDropTarget; -class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; -class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; - -class WXDLLIMPEXP_FWD_CORE 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(X##_xpm) - -//------------------------------------------------------------------------- -// wxDropTarget -//------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE 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); - - virtual ~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 // wxUSE_DRAG_AND_DROP - -#endif - //_WX_DND_H_ diff --git a/include/wx/osx/carbon/filedlg.h b/include/wx/osx/carbon/filedlg.h deleted file mode 100644 index cd2d7c9111..0000000000 --- a/include/wx/osx/carbon/filedlg.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -//------------------------------------------------------------------------- -// wxFileDialog -//------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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 = wxFD_DEFAULT_STYLE, - const wxPoint& pos = wxDefaultPosition, - const wxSize& sz = wxDefaultSize, - const wxString& name = wxFileDialogNameStr); - - virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; } - virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; } - - virtual int ShowModal(); - -protected: - // 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/osx/carbon/font.h b/include/wx/osx/carbon/font.h deleted file mode 100644 index 05f1b50601..0000000000 --- a/include/wx/osx/carbon/font.h +++ /dev/null @@ -1,139 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -// ---------------------------------------------------------------------------- -// wxFont -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxFont : public wxFontBase -{ -public: - // ctors and such - wxFont() { } - -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxFont(int size, - int family, - int style, - int weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); - } -#endif - - wxFont(int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT) - { - Create(size, family, style, weight, underlined, face, encoding); - } - - bool Create(int size, - wxFontFamily family, - wxFontStyle style, - wxFontWeight weight, - bool underlined = false, - const wxString& face = wxEmptyString, - wxFontEncoding encoding = wxFONTENCODING_DEFAULT); - - wxFont(const wxNativeFontInfo& info) - { - (void)Create(info); - } - - wxFont(const wxString& fontDesc); - - bool Create(const wxNativeFontInfo& info); - -#if wxOSX_USE_ATSU_TEXT - bool MacCreateFromThemeFont( wxUint16 themeFontID ) ; -#endif -#if wxOSX_USE_CORE_TEXT - bool MacCreateFromUIFont( wxUint32 coreTextFontType ); - bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 ); - bool MacCreateFromCTFont( const void * ctFont ); -#endif - - virtual ~wxFont(); - - // implement base class pure virtuals - virtual int GetPointSize() const; - virtual wxSize GetPixelSize() const; - virtual wxFontFamily GetFamily() const; - virtual wxFontStyle GetStyle() const; - virtual wxFontWeight 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(wxFontFamily family); - virtual void SetStyle(wxFontStyle style); - virtual void SetWeight(wxFontWeight weight); - virtual bool SetFaceName(const wxString& faceName); - virtual void SetUnderlined(bool underlined); - virtual void SetEncoding(wxFontEncoding encoding); - - WXDECLARE_COMPAT_SETTERS - - // implementation only from now on - // ------------------------------- - - virtual bool RealizeResource(); - - // Unofficial API, don't use - virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; - virtual bool GetNoAntiAliasing() const ; - - // Mac-specific, risks to change, don't use in portable code - -#if wxOSX_USE_ATSU_TEXT - // 'old' Quickdraw accessors - short MacGetFontNum() const; - short MacGetFontSize() const; - wxByte MacGetFontStyle() const; - - // 'new' ATSUI accessors - wxUint32 MacGetATSUFontID() const; - wxUint32 MacGetATSUAdditionalQDStyles() const; - wxUint16 MacGetThemeFontID() const ; - - // Returns an ATSUStyle not ATSUStyle* -#endif -#if wxOSX_USE_CORE_TEXT - const void * MacGetCTFont() const; -#endif -#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT - void* MacGetATSUStyle() const ; -#endif - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - -private: - void Unshare(); - - DECLARE_DYNAMIC_CLASS(wxFont) -}; - -#endif // _WX_FONT_H_ diff --git a/include/wx/osx/carbon/fontdlg.h b/include/wx/osx/carbon/fontdlg.h deleted file mode 100644 index ca96ff10c9..0000000000 --- a/include/wx/osx/carbon/fontdlg.h +++ /dev/null @@ -1,173 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/fontdlg.h -// Purpose: wxFontDialog class using fonts window services (10.2+). -// Author: Ryan Norton -// Modified by: -// Created: 2004-09-25 -// RCS-ID: $Id$ -// Copyright: (c) Ryan Norton -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_FONTDLG_H_ -#define _WX_FONTDLG_H_ - -#include "wx/dialog.h" -#include "wx/cmndata.h" - -/* - * Font dialog - */ - -/* - * support old notation - */ -#ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG -#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG -#endif - -#ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG -#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1 -#endif - -#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG - -class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog -{ -public: - wxFontDialog(); - wxFontDialog(wxWindow *parent, const wxFontData& data); - virtual ~wxFontDialog(); - - bool Create(wxWindow *parent, const wxFontData& data); - - int ShowModal(); - wxFontData& GetFontData() { return m_fontData; } - -protected: - wxFontData m_fontData; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) -}; - -extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ; - -#else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG - -#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX - -/*! - * Forward declarations - */ - -class wxFontColourSwatchCtrl; -class wxFontPreviewCtrl; -class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; -class WXDLLIMPEXP_FWD_CORE wxSpinEvent; -class WXDLLIMPEXP_FWD_CORE wxListBox; -class WXDLLIMPEXP_FWD_CORE wxChoice; -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxStaticText; -class WXDLLIMPEXP_FWD_CORE wxCheckBox; - -/*! - * Control identifiers - */ - -#define wxID_FONTDIALOG_FACENAME 20001 -#define wxID_FONTDIALOG_FONTSIZE 20002 -#define wxID_FONTDIALOG_BOLD 20003 -#define wxID_FONTDIALOG_ITALIC 20004 -#define wxID_FONTDIALOG_UNDERLINED 20005 -#define wxID_FONTDIALOG_COLOUR 20006 -#define wxID_FONTDIALOG_PREVIEW 20007 - -#endif - // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX - -class WXDLLIMPEXP_CORE wxFontDialog: public wxDialog -{ -DECLARE_DYNAMIC_CLASS(wxFontDialog) - -#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX -DECLARE_EVENT_TABLE() -#endif - -public: - wxFontDialog(); - wxFontDialog(wxWindow *parent, const wxFontData& data); - virtual ~wxFontDialog(); - - bool Create(wxWindow *parent, const wxFontData& data); - - int ShowModal(); - wxFontData& GetFontData() { return m_fontData; } - bool IsShown() const; - void OnPanelClose(); - void SetData(const wxFontData& data); - -#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX - - /// Creates the controls and sizers - void CreateControls(); - - /// Initialize font - void InitializeFont(); - - /// Set controls according to current font - void InitializeControls(); - - /// Respond to font change - void ChangeFont(); - - /// Respond to colour change - void OnColourChanged(wxCommandEvent& event); - - /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME - void OnFontdialogFacenameSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE - void OnFontdialogFontsizeUpdated( wxSpinEvent& event ); - - /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE - void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD - void OnFontdialogBoldClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC - void OnFontdialogItalicClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED - void OnFontdialogUnderlinedClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - void OnOkClick( wxCommandEvent& event ); - - /// Should we show tooltips? - static bool ShowToolTips(); - - wxListBox* m_facenameCtrl; - wxSpinCtrl* m_sizeCtrl; - wxCheckBox* m_boldCtrl; - wxCheckBox* m_italicCtrl; - wxCheckBox* m_underlinedCtrl; - wxFontColourSwatchCtrl* m_colourCtrl; - wxFontPreviewCtrl* m_previewCtrl; - - wxFont m_dialogFont; - bool m_suppressUpdates; - -#endif - // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX - -protected: - wxWindow* m_dialogParent; - wxFontData m_fontData; - void* m_pEventHandlerRef; -}; - -#endif - -#endif - // _WX_FONTDLG_H_ diff --git a/include/wx/osx/carbon/frame.h b/include/wx/osx/carbon/frame.h deleted file mode 100644 index 380fbf624e..0000000000 --- a/include/wx/osx/carbon/frame.h +++ /dev/null @@ -1,126 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/window.h" -#include "wx/toolbar.h" -#include "wx/accel.h" -#include "wx/icon.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr[]; - -class WXDLLIMPEXP_FWD_CORE wxMenuBar; -class WXDLLIMPEXP_FWD_CORE wxStatusBar; -class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; - -class WXDLLIMPEXP_CORE 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 - // ------------------------------- - - // 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; - - // override some more virtuals - virtual bool Enable(bool enable = TRUE) ; - - // 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 SetToolBar(wxToolBar *toolbar); -#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); -#endif // wxUSE_STATUSBAR - - // called by wxWindow whenever it gets focus - void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } - wxWindow *GetLastFocus() const { return m_winLastFocused; } - - void PositionBars(); - -protected: - // common part of all ctors - void Init(); - -#if wxUSE_TOOLBAR - virtual void PositionToolBar(); -#endif -#if wxUSE_STATUSBAR - virtual void PositionStatusBar(); -#endif - - // override base class virtuals - virtual void DoGetClientSize(int *width, int *height) const; - virtual void DoSetClientSize(int width, int height); - -#if wxUSE_MENUS - virtual void DetachMenuBar(); - virtual void AttachMenuBar(wxMenuBar *menubar); -#endif - - // osx specific event handling common for all osx-ports - virtual void HandleResized( double timestampsec ); - -protected: - // the last focused child: we restore focus to it on activation - wxWindow *m_winLastFocused; - - virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; - -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxFrame) -}; - -#endif - // _WX_FRAME_H_ diff --git a/include/wx/osx/carbon/gauge.h b/include/wx/osx/carbon/gauge.h deleted file mode 100644 index 3db68bebe8..0000000000 --- a/include/wx/osx/carbon/gauge.h +++ /dev/null @@ -1,56 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/control.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxGaugeNameStr[]; - -// Group box -class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase -{ - public: - inline wxGauge() { } - - 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); - - // set gauge range/value - virtual void SetRange(int range); - virtual void SetValue(int pos); - virtual int GetValue() const ; - - void Pulse(); - - protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge) -}; - -#endif - // _WX_GAUGE_H_ diff --git a/include/wx/osx/carbon/glcanvas.h b/include/wx/osx/carbon/glcanvas.h deleted file mode 100644 index 2d032aaad7..0000000000 --- a/include/wx/osx/carbon/glcanvas.h +++ /dev/null @@ -1,154 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/glcanvas.h -// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// RCS-ID: $Id$ -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_GLCANVAS_H_ -#define _WX_GLCANVAS_H_ - -#include - -// low level calls - -WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ); -WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context ); -WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext(); -WXDLLIMPEXP_GL void WXGLSwapBuffers( WXGLContext context ); - -WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList); -WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ); - -class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase -{ -public: - wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); - virtual ~wxGLContext(); - - virtual bool SetCurrent(const wxGLCanvas& win) const; - - // Mac-specific - WXGLContext GetWXGLContext() const { return m_glContext; } - -private: - WXGLContext m_glContext; - - DECLARE_NO_COPY_CLASS(wxGLContext) -}; - -class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase -{ -public: - wxGLCanvas(wxWindow *parent, - wxWindowID id = wxID_ANY, - const int *attribList = NULL, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const wxPalette& palette = wxNullPalette); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const int *attribList = NULL, - const wxPalette& palette = wxNullPalette); - - virtual ~wxGLCanvas(); - - // implement wxGLCanvasBase methods - virtual bool SwapBuffers(); - - - // Mac-specific functions - // ---------------------- - - // return true if multisample extension is supported - static bool IsAGLMultiSampleAvailable(); - - // return the pixel format used by this window - WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; } - - // update the view port of the current context to match this window - void SetViewport(); - - - // deprecated methods - // ------------------ - -#if WXWIN_COMPATIBILITY_2_8 - wxDEPRECATED( - wxGLCanvas(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const int *attribList = NULL, - const wxPalette& palette = wxNullPalette) - ); - - wxDEPRECATED( - wxGLCanvas(wxWindow *parent, - const wxGLContext *shared, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const int *attribList = NULL, - const wxPalette& palette = wxNullPalette) - ); - - wxDEPRECATED( - wxGLCanvas(wxWindow *parent, - const wxGLCanvas *shared, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxGLCanvasName, - const int *attribList = NULL, - const wxPalette& palette = wxNullPalette) - ); -#endif // WXWIN_COMPATIBILITY_2_8 - - // implementation-only from now on - -#if wxOSX_USE_CARBON - // Unlike some other platforms, this must get called if you override it, - // i.e. don't forget "event.Skip()" in your EVT_SIZE handler - void OnSize(wxSizeEvent& event); - - virtual void MacSuperChangedPosition(); - virtual void MacTopLevelWindowChangedPosition(); - virtual void MacVisibilityChanged(); - - void MacUpdateView(); - - GLint GetAglBufferName() const { return m_bufferName; } -#endif - -protected: - WXGLPixelFormat m_glFormat; - -#if wxOSX_USE_CARBON - bool m_macCanvasIsShown, - m_needsUpdate; - WXGLContext m_dummyContext; - GLint m_bufferName; -#endif - - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGLCanvas) -}; - -#endif // _WX_GLCANVAS_H_ diff --git a/include/wx/osx/carbon/helpxxxx.h b/include/wx/osx/carbon/helpxxxx.h deleted file mode 100644 index 7bb66c7cba..0000000000 --- a/include/wx/osx/carbon/helpxxxx.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/wx.h" - -#include "wx/helpbase.h" - -class WXDLLIMPEXP_CORE wxXXXXHelpController: public wxHelpControllerBase -{ - DECLARE_CLASS(wxXXXXHelpController) - - public: - wxXXXXHelpController(); - virtual ~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/osx/carbon/icon.h b/include/wx/osx/carbon/icon.h deleted file mode 100644 index 76113f7121..0000000000 --- a/include/wx/osx/carbon/icon.h +++ /dev/null @@ -1,90 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/bitmap.h" - -// Icon -class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject -{ -public: - wxIcon(); - - wxIcon(const char* const* data); - wxIcon(const char bits[], int width , int height ); - wxIcon(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, - int desiredWidth = -1, int desiredHeight = -1); - wxIcon(const wxIconLocation& loc) - { - LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); - } - - wxIcon(WXHICON icon, const wxSize& size); - - virtual ~wxIcon(); - - bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, - int desiredWidth = -1, int desiredHeight = -1); - - - // 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); - - int GetWidth() const; - int GetHeight() const; - int GetDepth() const; - void SetWidth(int w); - void SetHeight(int h); - void SetDepth(int d); - void SetOk(bool isOk); - - WXHICON GetHICON() const; - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - -private: - DECLARE_DYNAMIC_CLASS(wxIcon) -}; - -class WXDLLIMPEXP_CORE wxICONResourceHandler: public wxBitmapHandler -{ -public: - wxICONResourceHandler() - { - SetName(wxT("ICON resource")); - SetExtension(wxEmptyString); - SetType(wxBITMAP_TYPE_ICON_RESOURCE); - } - - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - wxBitmapType flags, - int desiredWidth = -1, - int desiredHeight = -1); - - // unhide the base class virtual - virtual bool LoadFile(wxBitmap *bitmap, - const wxString& name, - wxBitmapType flags) - { return LoadFile(bitmap, name, flags, -1, -1); } - -private: - DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) -}; - -#endif - // _WX_ICON_H_ diff --git a/include/wx/osx/carbon/imaglist.h b/include/wx/osx/carbon/imaglist.h deleted file mode 100644 index 10e96b588d..0000000000 --- a/include/wx/osx/carbon/imaglist.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: imaglist.h -// Purpose: -// Author: Robert Roebling, Stefan Csomor -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling and Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_IMAGLIST_H_ -#define _WX_IMAGLIST_H_ - -#include "wx/defs.h" -#include "wx/list.h" -#include "wx/icon.h" - -class WXDLLIMPEXP_FWD_CORE wxDC; -class WXDLLIMPEXP_FWD_CORE wxBitmap; -class WXDLLIMPEXP_FWD_CORE wxColour; - -class WXDLLIMPEXP_CORE wxImageList: public wxObject -{ -public: - wxImageList() { m_width = m_height = 0; } - wxImageList( int width, int height, bool mask = true, int initialCount = 1 ); - virtual ~wxImageList(); - bool Create( int width, int height, bool mask = true, int initialCount = 1 ); - bool Create(); - - virtual int GetImageCount() const; - virtual bool GetSize( int index, int &width, int &height ) const; - - int Add( const wxIcon& bitmap ); - int Add( const wxBitmap& bitmap ); - int Add( const wxBitmap& bitmap, const wxBitmap& mask ); - int Add( const wxBitmap& bitmap, const wxColour& maskColour ); - wxBitmap GetBitmap(int index) const; - wxIcon GetIcon(int index) const; - bool Replace( int index, const wxIcon &bitmap ); - bool Replace( int index, const wxBitmap &bitmap ); - bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ); - bool Remove( int index ); - bool RemoveAll(); - - virtual bool Draw(int index, wxDC& dc, int x, int y, - int flags = wxIMAGELIST_DRAW_NORMAL, - bool solidBackground = false); - -private: - wxList m_images; - - int m_width; - int m_height; - - DECLARE_DYNAMIC_CLASS(wxImageList) -}; - -#endif // _WX_IMAGLIST_H_ - diff --git a/include/wx/osx/carbon/joystick.h b/include/wx/osx/carbon/joystick.h deleted file mode 100644 index 94de2470e1..0000000000 --- a/include/wx/osx/carbon/joystick.h +++ /dev/null @@ -1,91 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/event.h" - -class WXDLLIMPEXP_ADV wxJoystick: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxJoystick) - public: - /* - * Public interface - */ - - wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; }; - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - wxPoint GetPosition() const; - int GetPosition(unsigned axis) const; - bool GetButtonState(unsigned button) 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 - static int GetNumberJoysticks() ; - 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/osx/carbon/listbox.h b/include/wx/osx/carbon/listbox.h deleted file mode 100644 index bf01a78fec..0000000000 --- a/include/wx/osx/carbon/listbox.h +++ /dev/null @@ -1,175 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -// ---------------------------------------------------------------------------- -// simple types -// ---------------------------------------------------------------------------- -#include "wx/dynarray.h" -#include "wx/arrstr.h" - -// forward decl for GetSelections() -class wxArrayInt; - -// forward decl for wxListWidgetImpl implementation type. -class wxListWidgetImpl; - -// List box item - -WX_DEFINE_ARRAY( char* , wxListDataArray ); - -// ---------------------------------------------------------------------------- -// List box control -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxListWidgetColumn; - -class WXDLLIMPEXP_FWD_CORE wxListWidgetCellValue; - -class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase -{ -public: - // ctors and such - wxListBox(); - - wxListBox( - wxWindow *parent, - wxWindowID winid, - 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, winid, pos, size, n, choices, style, validator, name); - } - - wxListBox( - wxWindow *parent, - wxWindowID winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr) - { - Create(parent, winid, pos, size, choices, style, validator, name); - } - - bool Create( - wxWindow *parent, - wxWindowID winid, - 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 winid, - const wxPoint& pos, - const wxSize& size, - const wxArrayString& choices, - long style = 0, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListBoxNameStr); - - virtual ~wxListBox(); - - // implement base class pure virtuals - virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); - - virtual unsigned int GetCount() const; - virtual wxString GetString(unsigned int n) const; - virtual void SetString(unsigned int n, const wxString& s); - virtual int FindString(const wxString& s, bool bCase = false) const; - - // data callbacks - virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); - virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); - - virtual bool IsSelected(int n) const; - virtual int GetSelection() const; - virtual int GetSelections(wxArrayInt& aSelections) const; - - virtual void EnsureVisible(int n); - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - // wxCheckListBox support - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - - wxListWidgetImpl* GetListPeer() const; - - bool MacGetBlockEvents() const { return m_blockEvents; } - - virtual void HandleLineEvent( unsigned int n, bool doubleClick ); -protected: - // callback for derived classes which may have to insert additional data - // at a certain line - which cannot be predetermined for sorted list data - virtual void OnItemInserted(unsigned int pos); - - virtual void DoClear(); - virtual void DoDeleteOneItem(unsigned int n); - - // from wxItemContainer - virtual int DoInsertItems(const wxArrayStringsAdapter& items, - unsigned int pos, - void **clientData, wxClientDataType type); - - virtual void DoSetItemClientData(unsigned int n, void* clientData); - virtual void* DoGetItemClientData(unsigned int n) const; - - // from wxListBoxBase - virtual void DoSetSelection(int n, bool select); - virtual void DoSetFirstItem(int n); - virtual int DoListHitTest(const wxPoint& point) const; - - // free memory (common part of Clear() and dtor) - // prevent collision with some BSD definitions of macro Free() - void FreeData(); - - virtual wxSize DoGetBestSize() const; - - bool m_blockEvents; - - wxListWidgetColumn* m_textColumn; - - // data storage (copied from univ) - - // the array containing all items (it is sorted if the listbox has - // wxLB_SORT style) - union - { - wxArrayString *unsorted; - wxSortedArrayString *sorted; - } m_strings; - - // and this one the client data (either void or wxClientData) - wxArrayPtrVoid m_itemsClientData; - -private: - DECLARE_DYNAMIC_CLASS(wxListBox) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_LISTBOX_H_ diff --git a/include/wx/osx/carbon/listctrl.h b/include/wx/osx/carbon/listctrl.h deleted file mode 100644 index 8d06d24d84..0000000000 --- a/include/wx/osx/carbon/listctrl.h +++ /dev/null @@ -1,420 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/defs.h" -#include "wx/generic/listctrl.h" - -#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic") - -class wxMacDataBrowserListCtrlControl; -class wxListCtrlTextCtrlWrapper; -class wxListCtrlRenameTimer; - -WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList); - -class WXDLLIMPEXP_CORE wxListCtrl: public wxControl -{ - DECLARE_DYNAMIC_CLASS(wxListCtrl) - public: - /* - * Public interface - */ - - wxListCtrl() { Init(); } - - wxListCtrl(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListCtrlNameStr) - { - Init(); - - Create(parent, id, pos, size, style, validator, name); - } - - virtual ~wxListCtrl(); - - bool Create(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxLC_ICON, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxListCtrlNameStr); - - // Attributes - //////////////////////////////////////////////////////////////////////////// - - // Gets information about this column - bool GetColumn(int col, wxListItem& item) const; - - // Sets information about this column - // TODO: NOT const to be compatible with wxGenericListCtrl API - 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) ; - - void AssignImageList(wxImageList *imageList, int which); - - // Sets the item image - bool SetItemImage(long item, int image, int selImage = -1) ; - bool SetItemColumnImage(long item, long column, int image); - - // Gets the item text - wxString GetItemText(long item) const ; - - // Sets the item text - void SetItemText(long item, const wxString& str) ; - - void SetItemTextColour(long item, const wxColour& colour) ; - wxColour GetItemTextColour(long item) const; - - void SetItemBackgroundColour(long item, const wxColour& colour) ; - wxColour GetItemBackgroundColour(long item) const; - - void SetItemFont( long item, const wxFont &f); - wxFont GetItemFont( long item ) const; - - // Gets the item data - long GetItemData(long item) const ; - - // Sets the item data - bool SetItemPtrData(long item, wxUIntPtr data); - bool SetItemData(long item, long data) { return SetItemPtrData(item, 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; - - void SetItemSpacing( int spacing, bool isSmall = false ); - wxSize GetItemSpacing() const; - - // Gets the number of selected items in the list control - int GetSelectedItemCount() const; - - wxRect GetViewRect() 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 ; - - // are we in report mode? - bool InReportView() const { return HasFlag(wxLC_REPORT); } - - bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } - - // 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 wxWidgets 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) - // Request the subitem number as well at the given coordinate. - long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; - - // 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); - - wxMacDataBrowserListCtrlControl* GetListPeer() const; - - // these functions are only used for virtual list view controls, i.e. the - // ones with wxLC_VIRTUAL style - - void SetItemCount(long count); - void RefreshItem(long item); - void RefreshItems(long itemFrom, long itemTo); - - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - - // return the attribute for the item (may return NULL if none) - virtual wxListItemAttr *OnGetItemAttr(long item) const; - -/* 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); }; - - wxListCtrlCompare GetCompareFunc() { return m_compareFunc; }; - long GetCompareFuncData() { return m_compareFuncData; }; - - - // public overrides needed for pimpl approach - virtual bool SetFont(const wxFont& font); - virtual bool SetForegroundColour(const wxColour& colour); - virtual bool SetBackgroundColour(const wxColour& colour); - virtual wxColour GetBackgroundColour() const; - - // functions for editing/timer - void OnRenameTimer(); - bool OnRenameAccept(long itemEdit, const wxString& value); - void OnRenameCancelled(long itemEdit); - - void ChangeCurrent(long current); - void ResetCurrent() { ChangeCurrent((long)-1); } - bool HasCurrent() const { return m_current != (long)-1; } - - void OnLeftDown(wxMouseEvent& event); - void OnDblClick(wxMouseEvent& event); - - void FinishEditing(wxTextCtrl *text) - { - delete text; - m_textctrlWrapper = NULL; - SetFocus(); - } - - virtual int GetScrollPos(int orient) const; - - void OnRightDown(wxMouseEvent& event); - void OnMiddleDown(wxMouseEvent& event); - void OnChar(wxKeyEvent& event); - virtual void SetFocus(); - void FireMouseEvent(wxEventType eventType, wxPoint position); - - virtual void SetDropTarget( wxDropTarget *dropTarget ); - virtual wxDropTarget* GetDropTarget() const; - - // with CG, we need to get the context from an kEventControlDraw event - // unfortunately, the DataBrowser callbacks don't provide the context - // and we need it, so we need to set/remove it before and after draw - // events so we can access it in the callbacks. - void MacSetDrawingContext(void* context) { m_cgContext = context; } - void* MacGetDrawingContext() { return m_cgContext; } - - virtual wxVisualAttributes GetDefaultAttributes() const - { - return GetClassDefaultAttributes(GetWindowVariant()); - } - - static wxVisualAttributes - GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); - -protected: - - // protected overrides needed for pimpl approach - virtual void DoSetSize(int x, int y, - int width, int height, - int sizeFlags = wxSIZE_AUTO); - - virtual wxSize DoGetBestSize() const; - - long m_current; - wxListCtrlTextCtrlWrapper *m_textctrlWrapper; - wxListCtrlRenameTimer *m_renameTimer; - // common part of all ctors - void Init(); - - wxGenericListCtrl* m_genericImpl; // allow use of the generic impl. - wxMacDataBrowserListCtrlControl* m_dbImpl; - void* m_macListCtrlEventHandler; - void* m_cgContext; - wxListCtrlCompare m_compareFunc; - long m_compareFuncData; - - 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) - - wxColumnList m_colsInfo; // for storing info about each column - wxColour m_textColor; - wxColour m_bgColor; - - // keep track of whether or not we should delete the image list ourselves. - bool m_ownsImageListNormal, - m_ownsImageListSmall, - m_ownsImageListState; - - long m_baseStyle; // Basic Windows style flags, for recreation purposes - int m_colCount; // Windows doesn't have GetColumnCount so must - // keep track of inserted/deleted columns - - int m_count; // for virtual lists, store item count - -private: - int CalcColumnAutoWidth(int col) const; - - DECLARE_EVENT_TABLE() -}; - -#endif - // _WX_LISTCTRL_H_ diff --git a/include/wx/osx/carbon/mdi.h b/include/wx/osx/carbon/mdi.h deleted file mode 100644 index cea49387eb..0000000000 --- a/include/wx/osx/carbon/mdi.h +++ /dev/null @@ -1,154 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/mdi.h -// Purpose: MDI (Multiple Document Interface) classes. -// Author: Stefan Csomor -// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes -// Created: 1998-01-01 -// RCS-ID: $Id$ -// Copyright: (c) Stefan Csomor -// (c) 2008 Vadim Zeitlin -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_OSX_CARBON_MDI_H_ -#define _WX_OSX_CARBON_MDI_H_ - -class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase -{ -public: - wxMDIParentFrame() { Init(); } - wxMDIParentFrame(wxWindow *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr) - { - 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 | wxVSCROLL | wxHSCROLL, - const wxString& name = wxFrameNameStr); - - virtual ~wxMDIParentFrame(); - - // implement/override base class [pure] virtuals - // --------------------------------------------- - - static bool IsTDI() { return false; } - - virtual void AddChild(wxWindowBase *child); - virtual void RemoveChild(wxWindowBase *child); - - virtual void ActivateNext() { /* TODO */ } - virtual void ActivatePrevious() { /* TODO */ } - - virtual bool Show(bool show = true); - - - // Mac-specific implementation from now on - // --------------------------------------- - - // Mac OS activate event - virtual void MacActivate(long timestamp, bool activating); - - // wxWidgets activate event - void OnActivate(wxActivateEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); - - void SetMenuBar(wxMenuBar *menu_bar); - - // Get rect to be used to center top-level children - virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); - -protected: - // common part of all ctors - void Init(); - - // returns true if this frame has some contents and so should be visible, - // false if it's used solely as container for its children - bool ShouldBeVisible() const; - - - wxMenu *m_windowMenu; - - // true if MDI Frame is intercepting commands, not child - bool m_parentFrameActive; - - // true if the frame should be shown but is not because it is empty and - // useless otherwise than a container for its children - bool m_shouldBeShown; - -private: - friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; - - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) -}; - -class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase -{ -public: - wxMDIChildFrame() { Init(); } - 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); - } - - bool Create(wxMDIParentFrame *parent, - wxWindowID id, - const wxString& title, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = wxFrameNameStr); - - virtual ~wxMDIChildFrame(); - - // un-override the base class override - virtual bool IsTopLevel() const { return true; } - - // implement MDI operations - virtual void Activate(); - - - // Mac OS activate event - virtual void MacActivate(long timestamp, bool activating); - -protected: - // common part of all ctors - void Init(); - - DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) -}; - -class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase -{ -public: - wxMDIClientWindow() { } - virtual ~wxMDIClientWindow(); - - virtual bool CreateClient(wxMDIParentFrame *parent, - long style = wxVSCROLL | wxHSCROLL); - -protected: - virtual void DoGetClientSize(int *width, int *height) const; - - DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) -}; - -#endif // _WX_OSX_CARBON_MDI_H_ diff --git a/include/wx/osx/carbon/menu.h b/include/wx/osx/carbon/menu.h deleted file mode 100644 index ff8e0e06cf..0000000000 --- a/include/wx/osx/carbon/menu.h +++ /dev/null @@ -1,198 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -class WXDLLIMPEXP_FWD_CORE wxFrame; - -#include "wx/arrstr.h" - -// ---------------------------------------------------------------------------- -// Menu -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxMenuImpl ; - -class WXDLLIMPEXP_CORE 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(); - - virtual void Attach(wxMenuBarBase *menubar) ; - - virtual void Break(); - - virtual void SetTitle(const wxString& title); - - bool ProcessCommand(wxCommandEvent& event); - - // semi-private accessors - - // get the window which contains this menu - wxWindow *GetWindow() const; - // get the menu handle - WXHMENU GetHMenu() const ; - - // implementation only from now on - // ------------------------------- - - bool HandleCommandUpdateStatus( wxMenuItem* menuItem, wxWindow* senderWindow = NULL); - bool HandleCommandProcess( wxMenuItem* menuItem, wxWindow* senderWindow = NULL); - void HandleMenuItemHighlighted( wxMenuItem* menuItem ); - void HandleMenuOpened(); - void HandleMenuClosed(); - - wxMenuImpl* GetPeer() { return m_peer; } - - // make sure we can veto - void SetAllowRearrange( bool allow ); - bool AllowRearrange() const { return m_allowRearrange; } - - // if a menu is used purely for internal implementation reasons (eg wxChoice) - // we don't want native menu events being triggered - void SetNoEventsMode( bool noEvents ); - bool GetNoEventsMode() const { return m_noEventsMode; } -protected: - // hide special menu items like exit, preferences etc - // that are expected in the app menu - void DoRearrange() ; - - bool DoHandleMenuEvent( wxEvent& evt ); - virtual wxMenuItem* DoAppend(wxMenuItem *item); - virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); - virtual wxMenuItem* DoRemove(wxMenuItem *item); - -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; - - // in this menu rearranging of menu items (esp hiding) is allowed - bool m_allowRearrange; - - // don't trigger native events - bool m_noEventsMode; - - // the position of the first item in the current radio group or -1 - int m_startRadioGroup; - - wxMenuImpl* m_peer; - - DECLARE_DYNAMIC_CLASS(wxMenu) -}; - -#if wxOSX_USE_COCOA_OR_CARBON - -// the iphone only has popup-menus - -// ---------------------------------------------------------------------------- -// Menu Bar (a la Windows) -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); - 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 SetMenuLabel( size_t pos, const wxString& label ); - virtual wxString GetMenuLabel( size_t pos ) const; - virtual bool Enable( bool enable = TRUE ); - // for virtual function hiding - virtual void Enable( int itemid, bool enable ) - { - wxMenuBarBase::Enable( itemid, enable ); - } - - // implementation from now on - 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); - - static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; } - static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; } - - void MacInstallMenuBar() ; - static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } - static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; } - static wxMenuBar* MacGetCommonMenuBar() { return s_macCommonMenuBar; } - - - static WXHMENU MacGetWindowMenuHMenu() { return s_macWindowMenuHandle ; } -protected: - // common part of all ctors - void Init(); - wxWindow *m_invokingWindow; - - wxArrayString m_titles; - static bool s_macAutoWindowMenu ; - static WXHMENU s_macWindowMenuHandle ; - -private: - static wxMenuBar* s_macInstalledMenuBar ; - static wxMenuBar* s_macCommonMenuBar ; - - wxMenu* m_rootMenu; - - DECLARE_DYNAMIC_CLASS(wxMenuBar) -}; - -#endif - -#endif // _WX_MENU_H_ diff --git a/include/wx/osx/carbon/menuitem.h b/include/wx/osx/carbon/menuitem.h deleted file mode 100644 index 6171b124ee..0000000000 --- a/include/wx/osx/carbon/menuitem.h +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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 - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -#include "wx/defs.h" -#include "wx/bitmap.h" - -// ---------------------------------------------------------------------------- -// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl ; - -class WXDLLIMPEXP_CORE 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 SetItemLabel(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); - - wxMenuItemImpl* GetPeer() { return m_peer; } -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 - - wxMenuItemImpl* m_peer; - - DECLARE_DYNAMIC_CLASS(wxMenuItem) -}; - -#endif //_MENUITEM_H diff --git a/include/wx/osx/carbon/metafile.h b/include/wx/osx/carbon/metafile.h deleted file mode 100644 index 4421a565bf..0000000000 --- a/include/wx/osx/carbon/metafile.h +++ /dev/null @@ -1,178 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/dc.h" -#include "wx/gdiobj.h" - -#if wxUSE_DATAOBJ -#include "wx/dataobj.h" -#endif - -#include "wx/osx/carbon/dcclient.h" - -/* - * Metafile and metafile device context classes - * - */ - -#define wxMetaFile wxMetafile -#define wxMetaFileDC wxMetafileDC - -class WXDLLIMPEXP_FWD_CORE wxMetafile; -class wxMetafileRefData ; - -#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) - -class WXDLLIMPEXP_CORE wxMetafile : public wxGDIObject -{ -public: - wxMetafile(const wxString& file = wxEmptyString); - virtual ~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); - - wxSize GetSize() const; - int GetWidth() const { return GetSize().x; } - int GetHeight() const { return GetSize().y; } - - // Implementation - WXHMETAFILE GetHMETAFILE() const ; - void SetHMETAFILE(WXHMETAFILE mf) ; -#ifndef __LP64__ - // Since the native metafile format is PDF for Quartz - // we need a call that allows setting PICT content for - // backwards compatibility - void SetPICT(void* pictHandle) ; -#endif - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - - DECLARE_DYNAMIC_CLASS(wxMetafile) -}; - - -class WXDLLIMPEXP_CORE wxMetafileDCImpl: public wxGCDCImpl -{ -public: - wxMetafileDCImpl( wxDC *owner, - const wxString& filename, - int width, int height, - const wxString& description ); - - virtual ~wxMetafileDCImpl(); - - // Should be called at end of drawing - virtual wxMetafile *Close(); - - // Implementation - wxMetafile *GetMetaFile(void) const { return m_metaFile; } - void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } - -protected: - virtual void DoGetSize(int *width, int *height) const; - - wxMetafile* m_metaFile; - -private: - DECLARE_CLASS(wxMetafileDCImpl) - DECLARE_NO_COPY_CLASS(wxMetafileDCImpl) -}; - -class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC -{ - 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 ) : - wxDC( new wxMetafileDCImpl( this, filename, width, height, description) ) - { } - - wxMetafile *GetMetafile() const - { return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); } - - wxMetafile *Close() - { return ((wxMetafileDCImpl*)m_pimpl)->Close(); } - -private: - DECLARE_CLASS(wxMetafileDC) - DECLARE_NO_COPY_CLASS(wxMetafileDC) -}; - - -/* - * 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 WXDLLIMPEXP_CORE wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); - -// Optional origin and extent -bool WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE 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 - // _WX_METAFIILE_H_ diff --git a/include/wx/osx/carbon/mimetype.h b/include/wx/osx/carbon/mimetype.h deleted file mode 100644 index 8d4c2e604f..0000000000 --- a/include/wx/osx/carbon/mimetype.h +++ /dev/null @@ -1,118 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/mimetype.h -// Purpose: Mac Carbon implementation for wx mime-related classes -// Author: Ryan Norton -// Modified by: -// Created: 04/16/2005 -// RCS-ID: $Id$ -// Copyright: (c) 2005 Ryan Norton () -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MIMETYPE_IMPL_H -#define _MIMETYPE_IMPL_H - -#include "wx/defs.h" -#include "wx/mimetype.h" - - -class wxMimeTypesManagerImpl -{ -public : - //kinda kooky but in wxMimeTypesManager::EnsureImpl it doesn't call - //intialize, so we do it ourselves - wxMimeTypesManagerImpl() : m_hIC(NULL) { Initialize(); } - ~wxMimeTypesManagerImpl() { ClearData(); } - - // 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); - - 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); - -private: - wxArrayFileTypeInfo m_fallbacks; - void* m_hIC; - void** m_hDatabase; - long m_lCount; - - void* pReserved1; - void* pReserved2; - void* pReserved3; - void* pReserved4; - void* pReserved5; - void* pReserved6; - - friend class wxFileTypeImpl; -}; - -class wxFileTypeImpl -{ -public: - //kind of nutty, but mimecmn.cpp creates one with an empty new - wxFileTypeImpl() : m_manager(NULL) {} - ~wxFileTypeImpl() {} //for those broken compilers - - // 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; - bool GetPrintCommand(wxString *printCmd, - const wxFileType::MessageParameters&) const; - - 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: - void Init(wxMimeTypesManagerImpl *manager, long lIndex) - { m_manager=(manager); m_lIndex=(lIndex); } - - // helper function - wxString GetCommand(const wxString& verb) const; - - wxMimeTypesManagerImpl *m_manager; - long m_lIndex; - - void* pReserved1; - void* pReserved2; - void* pReserved3; - void* pReserved4; - void* pReserved5; - void* pReserved6; - - friend class wxMimeTypesManagerImpl; -}; - -#endif - //_MIMETYPE_H diff --git a/include/wx/osx/carbon/minifram.h b/include/wx/osx/carbon/minifram.h deleted file mode 100644 index ba00ddd1a4..0000000000 --- a/include/wx/osx/carbon/minifram.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/frame.h" - -class WXDLLIMPEXP_CORE 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 = wxCAPTION | wxRESIZE_BORDER | 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); - } - - virtual ~wxMiniFrame() {} -protected: -}; - -#endif - // _WX_MINIFRAM_H_ diff --git a/include/wx/osx/carbon/msgdlg.h b/include/wx/osx/carbon/msgdlg.h deleted file mode 100644 index 4ec95ea4a6..0000000000 --- a/include/wx/osx/carbon/msgdlg.h +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogWithCustomLabels -{ -public: - wxMessageDialog(wxWindow *parent, - const wxString& message, - const wxString& caption = wxMessageBoxCaptionStr, - long style = wxOK|wxCENTRE, - const wxPoint& pos = wxDefaultPosition); - - virtual int ShowModal(); - -protected: - // not supported for message dialog - virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), - int WXUNUSED(width), int WXUNUSED(height), - int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} - - DECLARE_DYNAMIC_CLASS(wxMessageDialog) -}; - -#endif // _WX_MSGBOXDLG_H_ diff --git a/include/wx/osx/carbon/nonownedwnd.h b/include/wx/osx/carbon/nonownedwnd.h deleted file mode 100644 index 3ce7ae952c..0000000000 --- a/include/wx/osx/carbon/nonownedwnd.h +++ /dev/null @@ -1,128 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/nonownedwnd.h -// Purpose: declares wxNonOwnedWindow class -// Author: Stefan Csomor -// Modified by: -// Created: 2008-03-24 -// RCS-ID: $Id: nonownedwnd.h 46993 2007-06-28 08:46:04Z VS $ -// Copyright: (c) 2008 Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_NONOWNEDWND_H_ -#define _WX_MAC_NONOWNEDWND_H_ - -#include "wx/window.h" - -#if wxUSE_SYSTEM_OPTIONS - #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition") -#endif - -//----------------------------------------------------------------------------- -// wxNonOwnedWindow -//----------------------------------------------------------------------------- - -// This class represents "non-owned" window. A window is owned by another -// window if it has a parent and is positioned within the parent. For example, -// wxFrame is non-owned, because even though it can have a parent, it's -// location is independent of it. This class is for internal use only, it's -// the base class for wxTopLevelWindow and wxPopupWindow. - -class wxNonOwnedWindowImpl; - -class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow -{ -public: - // constructors and such - wxNonOwnedWindow() { Init(); } - - wxNonOwnedWindow(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr) - { - Init(); - - (void)Create(parent, id, pos, size, style, name); - } - - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr); - - virtual ~wxNonOwnedWindow(); - - virtual wxPoint GetClientAreaOrigin() const; - - // implement base class pure virtuals - - virtual bool SetShape(const wxRegion& region); - - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent(); - - virtual bool SetBackgroundStyle(wxBackgroundStyle style); - - virtual void Update(); - - WXWindow GetWXWindow() const ; - static wxNonOwnedWindow* GetFromWXWindow( WXWindow win ); - - // implementation from now on - // -------------------------- - - // activation hooks only necessary for MDI Implementation - static void MacDelayedDeactivation(long timestamp); - virtual void MacActivate( long timestamp , bool inIsActivating ) ; - - - virtual void Raise(); - virtual void Lower(); - virtual bool Show( bool show = true ); - - virtual bool ShowWithEffect(wxShowEffect effect, - unsigned timeout = 0) ; - - virtual bool HideWithEffect(wxShowEffect effect, - unsigned timeout = 0) ; - - virtual void SetExtraStyle(long exStyle) ; - - virtual bool SetBackgroundColour( const wxColour &colour ); - - wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; } - - // osx specific event handling common for all osx-ports - - virtual void HandleActivated( double timestampsec, bool didActivate ); - virtual void HandleResized( double timestampsec ); - virtual void HandleMoved( double timestampsec ); - virtual void HandleResizing( double timestampsec, wxRect* rect ); - -protected: - // common part of all ctors - void Init(); - - virtual void DoGetPosition( int *x, int *y ) const; - virtual void DoGetSize( int *width, int *height ) const; - virtual void DoMoveWindow(int x, int y, int width, int height); - virtual void DoGetClientSize(int *width, int *height) const; - - wxNonOwnedWindowImpl* m_nowpeer ; - -// wxWindowMac* m_macFocus ; - - static wxNonOwnedWindow *s_macDeactivateWindow; -private : -}; - -// list of all frames and modeless dialogs -extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; - - -#endif // _WX_MAC_NONOWNEDWND_H_ diff --git a/include/wx/osx/carbon/notebook.h b/include/wx/osx/carbon/notebook.h deleted file mode 100644 index 6a7d4a2e44..0000000000 --- a/include/wx/osx/carbon/notebook.h +++ /dev/null @@ -1,145 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- -#include "wx/event.h" - -// ---------------------------------------------------------------------------- -// types -// ---------------------------------------------------------------------------- - -// fwd declarations -class WXDLLIMPEXP_FWD_CORE wxImageList; -class WXDLLIMPEXP_FWD_CORE wxWindow; - -// ---------------------------------------------------------------------------- -// wxNotebook -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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 = wxNotebookNameStr); - // Create() function - bool Create(wxWindow *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxNotebookNameStr); - // dtor - virtual ~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) { return DoSetSelection(nPage, SetSelection_SendEvent); } - // get the currently selected page - int GetSelection() const { return m_nSelection; } - - // changes selected page without sending events - int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } - - // 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); - - // hit test - virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; - - // calculate size for wxNotebookSizer - wxSize CalcSizeFromPage(const wxSize& sizePage) const; - wxRect GetPageRect() 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); - - // callbacks - // --------- - void OnSize(wxSizeEvent& event); - void OnSelChange(wxBookCtrlEvent& event); - void OnSetFocus(wxFocusEvent& event); - void OnNavigationKey(wxNavigationKeyEvent& 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); - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - -protected: - virtual wxNotebookPage *DoRemovePage(size_t page) ; - // common part of all ctors - void Init(); - - // helper functions - void ChangePage(int nOldSel, int nSel); // change pages - void MacSetupTabs(); - - int DoSetSelection(size_t nPage, int flags = 0); - - // 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/osx/carbon/palette.h b/include/wx/osx/carbon/palette.h deleted file mode 100644 index 5c6aa4740f..0000000000 --- a/include/wx/osx/carbon/palette.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#include "wx/gdiobj.h" - -#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) - -class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase -{ -public: - wxPalette(); - - wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - virtual ~wxPalette(); - bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); - - int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; - bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; - - virtual int GetColoursCount() const; - -protected: - virtual wxGDIRefData *CreateGDIRefData() const; - virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; - -private: - DECLARE_DYNAMIC_CLASS(wxPalette) -}; - -#endif // _WX_PALETTE_H_ diff --git a/include/wx/osx/carbon/pnghand.h b/include/wx/osx/carbon/pnghand.h deleted file mode 100644 index de27a024d9..0000000000 --- a/include/wx/osx/carbon/pnghand.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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 -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PNGHAND_H_ -#define _WX_PNGHAND_H_ - -#include "wx/defs.h" - -#if wxUSE_LIBPNG - -class WXDLLIMPEXP_CORE wxPNGFileHandler: public wxBitmapHandler -{ - DECLARE_DYNAMIC_CLASS(wxPNGFileHandler) -public: - inline wxPNGFileHandler(void) - { - SetName(wxT("PNG bitmap file")); - SetExtension(wxT("bmp")); - SetType(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 //wxUSE_LIBPNG - -#endif - // _WX_PNGHAND_H_ - diff --git a/include/wx/osx/carbon/pngread.h b/include/wx/osx/carbon/pngread.h deleted file mode 100644 index 222a2c5589..0000000000 --- a/include/wx/osx/carbon/pngread.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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__ - -#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/osx/carbon/popupwin.h b/include/wx/osx/carbon/popupwin.h deleted file mode 100644 index 3bf458ef15..0000000000 --- a/include/wx/osx/carbon/popupwin.h +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/popupwin.h -// Purpose: wxPopupWindow class for wxMac -// Author: Stefan Csomor -// Modified by: -// Created: -// RCS-ID: $Id$ -// Copyright: (c) 2006 Stefan Csomor -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_POPUPWIN_H_ -#define _WX_MAC_POPUPWIN_H_ - -// ---------------------------------------------------------------------------- -// wxPopupWindow -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase -{ -public: - wxPopupWindow() { } - ~wxPopupWindow(); - - wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) - { (void)Create(parent, flags); } - - bool Create(wxWindow *parent, int flags = wxBORDER_NONE); - -protected: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) -}; - -#endif // _WX_MAC_POPUPWIN_H_ - diff --git a/include/wx/osx/carbon/printmac.h b/include/wx/osx/carbon/printmac.h deleted file mode 100644 index 776d6643c1..0000000000 --- a/include/wx/osx/carbon/printmac.h +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/prntbase.h" - -/* - * Represents the printer: manages printing a wxPrintout object - */ - -class WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE 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/osx/carbon/radiobox.h b/include/wx/osx/carbon/radiobox.h deleted file mode 100644 index 6890aaafb7..0000000000 --- a/include/wx/osx/carbon/radiobox.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -// List box item -class WXDLLIMPEXP_FWD_CORE wxBitmap ; - -class WXDLLIMPEXP_FWD_CORE wxRadioButton ; - -class WXDLLIMPEXP_CORE 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); - } - virtual ~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); - - // Enabling - virtual bool Enable(bool enable = true); - virtual bool Enable(unsigned int item, bool enable = true); - virtual bool IsItemEnabled(unsigned int item) const; - - // Showing - virtual bool Show(bool show = true); - virtual bool Show(unsigned int item, bool show = true); - virtual bool IsItemShown(unsigned int item) const; - - // Specific functions (in wxWidgets2 reference) - virtual void SetSelection(int item); - virtual int GetSelection() const; - - virtual unsigned int GetCount() const { return m_noItems; } - - virtual wxString GetString(unsigned int item) const; - virtual void SetString(unsigned int item, const wxString& label); - - virtual wxString GetLabel() const; - virtual void SetLabel(const wxString& label) ; - - // protect native font of box - virtual bool SetFont( const wxFont &font ); -// 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; - - unsigned 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/osx/carbon/radiobut.h b/include/wx/osx/carbon/radiobut.h deleted file mode 100644 index 9c719eed3b..0000000000 --- a/include/wx/osx/carbon/radiobut.h +++ /dev/null @@ -1,94 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -class WXDLLIMPEXP_CORE 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); - } - virtual ~wxRadioButton(); - - 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 - - void Command(wxCommandEvent& event); - wxRadioButton *AddInCycle(wxRadioButton *cycle); - void RemoveFromCycle(); - inline wxRadioButton *NextInCycle() {return m_cycle;} - - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - protected: - - wxRadioButton *m_cycle; -}; - -// Not implemented -#if 0 -class WXDLLIMPEXP_FWD_CORE wxBitmap ; - -WXDLLIMPEXP_DATA_CORE(extern const wxChar) wxBitmapRadioButtonNameStr[]; - -class WXDLLIMPEXP_CORE 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/osx/carbon/scrolbar.h b/include/wx/osx/carbon/scrolbar.h deleted file mode 100644 index cd32595315..0000000000 --- a/include/wx/osx/carbon/scrolbar.h +++ /dev/null @@ -1,68 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -// Scrollbar item -class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase -{ -public: - wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } - virtual ~wxScrollBar(); - - 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); - - virtual int GetThumbPosition() const ; - virtual int GetThumbSize() const { return m_viewSize; } - virtual int GetPageSize() const { return m_pageSize; } - virtual int GetRange() const { return m_objectSize; } - - virtual void SetThumbPosition(int viewStart); - virtual void SetScrollbar(int position, int thumbSize, int range, - int pageSize, bool refresh = true); - - // implementation only from now on - void Command(wxCommandEvent& event); -#if wxOSX_USE_CARBON - virtual void MacHandleControlClick( WXWidget control , - wxInt16 controlpart , - bool mouseStillDown ) ; -#endif - virtual bool HandleClicked( double timestampsec ); -protected: - virtual wxSize DoGetBestSize() const; - - int m_pageSize; - int m_viewSize; - int m_objectSize; - - DECLARE_DYNAMIC_CLASS(wxScrollBar) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_SCROLBAR_H_ diff --git a/include/wx/osx/carbon/slider.h b/include/wx/osx/carbon/slider.h deleted file mode 100644 index f2f40043e4..0000000000 --- a/include/wx/osx/carbon/slider.h +++ /dev/null @@ -1,110 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/control.h" -#include "wx/slider.h" -#include "wx/stattext.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxSliderNameStr[]; - -// Slider -class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase -{ - 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); - } - - virtual ~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) ; - - void Command(wxCommandEvent& event); - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - void MacHandleControlClick(WXWidget control, wxInt16 controlpart, bool mouseStillDown); - -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); - - // set min/max size of the slider - virtual void DoSetSizeHints( int minW, int minH, - int maxW, int maxH, - int incW, int incH); - - // Common processing to invert slider values based on wxSL_INVERSE - virtual int ValueInvertOrNot(int value) const; - - 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/osx/carbon/sound.h b/include/wx/osx/carbon/sound.h deleted file mode 100644 index 670b170b9e..0000000000 --- a/include/wx/osx/carbon/sound.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: sound.h -// Purpose: wxSound class (loads and plays short Windows .wav files). -// Optional on non-Windows platforms. -// Author: Ryan Norton, Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// RCS-ID: $Id$ -// Copyright: (c) Ryan Norton, Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SOUND_H_ -#define _WX_SOUND_H_ - -#if wxUSE_SOUND - -#include "wx/object.h" - -class WXDLLIMPEXP_ADV wxSound : public wxSoundBase -{ -public: - wxSound(); - wxSound(const wxString& fileName, bool isResource = FALSE); - wxSound(int size, const wxByte* data); - virtual ~wxSound(); - -public: - bool Create(const wxString& fileName, bool isResource = FALSE); - bool IsOk() const { return !m_sndname.IsEmpty(); } - static void Stop(); - static bool IsPlaying(); - - void* GetHandle(); -protected: - bool DoPlay(unsigned flags) const; - -private: - wxString m_sndname; //file path - char* m_hSnd; //pointer to resource or memory location - int m_waveLength; //size of file in memory mode - void* m_pTimer; //timer - - enum wxSoundType - { - wxSound_MEMORY, - wxSound_FILE, - wxSound_RESOURCE, - wxSound_NONE - } m_type; //mode -}; - -#endif -#endif - // _WX_SOUND_H_ diff --git a/include/wx/osx/carbon/spinbutt.h b/include/wx/osx/carbon/spinbutt.h deleted file mode 100644 index 5c34e911d8..0000000000 --- a/include/wx/osx/carbon/spinbutt.h +++ /dev/null @@ -1,78 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#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 WXDLLIMPEXP_CORE 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 void SetRange(int minVal, int maxVal); - virtual int GetValue() const ; - virtual void SetValue(int val); - - // implementation - -#if wxOSX_USE_CARBON - virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; -#endif - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); - -protected: - void SendThumbTrackEvent() ; - - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_DYNAMIC_CLASS(wxSpinButton) -}; - -#endif - // _WX_SPINBUTT_H_ diff --git a/include/wx/osx/carbon/spinctrl.h b/include/wx/osx/carbon/spinctrl.h deleted file mode 100644 index 38fd7a9bff..0000000000 --- a/include/wx/osx/carbon/spinctrl.h +++ /dev/null @@ -1,195 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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 - -#include "wx/containr.h" - -class WXDLLIMPEXP_FWD_CORE wxSpinButton; -class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -class WXDLLIMPEXP_FWD_CORE wxSpinCtrlText; -class WXDLLIMPEXP_FWD_CORE wxSpinCtrlButton; - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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; - - WX_DECLARE_CONTROL_CONTAINER(); - -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; - - friend class wxSpinCtrlText; - friend class wxSpinCtrlButton; - - int m_oldValue; -private: - DECLARE_EVENT_TABLE() - DECLARE_DYNAMIC_CLASS(wxSpinCtrl) -}; - -#else // !wxUSE_SPINBTN - -// ---------------------------------------------------------------------------- -// wxSpinCtrl is just a text control -// ---------------------------------------------------------------------------- - -#include "wx/textctrl.h" - -class WXDLLIMPEXP_CORE 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/osx/carbon/srchctrl.h b/include/wx/osx/carbon/srchctrl.h deleted file mode 100644 index a883134422..0000000000 --- a/include/wx/osx/carbon/srchctrl.h +++ /dev/null @@ -1,84 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/srchctrl.h -// Purpose: mac carbon wxSearchCtrl class -// Author: Vince Harron -// Created: 2006-02-19 -// RCS-ID: $Id$ -// Copyright: Vince Harron -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_SEARCHCTRL_H_ -#define _WX_SEARCHCTRL_H_ - -#if wxUSE_SEARCHCTRL - -class wxSearchWidgetImpl; - -class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase -{ -public: - // creation - // -------- - - wxSearchCtrl(); - wxSearchCtrl(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 = wxSearchCtrlNameStr); - - virtual ~wxSearchCtrl(); - - 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 = wxSearchCtrlNameStr); - - // get/set search button menu - // -------------------------- - virtual void SetMenu( wxMenu* menu ); - virtual wxMenu* GetMenu(); - - // get/set search options - // ---------------------- - virtual void ShowSearchButton( bool show ); - virtual bool IsSearchButtonVisible() const; - - virtual void ShowCancelButton( bool show ); - virtual bool IsCancelButtonVisible() const; - - // TODO: In 2.9 these should probably be virtual, and declared in the base class... - void SetDescriptiveText(const wxString& text); - wxString GetDescriptiveText() const; - - virtual bool HandleSearchFieldSearchHit() ; - virtual bool HandleSearchFieldCancelHit() ; - - wxSearchWidgetImpl * GetSearchPeer() const; - -protected: - - wxSize DoGetBestSize() const; - - void Init(); - - wxMenu *m_menu; - - wxString m_descriptiveText; - -private: - DECLARE_DYNAMIC_CLASS(wxSearchCtrl) - - DECLARE_EVENT_TABLE() -}; - -#endif // wxUSE_SEARCHCTRL - -#endif // _WX_SEARCHCTRL_H_ - diff --git a/include/wx/osx/carbon/statbox.h b/include/wx/osx/carbon/statbox.h deleted file mode 100644 index b7b86b08a9..0000000000 --- a/include/wx/osx/carbon/statbox.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -#include "wx/control.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBoxNameStr[]; - -// Group box -class WXDLLIMPEXP_CORE 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)) {}; - - virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; - - virtual bool AcceptsFocus() const { return false; } - - // protect native font of box - virtual bool SetFont( const wxFont &font ); -}; - -#endif - // _WX_STATBOX_H_ diff --git a/include/wx/osx/carbon/statline.h b/include/wx/osx/carbon/statline.h deleted file mode 100644 index 29de9f2a54..0000000000 --- a/include/wx/osx/carbon/statline.h +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -class wxStaticBox; - -// ---------------------------------------------------------------------------- -// wxStaticLine -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase -{ -public: - // constructors and pseudo-constructors - wxStaticLine() : m_statbox(NULL) { } - - wxStaticLine( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ) - : m_statbox(NULL) - { - Create(parent, id, pos, size, style, name); - } - - bool Create( wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxPoint &pos = wxDefaultPosition, - const wxSize &size = wxDefaultSize, - long style = wxLI_HORIZONTAL, - const wxString &name = wxStaticLineNameStr ); - - // 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; - - DECLARE_DYNAMIC_CLASS(wxStaticLine) -}; - -#endif // _WX_GENERIC_STATLINE_H_ - diff --git a/include/wx/osx/carbon/stattext.h b/include/wx/osx/carbon/stattext.h deleted file mode 100644 index fc69ab3457..0000000000 --- a/include/wx/osx/carbon/stattext.h +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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_ - -class WXDLLIMPEXP_CORE wxStaticText: public wxStaticTextBase -{ -public: - wxStaticText() { } - - 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 ); - - virtual bool AcceptsFocus() const { return FALSE; } - -protected : - - virtual wxString DoGetLabel() const; - virtual void DoSetLabel(const wxString& str); - - virtual wxSize DoGetBestSize() const ; - - DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) -}; - -#endif - // _WX_STATTEXT_H_ diff --git a/include/wx/osx/carbon/statusbr.h b/include/wx/osx/carbon/statusbr.h deleted file mode 100644 index 81ee10257c..0000000000 --- a/include/wx/osx/carbon/statusbr.h +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -class WXDLLIMPEXP_CORE wxStatusBarMac : public wxStatusBarGeneric -{ - DECLARE_DYNAMIC_CLASS(wxStatusBarMac) - - wxStatusBarMac(); - wxStatusBarMac(wxWindow *parent, wxWindowID id = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr); - - virtual ~wxStatusBarMac(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - long style = wxST_SIZEGRIP, - const wxString& name = wxStatusBarNameStr); - - 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 MacHiliteChanged(); - void OnPaint(wxPaintEvent& event); - -protected: - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_STATBAR_H_ diff --git a/include/wx/osx/carbon/taskbarosx.h b/include/wx/osx/carbon/taskbarosx.h deleted file mode 100644 index 0d48721613..0000000000 --- a/include/wx/osx/carbon/taskbarosx.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// 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_ - -class WXDLLIMPEXP_FWD_CORE wxIcon; -class WXDLLIMPEXP_FWD_CORE wxMenu; - -class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase -{ - DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) -public: - // type of taskbar item to create (currently only DOCK is implemented) - enum wxTaskBarIconType - { - DOCK -#if wxOSX_USE_COCOA - , CUSTOM_STATUSITEM -#endif -// , STATUSITEM -// , MENUEXTRA - , DEFAULT_TYPE = DOCK - }; - - wxTaskBarIcon(wxTaskBarIconType iconType = DEFAULT_TYPE); - virtual ~wxTaskBarIcon(); - - bool IsOk() const { return true; } - - bool IsIconInstalled() const; - bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); - bool RemoveIcon(); - bool PopupMenu(wxMenu *menu); - -protected: - class wxTaskBarIconImpl* m_impl; - friend class wxTaskBarIconImpl; -}; -#endif - // _TASKBAR_H_ diff --git a/include/wx/osx/carbon/textctrl.h b/include/wx/osx/carbon/textctrl.h deleted file mode 100644 index df6967f9ab..0000000000 --- a/include/wx/osx/carbon/textctrl.h +++ /dev/null @@ -1,208 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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 wxUSE_SYSTEM_OPTIONS - // set this to 'true' if you want to use the 'classic' MLTE-based implementation - // instead of the HIView-based implementation in 10.3 and upwards, the former - // has more features (backgrounds etc.), but may show redraw artefacts and other - // problems depending on your usage; hence, the default is 'false'. - #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte") - // set this to 'true' if you want editable text controls to have spell checking turned - // on by default, you can change this setting individually on a control using MacCheckSpelling - #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker") -#endif - -#include "wx/control.h" -#include "wx/textctrl.h" - -// forward decl for wxListWidgetImpl implementation type. -class WXDLLIMPEXP_FWD_CORE wxTextWidgetImpl; - -class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase -{ - DECLARE_DYNAMIC_CLASS(wxTextCtrl) - -public: - wxTextCtrl() - { Init(); } - - 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); - } - - virtual ~wxTextCtrl(); - - 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 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); - - // 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 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 SetFont( const wxFont &font ); - 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 into the textctrl - // 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 wxTextPos GetLastPosition() const; - - virtual void SetSelection(long from, long to); - virtual void SetEditable(bool editable); - - // 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 OnDelete(wxCommandEvent& event); - void OnSelectAll(wxCommandEvent& event); - - void OnUpdateCut(wxUpdateUIEvent& event); - void OnUpdateCopy(wxUpdateUIEvent& event); - void OnUpdatePaste(wxUpdateUIEvent& event); - void OnUpdateUndo(wxUpdateUIEvent& event); - void OnUpdateRedo(wxUpdateUIEvent& event); - void OnUpdateDelete(wxUpdateUIEvent& event); - void OnUpdateSelectAll(wxUpdateUIEvent& event); - - void OnContextMenu(wxContextMenuEvent& event); - - virtual bool MacSetupCursor( const wxPoint& pt ); - - virtual void MacVisibilityChanged(); - virtual void MacSuperChangedPosition(); - virtual void MacCheckSpelling(bool check); - - wxTextWidgetImpl * GetTextPeer() const; -protected: - // common part of all ctors - void Init(); - - virtual wxSize DoGetBestSize() const; - - virtual void DoSetValue(const wxString& value, int flags = 0); - - bool m_editable; - - // flag is set to true when the user edits the controls contents - bool m_dirty; - - // need to make this public because of the current implementation via callbacks - unsigned long m_maxLength; - - bool GetTriggerOnSetValue() const - { - return m_triggerOnSetValue; - } - - void SetTriggerOnSetValue(bool trigger) - { - m_triggerOnSetValue = trigger; - } - - bool m_triggerOnSetValue ; - -private : - wxMenu *m_privateContextMenu; - - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_TEXTCTRL_H_ diff --git a/include/wx/osx/carbon/tglbtn.h b/include/wx/osx/carbon/tglbtn.h deleted file mode 100644 index fde10d7980..0000000000 --- a/include/wx/osx/carbon/tglbtn.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// 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 licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_TOGGLEBUTTON_H_ -#define _WX_TOGGLEBUTTON_H_ - -WXDLLIMPEXP_DATA_CORE(extern const char) wxCheckBoxNameStr[]; - - -class WXDLLIMPEXP_CORE wxBitmapToggleButton : public wxToggleButtonBase -{ -public: - wxBitmapToggleButton() {} - wxBitmapToggleButton(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& 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 bool HandleClicked( double timestampsec ); - - virtual void Command(wxCommandEvent& event); - -private: - wxBitmap m_bitmap; - - int m_marginX, - m_marginY; - -protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton) -}; - - -class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase -{ -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 bool HandleClicked( double timestampsec ); - - virtual void Command(wxCommandEvent& event); - -protected: - virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; - -private: - DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) -}; - -#endif // _WX_TOGGLEBUTTON_H_ - diff --git a/include/wx/osx/carbon/toolbar.h b/include/wx/osx/carbon/toolbar.h deleted file mode 100644 index 6dd02028cb..0000000000 --- a/include/wx/osx/carbon/toolbar.h +++ /dev/null @@ -1,109 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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 wxUSE_TOOLBAR - -#include "wx/tbarbase.h" -#include "wx/dynarray.h" - -WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr[]; - -class WXDLLIMPEXP_CORE 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); - } - virtual ~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); - - virtual void SetWindowStyleFlag(long style); - - // override/implement base class virtuals - virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; - - virtual bool Show(bool show = true); - virtual bool IsShown() const; - virtual bool Realize(); - - virtual void SetToolBitmapSize(const wxSize& size); - virtual wxSize GetToolSize() const; - - virtual void SetRows(int nRows); - - virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); - virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); - - // Add all the buttons - - virtual wxString MacGetToolTipString( wxPoint &where ) ; - void OnPaint(wxPaintEvent& event) ; - void OnMouse(wxMouseEvent& event) ; - virtual void MacSuperChangedPosition() ; - -#if wxOSX_USE_NATIVE_TOOLBAR - bool MacInstallNativeToolbar(bool usesNative); - bool MacWantsNativeToolbar(); - bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const; -#endif -protected: - // common part of all ctors - void Init(); - - virtual void DoGetSize(int *width, int *height) const; - virtual wxSize DoGetBestSize() const; - 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, - const wxString& label); - - DECLARE_EVENT_TABLE() -#if wxOSX_USE_NATIVE_TOOLBAR - bool m_macUsesNativeToolbar ; - void* m_macToolbar ; -#endif -}; - -#endif // wxUSE_TOOLBAR - -#endif - // _WX_TOOLBAR_H_ diff --git a/include/wx/osx/carbon/tooltip.h b/include/wx/osx/carbon/tooltip.h deleted file mode 100644 index df51d47ffb..0000000000 --- a/include/wx/osx/carbon/tooltip.h +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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 -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_TOOLTIP_H_ -#define _WX_MAC_TOOLTIP_H_ - -#include "wx/string.h" -#include "wx/event.h" - -class WXDLLIMPEXP_CORE 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); - // set the delay after which the tooltip disappears or how long the tooltip remains visible - static void SetAutoPop(long milliseconds); - // set the delay between subsequent tooltips to appear - static void SetReshow(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) -}; - -#endif // _WX_MAC_TOOLTIP_H_ diff --git a/include/wx/osx/carbon/toplevel.h b/include/wx/osx/carbon/toplevel.h deleted file mode 100644 index 7983b8c5c6..0000000000 --- a/include/wx/osx/carbon/toplevel.h +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -// ---------------------------------------------------------------------------- -// wxTopLevelWindowMac -// ---------------------------------------------------------------------------- - -class WXDLLIMPEXP_CORE 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(); - - virtual bool Destroy(); - - virtual wxPoint GetClientAreaOrigin() const; - - // Attracts the users attention to this window if the application is - // inactive (should be called when a background event occurs) - virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); - - // 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 Restore(); - - virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) ; - virtual bool IsFullScreen() const ; - - // implementation from now on - // -------------------------- - - virtual void SetTitle( const wxString& title); - virtual wxString GetTitle() const; - -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; -private : - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_MSW_TOPLEVEL_H_ diff --git a/include/wx/osx/carbon/treectrl.h b/include/wx/osx/carbon/treectrl.h deleted file mode 100644 index a8c92b288f..0000000000 --- a/include/wx/osx/carbon/treectrl.h +++ /dev/null @@ -1,291 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/mac/carbon/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_ - -#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. -}; - -#if WXWIN_COMPATIBILITY_2_6 - // Flags for InsertItem - enum { - wxTREE_INSERT_LAST = -1, - wxTREE_INSERT_FIRST = -2, - wxTREE_INSERT_SORT = -3 - }; -#endif - -class WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE wxTreeCtrl: public wxControl -{ -public: - /* - * Public interface - */ - - // creation - // -------- - wxTreeCtrl(); - - inline wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, - 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); - } - virtual ~wxTreeCtrl(); - - bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, - 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 - // --------- - // - virtual unsigned int GetCount() const; - - // indent - int GetIndent() const; - void SetIndent(int indent); - // image list - wxImageList *GetImageList(int which = wxIMAGE_LIST_NORMAL) const; - - // 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); - -#if WXWIN_COMPATIBILITY_2_6 - wxDEPRECATED( 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. - wxDEPRECATED( long InsertItem(long parent, const wxString& label, - int image = -1, int selImage = -1, - long insertAfter = wxTREE_INSERT_LAST) ); - - // use Expand, Collapse, CollapseAndReset or Toggle - wxDEPRECATED( bool ExpandItem(long item, int action) ); - wxDEPRECATED( void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL) ); -#endif // WXWIN_COMPATIBILITY_2_6 - - // 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); } - - // - 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 WXDLLIMPEXP_CORE 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/osx/carbon/window.h b/include/wx/osx/carbon/window.h deleted file mode 100644 index 783aee0929..0000000000 --- a/include/wx/osx/carbon/window.h +++ /dev/null @@ -1,344 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: include/wx/mac/carbon/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_ - -#include "wx/brush.h" -#include "wx/dc.h" - -class WXDLLIMPEXP_FWD_CORE wxButton; -class WXDLLIMPEXP_FWD_CORE wxScrollBar; -class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; - -class WXDLLIMPEXP_FWD_CORE wxMacControl ; -class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ; - -class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase -{ - DECLARE_DYNAMIC_CLASS(wxWindowMac) - - friend class wxDC; - friend class wxPaintDC; - -public: - wxWindowMac(); - - wxWindowMac( wxWindowMac *parent, - wxWindowID id, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = wxPanelNameStr ); - - 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 SetLabel( const wxString& label ); - virtual wxString GetLabel() const; - - virtual void Raise(); - virtual void Lower(); - - virtual bool Show( bool show = true ); - - virtual bool IsShownOnScreen() const; - - virtual void SetFocus(); - - virtual void WarpPointer( int x, int y ); - - virtual void Refresh( bool eraseBackground = true, - const wxRect *rect = NULL ); - - virtual void Update() ; - virtual void ClearBackground(); - - virtual bool SetCursor( const wxCursor &cursor ); - virtual bool SetFont( const wxFont &font ); - virtual bool SetBackgroundColour( const wxColour &colour ); - virtual bool SetForegroundColour( const wxColour &colour ); - - virtual int GetCharHeight() const; - virtual int GetCharWidth() const; - virtual void GetTextExtent( const wxString& string, - int *x, int *y, - int *descent = NULL, - int *externalLeading = NULL, - const wxFont *theFont = NULL ) - const; -protected: - virtual void DoEnable( bool enable ); -#if wxUSE_MENUS - virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); -#endif - - virtual void DoFreeze(); - virtual void DoThaw(); - -public: - virtual void SetScrollbar( int orient, int pos, int thumbVisible, - int range, bool refresh = true ); - virtual void SetScrollPos( int orient, int pos, bool refresh = true ); - virtual int GetScrollPos( int orient ) const; - virtual int GetScrollThumb( int orient ) const; - virtual int GetScrollRange( int orient ) const; - virtual void ScrollWindow( int dx, int dy, - const wxRect* rect = (wxRect *) NULL ); - virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true); - virtual bool IsScrollbarAlwaysShown(int orient) const - { - return orient == wxHORIZONTAL ? m_hScrollBarAlwaysShown - : m_vScrollBarAlwaysShown; - } - - virtual bool Reparent( wxWindowBase *newParent ); - -#if wxUSE_DRAG_AND_DROP - virtual void SetDropTarget( wxDropTarget *dropTarget ); -#endif - - // Accept files for dragging - virtual void DragAcceptFiles( bool accept ); - - // implementation from now on - // -------------------------- - - void MacClientToRootWindow( 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 - // ---------------- - - virtual WXWidget GetHandle() const; - - virtual bool SetTransparent(wxByte alpha); - virtual bool CanSetTransparent(); - virtual wxByte GetTransparent() const ; - - // event handlers - // -------------- - void OnPaint( wxPaintEvent& event ); - void OnNcPaint( wxNcPaintEvent& event ); - void OnEraseBackground(wxEraseEvent& event ); - void OnMouseEvent( wxMouseEvent &event ); - - void MacOnScroll( wxScrollEvent&event ); - - virtual bool AcceptsFocus() const; - - virtual bool IsDoubleBuffered() const { return true; } - -public: - static long MacRemoveBordersFromStyle( long style ) ; - -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; - - virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; - virtual bool MacDoRedraw( void* updatergn , long time ) ; - - // 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 ) ; - void MacPaintGrowBox(); - - // invalidates the borders and focus area around the control; - // must not be virtual as it will be called during destruction - void MacInvalidateBorders() ; - - WXWindow MacGetTopLevelWindowRef() const ; - wxNonOwnedWindow* MacGetTopLevelWindow() const ; - - virtual long MacGetLeftBorderSize() const ; - virtual long MacGetRightBorderSize() const ; - virtual long MacGetTopBorderSize() const ; - virtual long MacGetBottomBorderSize() const ; - - virtual void MacSuperChangedPosition() ; - - // absolute coordinates of this window's root have changed - virtual void MacTopLevelWindowChangedPosition() ; - - virtual void MacChildAdded() ; - virtual void MacVisibilityChanged() ; - virtual void MacEnabledStateChanged() ; - virtual void MacHiliteChanged() ; - virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; - - bool MacIsReallyEnabled() ; - bool MacIsReallyHilited() ; - - bool MacIsUserPane() { return m_macIsUserPane; } - - virtual bool MacSetupCursor( const wxPoint& pt ) ; - - // return the rectangle that would be visible of this control, - // regardless whether controls are hidden - // only taking into account clipping by parent windows - const wxRect& MacGetClippedClientRect() const ; - const wxRect& MacGetClippedRect() const ; - const wxRect& MacGetClippedRectWithOuterStructure() const ; - - // returns the visible region of this control in window ie non-client coordinates - const wxRegion& MacGetVisibleRegion( bool includeOuterStructures = false ) ; - - // returns true if children have to clipped to the content area - // (e.g., scrolled windows) - bool MacClipChildren() const { return m_clipChildren ; } - void MacSetClipChildren( bool clip ) { m_clipChildren = clip ; } - - // returns true if the grandchildren need to be clipped to the children's content area - // (e.g., splitter windows) - virtual bool MacClipGrandChildren() const { return false ; } - bool MacIsWindowScrollbar( const wxWindow* sb ) const - { return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; } - virtual bool IsClientAreaChild(const wxWindow *child) const - { - return !MacIsWindowScrollbar(child) && - wxWindowBase::IsClientAreaChild(child); - } - - void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ; - wxList& GetSubcontrols() { return m_subControls; } - - // translate wxWidgets coords into ones suitable - // to be passed to CreateControl calls - // - // returns true if non-default coords are returned, false otherwise - bool MacGetBoundsForControl(const wxPoint& pos, - const wxSize& size, - int& x, int& y, - int& w, int& h , bool adjustForOrigin ) const ; - - // the 'true' OS level control for this wxWindow -#if wxOSX_USE_CARBON - wxMacControl* GetPeer() const { return m_peer ; } -#else - wxWidgetImpl* GetPeer() const { return m_peer ; } -#endif - - void * MacGetCGContextRef() { return m_cgContextRef ; } - void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; } - - // osx specific event handling common for all osx-ports - - virtual bool HandleClicked( double timestampsec ); -protected: - // For controls like radio buttons which are genuinely composite - wxList m_subControls; - -#if wxOSX_USE_CARBON - // the peer object, allowing for cleaner API support - wxMacControl * m_peer ; -#else - wxWidgetImpl * m_peer ; -#endif - void * m_cgContextRef ; - - // cache the clipped rectangles within the window hierarchy - void MacUpdateClippedRects() const ; - - mutable bool m_cachedClippedRectValid ; - mutable wxRect m_cachedClippedRectWithOuterStructure ; - mutable wxRect m_cachedClippedRect ; - mutable wxRect m_cachedClippedClientRect ; - mutable wxRegion m_cachedClippedRegionWithOuterStructure ; - mutable wxRegion m_cachedClippedRegion ; - mutable wxRegion m_cachedClippedClientRegion ; - - // true if is is not a native control but a wxWindow control - bool m_macIsUserPane ; - - // insets of the mac control from the wx top left corner - wxPoint m_macTopLeftInset ; - wxPoint m_macBottomRightInset ; - wxByte m_macAlpha ; - - wxScrollBar* m_hScrollBar ; - wxScrollBar* m_vScrollBar ; - bool m_hScrollBarAlwaysShown; - bool m_vScrollBarAlwaysShown; - wxString m_label ; - - // set to true if we do a sharp clip at the content area of this window - // must be dynamic as eg a panel normally is not clipping precisely, but if - // it becomes the target window of a scrolled window it has to... - bool m_clipChildren ; - - virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; - - bool MacHasScrollBarCorner() const; - void MacCreateScrollBars( long style ) ; - void MacRepositionScrollBars() ; - void MacUpdateControlFont() ; - - // implement the base class pure virtuals - virtual wxSize DoGetBestSize() const; - virtual wxSize DoGetSizeFromClientSize( const wxSize & size ) const; - 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 ); - virtual void DoSetWindowVariant( wxWindowVariant variant ); - -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip( wxToolTip *tip ); -#endif - -private: - // common part of all ctors - void Init(); - - // show/hide scrollbars as needed, common part of SetScrollbar() and - // AlwaysShowScrollbars() - void DoUpdateScrollbarVisibility(); - - - DECLARE_NO_COPY_CLASS(wxWindowMac) - DECLARE_EVENT_TABLE() -}; - -#endif // _WX_WINDOW_H_ diff --git a/include/wx/osx/checkbox.h b/include/wx/osx/checkbox.h index d578f6da22..85ea0b7739 100644 --- a/include/wx/osx/checkbox.h +++ b/include/wx/osx/checkbox.h @@ -1,5 +1,83 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/checkbox.h" -#else -#include "wx/osx/carbon/checkbox.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +// Checkbox item (single checkbox) +class WXDLLIMPEXP_CORE 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; + + virtual void Command(wxCommandEvent& event); + + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); +protected: + void DoSet3StateValue(wxCheckBoxState val); + virtual wxCheckBoxState DoGet3StateValue() const; + + DECLARE_DYNAMIC_CLASS(wxCheckBox) +}; + +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_CORE 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/osx/checklst.h b/include/wx/osx/checklst.h index 81ef6c6d4b..5e2fb9774b 100644 --- a/include/wx/osx/checklst.h +++ b/include/wx/osx/checklst.h @@ -1,5 +1,94 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/checklst.h" -#else -#include "wx/osx/carbon/checklst.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_MAC_CHECKLST_H_ +#define _WX_MAC_CHECKLST_H_ + +class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase +{ +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(unsigned int uiIndex) const; + void Check(unsigned int uiIndex, bool bCheck = true); + + // data callbacks + virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + +protected: + // override all methods which add/delete items to update m_checks array as + // well + virtual void OnItemInserted(unsigned int pos); + virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear(); + + // the array containing the checked status of the items + wxArrayInt m_checks; + + wxListWidgetColumn* m_checkColumn ; + + void Init(); + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxCheckListBox) +}; + +#endif // _WX_MAC_CHECKLST_H_ diff --git a/include/wx/osx/choice.h b/include/wx/osx/choice.h index 011827b7e0..829843be36 100644 --- a/include/wx/osx/choice.h +++ b/include/wx/osx/choice.h @@ -1,5 +1,101 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/choice.h" -#else -#include "wx/osx/carbon/choice.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#include "wx/control.h" + +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxChoiceNameStr[]; + +WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ; + +// Choice item +class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase +{ + DECLARE_DYNAMIC_CLASS(wxChoice) + +public: + wxChoice() + : m_strings(), m_datas() + {} + + 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); + + virtual unsigned int GetCount() const ; + virtual int GetSelection() const ; + virtual void SetSelection(int n); + + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual wxString GetString(unsigned int n) const ; + virtual void SetString(unsigned int pos, const wxString& s); + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + +protected: + virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear(); + + virtual wxSize DoGetBestSize() const ; + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + + wxArrayString m_strings; + wxChoiceDataArray m_datas ; + wxMenu* m_popUpMenu ; +}; + #endif + // _WX_CHOICE_H_ diff --git a/include/wx/osx/clipbrd.h b/include/wx/osx/clipbrd.h index b16d3418b1..db74c5ba46 100644 --- a/include/wx/osx/clipbrd.h +++ b/include/wx/osx/clipbrd.h @@ -1,5 +1,76 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/clipbrd.h" -#else -#include "wx/osx/carbon/clipbrd.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: clipbrd.h +// Purpose: Clipboard functionality. +// Note: this functionality is under review, and +// is derived from wxWidgets 1.xx code. Please contact +// the wxWidgets 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 wxUSE_CLIPBOARD + +#include "wx/list.h" +#include "wx/module.h" +#include "wx/dataobj.h" // for wxDataFormat + +#include "wx/osx/core/cfref.h" + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxDataObject; +class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase +{ + DECLARE_DYNAMIC_CLASS(wxClipboard) + +public: + wxClipboard(); + virtual ~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(); + +private: + wxDataObject *m_data; + bool m_open; + wxCFRef m_pasteboard; +}; + +#endif // wxUSE_CLIPBOARD + +#endif // _WX_CLIPBRD_H_ diff --git a/include/wx/osx/colordlg.h b/include/wx/osx/colordlg.h index 89f32c2195..219e1b4e19 100644 --- a/include/wx/osx/colordlg.h +++ b/include/wx/osx/colordlg.h @@ -1,6 +1,42 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/colordlg.h" -#else -#include "wx/osx/carbon/colordlg.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#include "wx/defs.h" +#include "wx/dialog.h" +#include "wx/cmndata.h" + +/* + * Platform-specific colour dialog implementation + */ + +class WXDLLIMPEXP_CORE 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/osx/combobox.h b/include/wx/osx/combobox.h index 8525d8008d..6e0c649aaa 100644 --- a/include/wx/osx/combobox.h +++ b/include/wx/osx/combobox.h @@ -1,5 +1,164 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/combobox.h" -#else -#include "wx/osx/carbon/combobox.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#include "wx/containr.h" +#include "wx/choice.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr[]; + +// forward declaration of private implementation classes + +class wxComboBoxText; +class wxComboBoxChoice; + +// Combobox item +class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase +{ + DECLARE_DYNAMIC_CLASS(wxComboBox) + + public: + virtual ~wxComboBox(); + + // forward these functions to all subcontrols + virtual bool Enable(bool enable = true); + virtual bool Show(bool show = true); + + // callback functions + virtual void DelegateTextChanged( const wxString& value ); + virtual void DelegateChoice( const wxString& value ); + + wxComboBox() { Init(); } + + 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) + { + Init(); + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + + 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) + { + Init(); + 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); + + virtual int GetSelection() const; + virtual void SetSelection(int n); + virtual int FindString(const wxString& s, bool bCase = false) const; + virtual wxString GetString(unsigned int n) const; + virtual wxString GetStringSelection() const; + virtual void SetString(unsigned int n, const wxString& s); + + // Text field functions + virtual void SetValue(const wxString& value); + virtual wxString GetValue() const; + virtual void WriteText(const wxString& text); + virtual void GetSelection(long *from, long *to) const; + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual wxTextPos 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 bool IsEditable() const; + + virtual unsigned int GetCount() const; + + virtual void Undo(); + virtual void Redo(); + virtual void SelectAll(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + virtual wxClientDataType GetClientDataType() const; + + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + + wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST + + WX_DECLARE_CONTROL_CONTAINER(); + +protected: + // common part of all ctors + void Init(); + + // List functions + virtual void DoDeleteOneItem(unsigned int n); + virtual void DoClear(); + + // override the base class virtuals involved in geometry calculations + virtual wxSize DoGetBestSize() const; + virtual void DoMoveWindow(int x, int y, int width, int height); + + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void * DoGetItemClientData(unsigned int n) const; + + virtual void SetClientDataType(wxClientDataType clientDataItemsType); + + // the subcontrols + wxComboBoxText* m_text; + wxComboBoxChoice* m_choice; + + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_COMBOBOX_H_ diff --git a/include/wx/osx/control.h b/include/wx/osx/control.h index 73ddfa3b65..8d7f2652c3 100644 --- a/include/wx/osx/control.h +++ b/include/wx/osx/control.h @@ -1,5 +1,53 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/control.h" -#else -#include "wx/osx/carbon/control.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +WXDLLIMPEXP_DATA_CORE(extern const char) wxControlNameStr[]; + +// General item class +class WXDLLIMPEXP_CORE wxControl : public wxControlBase +{ + DECLARE_ABSTRACT_CLASS(wxControl) + +public: + wxControl(); + wxControl(wxWindow *parent, wxWindowID winid, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr) + { + Create(parent, winid, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID winid, + 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); + + void OnKeyDown( wxKeyEvent &event ) ; +}; + #endif + // _WX_CONTROL_H_ diff --git a/include/wx/osx/cursor.h b/include/wx/osx/cursor.h index 157d7e20ac..fe0c01391c 100644 --- a/include/wx/osx/cursor.h +++ b/include/wx/osx/cursor.h @@ -1,5 +1,55 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/cursor.h" -#else -#include "wx/osx/carbon/cursor.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#include "wx/bitmap.h" + +// Cursor +class WXDLLIMPEXP_CORE wxCursor : public wxGDIObject +{ +public: + wxCursor(); + + wxCursor(const wxImage & image) ; + wxCursor(const char* const* bits); + wxCursor(const wxString& name, + wxBitmapType type = wxCURSOR_DEFAULT_TYPE, + int hotSpotX = 0, int hotSpotY = 0); + + wxCursor(wxStockCursor id) { InitFromStock(id); } +#if WXWIN_COMPATIBILITY_2_8 + wxCursor(int id) { InitFromStock((wxStockCursor)id); } #endif + virtual ~wxCursor(); + + bool CreateFromXpm(const char* const* bits); + + void MacInstall() const ; + + void SetHCURSOR(WXHCURSOR cursor); + WXHCURSOR GetHCURSOR() const; + +private: + void InitFromStock(wxStockCursor); + + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + void CreateFromImage(const wxImage & image) ; + + DECLARE_DYNAMIC_CLASS(wxCursor) +}; + +extern WXDLLIMPEXP_CORE void wxSetCursor(const wxCursor& cursor); + +#endif // _WX_CURSOR_H_ diff --git a/include/wx/osx/dataform.h b/include/wx/osx/dataform.h index b0c0bd7ba2..910dfc5fef 100644 --- a/include/wx/osx/dataform.h +++ b/include/wx/osx/dataform.h @@ -1,5 +1,69 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dataform.h" -#else -#include "wx/osx/carbon/dataform.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// 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 WXDLLIMPEXP_CORE wxDataFormat +{ +public: + typedef unsigned long NativeFormat; + + wxDataFormat(); + wxDataFormat(wxDataFormatId vType); + wxDataFormat(const wxDataFormat& rFormat); + wxDataFormat(const wxString& rId); + wxDataFormat(const wxChar* pId); + wxDataFormat(NativeFormat vFormat); + ~wxDataFormat(); + + wxDataFormat& operator=(NativeFormat vFormat) + { SetId(vFormat); return *this; } + + // comparison (must have both versions) + bool operator==(const wxDataFormat& format) const ; + bool operator!=(const wxDataFormat& format) const + { return ! ( *this == format ); } + bool operator==(wxDataFormatId format) const + { return m_type == (wxDataFormatId)format; } + bool operator!=(wxDataFormatId format) const + { return m_type != (wxDataFormatId)format; } + + wxDataFormat& operator=(const wxDataFormat& 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 wxString& pId); + + // implementation + wxDataFormatId GetType() const { return m_type; } + void SetType( wxDataFormatId type ); + + // returns true if the format is one of those defined in wxDataFormatId + bool IsStandard() const { return m_type > 0 && m_type < wxDF_PRIVATE; } + +private: + wxDataFormatId m_type; + NativeFormat m_format; + // indicates the type in case of wxDF_PRIVATE : + wxString m_id ; +}; + +#endif // _WX_MAC_DATAFORM_H diff --git a/include/wx/osx/dataobj.h b/include/wx/osx/dataobj.h index 28b137f957..4b027bfe13 100644 --- a/include/wx/osx/dataobj.h +++ b/include/wx/osx/dataobj.h @@ -1,5 +1,37 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dataobj.h" -#else -#include "wx/osx/carbon/dataobj.h" +/////////////////////////////////////////////////////////////////////////////// +// 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_ + +// ---------------------------------------------------------------------------- +// wxDataObject is the same as wxDataObjectBase under wxGTK +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase +{ +public: + wxDataObject(); +#ifdef __DARWIN__ + virtual ~wxDataObject() { } #endif + + virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const; + void AddToPasteboard( void * pasteboardRef , int itemID ); + // returns true if the passed in format is present in the pasteboard + static bool IsFormatInPasteboard( void * pasteboardRef, const wxDataFormat &dataFormat ); + // returns true if any of the accepted formats of this dataobj is in the pasteboard + bool HasDataInPasteboard( void * pasteboardRef ); + bool GetFromPasteboard( void * pasteboardRef ); +}; + +#endif // _WX_MAC_DATAOBJ_H_ + diff --git a/include/wx/osx/dataobj2.h b/include/wx/osx/dataobj2.h index 546577a211..8caa5b4e6d 100644 --- a/include/wx/osx/dataobj2.h +++ b/include/wx/osx/dataobj2.h @@ -1,5 +1,94 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dataobj2.h" -#else -#include "wx/osx/carbon/dataobj2.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: mac/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_MAC_DATAOBJ2_H_ +#define _WX_MAC_DATAOBJ2_H_ + +// ---------------------------------------------------------------------------- +// wxBitmapDataObject is a specialization of wxDataObject for bitmaps +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase +{ +public: + // ctors + wxBitmapDataObject(); + wxBitmapDataObject(const wxBitmap& bitmap); + + // destr + virtual ~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); + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + { + return SetData(len, buf); + } + +protected : + void Init() ; + void Clear() ; + + void* m_pictHandle ; + bool m_pictCreated ; +}; + +// ---------------------------------------------------------------------------- +// wxFileDataObject is a specialization of wxDataObject for file names +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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); + // Must provide overloads to avoid hiding them (and warnings about it) + virtual size_t GetDataSize(const wxDataFormat&) const + { + return GetDataSize(); + } + virtual bool GetDataHere(const wxDataFormat&, void *buf) const + { + return GetDataHere(buf); + } + virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) + { + return SetData(len, buf); + } +protected: + // translates the filenames stored into a utf8 encoded char stream + void GetFileNames(wxCharBuffer &buf) const ; +}; + +#endif // _WX_MAC_DATAOBJ2_H_ + diff --git a/include/wx/osx/dc.h b/include/wx/osx/dc.h index fd1b3f8f97..1e66662f2c 100644 --- a/include/wx/osx/dc.h +++ b/include/wx/osx/dc.h @@ -1,5 +1,15 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dc.h" -#else -#include "wx/osx/carbon/dc.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#endif // _WX_DC_H_ diff --git a/include/wx/osx/dcclient.h b/include/wx/osx/dcclient.h index 280167a2cb..3c677f99ad 100644 --- a/include/wx/osx/dcclient.h +++ b/include/wx/osx/dcclient.h @@ -1,5 +1,72 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dcclient.h" -#else -#include "wx/osx/carbon/dcclient.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/dc.h" +#include "wx/dcgraph.h" + +//----------------------------------------------------------------------------- +// classes +//----------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxPaintDC; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_CORE wxWindowDCImpl: public wxGCDCImpl +{ +public: + wxWindowDCImpl( wxDC *owner ); + wxWindowDCImpl( wxDC *owner, wxWindow *window ); + virtual ~wxWindowDCImpl(); + + virtual void DoGetSize( int *width, int *height ) const; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const; + +protected: + bool m_release; + int m_width; + int m_height; + + DECLARE_CLASS(wxWindowDCImpl) + DECLARE_NO_COPY_CLASS(wxWindowDCImpl) +}; + + +class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl +{ +public: + wxClientDCImpl( wxDC *owner ); + wxClientDCImpl( wxDC *owner, wxWindow *window ); + virtual ~wxClientDCImpl(); + +private: + DECLARE_CLASS(wxClientDCImpl) + DECLARE_NO_COPY_CLASS(wxClientDCImpl) +}; + + +class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl +{ +public: + wxPaintDCImpl( wxDC *owner ); + wxPaintDCImpl( wxDC *owner, wxWindow *win ); + virtual ~wxPaintDCImpl(); + +protected: + DECLARE_CLASS(wxPaintDCImpl) + DECLARE_NO_COPY_CLASS(wxPaintDCImpl) +}; + + #endif + // _WX_DCCLIENT_H_ diff --git a/include/wx/osx/dcmemory.h b/include/wx/osx/dcmemory.h index 2b9003b3c6..7c69b01f79 100644 --- a/include/wx/osx/dcmemory.h +++ b/include/wx/osx/dcmemory.h @@ -1,5 +1,46 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dcmemory.h" -#else -#include "wx/osx/carbon/dcmemory.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/osx/carbon/dcclient.h" + +class WXDLLIMPEXP_CORE wxMemoryDCImpl: public wxPaintDCImpl +{ +public: + wxMemoryDCImpl( wxMemoryDC *owner ); + wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ); + wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); + + virtual ~wxMemoryDCImpl(); + + virtual void DoGetSize( int *width, int *height ) const; + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const + { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } + virtual void DoSelect(const wxBitmap& bitmap); + + virtual const wxBitmap& GetSelectedBitmap() const + { return m_selected; } + virtual wxBitmap& GetSelectedBitmap() + { return m_selected; } + +private: + void Init(); + + wxBitmap m_selected; + + DECLARE_CLASS(wxMemoryDCImpl) + DECLARE_NO_COPY_CLASS(wxMemoryDCImpl) +}; + #endif + // _WX_DCMEMORY_H_ diff --git a/include/wx/osx/dcprint.h b/include/wx/osx/dcprint.h index 51b22c6c08..4380f4f4f2 100644 --- a/include/wx/osx/dcprint.h +++ b/include/wx/osx/dcprint.h @@ -1,5 +1,52 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dcprint.h" -#else -#include "wx/osx/carbon/dcprint.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#include "wx/dc.h" +#include "wx/dcgraph.h" +#include "wx/cmndata.h" + +class wxNativePrinterDC ; + +class WXDLLIMPEXP_CORE wxPrinterDCImpl: public wxGCDCImpl +{ +public: +#if wxUSE_PRINTING_ARCHITECTURE + + wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printdata ); + virtual ~wxPrinterDCImpl(); + + virtual bool StartDoc( const wxString& WXUNUSED(message) ) ; + virtual void EndDoc(void) ; + virtual void StartPage(void) ; + virtual void EndPage(void) ; + + wxRect GetPaperRect() const; + + wxPrintData& GetPrintData() { return m_printData; } + virtual wxSize GetPPI() const; + +protected: + virtual void DoGetSize( int *width, int *height ) const; + + wxPrintData m_printData ; + wxNativePrinterDC* m_nativePrinterDC ; + +private: + DECLARE_CLASS(wxPrinterDC) +#endif // wxUSE_PRINTING_ARCHITECTURE +}; + #endif + // _WX_DCPRINT_H_ + diff --git a/include/wx/osx/dcscreen.h b/include/wx/osx/dcscreen.h index 13b7afb7d9..8bf2aa52f4 100644 --- a/include/wx/osx/dcscreen.h +++ b/include/wx/osx/dcscreen.h @@ -1,5 +1,35 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dcscreen.h" -#else -#include "wx/osx/carbon/dcscreen.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/dcclient.h" +#include "wx/osx/carbon/dcclient.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl: public wxWindowDCImpl +{ +public: + wxScreenDCImpl( wxDC *owner ); + virtual ~wxScreenDCImpl(); + + virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const; +private: + void* m_overlayWindow; + +private: + DECLARE_CLASS(wxScreenDCImpl) + DECLARE_NO_COPY_CLASS(wxScreenDCImpl) +}; + #endif + // _WX_DCSCREEN_H_ + diff --git a/include/wx/osx/dialog.h b/include/wx/osx/dialog.h index 2ab090bbbd..351f6b8aee 100644 --- a/include/wx/osx/dialog.h +++ b/include/wx/osx/dialog.h @@ -1,5 +1,79 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dialog.h" -#else -#include "wx/osx/carbon/dialog.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/panel.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; + +// Dialog boxes +class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase +{ + DECLARE_DYNAMIC_CLASS(wxDialog) + +public: + wxDialog() { Init(); } + + // 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) + { + 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_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + + virtual ~wxDialog(); + +// virtual bool Destroy(); + virtual 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); + + // implementation + // -------------- + + // show modal dialog and enter modal loop + void DoShowModal(); + +protected: + // mac also takes command-period as cancel + virtual bool IsEscapeKey(const wxKeyEvent& event); + +private: + void Init(); + + bool m_isModalStyle; +}; + #endif + // _WX_DIALOG_H_ diff --git a/include/wx/osx/dirdlg.h b/include/wx/osx/dirdlg.h index 689d2adf62..8e7761505d 100644 --- a/include/wx/osx/dirdlg.h +++ b/include/wx/osx/dirdlg.h @@ -1,5 +1,35 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dirdlg.h" -#else -#include "wx/osx/carbon/dirdlg.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase +{ +public: + wxDirDialog(wxWindow *parent, + const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = _T(""), + long style = wxDD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); + + virtual int ShowModal(); + +protected: + wxWindow * m_parent; + + DECLARE_DYNAMIC_CLASS(wxDirDialog) +}; + #endif + // _WX_DIRDLG_H_ diff --git a/include/wx/osx/dnd.h b/include/wx/osx/dnd.h index 7f54a209e7..2f0b8d48ef 100644 --- a/include/wx/osx/dnd.h +++ b/include/wx/osx/dnd.h @@ -1,5 +1,108 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/dnd.h" -#else -#include "wx/osx/carbon/dnd.h" +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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 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 WXDLLIMPEXP_FWD_CORE wxWindow; + +class WXDLLIMPEXP_FWD_CORE wxDropTarget; +class WXDLLIMPEXP_FWD_CORE wxTextDropTarget; +class WXDLLIMPEXP_FWD_CORE wxFileDropTarget; + +class WXDLLIMPEXP_FWD_CORE 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(X##_xpm) + +//------------------------------------------------------------------------- +// wxDropTarget +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE 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); + + virtual ~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 // wxUSE_DRAG_AND_DROP + #endif + //_WX_DND_H_ diff --git a/include/wx/osx/filedlg.h b/include/wx/osx/filedlg.h index 7d9813366c..cd2d7c9111 100644 --- a/include/wx/osx/filedlg.h +++ b/include/wx/osx/filedlg.h @@ -1,5 +1,49 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/filedlg.h" -#else -#include "wx/osx/carbon/filedlg.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// 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_ + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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 = wxFD_DEFAULT_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize, + const wxString& name = wxFileDialogNameStr); + + virtual void GetPaths(wxArrayString& paths) const { paths = m_paths; } + virtual void GetFilenames(wxArrayString& files) const { files = m_fileNames ; } + + virtual int ShowModal(); + +protected: + // 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/osx/font.h b/include/wx/osx/font.h index 2114906bef..05f1b50601 100644 --- a/include/wx/osx/font.h +++ b/include/wx/osx/font.h @@ -1,5 +1,139 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/font.h" -#else -#include "wx/osx/carbon/font.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { } + +#if FUTURE_WXWIN_COMPATIBILITY_3_0 + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); + } #endif + + wxFont(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Create(size, family, style, weight, underlined, face, encoding); + } + + bool Create(int size, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + wxFont(const wxNativeFontInfo& info) + { + (void)Create(info); + } + + wxFont(const wxString& fontDesc); + + bool Create(const wxNativeFontInfo& info); + +#if wxOSX_USE_ATSU_TEXT + bool MacCreateFromThemeFont( wxUint16 themeFontID ) ; +#endif +#if wxOSX_USE_CORE_TEXT + bool MacCreateFromUIFont( wxUint32 coreTextFontType ); + bool MacCreateFromCTFontDescriptor( const void * ctFontDescriptor, int pointSize = 0 ); + bool MacCreateFromCTFont( const void * ctFont ); +#endif + + virtual ~wxFont(); + + // implement base class pure virtuals + virtual int GetPointSize() const; + virtual wxSize GetPixelSize() const; + virtual wxFontFamily GetFamily() const; + virtual wxFontStyle GetStyle() const; + virtual wxFontWeight 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(wxFontFamily family); + virtual void SetStyle(wxFontStyle style); + virtual void SetWeight(wxFontWeight weight); + virtual bool SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + WXDECLARE_COMPAT_SETTERS + + // implementation only from now on + // ------------------------------- + + virtual bool RealizeResource(); + + // Unofficial API, don't use + virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; + virtual bool GetNoAntiAliasing() const ; + + // Mac-specific, risks to change, don't use in portable code + +#if wxOSX_USE_ATSU_TEXT + // 'old' Quickdraw accessors + short MacGetFontNum() const; + short MacGetFontSize() const; + wxByte MacGetFontStyle() const; + + // 'new' ATSUI accessors + wxUint32 MacGetATSUFontID() const; + wxUint32 MacGetATSUAdditionalQDStyles() const; + wxUint16 MacGetThemeFontID() const ; + + // Returns an ATSUStyle not ATSUStyle* +#endif +#if wxOSX_USE_CORE_TEXT + const void * MacGetCTFont() const; +#endif +#if wxOSX_USE_CORE_TEXT || wxOSX_USE_ATSU_TEXT + void* MacGetATSUStyle() const ; +#endif + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + void Unshare(); + + DECLARE_DYNAMIC_CLASS(wxFont) +}; + +#endif // _WX_FONT_H_ diff --git a/include/wx/osx/fontdlg.h b/include/wx/osx/fontdlg.h index 1c35ddb1d3..ca96ff10c9 100644 --- a/include/wx/osx/fontdlg.h +++ b/include/wx/osx/fontdlg.h @@ -1,5 +1,173 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/fontdlg.h" -#else -#include "wx/osx/carbon/fontdlg.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/fontdlg.h +// Purpose: wxFontDialog class using fonts window services (10.2+). +// Author: Ryan Norton +// Modified by: +// Created: 2004-09-25 +// RCS-ID: $Id$ +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTDLG_H_ +#define _WX_FONTDLG_H_ + +#include "wx/dialog.h" +#include "wx/cmndata.h" + +/* + * Font dialog + */ + +/* + * support old notation + */ +#ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG +#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG #endif + +#ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG +#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1 +#endif + +#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG + +class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog +{ +public: + wxFontDialog(); + wxFontDialog(wxWindow *parent, const wxFontData& data); + virtual ~wxFontDialog(); + + bool Create(wxWindow *parent, const wxFontData& data); + + int ShowModal(); + wxFontData& GetFontData() { return m_fontData; } + +protected: + wxFontData m_fontData; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) +}; + +extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ; + +#else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG + +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + +/*! + * Forward declarations + */ + +class wxFontColourSwatchCtrl; +class wxFontPreviewCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinEvent; +class WXDLLIMPEXP_FWD_CORE wxListBox; +class WXDLLIMPEXP_FWD_CORE wxChoice; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; + +/*! + * Control identifiers + */ + +#define wxID_FONTDIALOG_FACENAME 20001 +#define wxID_FONTDIALOG_FONTSIZE 20002 +#define wxID_FONTDIALOG_BOLD 20003 +#define wxID_FONTDIALOG_ITALIC 20004 +#define wxID_FONTDIALOG_UNDERLINED 20005 +#define wxID_FONTDIALOG_COLOUR 20006 +#define wxID_FONTDIALOG_PREVIEW 20007 + +#endif + // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + +class WXDLLIMPEXP_CORE wxFontDialog: public wxDialog +{ +DECLARE_DYNAMIC_CLASS(wxFontDialog) + +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX +DECLARE_EVENT_TABLE() +#endif + +public: + wxFontDialog(); + wxFontDialog(wxWindow *parent, const wxFontData& data); + virtual ~wxFontDialog(); + + bool Create(wxWindow *parent, const wxFontData& data); + + int ShowModal(); + wxFontData& GetFontData() { return m_fontData; } + bool IsShown() const; + void OnPanelClose(); + void SetData(const wxFontData& data); + +#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + + /// Creates the controls and sizers + void CreateControls(); + + /// Initialize font + void InitializeFont(); + + /// Set controls according to current font + void InitializeControls(); + + /// Respond to font change + void ChangeFont(); + + /// Respond to colour change + void OnColourChanged(wxCommandEvent& event); + + /// wxEVT_COMMAND_LISTBOX_SELECTED event handler for wxID_FONTDIALOG_FACENAME + void OnFontdialogFacenameSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE + void OnFontdialogFontsizeUpdated( wxSpinEvent& event ); + + /// wxEVT_COMMAND_TEXT_UPDATED event handler for wxID_FONTDIALOG_FONTSIZE + void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_BOLD + void OnFontdialogBoldClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_ITALIC + void OnFontdialogItalicClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_CHECKBOX_CLICKED event handler for wxID_FONTDIALOG_UNDERLINED + void OnFontdialogUnderlinedClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK + void OnOkClick( wxCommandEvent& event ); + + /// Should we show tooltips? + static bool ShowToolTips(); + + wxListBox* m_facenameCtrl; + wxSpinCtrl* m_sizeCtrl; + wxCheckBox* m_boldCtrl; + wxCheckBox* m_italicCtrl; + wxCheckBox* m_underlinedCtrl; + wxFontColourSwatchCtrl* m_colourCtrl; + wxFontPreviewCtrl* m_previewCtrl; + + wxFont m_dialogFont; + bool m_suppressUpdates; + +#endif + // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX + +protected: + wxWindow* m_dialogParent; + wxFontData m_fontData; + void* m_pEventHandlerRef; +}; + +#endif + +#endif + // _WX_FONTDLG_H_ diff --git a/include/wx/osx/frame.h b/include/wx/osx/frame.h index 2952bf36dc..380fbf624e 100644 --- a/include/wx/osx/frame.h +++ b/include/wx/osx/frame.h @@ -1,5 +1,126 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/frame.h" -#else -#include "wx/osx/carbon/frame.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/window.h" +#include "wx/toolbar.h" +#include "wx/accel.h" +#include "wx/icon.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxMenuBar; +class WXDLLIMPEXP_FWD_CORE wxStatusBar; +class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; + +class WXDLLIMPEXP_CORE 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 + // ------------------------------- + + // 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; + + // override some more virtuals + virtual bool Enable(bool enable = TRUE) ; + + // 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 SetToolBar(wxToolBar *toolbar); +#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); +#endif // wxUSE_STATUSBAR + + // called by wxWindow whenever it gets focus + void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } + wxWindow *GetLastFocus() const { return m_winLastFocused; } + + void PositionBars(); + +protected: + // common part of all ctors + void Init(); + +#if wxUSE_TOOLBAR + virtual void PositionToolBar(); #endif +#if wxUSE_STATUSBAR + virtual void PositionStatusBar(); +#endif + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + +#if wxUSE_MENUS + virtual void DetachMenuBar(); + virtual void AttachMenuBar(wxMenuBar *menubar); +#endif + + // osx specific event handling common for all osx-ports + virtual void HandleResized( double timestampsec ); + +protected: + // the last focused child: we restore focus to it on activation + wxWindow *m_winLastFocused; + + virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxFrame) +}; + +#endif + // _WX_FRAME_H_ diff --git a/include/wx/osx/gauge.h b/include/wx/osx/gauge.h index 568eca5b75..3db68bebe8 100644 --- a/include/wx/osx/gauge.h +++ b/include/wx/osx/gauge.h @@ -1,5 +1,56 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/gauge.h" -#else -#include "wx/osx/carbon/gauge.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/control.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxGaugeNameStr[]; + +// Group box +class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase +{ + public: + inline wxGauge() { } + + 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); + + // set gauge range/value + virtual void SetRange(int range); + virtual void SetValue(int pos); + virtual int GetValue() const ; + + void Pulse(); + + protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge) +}; + #endif + // _WX_GAUGE_H_ diff --git a/include/wx/osx/glcanvas.h b/include/wx/osx/glcanvas.h index 3e63b7bf79..2d032aaad7 100644 --- a/include/wx/osx/glcanvas.h +++ b/include/wx/osx/glcanvas.h @@ -1,5 +1,154 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/glcanvas.h" -#else -#include "wx/osx/carbon/glcanvas.h" -#endif \ No newline at end of file +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Macintosh +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include + +// low level calls + +WXDLLIMPEXP_GL WXGLContext WXGLCreateContext( WXGLPixelFormat pixelFormat, WXGLContext shareContext ); +WXDLLIMPEXP_GL void WXGLDestroyContext( WXGLContext context ); +WXDLLIMPEXP_GL WXGLContext WXGLGetCurrentContext(); +WXDLLIMPEXP_GL void WXGLSwapBuffers( WXGLContext context ); + +WXDLLIMPEXP_GL WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList); +WXDLLIMPEXP_GL void WXGLDestroyPixelFormat( WXGLPixelFormat pixelFormat ); + +class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase +{ +public: + wxGLContext(wxGLCanvas *win, const wxGLContext *other = NULL); + virtual ~wxGLContext(); + + virtual bool SetCurrent(const wxGLCanvas& win) const; + + // Mac-specific + WXGLContext GetWXGLContext() const { return m_glContext; } + +private: + WXGLContext m_glContext; + + DECLARE_NO_COPY_CLASS(wxGLContext) +}; + +class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase +{ +public: + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const int *attribList = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const wxPalette& palette = wxNullPalette); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette); + + virtual ~wxGLCanvas(); + + // implement wxGLCanvasBase methods + virtual bool SwapBuffers(); + + + // Mac-specific functions + // ---------------------- + + // return true if multisample extension is supported + static bool IsAGLMultiSampleAvailable(); + + // return the pixel format used by this window + WXGLPixelFormat GetWXGLPixelFormat() const { return m_glFormat; } + + // update the view port of the current context to match this window + void SetViewport(); + + + // deprecated methods + // ------------------ + +#if WXWIN_COMPATIBILITY_2_8 + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); + + wxDEPRECATED( + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + const int *attribList = NULL, + const wxPalette& palette = wxNullPalette) + ); +#endif // WXWIN_COMPATIBILITY_2_8 + + // implementation-only from now on + +#if wxOSX_USE_CARBON + // Unlike some other platforms, this must get called if you override it, + // i.e. don't forget "event.Skip()" in your EVT_SIZE handler + void OnSize(wxSizeEvent& event); + + virtual void MacSuperChangedPosition(); + virtual void MacTopLevelWindowChangedPosition(); + virtual void MacVisibilityChanged(); + + void MacUpdateView(); + + GLint GetAglBufferName() const { return m_bufferName; } +#endif + +protected: + WXGLPixelFormat m_glFormat; + +#if wxOSX_USE_CARBON + bool m_macCanvasIsShown, + m_needsUpdate; + WXGLContext m_dummyContext; + GLint m_bufferName; +#endif + + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxGLCanvas) +}; + +#endif // _WX_GLCANVAS_H_ diff --git a/include/wx/osx/helpxxxx.h b/include/wx/osx/helpxxxx.h index 5a6a67ff63..7bb66c7cba 100644 --- a/include/wx/osx/helpxxxx.h +++ b/include/wx/osx/helpxxxx.h @@ -1,5 +1,49 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/helpxxxx.h" -#else -#include "wx/osx/carbon/helpxxxx.h" -#endif \ No newline at end of file +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/wx.h" + +#include "wx/helpbase.h" + +class WXDLLIMPEXP_CORE wxXXXXHelpController: public wxHelpControllerBase +{ + DECLARE_CLASS(wxXXXXHelpController) + + public: + wxXXXXHelpController(); + virtual ~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/osx/icon.h b/include/wx/osx/icon.h index 8ef62dac14..76113f7121 100644 --- a/include/wx/osx/icon.h +++ b/include/wx/osx/icon.h @@ -1,5 +1,90 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/icon.h" -#else -#include "wx/osx/carbon/icon.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/bitmap.h" + +// Icon +class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject +{ +public: + wxIcon(); + + wxIcon(const char* const* data); + wxIcon(const char bits[], int width , int height ); + wxIcon(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, + int desiredWidth = -1, int desiredHeight = -1); + wxIcon(const wxIconLocation& loc) + { + LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); + } + + wxIcon(WXHICON icon, const wxSize& size); + + virtual ~wxIcon(); + + bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, + int desiredWidth = -1, int desiredHeight = -1); + + + // 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); + + int GetWidth() const; + int GetHeight() const; + int GetDepth() const; + void SetWidth(int w); + void SetHeight(int h); + void SetDepth(int d); + void SetOk(bool isOk); + + WXHICON GetHICON() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + DECLARE_DYNAMIC_CLASS(wxIcon) +}; + +class WXDLLIMPEXP_CORE wxICONResourceHandler: public wxBitmapHandler +{ +public: + wxICONResourceHandler() + { + SetName(wxT("ICON resource")); + SetExtension(wxEmptyString); + SetType(wxBITMAP_TYPE_ICON_RESOURCE); + } + + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + wxBitmapType flags, + int desiredWidth = -1, + int desiredHeight = -1); + + // unhide the base class virtual + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + wxBitmapType flags) + { return LoadFile(bitmap, name, flags, -1, -1); } + +private: + DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) +}; + #endif + // _WX_ICON_H_ diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h index 2e64503699..10e96b588d 100644 --- a/include/wx/osx/imaglist.h +++ b/include/wx/osx/imaglist.h @@ -1,5 +1,60 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/imaglist.h" -#else -#include "wx/osx/carbon/imaglist.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: imaglist.h +// Purpose: +// Author: Robert Roebling, Stefan Csomor +// Created: 01/02/97 +// Id: +// Copyright: (c) 1998 Robert Roebling and Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_ +#define _WX_IMAGLIST_H_ + +#include "wx/defs.h" +#include "wx/list.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; + +class WXDLLIMPEXP_CORE wxImageList: public wxObject +{ +public: + wxImageList() { m_width = m_height = 0; } + wxImageList( int width, int height, bool mask = true, int initialCount = 1 ); + virtual ~wxImageList(); + bool Create( int width, int height, bool mask = true, int initialCount = 1 ); + bool Create(); + + virtual int GetImageCount() const; + virtual bool GetSize( int index, int &width, int &height ) const; + + int Add( const wxIcon& bitmap ); + int Add( const wxBitmap& bitmap ); + int Add( const wxBitmap& bitmap, const wxBitmap& mask ); + int Add( const wxBitmap& bitmap, const wxColour& maskColour ); + wxBitmap GetBitmap(int index) const; + wxIcon GetIcon(int index) const; + bool Replace( int index, const wxIcon &bitmap ); + bool Replace( int index, const wxBitmap &bitmap ); + bool Replace( int index, const wxBitmap &bitmap, const wxBitmap &mask ); + bool Remove( int index ); + bool RemoveAll(); + + virtual bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = false); + +private: + wxList m_images; + + int m_width; + int m_height; + + DECLARE_DYNAMIC_CLASS(wxImageList) +}; + +#endif // _WX_IMAGLIST_H_ + diff --git a/include/wx/osx/joystick.h b/include/wx/osx/joystick.h index 969cac9626..94de2470e1 100644 --- a/include/wx/osx/joystick.h +++ b/include/wx/osx/joystick.h @@ -1,5 +1,91 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/joystick.h" -#else -#include "wx/osx/carbon/joystick.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/event.h" + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; }; + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition() const; + int GetPosition(unsigned axis) const; + bool GetButtonState(unsigned button) 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 + static int GetNumberJoysticks() ; + 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/osx/listbox.h b/include/wx/osx/listbox.h index 078ca2a4ec..bf01a78fec 100644 --- a/include/wx/osx/listbox.h +++ b/include/wx/osx/listbox.h @@ -1,5 +1,175 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/listbox.h" -#else -#include "wx/osx/carbon/listbox.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +// ---------------------------------------------------------------------------- +// simple types +// ---------------------------------------------------------------------------- +#include "wx/dynarray.h" +#include "wx/arrstr.h" + +// forward decl for GetSelections() +class wxArrayInt; + +// forward decl for wxListWidgetImpl implementation type. +class wxListWidgetImpl; + +// List box item + +WX_DEFINE_ARRAY( char* , wxListDataArray ); + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxListWidgetColumn; + +class WXDLLIMPEXP_FWD_CORE wxListWidgetCellValue; + +class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox(); + + wxListBox( + wxWindow *parent, + wxWindowID winid, + 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, winid, pos, size, n, choices, style, validator, name); + } + + wxListBox( + wxWindow *parent, + wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, winid, pos, size, choices, style, validator, name); + } + + bool Create( + wxWindow *parent, + wxWindowID winid, + 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 winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + virtual ~wxListBox(); + + // implement base class pure virtuals + virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); + + virtual unsigned int GetCount() const; + virtual wxString GetString(unsigned int n) const; + virtual void SetString(unsigned int n, const wxString& s); + virtual int FindString(const wxString& s, bool bCase = false) const; + + // data callbacks + virtual void GetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + virtual void SetValueCallback( unsigned int n, wxListWidgetColumn* col , wxListWidgetCellValue& value ); + + virtual bool IsSelected(int n) const; + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + + virtual void EnsureVisible(int n); + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + // wxCheckListBox support + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + wxListWidgetImpl* GetListPeer() const; + + bool MacGetBlockEvents() const { return m_blockEvents; } + + virtual void HandleLineEvent( unsigned int n, bool doubleClick ); +protected: + // callback for derived classes which may have to insert additional data + // at a certain line - which cannot be predetermined for sorted list data + virtual void OnItemInserted(unsigned int pos); + + virtual void DoClear(); + virtual void DoDeleteOneItem(unsigned int n); + + // from wxItemContainer + virtual int DoInsertItems(const wxArrayStringsAdapter& items, + unsigned int pos, + void **clientData, wxClientDataType type); + + virtual void DoSetItemClientData(unsigned int n, void* clientData); + virtual void* DoGetItemClientData(unsigned int n) const; + + // from wxListBoxBase + virtual void DoSetSelection(int n, bool select); + virtual void DoSetFirstItem(int n); + virtual int DoListHitTest(const wxPoint& point) const; + + // free memory (common part of Clear() and dtor) + // prevent collision with some BSD definitions of macro Free() + void FreeData(); + + virtual wxSize DoGetBestSize() const; + + bool m_blockEvents; + + wxListWidgetColumn* m_textColumn; + + // data storage (copied from univ) + + // the array containing all items (it is sorted if the listbox has + // wxLB_SORT style) + union + { + wxArrayString *unsorted; + wxSortedArrayString *sorted; + } m_strings; + + // and this one the client data (either void or wxClientData) + wxArrayPtrVoid m_itemsClientData; + +private: + DECLARE_DYNAMIC_CLASS(wxListBox) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_LISTBOX_H_ diff --git a/include/wx/osx/listctrl.h b/include/wx/osx/listctrl.h index 373d2e57ab..8d06d24d84 100644 --- a/include/wx/osx/listctrl.h +++ b/include/wx/osx/listctrl.h @@ -1,5 +1,420 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/listctrl.h" -#else -#include "wx/osx/carbon/listctrl.h" -#endif \ No newline at end of file +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/defs.h" +#include "wx/generic/listctrl.h" + +#define wxMAC_ALWAYS_USE_GENERIC_LISTCTRL wxT("mac.listctrl.always_use_generic") + +class wxMacDataBrowserListCtrlControl; +class wxListCtrlTextCtrlWrapper; +class wxListCtrlRenameTimer; + +WX_DECLARE_EXPORTED_LIST(wxListItem, wxColumnList); + +class WXDLLIMPEXP_CORE wxListCtrl: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxListCtrl) + public: + /* + * Public interface + */ + + wxListCtrl() { Init(); } + + wxListCtrl(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListCtrlNameStr) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxListCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListCtrlNameStr); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Gets information about this column + bool GetColumn(int col, wxListItem& item) const; + + // Sets information about this column + // TODO: NOT const to be compatible with wxGenericListCtrl API + 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) ; + + void AssignImageList(wxImageList *imageList, int which); + + // Sets the item image + bool SetItemImage(long item, int image, int selImage = -1) ; + bool SetItemColumnImage(long item, long column, int image); + + // Gets the item text + wxString GetItemText(long item) const ; + + // Sets the item text + void SetItemText(long item, const wxString& str) ; + + void SetItemTextColour(long item, const wxColour& colour) ; + wxColour GetItemTextColour(long item) const; + + void SetItemBackgroundColour(long item, const wxColour& colour) ; + wxColour GetItemBackgroundColour(long item) const; + + void SetItemFont( long item, const wxFont &f); + wxFont GetItemFont( long item ) const; + + // Gets the item data + long GetItemData(long item) const ; + + // Sets the item data + bool SetItemPtrData(long item, wxUIntPtr data); + bool SetItemData(long item, long data) { return SetItemPtrData(item, 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; + + void SetItemSpacing( int spacing, bool isSmall = false ); + wxSize GetItemSpacing() const; + + // Gets the number of selected items in the list control + int GetSelectedItemCount() const; + + wxRect GetViewRect() 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 ; + + // are we in report mode? + bool InReportView() const { return HasFlag(wxLC_REPORT); } + + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + + // 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 wxWidgets 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) + // Request the subitem number as well at the given coordinate. + long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = NULL) const; + + // 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); + + wxMacDataBrowserListCtrlControl* GetListPeer() const; + + // these functions are only used for virtual list view controls, i.e. the + // ones with wxLC_VIRTUAL style + + void SetItemCount(long count); + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + + // return the text for the given column of the given item + virtual wxString OnGetItemText(long item, long column) const; + + // return the icon for the given item. In report view, OnGetItemImage will + // only be called for the first column. See OnGetItemColumnImage for + // details. + virtual int OnGetItemImage(long item) const; + + // return the icon for the given item and column. + virtual int OnGetItemColumnImage(long item, long column) const; + + // return the attribute for the item (may return NULL if none) + virtual wxListItemAttr *OnGetItemAttr(long item) const; + +/* 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); }; + + wxListCtrlCompare GetCompareFunc() { return m_compareFunc; }; + long GetCompareFuncData() { return m_compareFuncData; }; + + + // public overrides needed for pimpl approach + virtual bool SetFont(const wxFont& font); + virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetBackgroundColour(const wxColour& colour); + virtual wxColour GetBackgroundColour() const; + + // functions for editing/timer + void OnRenameTimer(); + bool OnRenameAccept(long itemEdit, const wxString& value); + void OnRenameCancelled(long itemEdit); + + void ChangeCurrent(long current); + void ResetCurrent() { ChangeCurrent((long)-1); } + bool HasCurrent() const { return m_current != (long)-1; } + + void OnLeftDown(wxMouseEvent& event); + void OnDblClick(wxMouseEvent& event); + + void FinishEditing(wxTextCtrl *text) + { + delete text; + m_textctrlWrapper = NULL; + SetFocus(); + } + + virtual int GetScrollPos(int orient) const; + + void OnRightDown(wxMouseEvent& event); + void OnMiddleDown(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); + virtual void SetFocus(); + void FireMouseEvent(wxEventType eventType, wxPoint position); + + virtual void SetDropTarget( wxDropTarget *dropTarget ); + virtual wxDropTarget* GetDropTarget() const; + + // with CG, we need to get the context from an kEventControlDraw event + // unfortunately, the DataBrowser callbacks don't provide the context + // and we need it, so we need to set/remove it before and after draw + // events so we can access it in the callbacks. + void MacSetDrawingContext(void* context) { m_cgContext = context; } + void* MacGetDrawingContext() { return m_cgContext; } + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + + // protected overrides needed for pimpl approach + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual wxSize DoGetBestSize() const; + + long m_current; + wxListCtrlTextCtrlWrapper *m_textctrlWrapper; + wxListCtrlRenameTimer *m_renameTimer; + // common part of all ctors + void Init(); + + wxGenericListCtrl* m_genericImpl; // allow use of the generic impl. + wxMacDataBrowserListCtrlControl* m_dbImpl; + void* m_macListCtrlEventHandler; + void* m_cgContext; + wxListCtrlCompare m_compareFunc; + long m_compareFuncData; + + 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) + + wxColumnList m_colsInfo; // for storing info about each column + wxColour m_textColor; + wxColour m_bgColor; + + // keep track of whether or not we should delete the image list ourselves. + bool m_ownsImageListNormal, + m_ownsImageListSmall, + m_ownsImageListState; + + long m_baseStyle; // Basic Windows style flags, for recreation purposes + int m_colCount; // Windows doesn't have GetColumnCount so must + // keep track of inserted/deleted columns + + int m_count; // for virtual lists, store item count + +private: + int CalcColumnAutoWidth(int col) const; + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_LISTCTRL_H_ diff --git a/include/wx/osx/mdi.h b/include/wx/osx/mdi.h index 1e0c1fed86..cea49387eb 100644 --- a/include/wx/osx/mdi.h +++ b/include/wx/osx/mdi.h @@ -1,5 +1,154 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/mdi.h" -#else -#include "wx/osx/carbon/mdi.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/osx/carbon/mdi.h +// Purpose: MDI (Multiple Document Interface) classes. +// Author: Stefan Csomor +// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// (c) 2008 Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_OSX_CARBON_MDI_H_ +#define _WX_OSX_CARBON_MDI_H_ + +class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase +{ +public: + wxMDIParentFrame() { Init(); } + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr) + { + 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 | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr); + + virtual ~wxMDIParentFrame(); + + // implement/override base class [pure] virtuals + // --------------------------------------------- + + static bool IsTDI() { return false; } + + virtual void AddChild(wxWindowBase *child); + virtual void RemoveChild(wxWindowBase *child); + + virtual void ActivateNext() { /* TODO */ } + virtual void ActivatePrevious() { /* TODO */ } + + virtual bool Show(bool show = true); + + + // Mac-specific implementation from now on + // --------------------------------------- + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating); + + // wxWidgets activate event + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void SetMenuBar(wxMenuBar *menu_bar); + + // Get rect to be used to center top-level children + virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); + +protected: + // common part of all ctors + void Init(); + + // returns true if this frame has some contents and so should be visible, + // false if it's used solely as container for its children + bool ShouldBeVisible() const; + + + wxMenu *m_windowMenu; + + // true if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + + // true if the frame should be shown but is not because it is empty and + // useless otherwise than a container for its children + bool m_shouldBeShown; + +private: + friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) +}; + +class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase +{ +public: + wxMDIChildFrame() { Init(); } + 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); + } + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxMDIChildFrame(); + + // un-override the base class override + virtual bool IsTopLevel() const { return true; } + + // implement MDI operations + virtual void Activate(); + + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating); + +protected: + // common part of all ctors + void Init(); + + DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) +}; + +class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase +{ +public: + wxMDIClientWindow() { } + virtual ~wxMDIClientWindow(); + + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL); + +protected: + virtual void DoGetClientSize(int *width, int *height) const; + + DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) +}; + +#endif // _WX_OSX_CARBON_MDI_H_ diff --git a/include/wx/osx/menu.h b/include/wx/osx/menu.h index ea9cae7133..ff8e0e06cf 100644 --- a/include/wx/osx/menu.h +++ b/include/wx/osx/menu.h @@ -1,5 +1,198 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/menu.h" -#else -#include "wx/osx/carbon/menu.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +class WXDLLIMPEXP_FWD_CORE wxFrame; + +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMenuImpl ; + +class WXDLLIMPEXP_CORE 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(); + + virtual void Attach(wxMenuBarBase *menubar) ; + + virtual void Break(); + + virtual void SetTitle(const wxString& title); + + bool ProcessCommand(wxCommandEvent& event); + + // semi-private accessors + + // get the window which contains this menu + wxWindow *GetWindow() const; + // get the menu handle + WXHMENU GetHMenu() const ; + + // implementation only from now on + // ------------------------------- + + bool HandleCommandUpdateStatus( wxMenuItem* menuItem, wxWindow* senderWindow = NULL); + bool HandleCommandProcess( wxMenuItem* menuItem, wxWindow* senderWindow = NULL); + void HandleMenuItemHighlighted( wxMenuItem* menuItem ); + void HandleMenuOpened(); + void HandleMenuClosed(); + + wxMenuImpl* GetPeer() { return m_peer; } + + // make sure we can veto + void SetAllowRearrange( bool allow ); + bool AllowRearrange() const { return m_allowRearrange; } + + // if a menu is used purely for internal implementation reasons (eg wxChoice) + // we don't want native menu events being triggered + void SetNoEventsMode( bool noEvents ); + bool GetNoEventsMode() const { return m_noEventsMode; } +protected: + // hide special menu items like exit, preferences etc + // that are expected in the app menu + void DoRearrange() ; + + bool DoHandleMenuEvent( wxEvent& evt ); + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + +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; + + // in this menu rearranging of menu items (esp hiding) is allowed + bool m_allowRearrange; + + // don't trigger native events + bool m_noEventsMode; + + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + + wxMenuImpl* m_peer; + + DECLARE_DYNAMIC_CLASS(wxMenu) +}; + +#if wxOSX_USE_COCOA_OR_CARBON + +// the iphone only has popup-menus + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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(size_t n, wxMenu *menus[], const wxString titles[], long style = 0); + 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 SetMenuLabel( size_t pos, const wxString& label ); + virtual wxString GetMenuLabel( size_t pos ) const; + virtual bool Enable( bool enable = TRUE ); + // for virtual function hiding + virtual void Enable( int itemid, bool enable ) + { + wxMenuBarBase::Enable( itemid, enable ); + } + + // implementation from now on + 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); + + static void SetAutoWindowMenu( bool enable ) { s_macAutoWindowMenu = enable ; } + static bool GetAutoWindowMenu() { return s_macAutoWindowMenu ; } + + void MacInstallMenuBar() ; + static wxMenuBar* MacGetInstalledMenuBar() { return s_macInstalledMenuBar ; } + static void MacSetCommonMenuBar(wxMenuBar* menubar) { s_macCommonMenuBar=menubar; } + static wxMenuBar* MacGetCommonMenuBar() { return s_macCommonMenuBar; } + + + static WXHMENU MacGetWindowMenuHMenu() { return s_macWindowMenuHandle ; } +protected: + // common part of all ctors + void Init(); + wxWindow *m_invokingWindow; + + wxArrayString m_titles; + static bool s_macAutoWindowMenu ; + static WXHMENU s_macWindowMenuHandle ; + +private: + static wxMenuBar* s_macInstalledMenuBar ; + static wxMenuBar* s_macCommonMenuBar ; + + wxMenu* m_rootMenu; + + DECLARE_DYNAMIC_CLASS(wxMenuBar) +}; + #endif + +#endif // _WX_MENU_H_ diff --git a/include/wx/osx/menuitem.h b/include/wx/osx/menuitem.h index 5bf0c78974..6171b124ee 100644 --- a/include/wx/osx/menuitem.h +++ b/include/wx/osx/menuitem.h @@ -1,5 +1,84 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/menuitem.h" -#else -#include "wx/osx/carbon/menuitem.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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 + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/defs.h" +#include "wx/bitmap.h" + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_FWD_CORE wxMenuItemImpl ; + +class WXDLLIMPEXP_CORE 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 SetItemLabel(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); + + wxMenuItemImpl* GetPeer() { return m_peer; } +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 + + wxMenuItemImpl* m_peer; + + DECLARE_DYNAMIC_CLASS(wxMenuItem) +}; + +#endif //_MENUITEM_H diff --git a/include/wx/osx/metafile.h b/include/wx/osx/metafile.h index 3b8d5335a2..4421a565bf 100644 --- a/include/wx/osx/metafile.h +++ b/include/wx/osx/metafile.h @@ -1,5 +1,178 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/metafile.h" -#else -#include "wx/osx/carbon/metafile.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DATAOBJ +#include "wx/dataobj.h" #endif + +#include "wx/osx/carbon/dcclient.h" + +/* + * Metafile and metafile device context classes + * + */ + +#define wxMetaFile wxMetafile +#define wxMetaFileDC wxMetafileDC + +class WXDLLIMPEXP_FWD_CORE wxMetafile; +class wxMetafileRefData ; + +#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxMetafile : public wxGDIObject +{ +public: + wxMetafile(const wxString& file = wxEmptyString); + virtual ~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); + + wxSize GetSize() const; + int GetWidth() const { return GetSize().x; } + int GetHeight() const { return GetSize().y; } + + // Implementation + WXHMETAFILE GetHMETAFILE() const ; + void SetHMETAFILE(WXHMETAFILE mf) ; +#ifndef __LP64__ + // Since the native metafile format is PDF for Quartz + // we need a call that allows setting PICT content for + // backwards compatibility + void SetPICT(void* pictHandle) ; +#endif + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + DECLARE_DYNAMIC_CLASS(wxMetafile) +}; + + +class WXDLLIMPEXP_CORE wxMetafileDCImpl: public wxGCDCImpl +{ +public: + wxMetafileDCImpl( wxDC *owner, + const wxString& filename, + int width, int height, + const wxString& description ); + + virtual ~wxMetafileDCImpl(); + + // Should be called at end of drawing + virtual wxMetafile *Close(); + + // Implementation + wxMetafile *GetMetaFile(void) const { return m_metaFile; } + void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + +protected: + virtual void DoGetSize(int *width, int *height) const; + + wxMetafile* m_metaFile; + +private: + DECLARE_CLASS(wxMetafileDCImpl) + DECLARE_NO_COPY_CLASS(wxMetafileDCImpl) +}; + +class WXDLLIMPEXP_CORE wxMetafileDC: public wxDC +{ + 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 ) : + wxDC( new wxMetafileDCImpl( this, filename, width, height, description) ) + { } + + wxMetafile *GetMetafile() const + { return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); } + + wxMetafile *Close() + { return ((wxMetafileDCImpl*)m_pimpl)->Close(); } + +private: + DECLARE_CLASS(wxMetafileDC) + DECLARE_NO_COPY_CLASS(wxMetafileDC) +}; + + +/* + * 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 WXDLLIMPEXP_CORE wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); + +// Optional origin and extent +bool WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE 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 + // _WX_METAFIILE_H_ diff --git a/include/wx/osx/mimetype.h b/include/wx/osx/mimetype.h index cd3a3a1e43..8d4c2e604f 100644 --- a/include/wx/osx/mimetype.h +++ b/include/wx/osx/mimetype.h @@ -1,5 +1,118 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/mimetype.h" -#else -#include "wx/osx/core/mimetype.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/mimetype.h +// Purpose: Mac Carbon implementation for wx mime-related classes +// Author: Ryan Norton +// Modified by: +// Created: 04/16/2005 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Ryan Norton () +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#include "wx/defs.h" +#include "wx/mimetype.h" + + +class wxMimeTypesManagerImpl +{ +public : + //kinda kooky but in wxMimeTypesManager::EnsureImpl it doesn't call + //intialize, so we do it ourselves + wxMimeTypesManagerImpl() : m_hIC(NULL) { Initialize(); } + ~wxMimeTypesManagerImpl() { ClearData(); } + + // 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); + + 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); + +private: + wxArrayFileTypeInfo m_fallbacks; + void* m_hIC; + void** m_hDatabase; + long m_lCount; + + void* pReserved1; + void* pReserved2; + void* pReserved3; + void* pReserved4; + void* pReserved5; + void* pReserved6; + + friend class wxFileTypeImpl; +}; + +class wxFileTypeImpl +{ +public: + //kind of nutty, but mimecmn.cpp creates one with an empty new + wxFileTypeImpl() : m_manager(NULL) {} + ~wxFileTypeImpl() {} //for those broken compilers + + // 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; + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters&) const; + + 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: + void Init(wxMimeTypesManagerImpl *manager, long lIndex) + { m_manager=(manager); m_lIndex=(lIndex); } + + // helper function + wxString GetCommand(const wxString& verb) const; + + wxMimeTypesManagerImpl *m_manager; + long m_lIndex; + + void* pReserved1; + void* pReserved2; + void* pReserved3; + void* pReserved4; + void* pReserved5; + void* pReserved6; + + friend class wxMimeTypesManagerImpl; +}; + #endif + //_MIMETYPE_H diff --git a/include/wx/osx/minifram.h b/include/wx/osx/minifram.h index 3b6a719f0a..ba00ddd1a4 100644 --- a/include/wx/osx/minifram.h +++ b/include/wx/osx/minifram.h @@ -1,5 +1,42 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/minifram.h" -#else -#include "wx/osx/carbon/minifram.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/frame.h" + +class WXDLLIMPEXP_CORE 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 = wxCAPTION | wxRESIZE_BORDER | 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); + } + + virtual ~wxMiniFrame() {} +protected: +}; + #endif + // _WX_MINIFRAM_H_ diff --git a/include/wx/osx/msgdlg.h b/include/wx/osx/msgdlg.h index 2fdecde696..4ec95ea4a6 100644 --- a/include/wx/osx/msgdlg.h +++ b/include/wx/osx/msgdlg.h @@ -1,5 +1,36 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/msgdlg.h" -#else -#include "wx/osx/carbon/msgdlg.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogWithCustomLabels +{ +public: + wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + + virtual int ShowModal(); + +protected: + // not supported for message dialog + virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {} + + DECLARE_DYNAMIC_CLASS(wxMessageDialog) +}; + +#endif // _WX_MSGBOXDLG_H_ diff --git a/include/wx/osx/nonownedwnd.h b/include/wx/osx/nonownedwnd.h index 126299df5d..3ce7ae952c 100644 --- a/include/wx/osx/nonownedwnd.h +++ b/include/wx/osx/nonownedwnd.h @@ -1,5 +1,128 @@ -#ifdef __WXMAC_CLASSIC__ -#error "no implementation" -#else -#include "wx/osx/carbon/nonownedwnd.h" -#endif \ No newline at end of file +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/nonownedwnd.h +// Purpose: declares wxNonOwnedWindow class +// Author: Stefan Csomor +// Modified by: +// Created: 2008-03-24 +// RCS-ID: $Id: nonownedwnd.h 46993 2007-06-28 08:46:04Z VS $ +// Copyright: (c) 2008 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_NONOWNEDWND_H_ +#define _WX_MAC_NONOWNEDWND_H_ + +#include "wx/window.h" + +#if wxUSE_SYSTEM_OPTIONS + #define wxMAC_WINDOW_PLAIN_TRANSITION _T("mac.window-plain-transition") +#endif + +//----------------------------------------------------------------------------- +// wxNonOwnedWindow +//----------------------------------------------------------------------------- + +// This class represents "non-owned" window. A window is owned by another +// window if it has a parent and is positioned within the parent. For example, +// wxFrame is non-owned, because even though it can have a parent, it's +// location is independent of it. This class is for internal use only, it's +// the base class for wxTopLevelWindow and wxPopupWindow. + +class wxNonOwnedWindowImpl; + +class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow +{ +public: + // constructors and such + wxNonOwnedWindow() { Init(); } + + wxNonOwnedWindow(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + + (void)Create(parent, id, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + virtual ~wxNonOwnedWindow(); + + virtual wxPoint GetClientAreaOrigin() const; + + // implement base class pure virtuals + + virtual bool SetShape(const wxRegion& region); + + virtual bool SetTransparent(wxByte alpha); + virtual bool CanSetTransparent(); + + virtual bool SetBackgroundStyle(wxBackgroundStyle style); + + virtual void Update(); + + WXWindow GetWXWindow() const ; + static wxNonOwnedWindow* GetFromWXWindow( WXWindow win ); + + // implementation from now on + // -------------------------- + + // activation hooks only necessary for MDI Implementation + static void MacDelayedDeactivation(long timestamp); + virtual void MacActivate( long timestamp , bool inIsActivating ) ; + + + virtual void Raise(); + virtual void Lower(); + virtual bool Show( bool show = true ); + + virtual bool ShowWithEffect(wxShowEffect effect, + unsigned timeout = 0) ; + + virtual bool HideWithEffect(wxShowEffect effect, + unsigned timeout = 0) ; + + virtual void SetExtraStyle(long exStyle) ; + + virtual bool SetBackgroundColour( const wxColour &colour ); + + wxNonOwnedWindowImpl* GetNonOwnedPeer() const { return m_nowpeer; } + + // osx specific event handling common for all osx-ports + + virtual void HandleActivated( double timestampsec, bool didActivate ); + virtual void HandleResized( double timestampsec ); + virtual void HandleMoved( double timestampsec ); + virtual void HandleResizing( double timestampsec, wxRect* rect ); + +protected: + // common part of all ctors + void Init(); + + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoGetClientSize(int *width, int *height) const; + + wxNonOwnedWindowImpl* m_nowpeer ; + +// wxWindowMac* m_macFocus ; + + static wxNonOwnedWindow *s_macDeactivateWindow; +private : +}; + +// list of all frames and modeless dialogs +extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows; + + +#endif // _WX_MAC_NONOWNEDWND_H_ diff --git a/include/wx/osx/notebook.h b/include/wx/osx/notebook.h index 12655a9f0c..6a7d4a2e44 100644 --- a/include/wx/osx/notebook.h +++ b/include/wx/osx/notebook.h @@ -1,5 +1,145 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/notebook.h" -#else -#include "wx/osx/carbon/notebook.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- +#include "wx/event.h" + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// fwd declarations +class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxWindow; + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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 = wxNotebookNameStr); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNotebookNameStr); + // dtor + virtual ~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) { return DoSetSelection(nPage, SetSelection_SendEvent); } + // get the currently selected page + int GetSelection() const { return m_nSelection; } + + // changes selected page without sending events + int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } + + // 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); + + // hit test + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + + // calculate size for wxNotebookSizer + wxSize CalcSizeFromPage(const wxSize& sizePage) const; + wxRect GetPageRect() 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); + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnSelChange(wxBookCtrlEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& 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); + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + +protected: + virtual wxNotebookPage *DoRemovePage(size_t page) ; + // common part of all ctors + void Init(); + + // helper functions + void ChangePage(int nOldSel, int nSel); // change pages + void MacSetupTabs(); + + int DoSetSelection(size_t nPage, int flags = 0); + + // 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/osx/palette.h b/include/wx/osx/palette.h index 8eb1cd199e..5c6aa4740f 100644 --- a/include/wx/osx/palette.h +++ b/include/wx/osx/palette.h @@ -1,5 +1,41 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/palette.h" -#else -#include "wx/osx/carbon/palette.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#include "wx/gdiobj.h" + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase +{ +public: + wxPalette(); + + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + virtual ~wxPalette(); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + + int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + + virtual int GetColoursCount() const; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + DECLARE_DYNAMIC_CLASS(wxPalette) +}; + +#endif // _WX_PALETTE_H_ diff --git a/include/wx/osx/pnghand.h b/include/wx/osx/pnghand.h index 3d02b61176..de27a024d9 100644 --- a/include/wx/osx/pnghand.h +++ b/include/wx/osx/pnghand.h @@ -1,5 +1,39 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/pnghand.h" -#else -#include "wx/osx/carbon/pnghand.h" +///////////////////////////////////////////////////////////////////////////// +// 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 +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PNGHAND_H_ +#define _WX_PNGHAND_H_ + +#include "wx/defs.h" + +#if wxUSE_LIBPNG + +class WXDLLIMPEXP_CORE wxPNGFileHandler: public wxBitmapHandler +{ + DECLARE_DYNAMIC_CLASS(wxPNGFileHandler) +public: + inline wxPNGFileHandler(void) + { + SetName(wxT("PNG bitmap file")); + SetExtension(wxT("bmp")); + SetType(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 //wxUSE_LIBPNG + #endif + // _WX_PNGHAND_H_ + diff --git a/include/wx/osx/pngread.h b/include/wx/osx/pngread.h index 7481e1d0d2..222a2c5589 100644 --- a/include/wx/osx/pngread.h +++ b/include/wx/osx/pngread.h @@ -1,5 +1,287 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/pngread.h" -#else -#include "wx/osx/carbon/pngread.h" +/* + * 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__ + +#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/osx/popupwin.h b/include/wx/osx/popupwin.h index 8c7eed39a8..3bf458ef15 100644 --- a/include/wx/osx/popupwin.h +++ b/include/wx/osx/popupwin.h @@ -1,5 +1,35 @@ -#ifdef __WXMAC_CLASSIC__ -#error "wxPopupWindow is not supported under this platform." -#else -#include "wx/osx/carbon/popupwin.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/popupwin.h +// Purpose: wxPopupWindow class for wxMac +// Author: Stefan Csomor +// Modified by: +// Created: +// RCS-ID: $Id$ +// Copyright: (c) 2006 Stefan Csomor +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_POPUPWIN_H_ +#define _WX_MAC_POPUPWIN_H_ + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + ~wxPopupWindow(); + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) +}; + +#endif // _WX_MAC_POPUPWIN_H_ + diff --git a/include/wx/osx/printmac.h b/include/wx/osx/printmac.h index 32c598a854..776d6643c1 100644 --- a/include/wx/osx/printmac.h +++ b/include/wx/osx/printmac.h @@ -1,5 +1,60 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/printmac.h" -#else -#include "wx/osx/carbon/printmac.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/prntbase.h" + +/* + * Represents the printer: manages printing a wxPrintout object + */ + +class WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE 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/osx/radiobox.h b/include/wx/osx/radiobox.h index 3378811c57..6890aaafb7 100644 --- a/include/wx/osx/radiobox.h +++ b/include/wx/osx/radiobox.h @@ -1,5 +1,107 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/radiobox.h" -#else -#include "wx/osx/carbon/radiobox.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +// List box item +class WXDLLIMPEXP_FWD_CORE wxBitmap ; + +class WXDLLIMPEXP_FWD_CORE wxRadioButton ; + +class WXDLLIMPEXP_CORE 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); + } + virtual ~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); + + // Enabling + virtual bool Enable(bool enable = true); + virtual bool Enable(unsigned int item, bool enable = true); + virtual bool IsItemEnabled(unsigned int item) const; + + // Showing + virtual bool Show(bool show = true); + virtual bool Show(unsigned int item, bool show = true); + virtual bool IsItemShown(unsigned int item) const; + + // Specific functions (in wxWidgets2 reference) + virtual void SetSelection(int item); + virtual int GetSelection() const; + + virtual unsigned int GetCount() const { return m_noItems; } + + virtual wxString GetString(unsigned int item) const; + virtual void SetString(unsigned int item, const wxString& label); + + virtual wxString GetLabel() const; + virtual void SetLabel(const wxString& label) ; + + // protect native font of box + virtual bool SetFont( const wxFont &font ); +// 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; + + unsigned 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/osx/radiobut.h b/include/wx/osx/radiobut.h index ff66c40e65..9c719eed3b 100644 --- a/include/wx/osx/radiobut.h +++ b/include/wx/osx/radiobut.h @@ -1,5 +1,94 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/radiobut.h" -#else -#include "wx/osx/carbon/radiobut.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +class WXDLLIMPEXP_CORE 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); + } + virtual ~wxRadioButton(); + + 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 + + void Command(wxCommandEvent& event); + wxRadioButton *AddInCycle(wxRadioButton *cycle); + void RemoveFromCycle(); + inline wxRadioButton *NextInCycle() {return m_cycle;} + + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + protected: + + wxRadioButton *m_cycle; +}; + +// Not implemented +#if 0 +class WXDLLIMPEXP_FWD_CORE wxBitmap ; + +WXDLLIMPEXP_DATA_CORE(extern const wxChar) wxBitmapRadioButtonNameStr[]; + +class WXDLLIMPEXP_CORE 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/osx/scrolbar.h b/include/wx/osx/scrolbar.h index 135678af82..cd32595315 100644 --- a/include/wx/osx/scrolbar.h +++ b/include/wx/osx/scrolbar.h @@ -1,5 +1,68 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/scrolbar.h" -#else -#include "wx/osx/carbon/scrolbar.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +// Scrollbar item +class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase +{ +public: + wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + virtual ~wxScrollBar(); + + 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); + + virtual int GetThumbPosition() const ; + virtual int GetThumbSize() const { return m_viewSize; } + virtual int GetPageSize() const { return m_pageSize; } + virtual int GetRange() const { return m_objectSize; } + + virtual void SetThumbPosition(int viewStart); + virtual void SetScrollbar(int position, int thumbSize, int range, + int pageSize, bool refresh = true); + + // implementation only from now on + void Command(wxCommandEvent& event); +#if wxOSX_USE_CARBON + virtual void MacHandleControlClick( WXWidget control , + wxInt16 controlpart , + bool mouseStillDown ) ; #endif + virtual bool HandleClicked( double timestampsec ); +protected: + virtual wxSize DoGetBestSize() const; + + int m_pageSize; + int m_viewSize; + int m_objectSize; + + DECLARE_DYNAMIC_CLASS(wxScrollBar) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_SCROLBAR_H_ diff --git a/include/wx/osx/slider.h b/include/wx/osx/slider.h index 6409c36fef..f2f40043e4 100644 --- a/include/wx/osx/slider.h +++ b/include/wx/osx/slider.h @@ -1,5 +1,110 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/slider.h" -#else -#include "wx/osx/carbon/slider.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/control.h" +#include "wx/slider.h" +#include "wx/stattext.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxSliderNameStr[]; + +// Slider +class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase +{ + 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); + } + + virtual ~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) ; + + void Command(wxCommandEvent& event); + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + void MacHandleControlClick(WXWidget control, wxInt16 controlpart, bool mouseStillDown); + +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); + + // set min/max size of the slider + virtual void DoSetSizeHints( int minW, int minH, + int maxW, int maxH, + int incW, int incH); + + // Common processing to invert slider values based on wxSL_INVERSE + virtual int ValueInvertOrNot(int value) const; + + 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/osx/sound.h b/include/wx/osx/sound.h index 9288010a41..670b170b9e 100644 --- a/include/wx/osx/sound.h +++ b/include/wx/osx/sound.h @@ -1,5 +1,55 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/sound.h" -#else -#include "wx/osx/carbon/sound.h" +///////////////////////////////////////////////////////////////////////////// +// Name: sound.h +// Purpose: wxSound class (loads and plays short Windows .wav files). +// Optional on non-Windows platforms. +// Author: Ryan Norton, Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Ryan Norton, Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#if wxUSE_SOUND + +#include "wx/object.h" + +class WXDLLIMPEXP_ADV wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = FALSE); + wxSound(int size, const wxByte* data); + virtual ~wxSound(); + +public: + bool Create(const wxString& fileName, bool isResource = FALSE); + bool IsOk() const { return !m_sndname.IsEmpty(); } + static void Stop(); + static bool IsPlaying(); + + void* GetHandle(); +protected: + bool DoPlay(unsigned flags) const; + +private: + wxString m_sndname; //file path + char* m_hSnd; //pointer to resource or memory location + int m_waveLength; //size of file in memory mode + void* m_pTimer; //timer + + enum wxSoundType + { + wxSound_MEMORY, + wxSound_FILE, + wxSound_RESOURCE, + wxSound_NONE + } m_type; //mode +}; + #endif +#endif + // _WX_SOUND_H_ diff --git a/include/wx/osx/spinbutt.h b/include/wx/osx/spinbutt.h index 395b540c4d..5c34e911d8 100644 --- a/include/wx/osx/spinbutt.h +++ b/include/wx/osx/spinbutt.h @@ -1,5 +1,78 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/spinbutt.h" -#else -#include "wx/osx/carbon/spinbutt.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#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 WXDLLIMPEXP_CORE 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 void SetRange(int minVal, int maxVal); + virtual int GetValue() const ; + virtual void SetValue(int val); + + // implementation + +#if wxOSX_USE_CARBON + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; #endif + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); + +protected: + void SendThumbTrackEvent() ; + + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinButton) +}; + +#endif + // _WX_SPINBUTT_H_ diff --git a/include/wx/osx/spinctrl.h b/include/wx/osx/spinctrl.h index 11d6944b79..38fd7a9bff 100644 --- a/include/wx/osx/spinctrl.h +++ b/include/wx/osx/spinctrl.h @@ -1,5 +1,195 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/spinctrl.h" -#else -#include "wx/osx/carbon/spinctrl.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// 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 + +#include "wx/containr.h" + +class WXDLLIMPEXP_FWD_CORE wxSpinButton; +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrlText; +class WXDLLIMPEXP_FWD_CORE wxSpinCtrlButton; + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is a combination of wxTextCtrl and wxSpinButton +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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; + + WX_DECLARE_CONTROL_CONTAINER(); + +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; + + friend class wxSpinCtrlText; + friend class wxSpinCtrlButton; + + int m_oldValue; +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) +}; + +#else // !wxUSE_SPINBTN + +// ---------------------------------------------------------------------------- +// wxSpinCtrl is just a text control +// ---------------------------------------------------------------------------- + +#include "wx/textctrl.h" + +class WXDLLIMPEXP_CORE 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/osx/srchctrl.h b/include/wx/osx/srchctrl.h index 90b98e03b4..a883134422 100644 --- a/include/wx/osx/srchctrl.h +++ b/include/wx/osx/srchctrl.h @@ -1,5 +1,84 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/generic/srchctlg.h" -#else -#include "wx/osx/carbon/srchctrl.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/srchctrl.h +// Purpose: mac carbon wxSearchCtrl class +// Author: Vince Harron +// Created: 2006-02-19 +// RCS-ID: $Id$ +// Copyright: Vince Harron +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SEARCHCTRL_H_ +#define _WX_SEARCHCTRL_H_ + +#if wxUSE_SEARCHCTRL + +class wxSearchWidgetImpl; + +class WXDLLIMPEXP_CORE wxSearchCtrl : public wxSearchCtrlBase +{ +public: + // creation + // -------- + + wxSearchCtrl(); + wxSearchCtrl(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 = wxSearchCtrlNameStr); + + virtual ~wxSearchCtrl(); + + 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 = wxSearchCtrlNameStr); + + // get/set search button menu + // -------------------------- + virtual void SetMenu( wxMenu* menu ); + virtual wxMenu* GetMenu(); + + // get/set search options + // ---------------------- + virtual void ShowSearchButton( bool show ); + virtual bool IsSearchButtonVisible() const; + + virtual void ShowCancelButton( bool show ); + virtual bool IsCancelButtonVisible() const; + + // TODO: In 2.9 these should probably be virtual, and declared in the base class... + void SetDescriptiveText(const wxString& text); + wxString GetDescriptiveText() const; + + virtual bool HandleSearchFieldSearchHit() ; + virtual bool HandleSearchFieldCancelHit() ; + + wxSearchWidgetImpl * GetSearchPeer() const; + +protected: + + wxSize DoGetBestSize() const; + + void Init(); + + wxMenu *m_menu; + + wxString m_descriptiveText; + +private: + DECLARE_DYNAMIC_CLASS(wxSearchCtrl) + + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_SEARCHCTRL_H_ + diff --git a/include/wx/osx/statbox.h b/include/wx/osx/statbox.h index 93b0313f7f..b7b86b08a9 100644 --- a/include/wx/osx/statbox.h +++ b/include/wx/osx/statbox.h @@ -1,5 +1,55 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/statbox.h" -#else -#include "wx/osx/carbon/statbox.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#include "wx/control.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxStaticBoxNameStr[]; + +// Group box +class WXDLLIMPEXP_CORE 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)) {}; + + virtual void GetBordersForSizer(int *borderTop, int *borderOther) const; + + virtual bool AcceptsFocus() const { return false; } + + // protect native font of box + virtual bool SetFont( const wxFont &font ); +}; + #endif + // _WX_STATBOX_H_ diff --git a/include/wx/osx/statline.h b/include/wx/osx/statline.h index b491cb2580..29de9f2a54 100644 --- a/include/wx/osx/statline.h +++ b/include/wx/osx/statline.h @@ -1,5 +1,57 @@ -#if wxOSX_USE_CARBON -#include "wx/osx/carbon/statline.h" -#else -#include "wx/osx/carbon/statline.h" -#endif +///////////////////////////////////////////////////////////////////////////// +// 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_ + +class wxStaticBox; + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() : m_statbox(NULL) { } + + wxStaticLine( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ) + : m_statbox(NULL) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id = wxID_ANY, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticLineNameStr ); + + // 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; + + DECLARE_DYNAMIC_CLASS(wxStaticLine) +}; + +#endif // _WX_GENERIC_STATLINE_H_ + diff --git a/include/wx/osx/stattext.h b/include/wx/osx/stattext.h index 9588f24832..fc69ab3457 100644 --- a/include/wx/osx/stattext.h +++ b/include/wx/osx/stattext.h @@ -1,5 +1,54 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/stattext.h" -#else -#include "wx/osx/carbon/stattext.h" +///////////////////////////////////////////////////////////////////////////// +// 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_ + +class WXDLLIMPEXP_CORE wxStaticText: public wxStaticTextBase +{ +public: + wxStaticText() { } + + 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 ); + + virtual bool AcceptsFocus() const { return FALSE; } + +protected : + + virtual wxString DoGetLabel() const; + virtual void DoSetLabel(const wxString& str); + + virtual wxSize DoGetBestSize() const ; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) +}; + #endif + // _WX_STATTEXT_H_ diff --git a/include/wx/osx/statusbr.h b/include/wx/osx/statusbr.h index 8d04cca4f6..81ee10257c 100644 --- a/include/wx/osx/statusbr.h +++ b/include/wx/osx/statusbr.h @@ -1,5 +1,43 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/statusbr.h" -#else -#include "wx/osx/carbon/statusbr.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +class WXDLLIMPEXP_CORE wxStatusBarMac : public wxStatusBarGeneric +{ + DECLARE_DYNAMIC_CLASS(wxStatusBarMac) + + wxStatusBarMac(); + wxStatusBarMac(wxWindow *parent, wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr); + + virtual ~wxStatusBarMac(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + long style = wxST_SIZEGRIP, + const wxString& name = wxStatusBarNameStr); + + 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 MacHiliteChanged(); + void OnPaint(wxPaintEvent& event); + +protected: + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_STATBAR_H_ diff --git a/include/wx/osx/taskbarosx.h b/include/wx/osx/taskbarosx.h index 4e893ad54f..0d48721613 100644 --- a/include/wx/osx/taskbarosx.h +++ b/include/wx/osx/taskbarosx.h @@ -1,5 +1,49 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/taskbarosx.h" -#else -#include "wx/osx/carbon/taskbarosx.h" +///////////////////////////////////////////////////////////////////////// +// 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_ + +class WXDLLIMPEXP_FWD_CORE wxIcon; +class WXDLLIMPEXP_FWD_CORE wxMenu; + +class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase +{ + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) +public: + // type of taskbar item to create (currently only DOCK is implemented) + enum wxTaskBarIconType + { + DOCK +#if wxOSX_USE_COCOA + , CUSTOM_STATUSITEM #endif +// , STATUSITEM +// , MENUEXTRA + , DEFAULT_TYPE = DOCK + }; + + wxTaskBarIcon(wxTaskBarIconType iconType = DEFAULT_TYPE); + virtual ~wxTaskBarIcon(); + + bool IsOk() const { return true; } + + bool IsIconInstalled() const; + bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); + bool RemoveIcon(); + bool PopupMenu(wxMenu *menu); + +protected: + class wxTaskBarIconImpl* m_impl; + friend class wxTaskBarIconImpl; +}; +#endif + // _TASKBAR_H_ diff --git a/include/wx/osx/textctrl.h b/include/wx/osx/textctrl.h index 3edbf1504c..df6967f9ab 100644 --- a/include/wx/osx/textctrl.h +++ b/include/wx/osx/textctrl.h @@ -1,5 +1,208 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/textctrl.h" -#else -#include "wx/osx/carbon/textctrl.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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 wxUSE_SYSTEM_OPTIONS + // set this to 'true' if you want to use the 'classic' MLTE-based implementation + // instead of the HIView-based implementation in 10.3 and upwards, the former + // has more features (backgrounds etc.), but may show redraw artefacts and other + // problems depending on your usage; hence, the default is 'false'. + #define wxMAC_TEXTCONTROL_USE_MLTE wxT("mac.textcontrol-use-mlte") + // set this to 'true' if you want editable text controls to have spell checking turned + // on by default, you can change this setting individually on a control using MacCheckSpelling + #define wxMAC_TEXTCONTROL_USE_SPELL_CHECKER wxT("mac.textcontrol-use-spell-checker") #endif + +#include "wx/control.h" +#include "wx/textctrl.h" + +// forward decl for wxListWidgetImpl implementation type. +class WXDLLIMPEXP_FWD_CORE wxTextWidgetImpl; + +class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase +{ + DECLARE_DYNAMIC_CLASS(wxTextCtrl) + +public: + wxTextCtrl() + { Init(); } + + 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); + } + + virtual ~wxTextCtrl(); + + 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 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); + + // 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 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 SetFont( const wxFont &font ); + 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 into the textctrl + // 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 wxTextPos GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // 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 OnDelete(wxCommandEvent& event); + void OnSelectAll(wxCommandEvent& event); + + void OnUpdateCut(wxUpdateUIEvent& event); + void OnUpdateCopy(wxUpdateUIEvent& event); + void OnUpdatePaste(wxUpdateUIEvent& event); + void OnUpdateUndo(wxUpdateUIEvent& event); + void OnUpdateRedo(wxUpdateUIEvent& event); + void OnUpdateDelete(wxUpdateUIEvent& event); + void OnUpdateSelectAll(wxUpdateUIEvent& event); + + void OnContextMenu(wxContextMenuEvent& event); + + virtual bool MacSetupCursor( const wxPoint& pt ); + + virtual void MacVisibilityChanged(); + virtual void MacSuperChangedPosition(); + virtual void MacCheckSpelling(bool check); + + wxTextWidgetImpl * GetTextPeer() const; +protected: + // common part of all ctors + void Init(); + + virtual wxSize DoGetBestSize() const; + + virtual void DoSetValue(const wxString& value, int flags = 0); + + bool m_editable; + + // flag is set to true when the user edits the controls contents + bool m_dirty; + + // need to make this public because of the current implementation via callbacks + unsigned long m_maxLength; + + bool GetTriggerOnSetValue() const + { + return m_triggerOnSetValue; + } + + void SetTriggerOnSetValue(bool trigger) + { + m_triggerOnSetValue = trigger; + } + + bool m_triggerOnSetValue ; + +private : + wxMenu *m_privateContextMenu; + + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_TEXTCTRL_H_ diff --git a/include/wx/osx/tglbtn.h b/include/wx/osx/tglbtn.h index 17f082b5d2..fde10d7980 100644 --- a/include/wx/osx/tglbtn.h +++ b/include/wx/osx/tglbtn.h @@ -1,5 +1,107 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/tglbtn.h" -#else -#include "wx/osx/carbon/tglbtn.h" -#endif \ No newline at end of file +///////////////////////////////////////////////////////////////////////////// +// 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 licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +WXDLLIMPEXP_DATA_CORE(extern const char) wxCheckBoxNameStr[]; + + +class WXDLLIMPEXP_CORE wxBitmapToggleButton : public wxToggleButtonBase +{ +public: + wxBitmapToggleButton() {} + wxBitmapToggleButton(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& 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 bool HandleClicked( double timestampsec ); + + virtual void Command(wxCommandEvent& event); + +private: + wxBitmap m_bitmap; + + int m_marginX, + m_marginY; + +protected: + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton) +}; + + +class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase +{ +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 bool HandleClicked( double timestampsec ); + + virtual void Command(wxCommandEvent& event); + +protected: + virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) +}; + +#endif // _WX_TOGGLEBUTTON_H_ + diff --git a/include/wx/osx/toolbar.h b/include/wx/osx/toolbar.h index 018be6a424..6dd02028cb 100644 --- a/include/wx/osx/toolbar.h +++ b/include/wx/osx/toolbar.h @@ -1,5 +1,109 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/toolbar.h" -#else -#include "wx/osx/carbon/toolbar.h" +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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 wxUSE_TOOLBAR + +#include "wx/tbarbase.h" +#include "wx/dynarray.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxToolBarNameStr[]; + +class WXDLLIMPEXP_CORE 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); + } + virtual ~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); + + virtual void SetWindowStyleFlag(long style); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual bool Show(bool show = true); + virtual bool IsShown() const; + virtual bool Realize(); + + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolSize() const; + + virtual void SetRows(int nRows); + + virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap); + virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap); + + // Add all the buttons + + virtual wxString MacGetToolTipString( wxPoint &where ) ; + void OnPaint(wxPaintEvent& event) ; + void OnMouse(wxMouseEvent& event) ; + virtual void MacSuperChangedPosition() ; + +#if wxOSX_USE_NATIVE_TOOLBAR + bool MacInstallNativeToolbar(bool usesNative); + bool MacWantsNativeToolbar(); + bool MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled) const; #endif +protected: + // common part of all ctors + void Init(); + + virtual void DoGetSize(int *width, int *height) const; + virtual wxSize DoGetBestSize() const; + 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, + const wxString& label); + + DECLARE_EVENT_TABLE() +#if wxOSX_USE_NATIVE_TOOLBAR + bool m_macUsesNativeToolbar ; + void* m_macToolbar ; +#endif +}; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TOOLBAR_H_ diff --git a/include/wx/osx/tooltip.h b/include/wx/osx/tooltip.h index 0e46d17005..df51d47ffb 100644 --- a/include/wx/osx/tooltip.h +++ b/include/wx/osx/tooltip.h @@ -1,5 +1,58 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/tooltip.h" -#else -#include "wx/osx/carbon/tooltip.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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 +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_TOOLTIP_H_ +#define _WX_MAC_TOOLTIP_H_ + +#include "wx/string.h" +#include "wx/event.h" + +class WXDLLIMPEXP_CORE 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); + // set the delay after which the tooltip disappears or how long the tooltip remains visible + static void SetAutoPop(long milliseconds); + // set the delay between subsequent tooltips to appear + static void SetReshow(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) +}; + +#endif // _WX_MAC_TOOLTIP_H_ diff --git a/include/wx/osx/toplevel.h b/include/wx/osx/toplevel.h index 108a842c30..7983b8c5c6 100644 --- a/include/wx/osx/toplevel.h +++ b/include/wx/osx/toplevel.h @@ -1,5 +1,86 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/toplevel.h" -#else -#include "wx/osx/carbon/toplevel.h" -#endif +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowMac +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_CORE 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(); + + virtual bool Destroy(); + + virtual wxPoint GetClientAreaOrigin() const; + + // Attracts the users attention to this window if the application is + // inactive (should be called when a background event occurs) + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + + // 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 Restore(); + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) ; + virtual bool IsFullScreen() const ; + + // implementation from now on + // -------------------------- + + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + +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; +private : + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_MSW_TOPLEVEL_H_ diff --git a/include/wx/osx/treectrl.h b/include/wx/osx/treectrl.h index 431a17775c..a8c92b288f 100644 --- a/include/wx/osx/treectrl.h +++ b/include/wx/osx/treectrl.h @@ -1,5 +1,291 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/treectl.h" -#else -#include "wx/osx/carbon/treectrl.h" -#endif \ No newline at end of file +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/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_ + +#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. +}; + +#if WXWIN_COMPATIBILITY_2_6 + // Flags for InsertItem + enum { + wxTREE_INSERT_LAST = -1, + wxTREE_INSERT_FIRST = -2, + wxTREE_INSERT_SORT = -3 + }; +#endif + +class WXDLLIMPEXP_CORE 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 WXDLLIMPEXP_CORE wxTreeCtrl: public wxControl +{ +public: + /* + * Public interface + */ + + // creation + // -------- + wxTreeCtrl(); + + inline wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, + 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); + } + virtual ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = wxID_ANY, + 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 + // --------- + // + virtual unsigned int GetCount() const; + + // indent + int GetIndent() const; + void SetIndent(int indent); + // image list + wxImageList *GetImageList(int which = wxIMAGE_LIST_NORMAL) const; + + // 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); + +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( 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. + wxDEPRECATED( long InsertItem(long parent, const wxString& label, + int image = -1, int selImage = -1, + long insertAfter = wxTREE_INSERT_LAST) ); + + // use Expand, Collapse, CollapseAndReset or Toggle + wxDEPRECATED( bool ExpandItem(long item, int action) ); + wxDEPRECATED( void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL) ); +#endif // WXWIN_COMPATIBILITY_2_6 + + // 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); } + + // + 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 WXDLLIMPEXP_CORE 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/osx/window.h b/include/wx/osx/window.h index ccd9b71b61..783aee0929 100644 --- a/include/wx/osx/window.h +++ b/include/wx/osx/window.h @@ -1,5 +1,344 @@ -#ifdef __WXMAC_CLASSIC__ -#include "wx/osx/classic/window.h" +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/mac/carbon/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_ + +#include "wx/brush.h" +#include "wx/dc.h" + +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxScrollBar; +class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; + +class WXDLLIMPEXP_FWD_CORE wxMacControl ; +class WXDLLIMPEXP_FWD_CORE wxWidgetImpl ; + +class WXDLLIMPEXP_CORE wxWindowMac: public wxWindowBase +{ + DECLARE_DYNAMIC_CLASS(wxWindowMac) + + friend class wxDC; + friend class wxPaintDC; + +public: + wxWindowMac(); + + wxWindowMac( wxWindowMac *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr ); + + 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 SetLabel( const wxString& label ); + virtual wxString GetLabel() const; + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show( bool show = true ); + + virtual bool IsShownOnScreen() const; + + virtual void SetFocus(); + + virtual void WarpPointer( int x, int y ); + + virtual void Refresh( bool eraseBackground = true, + const wxRect *rect = NULL ); + + virtual void Update() ; + virtual void ClearBackground(); + + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + virtual bool SetBackgroundColour( const wxColour &colour ); + virtual bool SetForegroundColour( const wxColour &colour ); + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent( const wxString& string, + int *x, int *y, + int *descent = NULL, + int *externalLeading = NULL, + const wxFont *theFont = NULL ) + const; +protected: + virtual void DoEnable( bool enable ); +#if wxUSE_MENUS + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); +#endif + + virtual void DoFreeze(); + virtual void DoThaw(); + +public: + virtual void SetScrollbar( int orient, int pos, int thumbVisible, + int range, bool refresh = true ); + virtual void SetScrollPos( int orient, int pos, bool refresh = true ); + virtual int GetScrollPos( int orient ) const; + virtual int GetScrollThumb( int orient ) const; + virtual int GetScrollRange( int orient ) const; + virtual void ScrollWindow( int dx, int dy, + const wxRect* rect = (wxRect *) NULL ); + virtual void AlwaysShowScrollbars(bool horz = true, bool vert = true); + virtual bool IsScrollbarAlwaysShown(int orient) const + { + return orient == wxHORIZONTAL ? m_hScrollBarAlwaysShown + : m_vScrollBarAlwaysShown; + } + + virtual bool Reparent( wxWindowBase *newParent ); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif + + // Accept files for dragging + virtual void DragAcceptFiles( bool accept ); + + // implementation from now on + // -------------------------- + + void MacClientToRootWindow( 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 + // ---------------- + + virtual WXWidget GetHandle() const; + + virtual bool SetTransparent(wxByte alpha); + virtual bool CanSetTransparent(); + virtual wxByte GetTransparent() const ; + + // event handlers + // -------------- + void OnPaint( wxPaintEvent& event ); + void OnNcPaint( wxNcPaintEvent& event ); + void OnEraseBackground(wxEraseEvent& event ); + void OnMouseEvent( wxMouseEvent &event ); + + void MacOnScroll( wxScrollEvent&event ); + + virtual bool AcceptsFocus() const; + + virtual bool IsDoubleBuffered() const { return true; } + +public: + static long MacRemoveBordersFromStyle( long style ) ; + +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; + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + virtual bool MacDoRedraw( void* updatergn , long time ) ; + + // 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 ) ; + void MacPaintGrowBox(); + + // invalidates the borders and focus area around the control; + // must not be virtual as it will be called during destruction + void MacInvalidateBorders() ; + + WXWindow MacGetTopLevelWindowRef() const ; + wxNonOwnedWindow* MacGetTopLevelWindow() const ; + + virtual long MacGetLeftBorderSize() const ; + virtual long MacGetRightBorderSize() const ; + virtual long MacGetTopBorderSize() const ; + virtual long MacGetBottomBorderSize() const ; + + virtual void MacSuperChangedPosition() ; + + // absolute coordinates of this window's root have changed + virtual void MacTopLevelWindowChangedPosition() ; + + virtual void MacChildAdded() ; + virtual void MacVisibilityChanged() ; + virtual void MacEnabledStateChanged() ; + virtual void MacHiliteChanged() ; + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + + bool MacIsReallyEnabled() ; + bool MacIsReallyHilited() ; + + bool MacIsUserPane() { return m_macIsUserPane; } + + virtual bool MacSetupCursor( const wxPoint& pt ) ; + + // return the rectangle that would be visible of this control, + // regardless whether controls are hidden + // only taking into account clipping by parent windows + const wxRect& MacGetClippedClientRect() const ; + const wxRect& MacGetClippedRect() const ; + const wxRect& MacGetClippedRectWithOuterStructure() const ; + + // returns the visible region of this control in window ie non-client coordinates + const wxRegion& MacGetVisibleRegion( bool includeOuterStructures = false ) ; + + // returns true if children have to clipped to the content area + // (e.g., scrolled windows) + bool MacClipChildren() const { return m_clipChildren ; } + void MacSetClipChildren( bool clip ) { m_clipChildren = clip ; } + + // returns true if the grandchildren need to be clipped to the children's content area + // (e.g., splitter windows) + virtual bool MacClipGrandChildren() const { return false ; } + bool MacIsWindowScrollbar( const wxWindow* sb ) const + { return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; } + virtual bool IsClientAreaChild(const wxWindow *child) const + { + return !MacIsWindowScrollbar(child) && + wxWindowBase::IsClientAreaChild(child); + } + + void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ; + wxList& GetSubcontrols() { return m_subControls; } + + // translate wxWidgets coords into ones suitable + // to be passed to CreateControl calls + // + // returns true if non-default coords are returned, false otherwise + bool MacGetBoundsForControl(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h , bool adjustForOrigin ) const ; + + // the 'true' OS level control for this wxWindow +#if wxOSX_USE_CARBON + wxMacControl* GetPeer() const { return m_peer ; } #else -#include "wx/osx/carbon/window.h" + wxWidgetImpl* GetPeer() const { return m_peer ; } +#endif + + void * MacGetCGContextRef() { return m_cgContextRef ; } + void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; } + + // osx specific event handling common for all osx-ports + + virtual bool HandleClicked( double timestampsec ); +protected: + // For controls like radio buttons which are genuinely composite + wxList m_subControls; + +#if wxOSX_USE_CARBON + // the peer object, allowing for cleaner API support + wxMacControl * m_peer ; +#else + wxWidgetImpl * m_peer ; +#endif + void * m_cgContextRef ; + + // cache the clipped rectangles within the window hierarchy + void MacUpdateClippedRects() const ; + + mutable bool m_cachedClippedRectValid ; + mutable wxRect m_cachedClippedRectWithOuterStructure ; + mutable wxRect m_cachedClippedRect ; + mutable wxRect m_cachedClippedClientRect ; + mutable wxRegion m_cachedClippedRegionWithOuterStructure ; + mutable wxRegion m_cachedClippedRegion ; + mutable wxRegion m_cachedClippedClientRegion ; + + // true if is is not a native control but a wxWindow control + bool m_macIsUserPane ; + + // insets of the mac control from the wx top left corner + wxPoint m_macTopLeftInset ; + wxPoint m_macBottomRightInset ; + wxByte m_macAlpha ; + + wxScrollBar* m_hScrollBar ; + wxScrollBar* m_vScrollBar ; + bool m_hScrollBarAlwaysShown; + bool m_vScrollBarAlwaysShown; + wxString m_label ; + + // set to true if we do a sharp clip at the content area of this window + // must be dynamic as eg a panel normally is not clipping precisely, but if + // it becomes the target window of a scrolled window it has to... + bool m_clipChildren ; + + virtual bool MacIsChildOfClientArea( const wxWindow* child ) const ; + + bool MacHasScrollBarCorner() const; + void MacCreateScrollBars( long style ) ; + void MacRepositionScrollBars() ; + void MacUpdateControlFont() ; + + // implement the base class pure virtuals + virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetSizeFromClientSize( const wxSize & size ) const; + 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 ); + virtual void DoSetWindowVariant( wxWindowVariant variant ); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); #endif + +private: + // common part of all ctors + void Init(); + + // show/hide scrollbars as needed, common part of SetScrollbar() and + // AlwaysShowScrollbars() + void DoUpdateScrollbarVisibility(); + + + DECLARE_NO_COPY_CLASS(wxWindowMac) + DECLARE_EVENT_TABLE() +}; + +#endif // _WX_WINDOW_H_ -- 2.45.2