From 5c6eb3a84be918dcfed2496d014549e13af0f0e9 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 11 Jun 2008 16:30:48 +0000 Subject: [PATCH] renaming git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/accel.h | 5 + include/wx/osx/app.h | 5 + include/wx/osx/bitmap.h | 5 + include/wx/osx/bmpbuttn.h | 5 + include/wx/osx/brush.h | 5 + include/wx/osx/button.h | 5 + include/wx/osx/carbon/accel.h | 36 + include/wx/osx/carbon/app.h | 135 +++ include/wx/osx/carbon/bitmap.h | 181 +++ include/wx/osx/carbon/bmpbuttn.h | 53 + include/wx/osx/carbon/brush.h | 53 + include/wx/osx/carbon/button.h | 93 ++ include/wx/osx/carbon/checkbox.h | 81 ++ include/wx/osx/carbon/checklst.h | 90 ++ include/wx/osx/carbon/chkconf.h | 150 +++ include/wx/osx/carbon/choice.h | 99 ++ include/wx/osx/carbon/clipbrd.h | 76 ++ include/wx/osx/carbon/colordlg.h | 42 + include/wx/osx/carbon/colour.h | 83 ++ include/wx/osx/carbon/combobox.h | 162 +++ include/wx/osx/carbon/control.h | 53 + include/wx/osx/carbon/cursor.h | 54 + include/wx/osx/carbon/databrow.h | 285 +++++ 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/dataview.h | 630 +++++++++++ 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 | 34 + 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/drawer.h | 71 ++ include/wx/osx/carbon/evtloop.h | 64 ++ include/wx/osx/carbon/filedlg.h | 49 + include/wx/osx/carbon/font.h | 123 ++ include/wx/osx/carbon/fontdlg.h | 166 +++ include/wx/osx/carbon/frame.h | 121 ++ include/wx/osx/carbon/gauge.h | 56 + include/wx/osx/carbon/glcanvas.h | 142 +++ include/wx/osx/carbon/helpxxxx.h | 49 + include/wx/osx/carbon/icon.h | 99 ++ include/wx/osx/carbon/imaglist.h | 60 + include/wx/osx/carbon/joystick.h | 91 ++ include/wx/osx/carbon/listbox.h | 147 +++ include/wx/osx/carbon/listctrl.h | 423 +++++++ include/wx/osx/carbon/mdi.h | 194 ++++ include/wx/osx/carbon/menu.h | 182 +++ include/wx/osx/carbon/menuitem.h | 80 ++ include/wx/osx/carbon/metafile.h | 178 +++ include/wx/osx/carbon/mimetype.h | 122 ++ include/wx/osx/carbon/minifram.h | 42 + include/wx/osx/carbon/msgdlg.h | 48 + include/wx/osx/carbon/nonownedwnd.h | 147 +++ include/wx/osx/carbon/notebook.h | 143 +++ include/wx/osx/carbon/palette.h | 41 + include/wx/osx/carbon/pen.h | 71 ++ 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/printdlg.h | 112 ++ include/wx/osx/carbon/printmac.h | 60 + include/wx/osx/carbon/private.h | 1072 ++++++++++++++++++ include/wx/osx/carbon/private/mactext.h | 97 ++ include/wx/osx/carbon/private/overlay.h | 58 + include/wx/osx/carbon/private/print.h | 45 + include/wx/osx/carbon/private/timer.h | 33 + include/wx/osx/carbon/radiobox.h | 105 ++ include/wx/osx/carbon/radiobut.h | 92 ++ include/wx/osx/carbon/region.h | 100 ++ include/wx/osx/carbon/scrolbar.h | 68 ++ include/wx/osx/carbon/slider.h | 108 ++ include/wx/osx/carbon/sound.h | 55 + include/wx/osx/carbon/spinbutt.h | 76 ++ include/wx/osx/carbon/spinctrl.h | 195 ++++ include/wx/osx/carbon/srchctrl.h | 90 ++ include/wx/osx/carbon/statbmp.h | 65 ++ include/wx/osx/carbon/statbox.h | 52 + 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/tabctrl.h | 154 +++ include/wx/osx/carbon/taskbarosx.h | 47 + include/wx/osx/carbon/textctrl.h | 215 ++++ include/wx/osx/carbon/tglbtn.h | 104 ++ 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/uma.h | 49 + include/wx/osx/carbon/window.h | 350 ++++++ include/wx/osx/checkbox.h | 5 + include/wx/osx/checklst.h | 5 + include/wx/osx/chkconf.h | 34 + include/wx/osx/choice.h | 5 + include/wx/osx/clipbrd.h | 5 + include/wx/osx/colordlg.h | 6 + include/wx/osx/colour.h | 5 + include/wx/osx/combobox.h | 5 + include/wx/osx/config_xcode.h | 137 +++ include/wx/osx/control.h | 5 + include/wx/osx/core/cfdataref.h | 97 ++ include/wx/osx/core/cfref.h | 389 +++++++ include/wx/osx/core/cfstring.h | 80 ++ include/wx/osx/core/hid.h | 116 ++ include/wx/osx/core/joystick.h | 93 ++ include/wx/osx/core/private.h | 82 ++ include/wx/osx/core/private/strconv_cf.h | 338 ++++++ include/wx/osx/core/stdpaths.h | 67 ++ include/wx/osx/cursor.h | 5 + include/wx/osx/dataform.h | 5 + include/wx/osx/dataobj.h | 5 + include/wx/osx/dataobj2.h | 5 + include/wx/osx/dataview.h | 5 + include/wx/osx/dc.h | 5 + include/wx/osx/dcclient.h | 5 + include/wx/osx/dcmemory.h | 5 + include/wx/osx/dcprint.h | 5 + include/wx/osx/dcscreen.h | 5 + include/wx/osx/dialog.h | 5 + include/wx/osx/dirdlg.h | 5 + include/wx/osx/dnd.h | 5 + include/wx/osx/evtloop.h | 18 + include/wx/osx/filedlg.h | 5 + include/wx/osx/font.h | 5 + include/wx/osx/fontdlg.h | 5 + include/wx/osx/frame.h | 5 + include/wx/osx/gauge.h | 5 + include/wx/osx/glcanvas.h | 5 + include/wx/osx/helpxxxx.h | 5 + include/wx/osx/icon.h | 5 + include/wx/osx/imaglist.h | 5 + include/wx/osx/joystick.h | 5 + include/wx/osx/listbox.h | 5 + include/wx/osx/listctrl.h | 5 + include/wx/osx/mdi.h | 5 + include/wx/osx/menu.h | 5 + include/wx/osx/menuitem.h | 5 + include/wx/osx/metafile.h | 5 + include/wx/osx/mimetype.h | 5 + include/wx/osx/minifram.h | 5 + include/wx/osx/msgdlg.h | 5 + include/wx/osx/nonownedwnd.h | 5 + include/wx/osx/notebook.h | 5 + include/wx/osx/palette.h | 5 + include/wx/osx/pen.h | 5 + include/wx/osx/pnghand.h | 5 + include/wx/osx/pngread.h | 5 + include/wx/osx/popupwin.h | 5 + include/wx/osx/printdlg.h | 5 + include/wx/osx/printmac.h | 5 + include/wx/osx/private.h | 7 + include/wx/osx/private/print.h | 5 + include/wx/osx/private/timer.h | 5 + include/wx/osx/radiobox.h | 5 + include/wx/osx/radiobut.h | 5 + include/wx/osx/region.h | 5 + include/wx/osx/scrolbar.h | 5 + include/wx/osx/setup0.h | 1319 ++++++++++++++++++++++ include/wx/osx/slider.h | 5 + include/wx/osx/sound.h | 5 + include/wx/osx/spinbutt.h | 5 + include/wx/osx/spinctrl.h | 5 + include/wx/osx/srchctrl.h | 5 + include/wx/osx/statbmp.h | 5 + include/wx/osx/statbox.h | 5 + include/wx/osx/statline.h | 5 + include/wx/osx/stattext.h | 5 + include/wx/osx/statusbr.h | 5 + include/wx/osx/tabctrl.h | 5 + include/wx/osx/taskbarosx.h | 5 + include/wx/osx/textctrl.h | 5 + include/wx/osx/tglbtn.h | 5 + include/wx/osx/toolbar.h | 5 + include/wx/osx/tooltip.h | 5 + include/wx/osx/toplevel.h | 5 + include/wx/osx/treectrl.h | 5 + include/wx/osx/uma.h | 5 + include/wx/osx/window.h | 5 + 182 files changed, 13550 insertions(+) create mode 100644 include/wx/osx/accel.h create mode 100644 include/wx/osx/app.h create mode 100644 include/wx/osx/bitmap.h create mode 100644 include/wx/osx/bmpbuttn.h create mode 100644 include/wx/osx/brush.h create mode 100644 include/wx/osx/button.h create mode 100644 include/wx/osx/carbon/accel.h create mode 100644 include/wx/osx/carbon/app.h create mode 100644 include/wx/osx/carbon/bitmap.h create mode 100644 include/wx/osx/carbon/bmpbuttn.h create mode 100644 include/wx/osx/carbon/brush.h create mode 100644 include/wx/osx/carbon/button.h create mode 100644 include/wx/osx/carbon/checkbox.h create mode 100644 include/wx/osx/carbon/checklst.h create mode 100644 include/wx/osx/carbon/chkconf.h create mode 100644 include/wx/osx/carbon/choice.h create mode 100644 include/wx/osx/carbon/clipbrd.h create mode 100644 include/wx/osx/carbon/colordlg.h create mode 100644 include/wx/osx/carbon/colour.h create mode 100644 include/wx/osx/carbon/combobox.h create mode 100644 include/wx/osx/carbon/control.h create mode 100644 include/wx/osx/carbon/cursor.h create mode 100644 include/wx/osx/carbon/databrow.h create mode 100644 include/wx/osx/carbon/dataform.h create mode 100644 include/wx/osx/carbon/dataobj.h create mode 100644 include/wx/osx/carbon/dataobj2.h create mode 100644 include/wx/osx/carbon/dataview.h create mode 100644 include/wx/osx/carbon/dc.h create mode 100644 include/wx/osx/carbon/dcclient.h create mode 100644 include/wx/osx/carbon/dcmemory.h create mode 100644 include/wx/osx/carbon/dcprint.h create mode 100644 include/wx/osx/carbon/dcscreen.h create mode 100644 include/wx/osx/carbon/dialog.h create mode 100644 include/wx/osx/carbon/dirdlg.h create mode 100644 include/wx/osx/carbon/dnd.h create mode 100644 include/wx/osx/carbon/drawer.h create mode 100644 include/wx/osx/carbon/evtloop.h create mode 100644 include/wx/osx/carbon/filedlg.h create mode 100644 include/wx/osx/carbon/font.h create mode 100644 include/wx/osx/carbon/fontdlg.h create mode 100644 include/wx/osx/carbon/frame.h create mode 100644 include/wx/osx/carbon/gauge.h create mode 100644 include/wx/osx/carbon/glcanvas.h create mode 100644 include/wx/osx/carbon/helpxxxx.h create mode 100644 include/wx/osx/carbon/icon.h create mode 100644 include/wx/osx/carbon/imaglist.h create mode 100644 include/wx/osx/carbon/joystick.h create mode 100644 include/wx/osx/carbon/listbox.h create mode 100644 include/wx/osx/carbon/listctrl.h create mode 100644 include/wx/osx/carbon/mdi.h create mode 100644 include/wx/osx/carbon/menu.h create mode 100644 include/wx/osx/carbon/menuitem.h create mode 100644 include/wx/osx/carbon/metafile.h create mode 100644 include/wx/osx/carbon/mimetype.h create mode 100644 include/wx/osx/carbon/minifram.h create mode 100644 include/wx/osx/carbon/msgdlg.h create mode 100644 include/wx/osx/carbon/nonownedwnd.h create mode 100644 include/wx/osx/carbon/notebook.h create mode 100644 include/wx/osx/carbon/palette.h create mode 100644 include/wx/osx/carbon/pen.h create mode 100644 include/wx/osx/carbon/pnghand.h create mode 100644 include/wx/osx/carbon/pngread.h create mode 100644 include/wx/osx/carbon/popupwin.h create mode 100644 include/wx/osx/carbon/printdlg.h create mode 100644 include/wx/osx/carbon/printmac.h create mode 100644 include/wx/osx/carbon/private.h create mode 100644 include/wx/osx/carbon/private/mactext.h create mode 100644 include/wx/osx/carbon/private/overlay.h create mode 100644 include/wx/osx/carbon/private/print.h create mode 100644 include/wx/osx/carbon/private/timer.h create mode 100644 include/wx/osx/carbon/radiobox.h create mode 100644 include/wx/osx/carbon/radiobut.h create mode 100644 include/wx/osx/carbon/region.h create mode 100644 include/wx/osx/carbon/scrolbar.h create mode 100644 include/wx/osx/carbon/slider.h create mode 100644 include/wx/osx/carbon/sound.h create mode 100644 include/wx/osx/carbon/spinbutt.h create mode 100644 include/wx/osx/carbon/spinctrl.h create mode 100644 include/wx/osx/carbon/srchctrl.h create mode 100644 include/wx/osx/carbon/statbmp.h create mode 100644 include/wx/osx/carbon/statbox.h create mode 100644 include/wx/osx/carbon/statline.h create mode 100644 include/wx/osx/carbon/stattext.h create mode 100644 include/wx/osx/carbon/statusbr.h create mode 100644 include/wx/osx/carbon/tabctrl.h create mode 100644 include/wx/osx/carbon/taskbarosx.h create mode 100644 include/wx/osx/carbon/textctrl.h create mode 100644 include/wx/osx/carbon/tglbtn.h create mode 100644 include/wx/osx/carbon/toolbar.h create mode 100644 include/wx/osx/carbon/tooltip.h create mode 100644 include/wx/osx/carbon/toplevel.h create mode 100644 include/wx/osx/carbon/treectrl.h create mode 100644 include/wx/osx/carbon/uma.h create mode 100644 include/wx/osx/carbon/window.h create mode 100644 include/wx/osx/checkbox.h create mode 100644 include/wx/osx/checklst.h create mode 100644 include/wx/osx/chkconf.h create mode 100644 include/wx/osx/choice.h create mode 100644 include/wx/osx/clipbrd.h create mode 100644 include/wx/osx/colordlg.h create mode 100644 include/wx/osx/colour.h create mode 100644 include/wx/osx/combobox.h create mode 100644 include/wx/osx/config_xcode.h create mode 100644 include/wx/osx/control.h create mode 100644 include/wx/osx/core/cfdataref.h create mode 100644 include/wx/osx/core/cfref.h create mode 100644 include/wx/osx/core/cfstring.h create mode 100644 include/wx/osx/core/hid.h create mode 100644 include/wx/osx/core/joystick.h create mode 100644 include/wx/osx/core/private.h create mode 100644 include/wx/osx/core/private/strconv_cf.h create mode 100644 include/wx/osx/core/stdpaths.h create mode 100644 include/wx/osx/cursor.h create mode 100644 include/wx/osx/dataform.h create mode 100644 include/wx/osx/dataobj.h create mode 100644 include/wx/osx/dataobj2.h create mode 100644 include/wx/osx/dataview.h create mode 100644 include/wx/osx/dc.h create mode 100644 include/wx/osx/dcclient.h create mode 100644 include/wx/osx/dcmemory.h create mode 100644 include/wx/osx/dcprint.h create mode 100644 include/wx/osx/dcscreen.h create mode 100644 include/wx/osx/dialog.h create mode 100644 include/wx/osx/dirdlg.h create mode 100644 include/wx/osx/dnd.h create mode 100644 include/wx/osx/evtloop.h create mode 100644 include/wx/osx/filedlg.h create mode 100644 include/wx/osx/font.h create mode 100644 include/wx/osx/fontdlg.h create mode 100644 include/wx/osx/frame.h create mode 100644 include/wx/osx/gauge.h create mode 100644 include/wx/osx/glcanvas.h create mode 100644 include/wx/osx/helpxxxx.h create mode 100644 include/wx/osx/icon.h create mode 100644 include/wx/osx/imaglist.h create mode 100644 include/wx/osx/joystick.h create mode 100644 include/wx/osx/listbox.h create mode 100644 include/wx/osx/listctrl.h create mode 100644 include/wx/osx/mdi.h create mode 100644 include/wx/osx/menu.h create mode 100644 include/wx/osx/menuitem.h create mode 100644 include/wx/osx/metafile.h create mode 100644 include/wx/osx/mimetype.h create mode 100644 include/wx/osx/minifram.h create mode 100644 include/wx/osx/msgdlg.h create mode 100644 include/wx/osx/nonownedwnd.h create mode 100644 include/wx/osx/notebook.h create mode 100644 include/wx/osx/palette.h create mode 100644 include/wx/osx/pen.h create mode 100644 include/wx/osx/pnghand.h create mode 100644 include/wx/osx/pngread.h create mode 100644 include/wx/osx/popupwin.h create mode 100644 include/wx/osx/printdlg.h create mode 100644 include/wx/osx/printmac.h create mode 100644 include/wx/osx/private.h create mode 100644 include/wx/osx/private/print.h create mode 100644 include/wx/osx/private/timer.h create mode 100644 include/wx/osx/radiobox.h create mode 100644 include/wx/osx/radiobut.h create mode 100644 include/wx/osx/region.h create mode 100644 include/wx/osx/scrolbar.h create mode 100644 include/wx/osx/setup0.h create mode 100644 include/wx/osx/slider.h create mode 100644 include/wx/osx/sound.h create mode 100644 include/wx/osx/spinbutt.h create mode 100644 include/wx/osx/spinctrl.h create mode 100644 include/wx/osx/srchctrl.h create mode 100644 include/wx/osx/statbmp.h create mode 100644 include/wx/osx/statbox.h create mode 100644 include/wx/osx/statline.h create mode 100644 include/wx/osx/stattext.h create mode 100644 include/wx/osx/statusbr.h create mode 100644 include/wx/osx/tabctrl.h create mode 100644 include/wx/osx/taskbarosx.h create mode 100644 include/wx/osx/textctrl.h create mode 100644 include/wx/osx/tglbtn.h create mode 100644 include/wx/osx/toolbar.h create mode 100644 include/wx/osx/tooltip.h create mode 100644 include/wx/osx/toplevel.h create mode 100644 include/wx/osx/treectrl.h create mode 100644 include/wx/osx/uma.h create mode 100644 include/wx/osx/window.h diff --git a/include/wx/osx/accel.h b/include/wx/osx/accel.h new file mode 100644 index 0000000000..dcccf61a60 --- /dev/null +++ b/include/wx/osx/accel.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/accel.h" +#else +#include "wx/mac/carbon/accel.h" +#endif diff --git a/include/wx/osx/app.h b/include/wx/osx/app.h new file mode 100644 index 0000000000..9c011306b9 --- /dev/null +++ b/include/wx/osx/app.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/app.h" +#else +#include "wx/mac/carbon/app.h" +#endif diff --git a/include/wx/osx/bitmap.h b/include/wx/osx/bitmap.h new file mode 100644 index 0000000000..297b4b51d5 --- /dev/null +++ b/include/wx/osx/bitmap.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/bitmap.h" +#else +#include "wx/mac/carbon/bitmap.h" +#endif diff --git a/include/wx/osx/bmpbuttn.h b/include/wx/osx/bmpbuttn.h new file mode 100644 index 0000000000..216f13de50 --- /dev/null +++ b/include/wx/osx/bmpbuttn.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/bmpbuttn.h" +#else +#include "wx/mac/carbon/bmpbuttn.h" +#endif diff --git a/include/wx/osx/brush.h b/include/wx/osx/brush.h new file mode 100644 index 0000000000..e910b1fac7 --- /dev/null +++ b/include/wx/osx/brush.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/brush.h" +#else +#include "wx/mac/carbon/brush.h" +#endif diff --git a/include/wx/osx/button.h b/include/wx/osx/button.h new file mode 100644 index 0000000000..c6b02cfc91 --- /dev/null +++ b/include/wx/osx/button.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/button.h" +#else +#include "wx/mac/carbon/button.h" +#endif diff --git a/include/wx/osx/carbon/accel.h b/include/wx/osx/carbon/accel.h new file mode 100644 index 0000000000..5a81d61840 --- /dev/null +++ b/include/wx/osx/carbon/accel.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..66796866a4 --- /dev/null +++ b/include/wx/osx/carbon/app.h @@ -0,0 +1,135 @@ +///////////////////////////////////////////////////////////////////////////// +// 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; } + +#if wxUSE_GUI + // setting up all MacOS Specific Event-Handlers etc + virtual bool OnInitGui(); +#endif // wxUSE_GUI + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + + void MacDoOneEvent() ; + +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 + + 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 ; } + void MacHandleOneEvent( WXEVENTREF ev ) ; + + // 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 ) ; + 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) ; + + // 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 new file mode 100644 index 0000000000..5aa1ce31b3 --- /dev/null +++ b/include/wx/osx/carbon/bitmap.h @@ -0,0 +1,181 @@ +///////////////////////////////////////////////////////////////////////////// +// 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_TYPE_PICT_RESOURCE); + + // 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_TYPE_BMP_RESOURCE); + 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 ; + + // 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 new file mode 100644 index 0000000000..265d2757bd --- /dev/null +++ b/include/wx/osx/carbon/bmpbuttn.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/brush.h b/include/wx/osx/carbon/brush.h new file mode 100644 index 0000000000..0d4d1c5586 --- /dev/null +++ b/include/wx/osx/carbon/brush.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/brush.h +// Purpose: wxBrush class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +class WXDLLIMPEXP_FWD_CORE wxBrush; + +// Brush +class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase +{ +public: + wxBrush(); + wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID); +#if FUTURE_WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_FUTURE( wxBrush(const wxColour& col, int style) ); +#endif + wxBrush(const wxBitmap& stipple); + virtual ~wxBrush(); + + virtual void SetColour(const wxColour& col) ; + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ; + virtual void SetStyle(wxBrushStyle style) ; + virtual void SetStipple(const wxBitmap& stipple) ; + + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxColour GetColour() const; + wxBrushStyle GetStyle() const ; + wxBitmap *GetStipple() const ; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + DECLARE_DYNAMIC_CLASS(wxBrush) +}; + +#endif // _WX_BRUSH_H_ diff --git a/include/wx/osx/carbon/button.h b/include/wx/osx/carbon/button.h new file mode 100644 index 0000000000..1c3b4d01ae --- /dev/null +++ b/include/wx/osx/carbon/button.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// 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); + + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + static wxSize GetDefaultSize(); + + virtual wxWindow *SetDefault(); + virtual void Command(wxCommandEvent& event); + +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; + + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + +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 new file mode 100644 index 0000000000..981a66b7cc --- /dev/null +++ b/include/wx/osx/carbon/checkbox.h @@ -0,0 +1,81 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + virtual void Command(wxCommandEvent& event); + +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 new file mode 100644 index 0000000000..8be9e99c08 --- /dev/null +++ b/include/wx/osx/carbon/checklst.h @@ -0,0 +1,90 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 wxMacCheckListControl +{ +public : + virtual bool MacIsChecked(unsigned int n) const = 0; + virtual void MacCheck(unsigned int n, bool bCheck = true) = 0; + + virtual ~wxMacCheckListControl() { } +}; + +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); + + wxMacCheckListControl* GetPeer() const; + +protected: + void Init(); + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxCheckListBox) +}; + +#endif // _WX_MAC_CHECKLST_H_ diff --git a/include/wx/osx/carbon/chkconf.h b/include/wx/osx/carbon/chkconf.h new file mode 100644 index 0000000000..3fe681da34 --- /dev/null +++ b/include/wx/osx/carbon/chkconf.h @@ -0,0 +1,150 @@ +/* + * Name: wx/mac/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: Julian Smart + * Modified by: + * Created: 01/02/97 + * RCS-ID: $Id$ + * Copyright: (c) Julian Smart + * Licence: wxWindows licence + */ + +#ifndef _WX_MAC_CHKCONF_H_ +#define _WX_MAC_CHKCONF_H_ + +/* + * disable the settings which don't work for some compilers + */ + +#if defined(__MWERKS__) + #undef wxUSE_DEBUG_NEW_ALWAYS + #define wxUSE_DEBUG_NEW_ALWAYS 0 + + /* DS: Fixes compilation when wxUSE_ON_FATAL_EXCEPTION is 1 */ + #ifndef wxTYPE_SA_HANDLER + #define wxTYPE_SA_HANDLER int + #endif +#endif + +/* + * use OS X CoreGraphics (1) or QuickDraw (0) for rendering + */ + +#ifndef wxMAC_USE_CORE_GRAPHICS + #define wxMAC_USE_CORE_GRAPHICS 1 +#endif + +/* + * wxMAC_USE_CORE_GRAPHICS is now implemented in terms of wxUSE_GRAPHICS_CONTEXT + */ + +#if wxMAC_USE_CORE_GRAPHICS + #undef wxUSE_GRAPHICS_CONTEXT + #define wxUSE_GRAPHICS_CONTEXT 1 +#endif + +/* + * check graphics context option + */ +#if wxUSE_GRAPHICS_CONTEXT && !wxMAC_USE_CORE_GRAPHICS +# error "wxUSE_GRAPHICS_CONTEXT on wxMac requires wxMAC_USE_CORE_GRAPHICS" +#endif + +/* + * native (1) or emulated (0) toolbar + */ + +#ifndef wxMAC_USE_NATIVE_TOOLBAR + #define wxMAC_USE_NATIVE_TOOLBAR 1 +#endif + +/* + * using mixins of cocoa functionality + */ + +#ifndef wxMAC_USE_COCOA + #define wxMAC_USE_COCOA 0 +#endif + +/* + * setting flags according to the platform + */ + +#ifdef __LP64__ + #if wxMAC_USE_COCOA == 0 + #undef wxMAC_USE_COCOA + #define wxMAC_USE_COCOA 1 + #endif + #define wxMAC_USE_QUICKDRAW 0 + #define wxMAC_USE_CARBON 0 +#else + #ifdef __WXOSX_IPHONE__ + #define wxMAC_USE_QUICKDRAW 0 + #define wxMAC_USE_CARBON 0 + #else + #define wxMAC_USE_QUICKDRAW 1 + #define wxMAC_USE_CARBON 1 + #endif +#endif + +/* + * text rendering system + */ + +/* we have different options and we turn on all that make sense + * under a certain platform + */ + +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + +#ifdef __WXOSX_IPHONE__ +#define wxMAC_USE_CG_TEXT 1 +#define wxMAC_USE_CORE_TEXT 0 +#define wxMAC_USE_ATSU_TEXT 0 +#else +#define wxMAC_USE_CORE_TEXT 1 +#define wxMAC_USE_ATSU_TEXT 0 +#define wxMAC_USE_CG_TEXT 0 +#endif + +#else // platform < 10.5 + +#define wxMAC_USE_CG_TEXT 0 + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 +#define wxMAC_USE_CORE_TEXT 1 +#else +#define wxMAC_USE_CORE_TEXT 0 +#endif +#define wxMAC_USE_ATSU_TEXT 1 + +#endif + +/* + * turning off capabilities that don't work under 64 bit yet + */ + +#ifdef __LP64__ + +#if wxUSE_DRAG_AND_DROP +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 +#endif + +#if wxUSE_TASKBARICON +#undef wxUSE_TASKBARICON +#define wxUSE_TASKBARICON 0 +#endif + +#if wxUSE_TOOLTIPS +#undef wxUSE_TOOLTIPS +#define wxUSE_TOOLTIPS 0 +#endif + + +#endif + + +#endif + /* _WX_MAC_CHKCONF_H_ */ + diff --git a/include/wx/osx/carbon/choice.h b/include/wx/osx/carbon/choice.h new file mode 100644 index 0000000000..c73a831069 --- /dev/null +++ b/include/wx/osx/carbon/choice.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// 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(), m_macPopUpMenuHandle(NULL) + {} + + virtual ~wxChoice() ; + + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + 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); + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + +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 ; + WXHMENU m_macPopUpMenuHandle ; +}; + +#endif + // _WX_CHOICE_H_ diff --git a/include/wx/osx/carbon/clipbrd.h b/include/wx/osx/carbon/clipbrd.h new file mode 100644 index 0000000000..973530ad29 --- /dev/null +++ b/include/wx/osx/carbon/clipbrd.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/mac/corefoundation/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 new file mode 100644 index 0000000000..219e1b4e19 --- /dev/null +++ b/include/wx/osx/carbon/colordlg.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/colour.h b/include/wx/osx/carbon/colour.h new file mode 100644 index 0000000000..9b1d6129d5 --- /dev/null +++ b/include/wx/osx/carbon/colour.h @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/colour.h +// Purpose: wxColour class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#include "wx/object.h" +#include "wx/string.h" + +#include "wx/mac/corefoundation/cfref.h" + +struct RGBColor; + +// Colour +class WXDLLIMPEXP_CORE wxColour: public wxColourBase +{ +public: + // constructors + // ------------ + DEFINE_STD_WXCOLOUR_CONSTRUCTORS + + // default copy ctor and dtor are ok + + // accessors + virtual bool IsOk() const { return m_cgColour; } + + ChannelType Red() const { return m_red; } + ChannelType Green() const { return m_green; } + ChannelType Blue() const { return m_blue; } + ChannelType Alpha() const { return m_alpha; } + + // comparison + bool operator == (const wxColour& colour) const; + + bool operator != (const wxColour& colour) const { return !(*this == colour); } + + CGColorRef GetPixel() const { return m_cgColour; }; + + CGColorRef GetCGColor() const { return m_cgColour; }; + CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; + +#if wxMAC_USE_QUICKDRAW + void GetRGBColor( RGBColor *col ) const; +#endif + + // Mac-specific ctor and assignment operator from the native colour + // assumes ownership of CGColorRef + wxColour( CGColorRef col ); +#if wxMAC_USE_QUICKDRAW + wxColour(const RGBColor& col); + wxColour& operator=(const RGBColor& col); +#endif + wxColour& operator=(CGColorRef col); + wxColour& operator=(const wxColour& col); + +protected : + virtual void + InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); +#if wxMAC_USE_QUICKDRAW + void InitRGBColor( const RGBColor& col ); +#endif + void InitCGColorRef( CGColorRef col ); +private: + wxCFRef m_cgColour; + + ChannelType m_red; + ChannelType m_blue; + ChannelType m_green; + ChannelType m_alpha; + + DECLARE_DYNAMIC_CLASS(wxColour) +}; + +#endif + // _WX_COLOUR_H_ diff --git a/include/wx/osx/carbon/combobox.h b/include/wx/osx/carbon/combobox.h new file mode 100644 index 0000000000..f8ff5bd4e5 --- /dev/null +++ b/include/wx/osx/carbon/combobox.h @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////////// +// 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; + + wxInt32 MacControlHit( WXEVENTHANDLERREF handler, WXEVENTREF event ); + + 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 new file mode 100644 index 0000000000..8d7f2652c3 --- /dev/null +++ b/include/wx/osx/carbon/control.h @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..9a7b05715a --- /dev/null +++ b/include/wx/osx/carbon/cursor.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL); + + wxCursor(const wxImage & image) ; + wxCursor(const char* const* bits); + wxCursor(const wxString& name, + wxBitmapType flags = wxBITMAP_TYPE_MACCURSOR_RESOURCE, + int hotSpotX = 0, int hotSpotY = 0); + + wxCursor(int cursor_type); + virtual ~wxCursor(); + + bool CreateFromXpm(const char* const* bits); + + void MacInstall() const ; + + void SetHCURSOR(WXHCURSOR cursor); + WXHCURSOR GetHCURSOR() const; + +private: + 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/databrow.h b/include/wx/osx/carbon/databrow.h new file mode 100644 index 0000000000..487388b4df --- /dev/null +++ b/include/wx/osx/carbon/databrow.h @@ -0,0 +1,285 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/mac/carbon/databrow.h +// Purpose: Classes and functions for the Carbon data browser +// Author: +// Modified by: +// Created: 2007-05-18 +// RCS-ID: $Id$ +// Copyright: (c) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DATABROW_H_ +#define _WX_DATABROW_H_ + +#include "wx/defs.h" + +#if wxUSE_GUI + +#include "wx/mac/private.h" + +WX_DEFINE_ARRAY_SIZE_T(size_t,wxArrayDataBrowserItemID); + +// ============================================================================ +// wxMacDataBrowserTableViewControl +// ============================================================================ +// +// this is a wrapper class for the Mac OS X data browser environment, +// it covers all general data brower functionality, +// + +// data browser's property IDs have a reserved ID range from 0 - 1023 +// therefore, the first usable property ID is 'kMinPropertyID' +DataBrowserPropertyID const kMinPropertyID = 1024; + +class wxMacDataBrowserTableViewControl : public wxMacControl +{ +public: +// +// constructors / destructor +// + wxMacDataBrowserTableViewControl(wxWindow* peer, const wxPoint& pos, const wxSize& size, long style); + wxMacDataBrowserTableViewControl(void) + { + } + +// +// callback handling +// + OSStatus SetCallbacks (DataBrowserCallbacks const* callbacks); + OSStatus SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks); + +// +// header handling +// + OSStatus GetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc) const; + + OSStatus SetHeaderDesc(DataBrowserPropertyID property, DataBrowserListViewHeaderDesc* desc); + +// +// layout handling +// + OSStatus AutoSizeColumns(); + + OSStatus EnableCellSizeModification(bool enableHeight=true, bool enableWidth=true); // enables or disables the column width and row height modification (default: false) + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + OSStatus GetAttributes (OptionBits* attributes); +#endif + OSStatus GetColumnWidth (DataBrowserPropertyID column, UInt16 *width ) const; // returns the column width in pixels + OSStatus GetDefaultColumnWidth(UInt16 *width ) const; // returns the default column width in pixels + OSStatus GetDefaultRowHeight (UInt16 * height ) const; + OSStatus GetHeaderButtonHeight(UInt16 *height ); + OSStatus GetPartBounds (DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserPropertyPart part, Rect* bounds); + OSStatus GetRowHeight (DataBrowserItemID item , UInt16 *height) const; + OSStatus GetScrollPosition (UInt32* top, UInt32 *left) const; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + OSStatus SetAttributes (OptionBits attributes); +#endif + OSStatus SetColumnWidth(DataBrowserPropertyID column, UInt16 width); // sets the column width in pixels + OSStatus SetDefaultColumnWidth( UInt16 width ); + OSStatus SetDefaultRowHeight( UInt16 height ); + OSStatus SetHasScrollBars( bool horiz, bool vert ); + OSStatus SetHeaderButtonHeight( UInt16 height ); + OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ); + OSStatus SetIndent(float Indent); + OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height); + OSStatus SetScrollPosition( UInt32 top , UInt32 left ); + +// +// column handling +// + OSStatus GetColumnCount (UInt32* numColumns) const; + OSStatus GetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const; // returns for the passed property the corresponding column index + OSStatus GetFreePropertyID(DataBrowserPropertyID* propertyID) const; // this method returns a property id that is valid and currently not used; if it cannot be found 'errDataBrowerPropertyNotSupported' is returned + OSStatus GetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags ) const; + OSStatus GetPropertyID (DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID); // returns for the passed item data reference the corresponding property ID + OSStatus GetPropertyID (DataBrowserTableViewColumnIndex index, DataBrowserPropertyID* propertyID); // returns for the passed column index the corresponding property ID + + OSStatus IsUsedPropertyID(DataBrowserPropertyID propertyID) const; // checks if passed property id is used by the control; no error is returned if the id exists + + OSStatus RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID); + OSStatus RemoveColumnByIndex (DataBrowserTableViewColumnIndex index); + + OSStatus SetColumnIndex (DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index); + OSStatus SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows=false); + OSStatus SetPropertyFlags (DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags); + +// +// item handling +// + OSStatus AddItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // adds a single item + { + return this->AddItems(container,1,itemID,kDataBrowserItemNoProperty); + } + OSStatus AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); // adds items to the data browser + + OSStatus GetFreeItemID(DataBrowserItemID* id) const; // this method returns an item id that is valid and currently not used; if it cannot be found 'errDataBrowserItemNotAdded' is returned + OSStatus GetItemCount (ItemCount* numItems) const + { + return this->GetItemCount(kDataBrowserNoItem,true,kDataBrowserItemAnyState,numItems); + } + OSStatus GetItemCount (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const; + OSStatus GetItemID (DataBrowserTableViewRowIndex row, DataBrowserItemID* item) const; + OSStatus GetItems (DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const; + OSStatus GetItemRow (DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const; + + OSStatus IsUsedItemID(DataBrowserItemID itemID) const; // checks if the passed id is in use + + OSStatus RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const; + + OSStatus RemoveItem(DataBrowserItemID container, DataBrowserItemID const* itemID) // removes a single item + { + return this->RemoveItems(container,1,itemID,kDataBrowserItemNoProperty); + } + OSStatus RemoveItems(void) // removes all items + { + return this->RemoveItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty); + } + OSStatus RemoveItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty); + + OSStatus UpdateItems(void) // updates all items + { + return this->UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); + } + OSStatus UpdateItems(DataBrowserItemID const* item) // updates all columns of item + { + return this->UpdateItems(kDataBrowserNoItem,1,item,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty); + } + OSStatus UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const; + +// +// item selection +// + size_t GetSelectedItemIDs(wxArrayDataBrowserItemID& itemIDs) const; // returns the number of selected item and the item IDs in the array + OSStatus GetSelectionAnchor(DataBrowserItemID *first, DataBrowserItemID *last) const; + OSStatus GetSelectionFlags (DataBrowserSelectionFlags* flags) const; + + bool IsItemSelected(DataBrowserItemID item) const; + + OSStatus SetSelectionFlags(DataBrowserSelectionFlags flags); + OSStatus SetSelectedItems (UInt32 numItems, DataBrowserItemID const* itemIDs, DataBrowserSetOption operation); + +// +// item sorting +// + OSStatus GetSortOrder (DataBrowserSortOrder* order) const; + OSStatus GetSortProperty(DataBrowserPropertyID* propertyID) const; + + OSStatus Resort(DataBrowserItemID container=kDataBrowserNoItem, Boolean sortChildren=true); + + OSStatus SetSortOrder (DataBrowserSortOrder order); + OSStatus SetSortProperty(DataBrowserPropertyID propertyID); + +// +// container handling +// + OSStatus CloseContainer(DataBrowserItemID containerID); + + OSStatus OpenContainer(DataBrowserItemID containerID); + +protected : +// +// standard callback functions +// + static pascal Boolean DataBrowserCompareProc (ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); + static pascal void DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); + static pascal OSStatus DataBrowserGetSetItemDataProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue); + static pascal void DataBrowserItemNotificationProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); + + virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) = 0; + virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) = 0; + virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean getValue) = 0; + virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) = 0; + +// +// callback functions for customized types +// + static pascal void DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); + static pascal Boolean DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); + static pascal Boolean DataBrowserHitTestProc (ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); + static pascal DataBrowserTrackingResult DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); + + virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) = 0; + virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) = 0; + virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) = 0; + virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) = 0; + +private: +// +// wxWidget internal stuff +// + DECLARE_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl) +}; + +// ============================================================================ +// wxMacDataBrowserListViewControl +// ============================================================================ +// +// this class is a wrapper for a list view which incorporates all general +// data browser functionality of the inherited table view control class; +// the term list view is in this case Mac OS X specific and is not related +// to any wxWidget naming conventions +// +class wxMacDataBrowserListViewControl : public wxMacDataBrowserTableViewControl +{ +public: +// +// constructors / destructor +// + wxMacDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) : wxMacDataBrowserTableViewControl(peer,pos,size,style) + { + } + +// +// column handling +// + OSStatus AddColumn(DataBrowserListViewColumnDesc *columnDesc, DataBrowserTableViewColumnIndex position); + +protected: +private: +}; + + +// ============================================================================ +// wxMacDataViewDataBrowserListViewControl +// ============================================================================ +// +// internal interface class between wxDataViewCtrl (wxWidget) and the data +// browser (Mac OS X) +// +class wxMacDataViewDataBrowserListViewControl : public wxMacDataBrowserListViewControl +{ +public: +// +// constructors / destructor +// + wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style); + +protected: +// +// standard callback functions (inherited from wxMacDataBrowserTableViewControl) +// + virtual Boolean DataBrowserCompareProc (DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty); + virtual void DataBrowserItemNotificationProc (DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData); + virtual void DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection); + virtual OSStatus DataBrowserGetSetItemDataProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue); + +// +// callback functions for customized types (inherited from wxMacDataBrowserTableViewControl) +// + virtual void DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice); + virtual Boolean DataBrowserEditItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit); + virtual Boolean DataBrowserHitTestProc (DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect); + virtual DataBrowserTrackingResult DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers); + +private: +}; + +typedef wxMacDataViewDataBrowserListViewControl* wxMacDataViewDataBrowserListViewControlPointer; + + +#endif // WX_GUI + +#endif // _WX_DATABROW_H_ diff --git a/include/wx/osx/carbon/dataform.h b/include/wx/osx/carbon/dataform.h new file mode 100644 index 0000000000..910dfc5fef --- /dev/null +++ b/include/wx/osx/carbon/dataform.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..4b027bfe13 --- /dev/null +++ b/include/wx/osx/carbon/dataobj.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..8caa5b4e6d --- /dev/null +++ b/include/wx/osx/carbon/dataobj2.h @@ -0,0 +1,94 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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/dataview.h b/include/wx/osx/carbon/dataview.h new file mode 100644 index 0000000000..9c5aa166eb --- /dev/null +++ b/include/wx/osx/carbon/dataview.h @@ -0,0 +1,630 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/dataview.h +// Purpose: wxDataViewCtrl native implementation header +// Author: +// Id: $Id$ +// Copyright: (c) 2007 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MACCARBONDATAVIEWCTRL_H_ +#define _WX_MACCARBONDATAVIEWCTRL_H_ + +// -------------------------------------------------------- +// Type definitions to mask native types +// -------------------------------------------------------- + +typedef void* WXDataBrowserItemDataRef; +typedef unsigned long WXDataBrowserPropertyType; +typedef wxUint32 WXDataBrowserPropertyID; + +// --------------------------------------------------------- +// wxDataViewRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewRenderer : public wxDataViewRendererBase +{ +public: +// +// constructors / destructor +// + wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited methods from wxDataViewRendererBase +// + virtual int GetAlignment() const + { + return this->m_alignment; + } + virtual wxDataViewCellMode GetMode() const + { + return this->m_mode; + } + virtual bool GetValue(wxVariant& value) const + { + value = this->m_value; + return true; + } + + virtual void SetAlignment(int WXUNUSED(align)) // is always identical to the header alignment + { + } + virtual void SetMode(wxDataViewCellMode mode); + virtual bool SetValue(wxVariant const& newValue) + { + this->m_value = newValue; + return true; + } + +// +// implementation +// + WXDataBrowserItemDataRef GetDataReference() const + { + return this->m_dataReference; + } + wxVariant const& GetValue() const + { + return this->m_value; + } + + virtual WXDataBrowserPropertyType GetPropertyType() const = 0; + + virtual bool Render() = 0; // a call to the appropriate data browser function filling the data reference with the stored datum; + // returns 'true' if the data value could be rendered, 'false' otherwise + + void SetDataReference(WXDataBrowserItemDataRef const& newDataReference) + { + this->m_dataReference = newDataReference; + } + +private: +// +// variables +// + WXDataBrowserItemDataRef m_dataReference; // data reference of the data browser; the data will be assigned to this reference during rendering + + int m_alignment; // contains the alignment flags + + wxDataViewCellMode m_mode; // storing the mode that determines how the cell is going to be shown + + wxVariant m_value; // value that is going to be rendered + +// +// wxWidget internal stuff +// + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewCustomRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer +{ +public: +// +// constructors / destructor +// + wxDataViewCustomRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + + virtual ~wxDataViewCustomRenderer(); + + void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state ); + +// +// methods handling render space +// + virtual wxSize GetSize() const = 0; + +// +// methods handling user actions +// + virtual bool Render(wxRect cell, wxDC* dc, int state) = 0; + + virtual bool Activate( wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col) ) + { return false; } + + virtual bool LeftClick( wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col) ) + { return false; } + + virtual bool StartDrag( wxPoint WXUNUSED(cursor), + wxRect WXUNUSED(cell), + wxDataViewModel *WXUNUSED(model), + const wxDataViewItem & WXUNUSED(item), + unsigned int WXUNUSED(col) ) + { return false; } + +// +// device context handling +// + virtual wxDC* GetDC(); // creates a device context and keeps it + +// +// implementation +// + virtual bool Render(); // declared in wxDataViewRenderer but will not be used here, therefore calling this function will + // return 'true' without having done anything + + virtual WXDataBrowserPropertyType GetPropertyType() const; + + void SetDC(wxDC* newDCPtr); // this method takes ownership of the pointer + +protected: +private: +// +// variables +// + wxControl* m_editorCtrlPtr; // pointer to an in-place editor control + + wxDC* m_DCPtr; + +// +// wxWidget internal stuff +// + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewTextRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer +{ +public: +// +// constructors / destructor +// + wxDataViewTextRenderer(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited functions from wxDataViewRenderer +// + virtual bool Render(); + +// +// implementation +// + virtual WXDataBrowserPropertyType GetPropertyType() const; + +protected: +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewTextRendererAttr +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewTextRendererAttr: public wxDataViewTextRenderer +{ +public: +// +// constructors / destructor +// + wxDataViewTextRendererAttr(wxString const& varianttype=wxT("string"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRendererAttr) +}; + +// --------------------------------------------------------- +// wxDataViewBitmapRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer +{ +public: +// +// constructors / destructor +// + wxDataViewBitmapRenderer(wxString const& varianttype=wxT("wxBitmap"), wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited functions from wxDataViewRenderer +// + virtual bool Render(); + +// +// implementation +// + virtual WXDataBrowserPropertyType GetPropertyType() const; + +protected: +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewRenderer +{ +public: + wxDataViewIconTextRenderer(wxString const& varianttype = wxT("wxDataViewIconText"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited functions from wxDataViewRenderer +// + virtual bool Render(); + +// +// implementation +// + virtual WXDataBrowserPropertyType GetPropertyType() const; + +protected: +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewToggleRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer +{ +public: + wxDataViewToggleRenderer(wxString const& varianttype = wxT("bool"), wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited functions from wxDataViewRenderer +// + virtual bool Render(); + +// +// implementation +// + virtual WXDataBrowserPropertyType GetPropertyType() const; + +protected: +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewProgressRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewRenderer +{ +public: + wxDataViewProgressRenderer(wxString const& label = wxEmptyString, wxString const& varianttype=wxT("long"), + wxDataViewCellMode mode=wxDATAVIEW_CELL_INERT, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited functions from wxDataViewRenderer +// + virtual bool Render(); + +// +// implementation +// + virtual WXDataBrowserPropertyType GetPropertyType() const; + +protected: +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewDateRenderer +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer +{ +public: + wxDataViewDateRenderer(wxString const& varianttype=wxT("datetime"), wxDataViewCellMode mode=wxDATAVIEW_CELL_ACTIVATABLE, int align=wxDVR_DEFAULT_ALIGNMENT); + +// +// inherited functions from wxDataViewRenderer +// + virtual bool Render(); + +// +// implementation +// + virtual WXDataBrowserPropertyType GetPropertyType() const; + +protected: +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer) +}; + +// --------------------------------------------------------- +// wxDataViewColumn +// --------------------------------------------------------- + +class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase +{ +public: +// +// constructors / destructor +// + wxDataViewColumn(wxString const& title, wxDataViewRenderer* renderer, unsigned int model_column, int width=80, wxAlignment align=wxALIGN_CENTER, + int flags=wxDATAVIEW_COL_RESIZABLE); + wxDataViewColumn(wxBitmap const& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width=80, wxAlignment align=wxALIGN_CENTER, + int flags=wxDATAVIEW_COL_RESIZABLE); + +// +// inherited methods from wxDataViewColumnBase +// + virtual wxAlignment GetAlignment() const + { + return this->m_alignment; + } + virtual int GetFlags() const + { + return this->m_flags; + } + virtual int GetMaxWidth() const + { + return this->m_maxWidth; + } + virtual int GetMinWidth() const + { + return this->m_minWidth; + } + virtual wxString GetTitle() const + { + return this->m_title; + } + virtual int GetWidth() const + { + return this->m_width; + } + + virtual bool IsHidden() const + { + return false; // not implemented + } + virtual bool IsReorderable() const + { + return ((this->m_flags & wxDATAVIEW_COL_REORDERABLE) != 0); + } + virtual bool IsResizeable() const + { + return ((this->m_flags & wxDATAVIEW_COL_RESIZABLE) != 0); + } + virtual bool IsSortable() const + { + return ((this->m_flags & wxDATAVIEW_COL_SORTABLE) != 0); + } + virtual bool IsSortOrderAscending() const + { + return this->m_ascending; + } + + virtual void SetAlignment(wxAlignment align); + virtual void SetBitmap (wxBitmap const& bitmap); + virtual void SetFlags (int flags); + virtual void SetHidden(bool WXUNUSED(hidden)) + { + } + virtual void SetMaxWidth (int maxWidth); + virtual void SetMinWidth (int minWidth); + virtual void SetReorderable(bool reorderable); + virtual void SetResizeable (bool resizeable); + virtual void SetSortable (bool sortable); + virtual void SetSortOrder (bool ascending); + virtual void SetTitle (wxString const& title); + virtual void SetWidth (int width); + +// +// implementation +// + WXDataBrowserPropertyID GetPropertyID() const + { + return this->m_propertyID; + } + + void SetPropertyID(WXDataBrowserPropertyID newID) + { + this->m_propertyID = newID; + } + void SetWidthVariable(int NewWidth) + { + this->m_width = NewWidth; + } + +protected: +private: +// +// variables +// + bool m_ascending; // sorting order + + WXDataBrowserPropertyID m_propertyID; // each column is identified by its unique property ID (NOT by the column index) + + int m_flags; // flags for the column + int m_maxWidth; // maximum width for the column + int m_minWidth; // minimum width for the column + int m_width; // column width + + wxAlignment m_alignment; // column header alignment + + wxString m_title; // column title + + // wxWidget internal stuff: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) +}; + +// --------------------------------------------------------- +// wxDataViewCtrl +// --------------------------------------------------------- +class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase +{ +public: + // Constructors / destructor: + wxDataViewCtrl() + { + this->Init(); + } + wxDataViewCtrl(wxWindow *parent, wxWindowID id, wxPoint const& pos = wxDefaultPosition, wxSize const& size = wxDefaultSize, long style = 0, + wxValidator const& validator = wxDefaultValidator) + { + this->Init(); + this->Create(parent, id, pos, size, style, validator ); + } + + ~wxDataViewCtrl(); + + // explicit control creation + bool Create(wxWindow *parent, wxWindowID id, wxPoint const& pos=wxDefaultPosition, wxSize const& size=wxDefaultSize, long style=0, + wxValidator const& validator=wxDefaultValidator); + + virtual wxControl* GetMainWindow() // should disappear as it is not of any use for the native implementation + { + return this; + } + + // inherited methods from 'wxDataViewCtrlBase': + virtual bool AssociateModel(wxDataViewModel* model); + + virtual bool AppendColumn(wxDataViewColumn* columnPtr); + virtual bool PrependColumn(wxDataViewColumn* columnPtr); + virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ); + + virtual bool ClearColumns(); + virtual bool DeleteColumn(wxDataViewColumn* columnPtr); + virtual wxDataViewColumn* GetColumn(unsigned int pos) const; + virtual unsigned int GetColumnCount() const; + virtual int GetColumnPosition(wxDataViewColumn const* columnPtr) const; + + virtual void Collapse(wxDataViewItem const& item); + virtual void EnsureVisible(wxDataViewItem const& item, wxDataViewColumn const* columnPtr=NULL); + virtual void Expand(wxDataViewItem const& item); + + virtual wxDataViewColumn* GetSortingColumn() const; + + virtual unsigned int GetCount() const; + virtual wxRect GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const; + virtual wxDataViewItem GetSelection() const; + virtual int GetSelections(wxDataViewItemArray& sel) const; + + virtual void HitTest(wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const; + + virtual bool IsSelected(wxDataViewItem const& item) const; + + virtual void SelectAll(); + virtual void Select(wxDataViewItem const& item); + virtual void SetSelections(wxDataViewItemArray const& sel); + + virtual void Unselect(wxDataViewItem const& item); + virtual void UnselectAll(); + +// +// implementation +// + + // adds all children of the passed parent to the control; if 'parentItem' is invalid the root(s) is/are added: + void AddChildrenLevel(wxDataViewItem const& parentItem); + + // finishes editing of custom items; if no custom item is currently edited the method does nothing + void FinishCustomItemEditing(); + + // returns a pointer to a column; + // in case the pointer cannot be found NULL is returned: + wxDataViewColumn* GetColumnPtr(WXDataBrowserPropertyID propertyID) const; + // returns the current being rendered item of the customized renderer (this item is only valid during editing) + wxDataViewItem const& GetCustomRendererItem() const + { + return this->m_CustomRendererItem; + } + // returns a pointer to a customized renderer (this pointer is only valid during editing) + wxDataViewCustomRenderer* GetCustomRendererPtr() const + { + return this->m_CustomRendererPtr; + } + + // checks if currently a delete process is running: + bool IsDeleting() const + { + return this->m_Deleting; + } + + // 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) + { + this->m_cgContext = context; + } + void* MacGetDrawingContext() const + { + return this->m_cgContext; + } + + // sets the currently being edited item of the custom renderer + void SetCustomRendererItem(wxDataViewItem const& NewItem) + { + this->m_CustomRendererItem = NewItem; + } + // sets the custom renderer + void SetCustomRendererPtr(wxDataViewCustomRenderer* NewCustomRendererPtr) + { + this->m_CustomRendererPtr = NewCustomRendererPtr; + } + // sets the flag indicating a deletion process: + void SetDeleting(bool deleting) + { + this->m_Deleting = deleting; + } + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + +protected: + // inherited methods from wxDataViewCtrlBase: + virtual void DoSetExpanderColumn(); + virtual void DoSetIndent(); + + // event handling: + void OnSize(wxSizeEvent &event); + +private: + // type definitions: + WX_DECLARE_HASH_MAP(WXDataBrowserPropertyID,wxDataViewColumn*,wxIntegerHash,wxIntegerEqual,ColumnPointerHashMapType); + + // initializing of local variables: + void Init(); + +/// +// variables +// + + bool m_Deleting; // flag indicating if a delete process is running; this flag is necessary because the notifier indicating an item deletion in the model may be called + // after the actual deletion of the item; then, the callback function "wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc" may + // try to update data into variables that are already deleted; this flag will ignore all variable update requests during item deletion + + void* m_cgContext; // pointer to core graphics context + + wxDataViewCustomRenderer* m_CustomRendererPtr; // pointer to a valid custom renderer while editing; this class does NOT own the pointer + + wxDataViewItem m_CustomRendererItem; // currently edited item by the customerenderer; it is invalid while not editing + + ColumnPointerHashMapType m_ColumnPointers; // all column pointers are stored in a hash map with the property ID as a key + + // wxWidget internal stuff: + DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) + DECLARE_NO_COPY_CLASS(wxDataViewCtrl) + DECLARE_EVENT_TABLE() +}; + + +#endif // _WX_MACCARBONDATAVIEWCTRL_H_ diff --git a/include/wx/osx/carbon/dc.h b/include/wx/osx/carbon/dc.h new file mode 100644 index 0000000000..1e66662f2c --- /dev/null +++ b/include/wx/osx/carbon/dc.h @@ -0,0 +1,15 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..fa518275f1 --- /dev/null +++ b/include/wx/osx/carbon/dcclient.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..c42c6544e7 --- /dev/null +++ b/include/wx/osx/carbon/dcmemory.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/mac/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 new file mode 100644 index 0000000000..1e64559a2d --- /dev/null +++ b/include/wx/osx/carbon/dcprint.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// 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(); + + 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 new file mode 100644 index 0000000000..a97d66554e --- /dev/null +++ b/include/wx/osx/carbon/dcscreen.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/mac/carbon/dcclient.h" + +class WXDLLIMPEXP_CORE wxScreenDCImpl: public wxWindowDCImpl +{ +public: + wxScreenDCImpl( wxDC *owner ); + virtual ~wxScreenDCImpl(); + +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 new file mode 100644 index 0000000000..351f6b8aee --- /dev/null +++ b/include/wx/osx/carbon/dialog.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..8e7761505d --- /dev/null +++ b/include/wx/osx/carbon/dirdlg.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..2f0b8d48ef --- /dev/null +++ b/include/wx/osx/carbon/dnd.h @@ -0,0 +1,108 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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/drawer.h b/include/wx/osx/carbon/drawer.h new file mode 100644 index 0000000000..ea9b70b15a --- /dev/null +++ b/include/wx/osx/carbon/drawer.h @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/drawer.h +// Purpose: Drawer child window class. +// Drawer windows appear under their parent window and +// behave like a drawer, opening and closing to reveal +// content that does not need to be visible at all times. +// Author: Jason Bagley +// Modified by: +// Created: 2004-30-01 +// RCS-ID: $Id$ +// Copyright: (c) Jason Bagley; Art & Logic, Inc. +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAWERWINDOW_H_ +#define _WX_DRAWERWINDOW_H_ + +#include "wx/toplevel.h" + +// +// NB: This is currently a private undocumented class - +// it is stable, but the API is not and will change in the +// near future +// + +#if ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) + +class WXDLLIMPEXP_ADV wxDrawerWindow : public wxTopLevelWindow +{ + DECLARE_DYNAMIC_CLASS(wxDrawerWindow) + +public: + + wxDrawerWindow(); + + wxDrawerWindow(wxWindow* parent, + wxWindowID id, + const wxString& title, + wxSize size = wxDefaultSize, + wxDirection edge = wxLEFT, + const wxString& name = wxT("drawerwindow")) + { + this->Create(parent, id, title, size, edge, name); + } + + virtual ~wxDrawerWindow(); + + // Create a drawer window. + // If parent is NULL, create as a tool window. + // If parent is not NULL, then wxTopLevelWindow::Attach this window to parent. + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + wxSize size = wxDefaultSize, + wxDirection edge = wxLEFT, + const wxString& name = wxFrameNameStr); + + bool Open(bool show = true); // open or close the drawer, possibility for async param, i.e. animate + bool Close() { return this->Open(false); } + bool IsOpen() const; + + // Set the edge of the parent where the drawer attaches. + bool SetPreferredEdge(wxDirection edge); + wxDirection GetPreferredEdge() const; + wxDirection GetCurrentEdge() const; // not necessarily the preferred, due to screen constraints +}; + +#endif // defined( __WXMAC__ ) && TARGET_API_MAC_OSX && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) + +#endif + // _WX_DRAWERWINDOW_H_ diff --git a/include/wx/osx/carbon/evtloop.h b/include/wx/osx/carbon/evtloop.h new file mode 100644 index 0000000000..5cf323876d --- /dev/null +++ b/include/wx/osx/carbon/evtloop.h @@ -0,0 +1,64 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/evtloop.h +// Purpose: declaration of wxEventLoop for wxMac +// Author: Vadim Zeitlin +// Modified by: +// Created: 2006-01-12 +// RCS-ID: $Id$ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_CARBON_EVTLOOP_H_ +#define _WX_MAC_CARBON_EVTLOOP_H_ + +// set wxMAC_USE_RUN_APP_EVENT_LOOP to 1 if the standard +// RunApplicationEventLoop function should be used, otherwise +// the lower level CarbonEventLoop will be used +// +// in the long run we should make this 1 by default but we will have to clean +// up event handling to make sure we don't miss handling of things like pending +// events etc and perhaps we will also have to pipe events through an +// ueber-event-handler to make sure we have one place to do all these +// house-keeping functions +#define wxMAC_USE_RUN_APP_EVENT_LOOP 0 + +// ---------------------------------------------------------------------------- +// wxEventLoop +// ---------------------------------------------------------------------------- + +#if wxMAC_USE_RUN_APP_EVENT_LOOP + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase +{ +public: + wxGUIEventLoop() { m_exitcode = 0; } + + // implement base class pure virtuals + virtual int Run(); + virtual void Exit(int rc = 0); + virtual bool Pending() const; + virtual bool Dispatch(); + +private: + int m_exitcode; +}; + +#else // manual event loop + +class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopManual +{ +public: + wxGUIEventLoop() { } + + virtual bool Pending() const; + virtual bool Dispatch(); + + // implement base class pure virtual + virtual void WakeUp(); +}; + +#endif // auto/manual event loop + +#endif // _WX_MAC_CARBON_EVTLOOP_H_ + diff --git a/include/wx/osx/carbon/filedlg.h b/include/wx/osx/carbon/filedlg.h new file mode 100644 index 0000000000..cd2d7c9111 --- /dev/null +++ b/include/wx/osx/carbon/filedlg.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..3962e4b287 --- /dev/null +++ b/include/wx/osx/carbon/font.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// 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() { } + + wxFont(int size, + int family, + int style, + int weight, + bool underlined = FALSE, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + (void)Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxNativeFontInfo& info) + { + (void)Create(info); + } + + wxFont(const wxString& fontDesc); + + bool Create(int size, + int family, + int style, + int weight, + bool underlined = FALSE, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + bool Create(const wxNativeFontInfo& info); + + bool MacCreateFromThemeFont( wxUint16 themeFontID ) ; +#if wxMAC_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 int GetFamily() const; + virtual int GetStyle() const; + virtual int GetWeight() const; + virtual bool GetUnderlined() const; + virtual wxString GetFaceName() const; + virtual wxFontEncoding GetEncoding() const; + virtual const wxNativeFontInfo *GetNativeFontInfo() const; + + virtual void SetPointSize(int pointSize); + virtual void SetFamily(int family); + virtual void SetStyle(int style); + virtual void SetWeight(int weight); + virtual bool SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + // implementation only from now on + // ------------------------------- + + virtual bool RealizeResource(); + + // Unofficial API, don't use + virtual void SetNoAntiAliasing( bool noAA = TRUE ) ; + virtual bool GetNoAntiAliasing() const ; + + // Mac-specific, risks to change, don't use in portable code + +#if wxMAC_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 wxMAC_USE_CORE_TEXT + const void * MacGetCTFont() const; + const void * MacGetCTFontDescriptor() const; +#endif +#if wxMAC_USE_CORE_TEXT || wxMAC_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 new file mode 100644 index 0000000000..48af50e871 --- /dev/null +++ b/include/wx/osx/carbon/fontdlg.h @@ -0,0 +1,166 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 + */ + +#ifndef wxMAC_USE_EXPERIMENTAL_FONTDIALOG +#define wxMAC_USE_EXPERIMENTAL_FONTDIALOG 1 +#endif + +#if wxMAC_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 // wxMAC_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 new file mode 100644 index 0000000000..4eb04e2435 --- /dev/null +++ b/include/wx/osx/carbon/frame.h @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////// +// 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); + + virtual void DetachMenuBar(); + virtual void AttachMenuBar(wxMenuBar *menubar); + +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 new file mode 100644 index 0000000000..3db68bebe8 --- /dev/null +++ b/include/wx/osx/carbon/gauge.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..cced04ff48 --- /dev/null +++ b/include/wx/osx/carbon/glcanvas.h @@ -0,0 +1,142 @@ +///////////////////////////////////////////////////////////////////////////// +// 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_ + +#ifdef __DARWIN__ +# include +# include +#else +# include +# include +#endif + +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 + AGLContext GetAGLContext() const { return m_aglContext; } + +private: + AGLContext m_aglContext; + + 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 + AGLPixelFormat GetAGLPixelFormat() const { return m_aglFormat; } + + // 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 + + // 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(); + +protected: + AGLPixelFormat m_aglFormat; + + bool m_macCanvasIsShown, + m_needsUpdate; + + 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 new file mode 100644 index 0000000000..7bb66c7cba --- /dev/null +++ b/include/wx/osx/carbon/helpxxxx.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..754a5344c1 --- /dev/null +++ b/include/wx/osx/carbon/icon.h @@ -0,0 +1,99 @@ +///////////////////////////////////////////////////////////////////////////// +// 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, int flags = wxBITMAP_TYPE_ICON_RESOURCE, + 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 /* = wxBITMAP_TYPE_ICON_RESOURCE */ , + int desiredWidth /* = -1 */ , int desiredHeight = -1); + bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) + { return LoadFile( name , flags , -1 , -1 ) ; } + + + // 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 wxICONFileHandler: public wxBitmapHandler +{ + DECLARE_DYNAMIC_CLASS(wxICONFileHandler) +public: + inline wxICONFileHandler() + { + m_name = "ICO icon file"; + m_extension = "ico"; + m_type = wxBITMAP_TYPE_ICO; + }; + + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth = -1, int desiredHeight = -1); +}; +*/ + +class WXDLLIMPEXP_CORE wxICONResourceHandler: public wxBitmapHandler +{ + DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) +public: + inline wxICONResourceHandler() + { + SetName(wxT("ICON resource")); + SetExtension(wxEmptyString); + SetType(wxBITMAP_TYPE_ICON_RESOURCE); + }; + + virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, + int desiredWidth = -1, int desiredHeight = -1); + +}; + +#endif + // _WX_ICON_H_ diff --git a/include/wx/osx/carbon/imaglist.h b/include/wx/osx/carbon/imaglist.h new file mode 100644 index 0000000000..10e96b588d --- /dev/null +++ b/include/wx/osx/carbon/imaglist.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..94de2470e1 --- /dev/null +++ b/include/wx/osx/carbon/joystick.h @@ -0,0 +1,91 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..cac622dfe9 --- /dev/null +++ b/include/wx/osx/carbon/listbox.h @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxMacListControl data type. +class wxMacListControl; + +// List box item + +WX_DEFINE_ARRAY( char* , wxListDataArray ); + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +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; + + 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); + + wxMacListControl* GetPeer() const; + + bool MacGetBlockEvents() const { return m_blockEvents; } + +protected: + 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; + +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 new file mode 100644 index 0000000000..c2aad6d74f --- /dev/null +++ b/include/wx/osx/carbon/listctrl.h @@ -0,0 +1,423 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxMacListControl; +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); + + wxMacListControl* GetPeer() 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(); + + // 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 + wxStringList m_stringPool; // Pool of 3 strings to satisfy Windows callback + // requirements + int m_colCount; // Windows doesn't have GetColumnCount so must + // keep track of inserted/deleted columns + + 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 new file mode 100644 index 0000000000..39319b262b --- /dev/null +++ b/include/wx/osx/carbon/mdi.h @@ -0,0 +1,194 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: mdi.h +// Purpose: MDI (Multiple Document Interface) classes. +// This doesn't have to be implemented just like Windows, +// it could be a tabbed design as in wxGTK. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDI_H_ +#define _WX_MDI_H_ + +#include "wx/frame.h" + +WXDLLIMPEXP_DATA_CORE(extern const char) wxStatusLineNameStr[]; + +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; + +class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame +{ + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + +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, // Scrolling refers to client window + const wxString& name = wxFrameNameStr) + { + Init(); + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMDIParentFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr); + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating); + + // wxWidgets activate event + void OnActivate(wxActivateEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void SetMenuBar(wxMenuBar *menu_bar); + + // Get the active MDI child window (Windows only) + wxMDIChildFrame *GetActiveChild() const ; + + // Get the client window + inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }; + // Get rect to be used to center top-level children + virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h); + + // Create the client window class (don't Create the window, + // just return a new class) + virtual wxMDIClientWindow *OnCreateClient() ; + + // MDI operations + virtual void Cascade(); + virtual void Tile(wxOrientation WXUNUSED(orient) = wxHORIZONTAL); + virtual void ArrangeIcons(); + virtual void ActivateNext(); + virtual void ActivatePrevious(); + + virtual bool Show( bool show = true ); + + // overridden base clas virtuals + virtual void AddChild(wxWindowBase *child); + virtual void RemoveChild(wxWindowBase *child); + +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; + + + // TODO maybe have this member + wxMDIClientWindow *m_clientWindow; + wxMDIChildFrame *m_currentChild; + wxMenu *m_windowMenu; + + // true if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + + // 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() +}; + +class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame +{ +DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) +public: + + wxMDIChildFrame(); + inline wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init() ; + Create(parent, id, title, pos, size, style, name); + } + + virtual ~wxMDIChildFrame(); + + bool Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + // Mac OS activate event + virtual void MacActivate(long timestamp, bool activating); + + // Set menu bar + void SetMenuBar(wxMenuBar *menu_bar); + + // MDI operations + virtual void Maximize(); + virtual void Maximize( bool ){ Maximize() ; } // this one is inherited from wxFrame + virtual void Restore(); + virtual void Activate(); +protected: + + // common part of all ctors + void Init(); +}; + +/* The client window is a child of the parent MDI frame, and itself + * contains the child MDI frames. + * However, you create the MDI children as children of the MDI parent: + * only in the implementation does the client window become the parent + * of the children. Phew! So the children are sort of 'adopted'... + */ + +class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow +{ + DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) + public: + + wxMDIClientWindow() ; + inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + CreateClient(parent, style); + } + + virtual ~wxMDIClientWindow(); + + // Note: this is virtual, to allow overridden behaviour. + virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); + + // Explicitly call default scroll behaviour + void OnScroll(wxScrollEvent& event); + +protected: + // Gets the size available for subwindows after menu size, toolbar size + // and status bar size have been subtracted. If you want to manage your own + // toolbar(s), don't call SetToolBar. + void DoGetClientSize(int *width, int *height) const; + +DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_MDI_H_ diff --git a/include/wx/osx/carbon/menu.h b/include/wx/osx/carbon/menu.h new file mode 100644 index 0000000000..4d5fa44c5a --- /dev/null +++ b/include/wx/osx/carbon/menu.h @@ -0,0 +1,182 @@ +///////////////////////////////////////////////////////////////////////////// +// 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_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); + + // MSW-specific + bool ProcessCommand(wxCommandEvent& event); + + // implementation only from now on + // ------------------------------- + + int MacGetIndexFromId( int id ) ; + int MacGetIndexFromItem( wxMenuItem *pItem ) ; + void MacEnableMenu( bool bDoEnable ) ; + // MacOS needs to know about submenus somewhere within this menu + // before it can be displayed , also hide special menu items like preferences + // that are handled by the OS + void MacBeforeDisplay( bool isSubMenu ) ; + // undo all changes from the MacBeforeDisplay call + void MacAfterDisplay( bool isSubMenu ) ; + + // semi-private accessors + // get the window which contains this menu + wxWindow *GetWindow() const; + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + + short MacGetMenuId() { return m_macMenuId ; } + + wxInt32 MacHandleCommandProcess( wxMenuItem* item, int id, wxWindow* targetWindow = NULL ); + wxInt32 MacHandleCommandUpdateStatus( wxMenuItem* item, int id, wxWindow* targetWindow = NULL); + +protected: + 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; + + // the position of the first item in the current radio group or -1 + int m_startRadioGroup; + + // the menu handle of this menu + WXHMENU m_hMenu; + + short m_macMenuId; + + static short s_macNextMenuId ; + + DECLARE_DYNAMIC_CLASS(wxMenu) +}; + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class 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 + WXHMENU Create(); + int FindMenu(const wxString& title); + void Detach(); + + // returns TRUE if we're attached to a frame + bool IsAttached() const { return m_menuBarFrame != NULL; } + // get the frame we live in + wxFrame *GetFrame() const { return m_menuBarFrame; } + // attach to a frame + void Attach(wxFrame *frame); + + // clear the invoking window for all menus and submenus + void UnsetInvokingWindow() ; + + // set the invoking window for all menus and submenus + void SetInvokingWindow( wxFrame* frame ) ; + + // if the menubar is modified, the display is not updated automatically, + // call this function to update it (m_menuBarFrame should be !NULL) + void Refresh(bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL); + + 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 ; + + DECLARE_DYNAMIC_CLASS(wxMenuBar) +}; + +#endif // _WX_MENU_H_ diff --git a/include/wx/osx/carbon/menuitem.h b/include/wx/osx/carbon/menuitem.h new file mode 100644 index 0000000000..cae5583583 --- /dev/null +++ b/include/wx/osx/carbon/menuitem.h @@ -0,0 +1,80 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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_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); + +private: + void DoUpdateItemBitmap( WXHMENU menu, wxUint16 index) ; + + void UncheckRadio() ; + + // the positions of the first and last items of the radio group this item + // belongs to or -1: start is the radio group start and is valid for all + // but first radio group items (m_isRadioGroupStart == FALSE), end is valid + // only for the first one + union + { + int start; + int end; + } m_radioGroup; + + // does this item start a radio group? + bool m_isRadioGroupStart; + + wxBitmap m_bitmap; // Bitmap for menuitem, if any + void* m_menu ; // the appropriate menu , may also be a system menu + + DECLARE_DYNAMIC_CLASS(wxMenuItem) +}; + +#endif //_MENUITEM_H diff --git a/include/wx/osx/carbon/metafile.h b/include/wx/osx/carbon/metafile.h new file mode 100644 index 0000000000..da4c864150 --- /dev/null +++ b/include/wx/osx/carbon/metafile.h @@ -0,0 +1,178 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/mac/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 new file mode 100644 index 0000000000..26f5cb098b --- /dev/null +++ b/include/wx/osx/carbon/mimetype.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// 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); + + // this are NOPs under MacOS + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = TRUE) { return TRUE; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) { return TRUE; } + + void AddFallback(const wxFileTypeInfo& ft) { m_fallbacks.Add(ft); } + + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + // remove association + bool Unassociate(wxFileType *ft); + +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 new file mode 100644 index 0000000000..ba00ddd1a4 --- /dev/null +++ b/include/wx/osx/carbon/minifram.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..1a945a909b --- /dev/null +++ b/include/wx/osx/carbon/msgdlg.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxMessageDialogBase +{ +public: + wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, + const wxPoint& pos = wxDefaultPosition); + + virtual int ShowModal(); + + // customization of the message box + virtual bool SetYesNoLabels(const wxString& yes,const wxString& no); + virtual bool SetYesNoCancelLabels(const wxString& yes, const wxString& no, const wxString& cancel); + virtual bool SetOKLabel(const wxString& ok); + virtual bool SetOKCancelLabels(const wxString& ok, const wxString& cancel); + +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) {} + + // labels for the buttons + wxString m_yes, + m_no, + m_ok, + m_cancel; + + DECLARE_DYNAMIC_CLASS(wxMessageDialog) +}; + +#endif // _WX_MSGBOXDLG_H_ diff --git a/include/wx/osx/carbon/nonownedwnd.h b/include/wx/osx/carbon/nonownedwnd.h new file mode 100644 index 0000000000..025e3dab7a --- /dev/null +++ b/include/wx/osx/carbon/nonownedwnd.h @@ -0,0 +1,147 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 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); + + // implementation from now on + // -------------------------- + + static void MacDelayedDeactivation(long timestamp); + virtual void MacCreateRealWindow( const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ) ; + + WXWindow MacGetWindowRef() { return m_macWindow ; } + virtual void MacActivate( long timestamp , bool inIsActivating ) ; + virtual void MacPerformUpdates() ; + + virtual void Raise(); + virtual void Lower(); + virtual bool Show( bool show = true ); + + virtual bool ShowWithEffect(wxShowEffect effect, + unsigned timeout = 0) + { return MacShowWithEffect(true, effect, timeout); } + + virtual bool HideWithEffect(wxShowEffect effect, + unsigned timeout = 0) + { return MacShowWithEffect(false, effect, timeout); } + + virtual void SetExtraStyle(long exStyle) ; + + virtual bool SetBackgroundColour( const wxColour &colour ); + + virtual void MacInstallTopLevelWindowEventHandler() ; + + bool MacGetMetalAppearance() const ; + bool MacGetUnifiedAppearance() const ; + + void MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) ; + wxUint32 MacGetWindowAttributes() const ; + + WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; } + + virtual void MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) ; + +protected: + // common part of all ctors + void Init(); + + bool MacShowWithEffect(bool show, wxShowEffect effect, unsigned timeout); + + 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; + + WXWindow m_macWindow ; + + wxWindowMac* m_macFocus ; + + static wxNonOwnedWindow *s_macDeactivateWindow; +private : + // KH: We cannot let this be called directly since the metal appearance is now managed by an + // extra style. Calling this function directly can result in blank white window backgrounds. + // This is because the ExtraStyle flags get out of sync with the metal appearance and the metal + // logic & checks cease to work as expected. To set the metal appearance, use SetExtraStyle. + void MacSetMetalAppearance( bool on ) ; + void MacSetUnifiedAppearance( bool on ) ; + // binary compatible workaround TODO REPLACE + void DoMacCreateRealWindow( wxWindow *parent, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name ); + + WXEVENTHANDLERREF m_macEventHandler ; +}; + +// 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 new file mode 100644 index 0000000000..48e13feb3a --- /dev/null +++ b/include/wx/osx/carbon/notebook.h @@ -0,0 +1,143 @@ +///////////////////////////////////////////////////////////////////////////// +// 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(wxNotebookEvent& 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); + virtual wxInt32 MacControlHit(WXEVENTHANDLERREF handler, WXEVENTREF event); + +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 new file mode 100644 index 0000000000..5c6aa4740f --- /dev/null +++ b/include/wx/osx/carbon/palette.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/pen.h b/include/wx/osx/carbon/pen.h new file mode 100644 index 0000000000..3807aa523e --- /dev/null +++ b/include/wx/osx/carbon/pen.h @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/pen.h +// Purpose: wxPen class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#include "wx/gdiobj.h" +#include "wx/colour.h" +#include "wx/bitmap.h" + +// Pen +class WXDLLIMPEXP_CORE wxPen : public wxPenBase +{ +public: + wxPen(); + wxPen(const wxColour& col, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID); +#if FUTURE_WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_FUTURE( wxPen(const wxColour& col, int width, int style) ); +#endif + + wxPen(const wxBitmap& stipple, int width); + virtual ~wxPen(); + + bool operator==(const wxPen& pen) const; + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + // Override in order to recreate the pen + void SetColour(const wxColour& col) ; + void SetColour(unsigned char r, unsigned char g, unsigned char b) ; + + void SetWidth(int width) ; + void SetStyle(wxPenStyle style) ; + void SetStipple(const wxBitmap& stipple) ; + void SetDashes(int nb_dashes, const wxDash *dash) ; + void SetJoin(wxPenJoin join) ; + void SetCap(wxPenCap cap) ; + + wxColour GetColour() const ; + int GetWidth() const; + wxPenStyle GetStyle() const; + wxPenJoin GetJoin() const; + wxPenCap GetCap() const; + int GetDashes(wxDash **ptr) const; + + wxBitmap *GetStipple() const ; + + // Implementation + + // Useful helper: create the brush resource + bool RealizeResource(); + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + +private: + void Unshare(); + + DECLARE_DYNAMIC_CLASS(wxPen) +}; + +#endif + // _WX_PEN_H_ diff --git a/include/wx/osx/carbon/pnghand.h b/include/wx/osx/carbon/pnghand.h new file mode 100644 index 0000000000..de27a024d9 --- /dev/null +++ b/include/wx/osx/carbon/pnghand.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..222a2c5589 --- /dev/null +++ b/include/wx/osx/carbon/pngread.h @@ -0,0 +1,287 @@ +/* + * 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 new file mode 100644 index 0000000000..3bf458ef15 --- /dev/null +++ b/include/wx/osx/carbon/popupwin.h @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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/printdlg.h b/include/wx/osx/carbon/printdlg.h new file mode 100644 index 0000000000..d6ec1ce09b --- /dev/null +++ b/include/wx/osx/carbon/printdlg.h @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/printdlg.h +// Purpose: wxPrintDialog, wxPageSetupDialog classes. +// Use generic, PostScript version if no +// platform-specific implementation. +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_ +#define _WX_PRINTDLG_H_ + +#include "wx/dialog.h" +#include "wx/cmndata.h" +#include "wx/printdlg.h" +#include "wx/prntbase.h" + +/* + * wxMacPrintDialog + * The Mac dialog for printing + */ + +class WXDLLIMPEXP_FWD_CORE wxDC; +class WXDLLIMPEXP_CORE wxMacPrintDialog: public wxPrintDialogBase +{ +public: + wxMacPrintDialog(); + wxMacPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxMacPrintDialog(wxWindow *parent, wxPrintData* data ); + virtual ~wxMacPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal(); + + virtual wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + virtual wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } + virtual wxDC *GetPrintDC(); + +private: + wxPrintDialogData m_printDialogData; + wxDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; + +private: + DECLARE_DYNAMIC_CLASS(wxPrintDialog) +}; + +/* + * wxMacPageSetupDialog + * The Mac page setup dialog + */ + +class WXDLLIMPEXP_CORE wxMacPageSetupDialog: public wxPageSetupDialogBase +{ +public: + wxMacPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL); + virtual ~wxMacPageSetupDialog(); + + virtual wxPageSetupData& GetPageSetupDialogData(); + + bool Create(wxWindow *parent, wxPageSetupData *data = NULL); + virtual int ShowModal(); + +private: + wxPageSetupData m_pageSetupData; + wxWindow* m_dialogParent; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageSetupDialog) +}; + +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; + +/* +* wxMacPageMarginsDialog +* A Mac dialog for setting the page margins separately from page setup since +* (native) wxMacPageSetupDialog doesn't let you set margins. +*/ + +class WXDLLIMPEXP_CORE wxMacPageMarginsDialog : public wxDialog +{ +public: + wxMacPageMarginsDialog(wxFrame* parent, wxPageSetupData* data); + bool TransferToWindow(); + bool TransferDataFromWindow(); + + virtual wxPageSetupData& GetPageSetupDialogData() { return *m_pageSetupDialogData; } + +private: + wxPageSetupData* m_pageSetupDialogData; + + wxPoint m_MinMarginTopLeft; + wxPoint m_MinMarginBottomRight; + wxTextCtrl *m_LeftMargin; + wxTextCtrl *m_TopMargin; + wxTextCtrl *m_RightMargin; + wxTextCtrl *m_BottomMargin; + + void GetMinMargins(); + bool CheckValue(wxTextCtrl* textCtrl, int *value, int minValue, const wxString& name); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageMarginsDialog) +}; + + +#endif // _WX_PRINTDLG_H_ diff --git a/include/wx/osx/carbon/printmac.h b/include/wx/osx/carbon/printmac.h new file mode 100644 index 0000000000..776d6643c1 --- /dev/null +++ b/include/wx/osx/carbon/printmac.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/private.h b/include/wx/osx/carbon/private.h new file mode 100644 index 0000000000..2b9a27e04d --- /dev/null +++ b/include/wx/osx/carbon/private.h @@ -0,0 +1,1072 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/defs.h" + +#include + +#include "wx/mac/corefoundation/cfstring.h" +#include "wx/mac/corefoundation/cfdataref.h" + +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 +typedef UInt32 URefCon; +typedef SInt32 SRefCon; +#endif + +#if wxUSE_GUI + +#include "wx/listbox.h" +#include "wx/mac/carbon/dc.h" +#include "wx/mac/carbon/dcclient.h" +#include "wx/mac/carbon/dcmemory.h" + +class WXDLLIMPEXP_CORE wxMacCGContextStateSaver +{ + DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver) + +public: + wxMacCGContextStateSaver( CGContextRef cg ) + { + m_cg = cg; + CGContextSaveGState( cg ); + } + ~wxMacCGContextStateSaver() + { + CGContextRestoreGState( m_cg ); + } +private: + CGContextRef m_cg; +}; + +// app.h + +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 +bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec); +#endif + +#endif // wxUSE_GUI + +// filefn.h +WXDLLIMPEXP_BASE wxString wxMacFSSpec2MacFilename( const FSSpec *spec ); +WXDLLIMPEXP_BASE void wxMacFilename2FSSpec( const wxString &path , FSSpec *spec ); + +// utils.h +WXDLLIMPEXP_BASE wxString wxMacFindFolderNoSeparator(short vRefNum, + OSType folderType, + Boolean createFolder); +WXDLLIMPEXP_BASE wxString wxMacFindFolder(short vRefNum, + OSType folderType, + Boolean createFolder); + +template EventParamType wxMacGetEventParamType() { wxFAIL_MSG( wxT("Unknown Param Type") ); return 0; } +template<> inline EventParamType wxMacGetEventParamType() { return typeQDRgnHandle; } +template<> inline EventParamType wxMacGetEventParamType() { return typeControlRef; } +template<> inline EventParamType wxMacGetEventParamType() { return typeWindowRef; } +template<> inline EventParamType wxMacGetEventParamType() { return typeMenuRef; } +template<> inline EventParamType wxMacGetEventParamType() { return typeEventRef; } +template<> inline EventParamType wxMacGetEventParamType() { return typeQDPoint; } +template<> inline EventParamType wxMacGetEventParamType() { return typeQDRectangle; } +template<> inline EventParamType wxMacGetEventParamType() { return typeBoolean; } +template<> inline EventParamType wxMacGetEventParamType() { return typeSInt16; } +template<> inline EventParamType wxMacGetEventParamType() { return typeSInt32; } +template<> inline EventParamType wxMacGetEventParamType() { return typeUInt32; } +template<> inline EventParamType wxMacGetEventParamType() { return typeRGBColor; } +template<> inline EventParamType wxMacGetEventParamType() { return typeHICommand; } +template<> inline EventParamType wxMacGetEventParamType() { return typeHIPoint; } +template<> inline EventParamType wxMacGetEventParamType() { return typeHISize; } +template<> inline EventParamType wxMacGetEventParamType() { return typeHIRect; } +template<> inline EventParamType wxMacGetEventParamType() { return typeVoidPtr; } +template<> inline EventParamType wxMacGetEventParamType() { return typeCFDictionaryRef; } +template<> inline EventParamType wxMacGetEventParamType() { return typeCollection; } +template<> inline EventParamType wxMacGetEventParamType() { return typeCGContextRef; } +/* + These are ambiguous + template<> EventParamType wxMacGetEventParamType() { return typeGrafPtr; } + template<> EventParamType wxMacGetEventParamType() { return typeOSStatus; } + template<> EventParamType wxMacGetEventParamType() { return typeCFIndex; } + template<> EventParamType wxMacGetEventParamType() { return typeGWorldPtr; } + */ + +class WXDLLIMPEXP_CORE wxMacCarbonEvent +{ + +public : + wxMacCarbonEvent() + { + m_eventRef = 0; + m_release = false; + } + + wxMacCarbonEvent( EventRef event , bool release = false ) + { + m_eventRef = event; + m_release = release; + } + + wxMacCarbonEvent(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) + { + m_eventRef = NULL; + verify_noerr( MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef) ); + m_release = true; + } + + ~wxMacCarbonEvent() + { + if ( m_release ) + ReleaseEvent( m_eventRef ); + } + + OSStatus Create(UInt32 inClassID,UInt32 inKind,EventTime inWhen = 0 /*now*/,EventAttributes inAttributes=kEventAttributeNone) + { + verify( (m_eventRef == NULL) || m_release ); + if ( m_eventRef && m_release ) + { + ReleaseEvent( m_eventRef ); + m_release = false; + m_eventRef = NULL; + } + OSStatus err = MacCreateEvent( NULL , inClassID, inKind,inWhen,inAttributes,&m_eventRef); + if ( err == noErr ) + m_release = true; + return err; + } + + OSStatus GetParameter( EventParamName inName, EventParamType inDesiredType, UInt32 inBufferSize, void * outData); + + template OSStatus GetParameter( EventParamName inName, EventParamType type , T *data ) + { + return GetParameter( inName, type , sizeof( T ) , data ); + } + template OSStatus GetParameter( EventParamName inName, T *data ) + { + return GetParameter( inName, wxMacGetEventParamType() , data ); + } + + template T GetParameter( EventParamName inName ) + { + T value; + verify_noerr( GetParameter( inName, &value ) ); + return value; + } + template T GetParameter( EventParamName inName, EventParamType inDesiredType ) + { + T value; + verify_noerr( GetParameter( inName, inDesiredType , &value ) ); + return value; + } + + OSStatus SetParameter( EventParamName inName, EventParamType inType, UInt32 inSize, const void * inData); + template OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T *data ) + { + return SetParameter( inName, inDesiredType , sizeof( T ) , data ); + } + template OSStatus SetParameter( EventParamName inName, EventParamType inDesiredType , const T& data ) + { + return SetParameter( inName, inDesiredType , &data ); + } + template OSStatus SetParameter( EventParamName inName, const T *data ) + { + return SetParameter( inName, wxMacGetEventParamType() , data ); + } + template OSStatus SetParameter( EventParamName inName, const T& data ) + { + return SetParameter( inName, wxMacGetEventParamType() , &data ); + } + UInt32 GetClass() + { + return ::GetEventClass( m_eventRef ); + } + UInt32 GetKind() + { + return ::GetEventKind( m_eventRef ); + } + EventTime GetTime() + { + return ::GetEventTime( m_eventRef ); + } + UInt32 GetTicks() + { + return EventTimeToTicks( GetTime() ); + } + OSStatus SetCurrentTime( ) + { + return ::SetEventTime( m_eventRef , GetCurrentEventTime() ); + } + OSStatus SetTime( EventTime when ) + { + return ::SetEventTime( m_eventRef , when ); + } + operator EventRef () { return m_eventRef; } + + bool IsValid() { return m_eventRef != 0; } +protected : + EventRef m_eventRef; + bool m_release; +}; + +// +// helper class for allocating and deallocating Universal Proc Ptrs +// + +template class wxMacUPP +{ +public : + wxMacUPP( procType WXUNUSED(proc) ) + { + m_upp = NULL; + m_upp = (*newUPP)( NULL ); + } + ~wxMacUPP() + { + if ( m_upp ) + disposeUPP( m_upp ); + } + operator uppType() { return m_upp; } +private : + uppType m_upp; +}; + +typedef wxMacUPP wxMacNMUPP; + +#if wxUSE_GUI + +class WXDLLIMPEXP_FWD_CORE wxMacToolTipTimer ; + +class WXDLLIMPEXP_CORE wxMacToolTip +{ +public : + wxMacToolTip() ; + ~wxMacToolTip() ; + + void Setup( WindowRef window , const wxString& text , const wxPoint& localPosition ) ; + void Draw() ; + void Clear() ; + + long GetMark() + { return m_mark ; } + + bool IsShown() + { return m_shown ; } + +private : + wxString m_label ; + wxPoint m_position ; + Rect m_rect ; + WindowRef m_window ; + PicHandle m_backpict ; + bool m_shown ; + long m_mark ; +#if wxUSE_TIMER + wxMacToolTipTimer* m_timer ; +#endif + wxCFStringRef m_helpTextRef ; +} ; + +// Quartz + +WXDLLIMPEXP_CORE void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ); +WXDLLIMPEXP_CORE void wxMacReleaseBitmapButton( ControlButtonContentInfo*info ); +WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap ); + +WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data ); +WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data ); +WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf ); + + +#define MAC_WXHBITMAP(a) (GWorldPtr(a)) +#define MAC_WXHMETAFILE(a) (PicHandle(a)) +#define MAC_WXHICON(a) (IconRef(a)) +#define MAC_WXHCURSOR(a) (CursHandle(a)) +#define MAC_WXHRGN(a) (RgnHandle(a)) +#define MAC_WXHWND(a) (WindowPtr(a)) +#define MAC_WXRECPTR(a) ((Rect*)a) +#define MAC_WXPOINTPTR(a) ((Point*)a) +#define MAC_WXHMENU(a) ((MenuHandle)a) + +struct wxOpaqueWindowRef +{ + wxOpaqueWindowRef( WindowRef ref ) { m_data = ref; } + operator WindowRef() { return m_data; } +private : + WindowRef m_data; +}; + +WXDLLIMPEXP_CORE void wxMacRectToNative( const wxRect *wx , Rect *n ); +WXDLLIMPEXP_CORE void wxMacNativeToRect( const Rect *n , wxRect* wx ); +WXDLLIMPEXP_CORE void wxMacPointToNative( const wxPoint* wx , Point *n ); +WXDLLIMPEXP_CORE void wxMacNativeToPoint( const Point *n , wxPoint* wx ); + +WXDLLIMPEXP_CORE wxWindow * wxFindControlFromMacControl(ControlRef inControl ); +WXDLLIMPEXP_CORE wxNonOwnedWindow* wxFindWinFromMacWindow( WindowRef inWindow ); +WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacMenu(MenuRef inMenuRef); + +WXDLLIMPEXP_CORE int wxMacCommandToId( UInt32 macCommandId ); +WXDLLIMPEXP_CORE UInt32 wxIdToMacCommand( int wxId ); +WXDLLIMPEXP_CORE wxMenu* wxFindMenuFromMacCommand( const HICommand &macCommandId , wxMenuItem* &item ); + +extern wxWindow* g_MacLastWindow; +WXDLLIMPEXP_CORE pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ); +WXDLLIMPEXP_CORE Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin = true ); + +ControlActionUPP GetwxMacLiveScrollbarActionProc(); + +// additional optional event defines + +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 +enum { + kEventControlFocusPartChanged = 164 +}; +#endif + +class WXDLLIMPEXP_CORE wxMacControl : public wxObject +{ +public : + wxMacControl( wxWindow* peer , bool isRootControl = false ); + wxMacControl( wxWindow* peer , ControlRef control ); + wxMacControl( wxWindow* peer , WXWidget control ); + wxMacControl() ; + virtual ~wxMacControl(); + + void Init(); + + virtual void Dispose(); + + bool Ok() const { return IsOk(); } + bool IsOk() const { return GetControlRef() != NULL; } + + void SetReferenceInNativeControl(); + static wxMacControl* GetReferenceFromNativeControl(ControlRef control); + + virtual ControlRef * GetControlRefAddr() { return &m_controlRef; } + virtual ControlRef GetControlRef() const { return m_controlRef; } + + virtual void SetReference( URefCon data ); + /* + void operator= (ControlRef c) { m_controlRef = c; } + operator ControlRef () { return m_controlRef; } + operator ControlRef * () { return &m_controlRef; } + */ + // accessing data and values + + virtual OSStatus SetData( ControlPartCode inPartCode , ResType inTag , Size inSize , const void * inData ); + virtual OSStatus GetData( ControlPartCode inPartCode , ResType inTag , Size inBufferSize , void * inOutBuffer , Size * outActualSize ) const; + virtual OSStatus GetDataSize( ControlPartCode inPartCode , ResType inTag , Size * outActualSize ) const; + virtual OSStatus SendEvent( EventRef ref , OptionBits inOptions = 0 ); + virtual OSStatus SendHICommand( HICommand &command , OptionBits inOptions = 0 ); + + virtual OSStatus SendHICommand( UInt32 commandID , OptionBits inOptions = 0 ); + + virtual SInt32 GetValue() const; + virtual SInt32 GetMaximum() const; + virtual SInt32 GetMinimum() const; + + virtual void SetValue( SInt32 v ); + virtual void SetMinimum( SInt32 v ); + virtual void SetMaximum( SInt32 v ); + + virtual void SetValueAndRange( SInt32 value , SInt32 minimum , SInt32 maximum ); + virtual void SetRange( SInt32 minimum , SInt32 maximum ); + + virtual OSStatus SetFocus( ControlFocusPart focusPart ); + virtual bool HasFocus() const; + virtual bool NeedsFocusRect() const; + virtual void SetNeedsFocusRect( bool needs ); + + // templated helpers + + Size GetDataSize( ControlPartCode inPartCode , ResType inTag ) const + { + Size sz; + verify_noerr( GetDataSize( inPartCode , inTag , &sz ) ); + return sz; + } + template OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T *data ) + { + return SetData( inPartCode , inTag , sizeof( T ) , data ); + } + template OSStatus SetData( ControlPartCode inPartCode , ResType inTag , const T& data ) + { + return SetData( inPartCode , inTag , sizeof( T ) , &data ); + } + template OSStatus SetData( ResType inTag , const T *data ) + { + return SetData( kControlEntireControl , inTag , sizeof( T ) , data ); + } + template OSStatus SetData( ResType inTag , const T& data ) + { + return SetData( kControlEntireControl , inTag , sizeof( T ) , &data ); + } + template OSStatus GetData( ControlPartCode inPartCode , ResType inTag , T *data ) const + { + Size dummy; + return GetData( inPartCode , inTag , sizeof( T ) , data , &dummy ); + } + template T GetData( ControlPartCode inPartCode , ResType inTag ) const + { + T value; + OSStatus err = GetData( inPartCode , inTag , &value ); + + if ( err != noErr ) + { + wxFAIL_MSG( wxString::Format(wxT("GetData Failed for Part [%i] and Tag [%i]"), + inPartCode, (int)inTag) ); + } + + return value; + } + template OSStatus GetData( ResType inTag , T *data ) const + { + Size dummy; + return GetData( kControlEntireControl , inTag , sizeof( T ) , data , &dummy ); + } + template T GetData( ResType inTag ) const + { + return GetData( kControlEntireControl , inTag ); + } + + // Flash the control for the specified amount of time + virtual void Flash( ControlPartCode part , UInt32 ticks = 8 ); + + virtual void VisibilityChanged( bool shown ); + virtual void SuperChangedPosition(); + + + virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ); + virtual void SetBackgroundColour( const wxColour& col ); + virtual ControlPartCode HandleKey( SInt16 keyCode, SInt16 charCode, EventModifiers modifiers ); + void SetActionProc( ControlActionUPP actionProc ); + void SetViewSize( SInt32 viewSize ); + SInt32 GetViewSize() const; + + virtual bool IsVisible() const; + virtual void SetVisibility( bool visible , bool redraw ); + virtual bool IsEnabled() const; + virtual bool IsActive() const; + virtual void Enable( bool enable ); + + // invalidates this control and all children + virtual void InvalidateWithChildren(); + virtual void SetDrawingEnabled( bool enable ); + virtual bool GetNeedsDisplay() const; + + // where is in native window relative coordinates + virtual void SetNeedsDisplay( RgnHandle where ); + // where is in native window relative coordinates + virtual void SetNeedsDisplay( Rect* where = NULL ); + + // if rect = NULL, entire view + virtual void ScrollRect( wxRect *rect , int dx , int dy ); + + // in native parent window relative coordinates + virtual void GetRect( Rect *r ); + + // in native parent window relative coordinates + virtual void SetRect( Rect *r ); + + virtual void GetRectInWindowCoords( Rect *r ); + virtual void GetBestRect( Rect *r ); + virtual void SetLabel( const wxString &title ); + // converts from Toplevel-Content relative to local + static void Convert( wxPoint *pt , wxMacControl *convert , wxMacControl *to ); + + virtual void GetFeatures( UInt32 *features ); + virtual OSStatus GetRegion( ControlPartCode partCode , RgnHandle region ); + virtual OSStatus SetZOrder( bool above , wxMacControl* other ); + + bool IsRootControl() { return m_isRootControl; } + + wxWindow* GetPeer() const + { + return m_peer; + } + + // to be moved into a tab control class + + virtual OSStatus SetTabEnabled( SInt16 tabNo , bool enable ); +protected : + ControlRef m_controlRef; + wxFont m_font; + long m_windowStyle; + wxWindow* m_peer; + bool m_needsFocusRect; + bool m_isRootControl; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacControl) +}; + +// ============================================================================ +// DataBrowser Wrapper +// ============================================================================ +// +// basing on DataBrowserItemIDs +// + +class WXDLLIMPEXP_CORE wxMacDataBrowserControl : public wxMacControl +{ +public : + wxMacDataBrowserControl( wxWindow* peer, const wxPoint& pos, const wxSize& size, long style); + wxMacDataBrowserControl() {} + + OSStatus SetCallbacks( const DataBrowserCallbacks *callbacks ); + + OSStatus GetItemCount( DataBrowserItemID container, + Boolean recurse, + DataBrowserItemState state, + ItemCount *numItems) const; + + OSStatus GetItems( DataBrowserItemID container, + Boolean recurse, + DataBrowserItemState state, + Handle items) const; + + + OSStatus AddColumn( DataBrowserListViewColumnDesc *columnDesc, + DataBrowserTableViewColumnIndex position ); + + OSStatus RemoveColumn( DataBrowserTableViewColumnIndex position ); + + OSStatus AutoSizeColumns(); + + OSStatus SetHasScrollBars( bool horiz, bool vert ); + OSStatus SetHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle ); + + OSStatus SetHeaderButtonHeight( UInt16 height ); + OSStatus GetHeaderButtonHeight( UInt16 *height ); + + OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems, + const DataBrowserItemID *items, + DataBrowserPropertyID preSortProperty, + DataBrowserPropertyID propertyID ) const; + + OSStatus AddItems( DataBrowserItemID container, UInt32 numItems, + const DataBrowserItemID *items, + DataBrowserPropertyID preSortProperty ); + OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems, + const DataBrowserItemID *items, + DataBrowserPropertyID preSortProperty ); + OSStatus RevealItem( DataBrowserItemID item, + DataBrowserPropertyID propertyID, + DataBrowserRevealOptions options ) const; + + OSStatus SetSelectionFlags( DataBrowserSelectionFlags ); + OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const; + bool IsItemSelected( DataBrowserItemID item ) const; + OSStatus SetSelectedItems( UInt32 numItems, + const DataBrowserItemID *items, + DataBrowserSetOption operation ); + + OSStatus GetItemID( DataBrowserTableViewRowIndex row, + DataBrowserItemID * item ) const; + OSStatus GetItemRow( DataBrowserItemID item, + DataBrowserTableViewRowIndex * row ) const; + + OSStatus SetDefaultRowHeight( UInt16 height ); + OSStatus GetDefaultRowHeight( UInt16 * height ) const; + + OSStatus SetRowHeight( DataBrowserItemID item , UInt16 height); + OSStatus GetRowHeight( DataBrowserItemID item , UInt16 *height) const; + + OSStatus GetColumnWidth( DataBrowserPropertyID column , UInt16 *width ) const; + OSStatus SetColumnWidth( DataBrowserPropertyID column , UInt16 width ); + + OSStatus GetDefaultColumnWidth( UInt16 *width ) const; + OSStatus SetDefaultColumnWidth( UInt16 width ); + + OSStatus GetColumnCount( UInt32* numColumns) const; + + OSStatus GetColumnIDFromIndex( DataBrowserTableViewColumnIndex position, DataBrowserTableViewColumnID* id ); + + OSStatus GetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex *position) const; + OSStatus SetColumnPosition( DataBrowserPropertyID column, DataBrowserTableViewColumnIndex position); + + OSStatus GetScrollPosition( UInt32 *top , UInt32 *left ) const; + OSStatus SetScrollPosition( UInt32 top , UInt32 left ); + + OSStatus GetSortProperty( DataBrowserPropertyID *column ) const; + OSStatus SetSortProperty( DataBrowserPropertyID column ); + + OSStatus GetSortOrder( DataBrowserSortOrder *order ) const; + OSStatus SetSortOrder( DataBrowserSortOrder order ); + + OSStatus GetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags *flags ) const; + OSStatus SetPropertyFlags( DataBrowserPropertyID property, DataBrowserPropertyFlags flags ); + + OSStatus GetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ) const; + OSStatus SetHeaderDesc( DataBrowserPropertyID property, DataBrowserListViewHeaderDesc *desc ); + + OSStatus SetDisclosureColumn( DataBrowserPropertyID property , Boolean expandableRows ); +protected : + + static pascal void DataBrowserItemNotificationProc( + ControlRef browser, + DataBrowserItemID itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData ); + + virtual void ItemNotification( + DataBrowserItemID itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData) = 0; + + static pascal OSStatus DataBrowserGetSetItemDataProc( + ControlRef browser, + DataBrowserItemID itemID, + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + Boolean changeValue ); + + virtual OSStatus GetSetItemData( + DataBrowserItemID itemID, + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + Boolean changeValue ) = 0; + + static pascal Boolean DataBrowserCompareProc( + ControlRef browser, + DataBrowserItemID itemOneID, + DataBrowserItemID itemTwoID, + DataBrowserPropertyID sortProperty); + + virtual Boolean CompareItems(DataBrowserItemID itemOneID, + DataBrowserItemID itemTwoID, + DataBrowserPropertyID sortProperty) = 0; + DECLARE_ABSTRACT_CLASS(wxMacDataBrowserControl) +}; + +// ============================================================================ +// Higher-level Databrowser +// ============================================================================ +// +// basing on data item objects +// + +// forward decl + +class wxMacDataItemBrowserControl; +class wxMacListBoxItem; + +const DataBrowserPropertyID kTextColumnId = 1024; +const DataBrowserPropertyID kNumericOrderColumnId = 1025; + +// for multi-column controls, we will use this + the column ID to identify the +// column. We don't use kTextColumnId there, and ideally the two should merge. +const DataBrowserPropertyID kMinColumnId = 1050; + +// base API for high-level databrowser operations + +class WXDLLIMPEXP_CORE wxMacListControl +{ +public: + virtual void MacDelete( unsigned int n ) = 0; + virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ) = 0; + // returns index of newly created line + virtual int MacAppend( const wxString& item ) = 0; + virtual void MacSetString( unsigned int n, const wxString& item ) = 0; + virtual void MacClear() = 0; + virtual void MacDeselectAll() = 0; + virtual void MacSetSelection( unsigned int n, bool select, bool multi ) = 0; + virtual int MacGetSelection() const = 0; + virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0; + virtual bool MacIsSelected( unsigned int n ) const = 0; + virtual void MacScrollTo( unsigned int n ) = 0; + virtual wxString MacGetString( unsigned int n) const = 0; + virtual unsigned int MacGetCount() const = 0; + + virtual void MacSetClientData( unsigned int n, void * data) = 0; + virtual void * MacGetClientData( unsigned int) const = 0; + + virtual ~wxMacListControl() { } +}; + +// base class for databrowser items + +enum DataItemType { + DataItem_Text +}; + +class WXDLLIMPEXP_CORE wxMacDataItem +{ +public : + wxMacDataItem(); + virtual ~wxMacDataItem(); + + virtual bool IsLessThan(wxMacDataItemBrowserControl *owner , + const wxMacDataItem*, + DataBrowserPropertyID property) const; + + // returns true if access was successful, otherwise false + virtual OSStatus GetSetData(wxMacDataItemBrowserControl *owner , + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + bool changeValue ); + + virtual void Notification(wxMacDataItemBrowserControl *owner , + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData ) const; + + void SetLabel( const wxString& str); + const wxString& GetLabel() const; + + void SetOrder( SInt32 order ); + SInt32 GetOrder() const; + + void SetData( void* data); + void* GetData() const; + + void SetColumn( short col ); + short GetColumn(); + +protected : + wxString m_label; + wxCFStringRef m_cfLabel; + void * m_data; + SInt32 m_order; + DataBrowserPropertyID m_colId; + +}; + +enum ListSortOrder { + SortOrder_None, + SortOrder_Text_Ascending, + SortOrder_Text_Descending +}; + +typedef wxMacDataItem* wxMacDataItemPtr; +const wxMacDataItemPtr wxMacDataBrowserRootContainer = NULL; + +WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxMacDataItemPtr, wxArrayMacDataItemPtr, class WXDLLIMPEXP_CORE); + +class WXDLLIMPEXP_CORE wxMacDataItemBrowserControl : public wxMacDataBrowserControl, public wxMacListControl +{ +public : + wxMacDataItemBrowserControl( wxWindow* peer , const wxPoint& pos, const wxSize& size, long style); + wxMacDataItemBrowserControl() {} + // create a list item (can be a subclass of wxMacListBoxItem) + + virtual wxMacDataItem* CreateItem(); + + unsigned int GetItemCount(const wxMacDataItem* container, bool recurse , DataBrowserItemState state) const; + void GetItems(const wxMacDataItem* container, bool recurse , + DataBrowserItemState state, wxArrayMacDataItemPtr &items ) const; + + unsigned int GetSelectedItemCount( const wxMacDataItem* container, bool recurse ) const; + + unsigned int GetLineFromItem(const wxMacDataItem *item) const; + wxMacDataItem * GetItemFromLine(unsigned int n) const; + + void UpdateItem(const wxMacDataItem *container, const wxMacDataItem *item, + DataBrowserPropertyID property) const; + void UpdateItems(const wxMacDataItem *container, wxArrayMacDataItemPtr &items, + DataBrowserPropertyID property) const; + + void InsertColumn(int colId, DataBrowserPropertyType colType, + const wxString& title, SInt16 just = teFlushDefault, int defaultWidth = -1); + + int GetColumnWidth(int colId); + void SetColumnWidth(int colId, int width); + + void AddItem(wxMacDataItem *container, wxMacDataItem *item); + void AddItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items ); + + void RemoveAllItems(wxMacDataItem *container); + void RemoveItem(wxMacDataItem *container, wxMacDataItem* item); + void RemoveItems(wxMacDataItem *container, wxArrayMacDataItemPtr &items); + + void SetSelectedItem( wxMacDataItem* item , DataBrowserSetOption option); + void SetSelectedItems( wxArrayMacDataItemPtr &items , DataBrowserSetOption option); + void SetSelectedAllItems( DataBrowserSetOption option); + Boolean IsItemSelected( const wxMacDataItem* item) const; + + void RevealItem( wxMacDataItem* item, DataBrowserRevealOptions options); + + void GetSelectionAnchor( wxMacDataItemPtr* first , wxMacDataItemPtr* last) const; + + // item aware methods, to be used in subclasses + + virtual Boolean CompareItems(const wxMacDataItem* itemOneID, + const wxMacDataItem* itemTwoID, + DataBrowserPropertyID sortProperty); + + virtual OSStatus GetSetItemData(wxMacDataItem* itemID, + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + Boolean changeValue ); + + virtual void ItemNotification( + const wxMacDataItem* itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData); + + // as we are getting the same events for human and API selection we have to suppress + // events in the latter case, since this will be used from many subclasses we keep it here + + bool IsSelectionSuppressed() const { return m_suppressSelection; } + bool SuppressSelection( bool suppress ); + + + // wxMacListControl Methods + // add and remove + + virtual void MacDelete( unsigned int n ); + virtual void MacInsert( unsigned int n, const wxArrayStringsAdapter& items, int column = -1 ); + virtual int MacAppend( const wxString& item ); + virtual void MacClear(); + + // selecting + + virtual void MacDeselectAll(); + virtual void MacSetSelection( unsigned int n, bool select, bool multi = false ); + virtual int MacGetSelection() const; + virtual int MacGetSelections( wxArrayInt& aSelections ) const; + virtual bool MacIsSelected( unsigned int n ) const; + + // display + + virtual void MacScrollTo( unsigned int n ); + + // accessing content + + virtual void MacSetString( unsigned int n, const wxString& item ); + virtual void MacSetClientData( unsigned int n, void * data); + virtual wxString MacGetString( unsigned int n) const; + virtual void * MacGetClientData( unsigned int) const; + virtual unsigned int MacGetCount() const; + + // client data + + virtual wxClientDataType GetClientDataType() const; + virtual void SetClientDataType(wxClientDataType clientDataItemsType); + //virtual ListSortOrder GetSortOrder() const; + //virtual void SetSortOrder(const ListSortOrder sort); + + + +protected: + + ListSortOrder m_sortOrder; + wxClientDataType m_clientDataItemsType; + + // ID aware base methods, should be 'final' ie not changed in subclasses + + virtual Boolean CompareItems(DataBrowserItemID itemOneID, + DataBrowserItemID itemTwoID, + DataBrowserPropertyID sortProperty); + + virtual OSStatus GetSetItemData(DataBrowserItemID itemID, + DataBrowserPropertyID property, + DataBrowserItemDataRef itemData, + Boolean changeValue ); + + virtual void ItemNotification( + DataBrowserItemID itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData); + + +private : + + bool m_suppressSelection; + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataItemBrowserControl) +}; + +class WXDLLIMPEXP_CORE wxMacDataItemBrowserSelectionSuppressor +{ +public : + wxMacDataItemBrowserSelectionSuppressor(wxMacDataItemBrowserControl *browser); + ~wxMacDataItemBrowserSelectionSuppressor(); + +private : + + bool m_former; + wxMacDataItemBrowserControl* m_browser; +}; + +// ============================================================================ +// platform listbox implementation +// ============================================================================ + +// exposed for reuse in wxCheckListBox + +class WXDLLIMPEXP_CORE wxMacListBoxItem : public wxMacDataItem +{ +public : + wxMacListBoxItem(); + + virtual ~wxMacListBoxItem(); + + virtual void Notification(wxMacDataItemBrowserControl *owner , + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData ) const; +}; + +class WXDLLIMPEXP_CORE wxMacDataBrowserListControl : public wxMacDataItemBrowserControl +{ +public: + wxMacDataBrowserListControl( wxWindow *peer, const wxPoint& pos, const wxSize& size, long style ); + wxMacDataBrowserListControl() {} + virtual ~wxMacDataBrowserListControl(); + + virtual wxMacDataItem* CreateItem(); + + virtual void ItemNotification( + const wxMacDataItem* itemID, + DataBrowserItemNotification message, + DataBrowserItemDataRef itemData); + + // pointing back + + wxWindow * GetPeer() const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListControl) +}; + +// ============================================================================ +// graphics implementation +// ============================================================================ + +// draw the image 'upside down' corrected as HIViewDrawCGImage does + +OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage( + CGContextRef inContext, + const HIRect * inBounds, + CGImageRef inImage) ; + +CGColorRef WXDLLIMPEXP_CORE wxMacCreateCGColorFromHITheme( ThemeBrush brush ) ; + +CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void); + +// toplevel.cpp + +class WXDLLIMPEXP_CORE wxMacDeferredWindowDeleter : public wxObject +{ +public : + wxMacDeferredWindowDeleter( WindowRef windowRef ); + virtual ~wxMacDeferredWindowDeleter(); + +protected : + WindowRef m_macWindow ; +} ; + +#endif // wxUSE_GUI + +#define wxMAC_DEFINE_PROC_GETTER( UPP , x ) \ +UPP Get##x() \ +{ \ + static UPP sHandler = NULL; \ + if ( sHandler == NULL ) \ + sHandler = New##UPP( x ); \ + return sHandler; \ +} + +//--------------------------------------------------------------------------- +// wxMac string conversions +//--------------------------------------------------------------------------- + +void wxMacSetupConverters(); +void wxMacCleanupConverters(); + +WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to ); +WXDLLIMPEXP_BASE wxString wxMacMakeStringFromPascal( ConstStringPtr from ); + +// filefn.cpp + +WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL ); +WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ); +WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname ); + +#if wxUSE_GUI + +// deprecating QD + +void wxMacLocalToGlobal( WindowRef window , Point*pt ); +void wxMacGlobalToLocal( WindowRef window , Point*pt ); + +#endif + +//--------------------------------------------------------------------------- +// cocoa bridging utilities +//--------------------------------------------------------------------------- + +bool wxMacInitCocoa(); + +class WXDLLIMPEXP_CORE wxMacAutoreleasePool +{ +public : + wxMacAutoreleasePool(); + ~wxMacAutoreleasePool(); +private : + void* m_pool; +}; + +// NSObject + +void wxMacCocoaRelease( void* obj ); +void wxMacCocoaAutorelease( void* obj ); +void wxMacCocoaRetain( void* obj ); + +#if wxMAC_USE_COCOA + +// NSCursor + +WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type ); +WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY ); +void wxMacCocoaSetCursor( WX_NSCursor cursor ); +void wxMacCocoaHideCursor(); +void wxMacCocoaShowCursor(); + +typedef struct tagClassicCursor +{ + wxUint16 bits[16]; + wxUint16 mask[16]; + wxInt16 hotspot[2]; +}ClassicCursor; + +#else // !wxMAC_USE_COCOA + +// non Darwin + +typedef Cursor ClassicCursor; + +#endif // wxMAC_USE_COCOA + +// ------------- +// Common to all +// ------------- + +// Cursor support + +const short kwxCursorBullseye = 0; +const short kwxCursorBlank = 1; +const short kwxCursorPencil = 2; +const short kwxCursorMagnifier = 3; +const short kwxCursorNoEntry = 4; +const short kwxCursorPaintBrush = 5; +const short kwxCursorPointRight = 6; +const short kwxCursorPointLeft = 7; +const short kwxCursorQuestionArrow = 8; +const short kwxCursorRightArrow = 9; +const short kwxCursorSizeNS = 10; +const short kwxCursorSize = 11; +const short kwxCursorSizeNESW = 12; +const short kwxCursorSizeNWSE = 13; +const short kwxCursorRoller = 14; +const short kwxCursorLast = kwxCursorRoller; + +// exposing our fallback cursor map + +extern ClassicCursor gMacCursors[]; + +#endif + // _WX_PRIVATE_H_ diff --git a/include/wx/osx/carbon/private/mactext.h b/include/wx/osx/carbon/private/mactext.h new file mode 100644 index 0000000000..2ef0cbcaed --- /dev/null +++ b/include/wx/osx/carbon/private/mactext.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: mactext.h +// Purpose: private wxMacTextControl base class +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// RCS-ID: $Id: +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_PRIVATE_MACTEXT_H_ +#define _WX_MAC_PRIVATE_MACTEXT_H_ + +#include "wx/mac/private.h" + +// common interface for all implementations +class wxMacTextControl : public wxMacControl +{ +public : + wxMacTextControl( wxTextCtrl *peer ) ; + virtual ~wxMacTextControl() ; + + virtual wxString GetStringValue() const = 0 ; + virtual void SetStringValue( const wxString &val ) = 0 ; + virtual void SetSelection( long from, long to ) = 0 ; + virtual void GetSelection( long* from, long* to ) const = 0 ; + virtual void WriteText( const wxString& str ) = 0 ; + + virtual void SetStyle( long start, long end, const wxTextAttr& style ) ; + virtual void Copy() ; + virtual void Cut() ; + virtual void Paste() ; + virtual bool CanPaste() const ; + virtual void SetEditable( bool editable ) ; + virtual wxTextPos GetLastPosition() const ; + virtual void Replace( long from, long to, const wxString &str ) ; + virtual void Remove( long from, long to ) ; + + + virtual bool HasOwnContextMenu() const + { return false ; } + + virtual bool SetupCursor( const wxPoint& WXUNUSED(pt) ) + { return false ; } + + virtual void Clear() ; + virtual bool CanUndo() const; + virtual void Undo() ; + virtual bool CanRedo() const; + virtual void Redo() ; + virtual int GetNumberOfLines() const ; + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const ; + virtual void ShowPosition(long WXUNUSED(pos)) ; + virtual int GetLineLength(long lineNo) const ; + virtual wxString GetLineText(long lineNo) const ; + virtual void CheckSpelling(bool WXUNUSED(check)) { } + virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ); +} ; + +class wxMacUnicodeTextControl : public wxMacTextControl +{ +public : + wxMacUnicodeTextControl( wxTextCtrl *wxPeer ) ; + wxMacUnicodeTextControl( wxTextCtrl *wxPeer, + const wxString& str, + const wxPoint& pos, + const wxSize& size, long style ) ; + virtual ~wxMacUnicodeTextControl(); + + virtual bool Create( wxTextCtrl *wxPeer, + const wxString& str, + const wxPoint& pos, + const wxSize& size, long style ) ; + virtual void VisibilityChanged(bool shown); + virtual wxString GetStringValue() const ; + virtual void SetStringValue( const wxString &str) ; + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual bool CanPaste() const; + virtual void SetEditable(bool editable) ; + virtual void GetSelection( long* from, long* to) const ; + virtual void SetSelection( long from , long to ) ; + virtual void WriteText(const wxString& str) ; + +protected : + virtual void CreateControl( wxTextCtrl* peer, const Rect* bounds, CFStringRef cfr ); + + // contains the tag for the content (is different for password and non-password controls) + OSType m_valueTag ; +public : + ControlEditTextSelectionRec m_selection ; +}; + +#endif // _WX_MAC_PRIVATE_MACTEXT_H_ diff --git a/include/wx/osx/carbon/private/overlay.h b/include/wx/osx/carbon/private/overlay.h new file mode 100644 index 0000000000..002da9a338 --- /dev/null +++ b/include/wx/osx/carbon/private/overlay.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/private/overlay.h +// Purpose: wxOverlayImpl declaration +// Author: Stefan Csomor +// Modified by: +// Created: 2006-10-20 +// RCS-ID: $Id$ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_CARBON_PRIVATE_OVERLAY_H_ +#define _WX_MAC_CARBON_PRIVATE_OVERLAY_H_ + +#include "wx/mac/private.h" +#include "wx/toplevel.h" +#include "wx/graphics.h" + +class wxOverlayImpl +{ +public: + wxOverlayImpl() ; + ~wxOverlayImpl() ; + + + // clears the overlay without restoring the former state + // to be done eg when the window content has been changed and repainted + void Reset(); + + // returns true if it has been setup + bool IsOk(); + + void Init( wxDC* dc, int x , int y , int width , int height ); + + void BeginDrawing( wxDC* dc); + + void EndDrawing( wxDC* dc); + + void Clear( wxDC* dc); + +private: + OSStatus CreateOverlayWindow(); + + void MacGetBounds( Rect *bounds ); + + WindowRef m_overlayWindow; + WindowRef m_overlayParentWindow; + CGContextRef m_overlayContext ; + // we store the window in case we would have to issue a Refresh() + wxWindow* m_window ; + + int m_x ; + int m_y ; + int m_width ; + int m_height ; +} ; + +#endif // _WX_MAC_CARBON_PRIVATE_OVERLAY_H_ diff --git a/include/wx/osx/carbon/private/print.h b/include/wx/osx/carbon/private/print.h new file mode 100644 index 0000000000..d4d8c2582e --- /dev/null +++ b/include/wx/osx/carbon/private/print.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/private/print.h +// Purpose: private implementation for printing on MacOS +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_PRIVATE_PRINT_H_ +#define _WX_MAC_PRIVATE_PRINT_H_ + +#include "wx/cmndata.h" +#include "wx/print.h" +#include "ApplicationServices/ApplicationServices.h" + +class WXDLLIMPEXP_CORE wxMacCarbonPrintData : public wxPrintNativeDataBase +{ +public : + wxMacCarbonPrintData() ; + virtual ~wxMacCarbonPrintData() ; + + virtual bool TransferTo( wxPrintData &data ); + virtual bool TransferFrom( const wxPrintData &data ); + + virtual bool IsOk() const ; + + virtual void TransferFrom( wxPageSetupDialogData * ) ; + virtual void TransferTo( wxPageSetupDialogData * ) ; + + virtual void TransferFrom( wxPrintDialogData * ) ; + virtual void TransferTo( wxPrintDialogData * ) ; +private : + virtual void ValidateOrCreate() ; +public : + PMPrintSession m_macPrintSession ; + PMPageFormat m_macPageFormat ; + PMPrintSettings m_macPrintSettings ; +private: + DECLARE_DYNAMIC_CLASS(wxMacCarbonPrintData) +} ; + +#endif // _WX_MAC_PRIVATE_PRINT_H_ diff --git a/include/wx/osx/carbon/private/timer.h b/include/wx/osx/carbon/private/timer.h new file mode 100644 index 0000000000..53a0af85aa --- /dev/null +++ b/include/wx/osx/carbon/private/timer.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/private/timer.h +// Purpose: wxTimer class +// Author: Stefan Csomor +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_PRIVATE_TIMER_H_ +#define _WX_MAC_PRIVATE_TIMER_H_ + +#include "wx/private/timer.h" + +struct MacTimerInfo; + +class WXDLLIMPEXP_CORE wxCarbonTimerImpl : public wxTimerImpl +{ +public: + wxCarbonTimerImpl(wxTimer *timer); + virtual ~wxCarbonTimerImpl(); + + virtual bool Start(int milliseconds = -1, bool one_shot = false); + virtual void Stop(); + + virtual bool IsRunning() const; + +private: + MacTimerInfo *m_info; +}; + +#endif // _WX_MAC_PRIVATE_TIMER_H_ diff --git a/include/wx/osx/carbon/radiobox.h b/include/wx/osx/carbon/radiobox.h new file mode 100644 index 0000000000..ac0747ff24 --- /dev/null +++ b/include/wx/osx/carbon/radiobox.h @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// 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) ; + +// 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 new file mode 100644 index 0000000000..6514d218e7 --- /dev/null +++ b/include/wx/osx/carbon/radiobut.h @@ -0,0 +1,92 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 + + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + void Command(wxCommandEvent& event); + wxRadioButton *AddInCycle(wxRadioButton *cycle); + void RemoveFromCycle(); + inline wxRadioButton *NextInCycle() {return m_cycle;} + + 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/region.h b/include/wx/osx/carbon/region.h new file mode 100644 index 0000000000..480109a8ee --- /dev/null +++ b/include/wx/osx/carbon/region.h @@ -0,0 +1,100 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: region.h +// Purpose: wxRegion class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_CARBON_REGION_H_ +#define _WX_MAC_CARBON_REGION_H_ + +#include "wx/list.h" + +class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine +{ +public: + wxRegion(long x, long y, long w, long h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion( WXHRGN hRegion ); + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); + wxRegion(); + wxRegion(const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion(const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // wxRegionBase methods + virtual void Clear(); + virtual bool IsEmpty() const; + + // Internal + const WXHRGN GetWXHRGN() const ; + +protected: + virtual wxGDIRefData *CreateGDIRefData() const; + virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; + + virtual bool DoIsEqual(const wxRegion& region) const; + virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; + virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; + virtual wxRegionContain DoContainsRect(const wxRect& rect) const; + + virtual bool DoOffset(wxCoord x, wxCoord y); + virtual bool DoCombine(const wxRegion& region, wxRegionOp op); + +private: + DECLARE_DYNAMIC_CLASS(wxRegion) + friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; +}; + +class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject +{ +public: + wxRegionIterator(); + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& iterator); + virtual ~wxRegionIterator(); + + wxRegionIterator& operator=(const wxRegionIterator& iterator); + + void Reset() { m_current = 0; } + void Reset(const wxRegion& region); + + operator bool () const { return m_current < m_numRects; } + bool HaveRects() const { return m_current < m_numRects; } + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + long GetX() const; + long GetY() const; + long GetW() const; + long GetWidth() const { return GetW(); } + long GetH() const; + long GetHeight() const { return GetH(); } + wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } + +private: + void SetRects(long numRects, wxRect *rects); + + long m_current; + long m_numRects; + wxRegion m_region; + wxRect* m_rects; + + DECLARE_DYNAMIC_CLASS(wxRegionIterator) +}; + +#endif // _WX_MAC_CARBON_REGION_H_ diff --git a/include/wx/osx/carbon/scrolbar.h b/include/wx/osx/carbon/scrolbar.h new file mode 100644 index 0000000000..b699adafcb --- /dev/null +++ b/include/wx/osx/carbon/scrolbar.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// 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); + virtual void MacHandleControlClick( WXWidget control , + wxInt16 controlpart , + bool mouseStillDown ) ; + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , + WXEVENTREF mevent ) ; + +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 new file mode 100644 index 0000000000..04dc08a6d0 --- /dev/null +++ b/include/wx/osx/carbon/slider.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// 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); + virtual wxInt32 MacControlHit(WXEVENTHANDLERREF handler, WXEVENTREF event); + 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 new file mode 100644 index 0000000000..670b170b9e --- /dev/null +++ b/include/wx/osx/carbon/sound.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..f7cdb58006 --- /dev/null +++ b/include/wx/osx/carbon/spinbutt.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 int GetMin() const; + virtual int GetMax() const; + virtual int GetValue() const; + virtual void SetValue(int val); + virtual void SetRange(int minVal, int maxVal); + + // implementation + + virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; + virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + +protected: + void MacHandleValueChanged( int inc ) ; + virtual wxSize DoGetBestSize() const; + int m_value ; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinButton) +}; + +#endif + // _WX_SPINBUTT_H_ diff --git a/include/wx/osx/carbon/spinctrl.h b/include/wx/osx/carbon/spinctrl.h new file mode 100644 index 0000000000..38fd7a9bff --- /dev/null +++ b/include/wx/osx/carbon/spinctrl.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..eba88ccc43 --- /dev/null +++ b/include/wx/osx/carbon/srchctrl.h @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxMacSearchFieldControl; + +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 wxInt32 MacSearchFieldSearchHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + virtual wxInt32 MacSearchFieldCancelHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + + wxMacSearchFieldControl * GetPeer() const + { return (wxMacSearchFieldControl*) m_peer; } + + virtual void SetFocus(); + +protected: + + wxSize DoGetBestSize() const; + + void Init(); + + virtual void CreatePeer( + const wxString& str, + const wxPoint& pos, + const wxSize& size, long style ); + + wxMenu *m_menu; + +private: + DECLARE_DYNAMIC_CLASS(wxSearchCtrl) + + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_SEARCHCTRL + +#endif // _WX_SEARCHCTRL_H_ + diff --git a/include/wx/osx/carbon/statbmp.h b/include/wx/osx/carbon/statbmp.h new file mode 100644 index 0000000000..17d38360f5 --- /dev/null +++ b/include/wx/osx/carbon/statbmp.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbmp.h +// Purpose: wxStaticBitmap class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#include "wx/icon.h" + +class WXDLLIMPEXP_CORE wxStaticBitmap: public wxStaticBitmapBase +{ + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + public: + wxStaticBitmap() { } + + wxStaticBitmap(wxWindow *parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxBitmap& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual void SetBitmap(const wxBitmap& bitmap); + + virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; + virtual void ProcessCommand(wxCommandEvent& WXUNUSED(event)) {}; + void OnPaint( wxPaintEvent &event ) ; + + wxBitmap GetBitmap() const { return m_bitmap; } + wxIcon GetIcon() const + { + // icons and bitmaps are really the same thing in wxMac + return (const wxIcon &)m_bitmap; + } + void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; } + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return FALSE; } + + protected: + virtual wxSize DoGetBestSize() const; + + wxBitmap m_bitmap; + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_STATBMP_H_ diff --git a/include/wx/osx/carbon/statbox.h b/include/wx/osx/carbon/statbox.h new file mode 100644 index 0000000000..7c1c2204cf --- /dev/null +++ b/include/wx/osx/carbon/statbox.h @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// 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; } +}; + +#endif + // _WX_STATBOX_H_ diff --git a/include/wx/osx/carbon/statline.h b/include/wx/osx/carbon/statline.h new file mode 100644 index 0000000000..29de9f2a54 --- /dev/null +++ b/include/wx/osx/carbon/statline.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..fc69ab3457 --- /dev/null +++ b/include/wx/osx/carbon/stattext.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..81ee10257c --- /dev/null +++ b/include/wx/osx/carbon/statusbr.h @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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/tabctrl.h b/include/wx/osx/carbon/tabctrl.h new file mode 100644 index 0000000000..30cf54fbc1 --- /dev/null +++ b/include/wx/osx/carbon/tabctrl.h @@ -0,0 +1,154 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tabctrl.h +// Purpose: wxTabCtrl class +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TABCTRL_H_ +#define _WX_TABCTRL_H_ + +#include "wx/control.h" + +class wxImageList; + +/* + * Flags returned by HitTest + */ + +#define wxTAB_HITTEST_NOWHERE 1 +#define wxTAB_HITTEST_ONICON 2 +#define wxTAB_HITTEST_ONLABEL 4 +#define wxTAB_HITTEST_ONITEM 6 + +class WXDLLIMPEXP_CORE wxTabCtrl: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxTabCtrl) + public: + /* + * Public interface + */ + + wxTabCtrl(); + + inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")) + { + Create(parent, id, pos, size, style, name); + } + virtual ~wxTabCtrl(); + +// Accessors + + // Get the selection + int GetSelection() const; + + // Get the tab with the current keyboard focus + int GetCurFocus() const; + + // Get the associated image list + wxImageList* GetImageList() const; + + // Get the number of items + int GetItemCount() const; + + // Get the rect corresponding to the tab + bool GetItemRect(int item, wxRect& rect) const; + + // Get the number of rows + int GetRowCount() const; + + // Get the item text + wxString GetItemText(int item) const ; + + // Get the item image + int GetItemImage(int item) const; + + // Get the item data + void* GetItemData(int item) const; + + // Set the selection + int SetSelection(int item); + + // Set the image list + void SetImageList(wxImageList* imageList); + + // Set the text for an item + bool SetItemText(int item, const wxString& text); + + // Set the image for an item + bool SetItemImage(int item, int image); + + // Set the data for an item + bool SetItemData(int item, void* data); + + // Set the size for a fixed-width tab control + void SetItemSize(const wxSize& size); + + // Set the padding between tabs + void SetPadding(const wxSize& padding); + +// Operations + + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")); + + // Delete all items + bool DeleteAllItems(); + + // Delete an item + bool DeleteItem(int item); + + // Hit test + int HitTest(const wxPoint& pt, long& flags); + + // Insert an item + bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); + + void Command(wxCommandEvent& event); + +protected: + wxImageList* m_imageList; + +DECLARE_EVENT_TABLE() +}; + +class WXDLLIMPEXP_CORE wxTabEvent : public wxNotifyEvent +{ +public: + wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = -1, int nOldSel = -1) + : wxNotifyEvent(commandType, id) + { + m_nSel = nSel; + m_nOldSel = nOldSel; + } + + // accessors + // the currently selected page (-1 if none) + int GetSelection() const { return m_nSel; } + void SetSelection(int nSel) { m_nSel = nSel; } + // the page that was selected before the change (-1 if none) + int GetOldSelection() const { return m_nOldSel; } + void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } + +private: + int m_nSel, // currently selected page + m_nOldSel; // previously selected page + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent) +}; + +typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); + +#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \ + id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), +#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \ + id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL), + +#endif + // _WX_TABCTRL_H_ diff --git a/include/wx/osx/carbon/taskbarosx.h b/include/wx/osx/carbon/taskbarosx.h new file mode 100644 index 0000000000..6f86eecf51 --- /dev/null +++ b/include/wx/osx/carbon/taskbarosx.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////// +// 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 +// , CUSTOM_STATUSITEM +// , 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 new file mode 100644 index 0000000000..a2f5956328 --- /dev/null +++ b/include/wx/osx/carbon/textctrl.h @@ -0,0 +1,215 @@ +///////////////////////////////////////////////////////////////////////////// +// 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" + +class wxMacTextControl; + + +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 MacCanFocus() const + { return true; } + + virtual bool MacSetupCursor( const wxPoint& pt ); + + virtual void MacVisibilityChanged(); + virtual void MacSuperChangedPosition(); + virtual void MacCheckSpelling(bool check); + + wxMacTextControl * GetPeer() const + { return (wxMacTextControl*) m_peer; } + +protected: + // common part of all ctors + void Init(); + + virtual wxSize DoGetBestSize() const; + + virtual void CreatePeer(const wxString& str, const wxPoint& pos, const wxSize& size, long style ); + + 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 new file mode 100644 index 0000000000..0091fbc8f0 --- /dev/null +++ b/include/wx/osx/carbon/tglbtn.h @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + + virtual void Command(wxCommandEvent& event); + +private: + wxBitmap m_bitmap; + +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 wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; + + 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 new file mode 100644 index 0000000000..efe961cdff --- /dev/null +++ b/include/wx/osx/carbon/toolbar.h @@ -0,0 +1,109 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 wxMAC_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 wxMAC_USE_NATIVE_TOOLBAR + bool m_macUsesNativeToolbar ; + void* m_macHIToolbarRef ; +#endif +}; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TOOLBAR_H_ diff --git a/include/wx/osx/carbon/tooltip.h b/include/wx/osx/carbon/tooltip.h new file mode 100644 index 0000000000..df51d47ffb --- /dev/null +++ b/include/wx/osx/carbon/tooltip.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 new file mode 100644 index 0000000000..d5e11e79ce --- /dev/null +++ b/include/wx/osx/carbon/toplevel.h @@ -0,0 +1,86 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 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; + + void *m_macFullScreenData ; +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 new file mode 100644 index 0000000000..a8c92b288f --- /dev/null +++ b/include/wx/osx/carbon/treectrl.h @@ -0,0 +1,291 @@ +///////////////////////////////////////////////////////////////////////////// +// 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/uma.h b/include/wx/osx/carbon/uma.h new file mode 100644 index 0000000000..78a34d3fa3 --- /dev/null +++ b/include/wx/osx/carbon/uma.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/carbon/uma.h +// Purpose: Universal MacOS API +// Author: Stefan Csomor +// Modified by: +// Created: 03/02/99 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef H_UMA +#define H_UMA + +#include "wx/mac/private.h" + +void UMAInitToolbox( UInt16 inMoreMastersCalls, bool isEmbedded) ; +long UMAGetSystemVersion() ; + +#if wxUSE_GUI + +// menu manager + +MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding) ; +void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding encoding) ; +void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ; + +void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , SInt16 submenuid ) ; +void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , SInt16 submenuid ) ; +void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , wxAcceleratorEntry *entry = NULL ) ; +void UMAInsertMenuItem( MenuRef menu , const wxString& title , wxFontEncoding encoding , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ; +void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ; + +void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title , wxFontEncoding encoding ) ; + +// Retrieves the Help menu handle. Warning: As a side-effect this functions also +// creates the Help menu if it didn't exist yet. +OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */ + +// Same as UMAGetHelpMenu, but doesn't create the Help menu if UMAGetHelpMenu hasn't been called yet. +OSStatus UMAGetHelpMenuDontCreate( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex); /* can be NULL */ + +#endif // wxUSE_GUI + +#endif diff --git a/include/wx/osx/carbon/window.h b/include/wx/osx/carbon/window.h new file mode 100644 index 0000000000..0092b70fc7 --- /dev/null +++ b/include/wx/osx/carbon/window.h @@ -0,0 +1,350 @@ +///////////////////////////////////////////////////////////////////////////// +// 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_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 ); + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); + + 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 MacRootWindowToClient( int *x , int *y ) const; + + void MacWindowToRootWindow( int *x , int *y ) const; + void MacWindowToRootWindow( short *x , short *y ) const; + + void MacRootWindowToWindow( int *x , int *y ) const; + void MacRootWindowToWindow( short *x , short *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 ) ; + virtual bool MacCanFocus() const ; + + // 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); + } + + virtual void MacInstallEventHandler(WXWidget native) ; + void MacPostControlCreate(const wxPoint& pos, const wxSize& size) ; + wxList& GetSubcontrols() { return m_subControls; } + WXEVENTHANDLERREF MacGetControlEventHandler() { return m_macControlEventHandler ; } + + // 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 ; + + // calculates the real window position and size from the native control + void MacGetPositionAndSizeFromControl(int& x, int& y, + int& w, int& h) const ; + + // gets the inset from every part + virtual void MacGetContentAreaInset( int &left , int &top , int &right , int &bottom ) ; + + // visibly flash the current invalid area: + // useful for debugging in OSX composited (double-buffered) situation + void MacFlashInvalidAreas() ; + + // the 'true' OS level control for this wxWindow + wxMacControl* GetPeer() const { return m_peer ; } + + void * MacGetCGContextRef() { return m_cgContextRef ; } + void MacSetCGContextRef(void * cg) { m_cgContextRef = cg ; } + +protected: + // For controls like radio buttons which are genuinely composite + wxList m_subControls; + + // the peer object, allowing for cleaner API support + wxMacControl * m_peer ; + + 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(); + + + WXEVENTHANDLERREF m_macControlEventHandler ; + + 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 new file mode 100644 index 0000000000..f7f7bf2de1 --- /dev/null +++ b/include/wx/osx/checkbox.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/checkbox.h" +#else +#include "wx/mac/carbon/checkbox.h" +#endif diff --git a/include/wx/osx/checklst.h b/include/wx/osx/checklst.h new file mode 100644 index 0000000000..098262d5fe --- /dev/null +++ b/include/wx/osx/checklst.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/checklst.h" +#else +#include "wx/mac/carbon/checklst.h" +#endif diff --git a/include/wx/osx/chkconf.h b/include/wx/osx/chkconf.h new file mode 100644 index 0000000000..916c162574 --- /dev/null +++ b/include/wx/osx/chkconf.h @@ -0,0 +1,34 @@ +/* + * Name: wx/mac/chkconf.h + * Purpose: Mac-specific config settings checks + * Author: Vadim Zeitlin + * Modified by: + * Created: 2005-04-05 (extracted from wx/chkconf.h) + * RCS-ID: $Id$ + * Copyright: (c) 2005 Vadim Zeitlin + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#if wxUSE_UNICODE +# if !TARGET_CARBON +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_UNICODE is only supported for Carbon Targets." +# else +# define wxUSE_UNICODE 0 +# endif +# endif +#endif + +#if wxUSE_STACKWALKER + /* not supported under Mac */ +# undef wxUSE_STACKWALKER +# define wxUSE_STACKWALKER 0 +#endif /* wxUSE_STACKWALKER */ + +#ifdef __WXMAC_CLASSIC__ +# include "wx/mac/classic/chkconf.h" +#else +# include "wx/mac/carbon/chkconf.h" +#endif diff --git a/include/wx/osx/choice.h b/include/wx/osx/choice.h new file mode 100644 index 0000000000..c1dc2abdda --- /dev/null +++ b/include/wx/osx/choice.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/choice.h" +#else +#include "wx/mac/carbon/choice.h" +#endif diff --git a/include/wx/osx/clipbrd.h b/include/wx/osx/clipbrd.h new file mode 100644 index 0000000000..5ee122ba68 --- /dev/null +++ b/include/wx/osx/clipbrd.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/clipbrd.h" +#else +#include "wx/mac/carbon/clipbrd.h" +#endif diff --git a/include/wx/osx/colordlg.h b/include/wx/osx/colordlg.h new file mode 100644 index 0000000000..c6a3ac6447 --- /dev/null +++ b/include/wx/osx/colordlg.h @@ -0,0 +1,6 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/colordlg.h" +#else +#include "wx/mac/carbon/colordlg.h" +#endif + diff --git a/include/wx/osx/colour.h b/include/wx/osx/colour.h new file mode 100644 index 0000000000..6f42a76fa0 --- /dev/null +++ b/include/wx/osx/colour.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/colour.h" +#else +#include "wx/mac/carbon/colour.h" +#endif diff --git a/include/wx/osx/combobox.h b/include/wx/osx/combobox.h new file mode 100644 index 0000000000..f4d0125ef4 --- /dev/null +++ b/include/wx/osx/combobox.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/combobox.h" +#else +#include "wx/mac/carbon/combobox.h" +#endif diff --git a/include/wx/osx/config_xcode.h b/include/wx/osx/config_xcode.h new file mode 100644 index 0000000000..7ea37fdb7a --- /dev/null +++ b/include/wx/osx/config_xcode.h @@ -0,0 +1,137 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: config_xcode.pch +// Purpose: configurations for xcode builds +// Author: Stefan Csomor +// Modified by: +// Created: 29.04.04 +// RCS-ID: $Id$ +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// from config.log confdefs + +#define HAVE_SSIZE_T 1 +#define STDC_HEADERS 1 +#if __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#define wxUSE_UNIX 1 +#define __UNIX__ 1 +#define __BSD__ 1 +#define __DARWIN__ 1 +#define wx_USE_NANOX 0 +#define TARGET_CARBON 1 + +#define HAVE_BOOL 1 +#define HAVE_EXPLICIT 1 +#define HAVE_CONST_CAST +#define HAVE_REINTERPRET_CAST +#define HAVE_STATIC_CAST +#define HAVE_VA_COPY 1 +#define HAVE_VARIADIC_MACROS 1 +#define CONST_COMPATIBILITY 0 +#define WX_TIMEZONE timezone +#define WX_SOCKLEN_T socklen_t +#define SOCKOPTLEN_T socklen_t +#define WX_STATFS_T struct statfs +#define wxTYPE_SA_HANDLER int +#define WX_GMTOFF_IN_TM 1 +#define HAVE_PW_GECOS 1 +#define HAVE_DLOPEN 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_FSYNC 1 +#define HAVE_SCHED_YIELD 1 +#define HAVE_PTHREAD_MUTEXATTR_T 1 +#define HAVE_PTHREAD_MUTEXATTR_SETTYPE_DECL 1 +#define HAVE_PTHREAD_CANCEL 1 +#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1 +#define HAVE_SNPRINTF 1 +#define HAVE_SNPRINTF_DECL 1 +#define HAVE_UNIX98_PRINTF 1 +#define HAVE_STATFS 1 +#define HAVE_STATFS_DECL 1 +#define HAVE_STRPTIME 1 +#define HAVE_STRPTIME_DECL 1 +#define HAVE_THREAD_PRIORITY_FUNCTIONS 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_VSNPRINTF_DECL 1 +#define HAVE_USLEEP 1 +#define HAVE_WCSLEN 1 +#define SIZEOF_WCHAR_T 4 +#define SIZEOF_SHORT 2 +#define SIZEOF_INT 4 +#ifdef __LP64__ +#define SIZEOF_VOID_P 8 +#define SIZEOF_LONG 8 +#define SIZEOF_SIZE_T 8 +#else +#define SIZEOF_VOID_P 4 +#define SIZEOF_LONG 4 +#define SIZEOF_SIZE_T 4 +#endif + +#define SIZEOF_LONG_LONG 8 +#define wxSIZE_T_IS_ULONG 1 +#define HAVE_FCNTL 1 +#define HAVE_GETHOSTBYNAME 1 +#define HAVE_GETSERVBYNAME 1 +#define HAVE_GMTIME_R 1 +#define HAVE_INET_ADDR 1 +#define HAVE_INET_ATON 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_MKSTEMP 1 +#define HAVE_PUTENV 1 +#define HAVE_STRTOK_R 1 +#define HAVE_UNAME 1 +#define HAVE_USLEEP 1 +#define HAVE_X11_XKBLIB_H 1 +#define HAVE_SCHED_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_WCHAR_H 1 +/* better to use the built-in CF conversions, also avoid iconv versioning problems */ +/* #undef HAVE_ICONV */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 +#define ICONV_CONST const +#else +#define ICONV_CONST +#endif +#define HAVE_LANGINFO_H 1 +#define HAVE_WCSRTOMBS 1 +#define HAVE_FPUTWS 1 +#define HAVE_STRCASECMP_IN_STRING_H 1 +#define HAVE_WPRINTF 1 +#define HAVE_VSWPRINTF 1 +#define HAVE_VSWSCANF 1 +#define HAVE_FSEEKO 1 +#define HAVE_SYS_SELECT_H 1 + +#define WXWIN_OS_DESCRIPTION "Darwin 7.9.0 Power Macintosh" +#define PACKAGE_BUGREPORT "wx-dev@lists.wxwidgets.org" +#define PACKAGE_NAME "wxWidgets" +#define PACKAGE_STRING "wxWidgets 2.9.0" +#define PACKAGE_TARNAME "wxwidgets" +#define PACKAGE_VERSION "2.9.0" + +// for regex +#define WX_NO_REGEX_ADVANCED 1 + +// for jpeg + +#define HAVE_STDLIB_H 1 + +// OBSOLETE ? + +#define HAVE_COS 1 +#define HAVE_FLOOR 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_MEMORY_H 1 + +#define HAVE_REGCOMP 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_X11_XLIB_H 1 +#define SOCKLEN_T socklen_t +#define _FILE_OFFSET_BITS 64 diff --git a/include/wx/osx/control.h b/include/wx/osx/control.h new file mode 100644 index 0000000000..e98814a856 --- /dev/null +++ b/include/wx/osx/control.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/control.h" +#else +#include "wx/mac/carbon/control.h" +#endif diff --git a/include/wx/osx/core/cfdataref.h b/include/wx/osx/core/cfdataref.h new file mode 100644 index 0000000000..19a44d71a8 --- /dev/null +++ b/include/wx/osx/core/cfdataref.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/corefoundation/cfdata.h +// Purpose: wxCFDataRef class +// Author: Stefan Csomor +// Modified by: +// Created: 2007/05/10 +// RCS-ID: $Id: cfdataref.h 46095 2007-05-18 07:29:49Z SC $ +// Copyright: (c) 2007 Stefan Csomor +// Licence: wxWindows licence +// Notes: See http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFBinaryData/index.html +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/mac/corefoundation/cfref.h + @abstract wxCFDataRef template class +*/ + +#ifndef _WX_MAC_COREFOUNDATION_CFDATAREF_H__ +#define _WX_MAC_COREFOUNDATION_CFDATAREF_H__ + +#include "wx/mac/corefoundation/cfref.h" + +#include + +/*! @class wxCFDataRef + @discussion Properly retains/releases reference to CoreFoundation data objects +*/ +class wxCFDataRef : public wxCFRef< CFDataRef > +{ +public: + /*! @method wxCFDataRef + @abstract Creates a NULL data ref + */ + wxCFDataRef() + {} + + typedef wxCFRef super_type; + + /*! @method wxCFDataRef + @abstract Assumes ownership of p and creates a reference to it. + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of. May be NULL. + @discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends + to transfer ownership of that reference to this ref holder. If the object comes from + a Create or Copy method then this is the correct behavior. If the object comes from + a Get method then you must CFRetain it yourself before passing it to this constructor. + A handy way to do this is to use the non-member wxCFRefFromGet factory funcion. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + explicit wxCFDataRef(CFDataRef r) + : super_type(r) + {} + + /*! @method wxCFDataRef + @abstract Copies a ref holder of the same type + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + wxCFDataRef(const wxCFDataRef& otherRef) + : super_type( otherRef ) + {} + + /*! @method wxCFDataRef + @abstract Copies raw data into a data ref + @param data The raw data. + @param length The data length. + */ + wxCFDataRef(const UInt8* data, CFIndex length) + : super_type(CFDataCreate(kCFAllocatorDefault, data, length)) + { + } + + /*! @method GetLength + @abstract returns the length in bytes of the data stored + */ + CFIndex GetLength() const + { + if ( m_ptr ) + return CFDataGetLength( *this ); + else + return 0; + } + + /*! @method GetBytes + @abstract Copies the data into an external buffer + @param range The desired range. + @param buffer The target buffer. + */ + void GetBytes( CFRange range, UInt8 *buffer ) const + { + if ( m_ptr ) + CFDataGetBytes(m_ptr, range, buffer); + } +}; + +#endif //ifndef _WX_MAC_COREFOUNDATION_CFDATAREF_H__ + diff --git a/include/wx/osx/core/cfref.h b/include/wx/osx/core/cfref.h new file mode 100644 index 0000000000..f5251ab1c0 --- /dev/null +++ b/include/wx/osx/core/cfref.h @@ -0,0 +1,389 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/corefoundation/cfref.h +// Purpose: wxCFRef template class +// Author: David Elliott +// Modified by: Stefan Csomor +// Created: 2007/05/10 +// RCS-ID: $Id$ +// Copyright: (c) 2007 David Elliott , Stefan Csomor +// Licence: wxWindows licence +// Notes: See http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/index.html +///////////////////////////////////////////////////////////////////////////// +/*! @header wx/mac/corefoundation/cfref.h + @abstract wxCFRef template class + @discussion FIXME: Convert doc tags to something less buggy with C++ +*/ + +#ifndef _WX_MAC_COREFOUNDATION_CFREF_H__ +#define _WX_MAC_COREFOUNDATION_CFREF_H__ + +// Include unistd to ensure that NULL is defined +#include +// Include AvailabilityMacros for DEPRECATED_ATTRIBUTE +#include + +// #include +/* Don't include CFBase.h such that this header can be included from public + * headers with minimal namespace pollution. + * Note that Darwin CF uses extern for CF_EXPORT. If we need this on Win32 + * or non-Darwin Mac OS we'll need to define the appropriate __declspec. + */ +typedef const void *CFTypeRef; +extern "C" { +extern /* CF_EXPORT */ +CFTypeRef CFRetain(CFTypeRef cf); +extern /* CF_EXPORT */ +void CFRelease(CFTypeRef cf); +} // extern "C" + + +/*! @function wxCFRelease + @abstract A CFRelease variant that checks for NULL before releasing. + @discussion The parameter is template not for type safety but to ensure the argument + is a raw pointer and not a ref holder of any type. +*/ +template +inline void wxCFRelease(Type *r) +{ + if ( r != NULL ) + ::CFRelease((CFTypeRef)r); +} + +/*! @function wxCFRetain + @abstract A typesafe CFRetain variant that checks for NULL. +*/ +template +inline Type* wxCFRetain(Type *r) +{ + // NOTE(DE): Setting r to the result of CFRetain improves efficiency on both x86 and PPC + // Casting r to CFTypeRef ensures we are calling the real C version defined in CFBase.h + // and not any possibly templated/overloaded CFRetain. + if ( r != NULL ) + r = (Type*)::CFRetain((CFTypeRef)r); + return r; +} + +template +class wxCFRef; + +/*! @class wxCFWeakRef + @templatefield refType The CF reference type (e.g. CFStringRef, CFRunLoopRef, etc.) + It should already be a pointer. This is different from + shared_ptr where the template parameter is the pointee type. + @discussion Wraps a raw pointer without any retain or release. + Provides a way to get what amounts to a raw pointer from a wxCFRef without + using a raw pointer. Unlike a raw pointer, constructing a wxCFRef from this + class will cause it to be retained because it is assumed that a wxCFWeakRef + does not own its pointer. +*/ +template +class wxCFWeakRef +{ + template + friend wxCFWeakRef static_cfref_cast(const wxCFRef &otherRef); +public: + /*! @method wxCFWeakRef + @abstract Creates a NULL reference + */ + wxCFWeakRef() + : m_ptr(NULL) + {} + + // Default copy constructor is fine. + // Default destructor is fine but we'll set NULL to avoid bugs + ~wxCFWeakRef() + { m_ptr = NULL; } + + // Do not implement a raw-pointer constructor. + + /*! @method wxCFWeakRef + @abstract Copies another ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by another wxCFWeakRef. + @param otherRef The other weak ref holder to copy. + @discussion This is merely a copy or implicit cast. + */ + template + wxCFWeakRef(const wxCFWeakRef& otherRef) + : m_ptr(otherRef.get()) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method wxCFWeakRef + @abstract Copies a strong ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by a wxCFRef. + @param otherRef The strong ref holder to copy. + @discussion This ref is merely a pointer copy, the strong ref still holds the pointer. + */ + template + wxCFWeakRef(const wxCFRef& otherRef) + : m_ptr(otherRef.get()) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method get + @abstract Explicit conversion to the underlying pointer type + @discussion Allows the caller to explicitly get the underlying pointer. + */ + refType get() const + { return m_ptr; } + + /*! @method operator refType + @abstract Implicit conversion to the underlying pointer type + @discussion Allows the ref to be used in CF function calls. + */ + operator refType() const + { return m_ptr; } + +protected: + /*! @method wxCFWeakRef + @abstract Constructs a weak reference to the raw pointer + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of. May be NULL. + @discussion This method is private so that the friend static_cfref_cast can use it + */ + template + explicit wxCFWeakRef(otherType *p) + : m_ptr(p) // Implicit conversion from otherType* to refType should occur. + {} + + /*! @var m_ptr The raw pointer. + */ + refType m_ptr; +}; + +/*! @class wxCFRef + @templatefield refType The CF reference type (e.g. CFStringRef, CFRunLoopRef, etc.) + It should already be a pointer. This is different from + shared_ptr where the template parameter is the pointee type. + @discussion Properly retains/releases reference to CoreFoundation objects +*/ +template +class wxCFRef +{ +public: + /*! @method wxCFRef + @abstract Creates a NULL reference + */ + wxCFRef() + : m_ptr(NULL) + {} + + /*! @method wxCFRef + @abstract Assumes ownership of p and creates a reference to it. + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of. May be NULL. + @discussion Like shared_ptr, it is assumed that the caller has a strong reference to p and intends + to transfer ownership of that reference to this ref holder. If the object comes from + a Create or Copy method then this is the correct behavior. If the object comes from + a Get method then you must CFRetain it yourself before passing it to this constructor. + A handy way to do this is to use the non-member wxCFRefFromGet factory funcion. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + template + explicit wxCFRef(otherType *p) + : m_ptr(p) // Implicit conversion from otherType* to refType should occur. + {} + + /*! @method wxCFRef + @abstract Copies a ref holder of the same type + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + wxCFRef(const wxCFRef& otherRef) + : m_ptr(wxCFRetain(otherRef.m_ptr)) + {} + + /*! @method wxCFRef + @abstract Copies a ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by another wxCFRef. + @param otherRef The other ref holder to copy. + @discussion Ownership will be shared by the original ref and the newly created ref. That is, + the object will be explicitly retained by this new ref. + */ + template + wxCFRef(const wxCFRef& otherRef) + : m_ptr(wxCFRetain(otherRef.get())) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method wxCFRef + @abstract Copies a weak ref holder where its type can be converted to ours + @templatefield otherRefType Any type held by a wxCFWeakRef. + @param otherRef The weak ref holder to copy. + @discussion Ownership will be taken by this newly created ref. That is, + the object will be explicitly retained by this new ref. + Ownership is most likely shared with some other ref as well. + */ + template + wxCFRef(const wxCFWeakRef& otherRef) + : m_ptr(wxCFRetain(otherRef.get())) // Implicit conversion from otherRefType to refType should occur + {} + + /*! @method ~wxCFRef + @abstract Releases (potentially shared) ownership of the ref. + @discussion A ref holder instance is always assumed to have ownership so ownership is always + released (CFRelease called) upon destruction. + */ + ~wxCFRef() + { reset(); } + + /*! @method operator= + @abstract Assigns the other ref's pointer to us when the otherRef is the same type. + @param otherRef The other ref holder to copy. + @discussion The incoming pointer is retained, the original pointer is released, and this object + is made to point to the new pointer. + */ + wxCFRef& operator=(const wxCFRef& otherRef) + { + wxCFRetain(otherRef.m_ptr); + wxCFRelease(m_ptr); + m_ptr = otherRef.m_ptr; + return *this; + } + + /*! @method operator= + @abstract Assigns the other ref's pointer to us when the other ref can be converted to our type. + @templatefield otherRefType Any type held by another wxCFRef + @param otherRef The other ref holder to copy. + @discussion The incoming pointer is retained, the original pointer is released, and this object + is made to point to the new pointer. + */ + template + wxCFRef& operator=(const wxCFRef& otherRef) + { + wxCFRetain(otherRef.get()); + wxCFRelease(m_ptr); + m_ptr = otherRef.get(); // Implicit conversion from otherRefType to refType should occur + return *this; + } + + /*! @method get + @abstract Explicit conversion to the underlying pointer type + @discussion Allows the caller to explicitly get the underlying pointer. + */ + refType get() const + { return m_ptr; } + + /*! @method operator refType + @abstract Implicit conversion to the underlying pointer type + @discussion Allows the ref to be used in CF function calls. + */ + operator refType() const + { return m_ptr; } + +#if 0 + < // HeaderDoc is retarded and thinks the GT from operator-> is part of a template param. + // So give it that < outside of a comment to fake it out. (if 0 is not a comment to HeaderDoc) +#endif + + /*! @method operator-> + @abstract Implicit conversion to the underlying pointer type + @discussion This is nearly useless for CF types which are nearly always opaque + */ + refType operator-> () const + { return m_ptr; } + + /*! @method reset + @abstract Nullifies the reference + @discussion Releases ownership (calls CFRelease) before nullifying the pointer. + */ + void reset() + { + wxCFRelease(m_ptr); + m_ptr = NULL; + } + + /*! @method reset + @abstract Sets this to a new reference + @templatefield otherType Any type. + @param p The raw pointer to assume ownership of + @discussion The existing reference is released (like destruction). It is assumed that the caller + has a strong reference to the new p and intends to transfer ownership of that reference + to this ref holder. Take care to call CFRetain if you received the object from a Get method. + This method is templated and takes an otherType *p. This prevents implicit conversion + using an operator refType() in a different ref-holding class type. + */ + template + void reset(otherType* p) + { + wxCFRelease(m_ptr); + m_ptr = p; // Automatic conversion should occur + } +protected: + /*! @var m_ptr The raw pointer. + */ + refType m_ptr; +}; + +/*! @function wxCFRefFromGet + @abstract Factory function to create wxCFRef from a raw pointer obtained from a Get-rule function + @param p The pointer to retain and create a wxCFRef from. May be NULL. + @discussion Unlike the wxCFRef raw pointer constructor, this function explicitly retains its + argument. This can be used for functions such as CFDictionaryGetValue() or + CFAttributedStringGetString() which return a temporary reference (Get-rule functions). + FIXME: Anybody got a better name? +*/ +template +inline wxCFRef wxCFRefFromGet(Type *p) +{ + return wxCFRef(wxCFRetain(p)); +} + +/*! @function static_cfref_cast + @abstract Works like static_cast but with a wxCFRef as the argument. + @param refType Template parameter. The destination raw pointer type + @param otherRef Normal parameter. The source wxCFRef<> object. + @discussion This is intended to be a clever way to make static_cast work while allowing + the return value to be converted to either a strong ref or a raw pointer + while ensuring that the retain count is updated appropriately. + + This is modeled after shared_ptr's static_pointer_cast. Just as wxCFRef is + parameterized on a pointer to an opaque type so is this class. Note that + this differs from shared_ptr which is parameterized on the pointee type. + + FIXME: Anybody got a better name? +*/ +template +inline wxCFWeakRef static_cfref_cast(const wxCFRef &otherRef); + +template +inline wxCFWeakRef static_cfref_cast(const wxCFRef &otherRef) +{ + return wxCFWeakRef(static_cast(otherRef.get())); +} + +/*! @function CFRelease + @abstract Overloads CFRelease so that the user is warned of bad behavior. + @discussion It is rarely appropriate to retain or release a wxCFRef. If one absolutely + must do it he can explicitly get() the raw pointer + Normally, this function is unimplemented resulting in a linker error if used. +*/ +template +inline void CFRelease(const wxCFRef & cfref) DEPRECATED_ATTRIBUTE; + +/*! @function CFRetain + @abstract Overloads CFRetain so that the user is warned of bad behavior. + @discussion It is rarely appropriate to retain or release a wxCFRef. If one absolutely + must do it he can explicitly get() the raw pointer + Normally, this function is unimplemented resulting in a linker error if used. +*/ +template +inline void CFRetain(const wxCFRef& cfref) DEPRECATED_ATTRIBUTE; + +// Change the 0 to a 1 if you want the functions to work (no link errors) +// Neither function will cause retain/release side-effects if implemented. +#if 0 +template +void CFRelease(const wxCFRef & cfref) +{ + CFRelease(cfref.get()); +} + +template +void CFRetain(const wxCFRef & cfref) +{ + CFRetain(cfref.get()); +} +#endif + +#endif //ndef _WX_MAC_COREFOUNDATION_CFREF_H__ + diff --git a/include/wx/osx/core/cfstring.h b/include/wx/osx/core/cfstring.h new file mode 100644 index 0000000000..c4b1719c4d --- /dev/null +++ b/include/wx/osx/core/cfstring.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/corefoundation/cfstring.h +// Purpose: wxCFStringRef and other string functions +// Author: Stefan Csomor +// Modified by: +// Created: 2004-10-29 (from code in wx/mac/carbon/private.h) +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +// Usage: Darwin (base library) +///////////////////////////////////////////////////////////////////////////// + +#ifndef __WX_CFSTRINGHOLDER_H__ +#define __WX_CFSTRINGHOLDER_H__ + +#include + +#include "wx/dlimpexp.h" +#include "wx/fontenc.h" +#include "wx/mac/corefoundation/cfref.h" + +class WXDLLIMPEXP_FWD_BASE wxString; + +WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ; +WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ; + +WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ; +WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ; + +WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ; +WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ; +WXDLLIMPEXP_BASE void wxMacWakeUp() ; + +class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef > +{ +public: + wxCFStringRef() + { + } + + wxCFStringRef(const wxString &str, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ; + + wxCFStringRef(CFStringRef ref) + : wxCFRef< CFStringRef >(ref) + { + } + + wxCFStringRef(const wxCFStringRef& otherRef ) + : wxCFRef< CFStringRef >(otherRef) + { + } + + ~wxCFStringRef() + { + } + + wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; + +private: +} ; + +// corresponding class for holding UniChars (native unicode characters) + +class WXDLLIMPEXP_BASE wxMacUniCharBuffer +{ +public : + wxMacUniCharBuffer( const wxString &str ) ; + + ~wxMacUniCharBuffer() ; + + UniCharPtr GetBuffer() ; + + UniCharCount GetChars() ; + +private : + UniCharPtr m_ubuf ; + UniCharCount m_chars ; +}; +#endif //__WXCFSTRINGHOLDER_H__ diff --git a/include/wx/osx/core/hid.h b/include/wx/osx/core/hid.h new file mode 100644 index 0000000000..e6df5cb45f --- /dev/null +++ b/include/wx/osx/core/hid.h @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/corefoundation/hid.h +// Purpose: DARWIN HID layer for WX +// Author: Ryan Norton +// Modified by: +// Created: 11/11/2003 +// RCS-ID: $Id$ +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#ifndef _WX_MACCARBONHID_H_ +#define _WX_MACCARBONHID_H_ + +#include "wx/defs.h" +#include "wx/string.h" + +//Mac OSX only +#ifdef __DARWIN__ + +#include +#include +#include +#include +#include + +//Darn apple - doesn't properly wrap their headers in extern "C"! +//http://www.macosx.com/forums/archive/index.php/t-68069.html +//Needed for codewarrior link error with mach_port_deallocate() +extern "C" { +#include +} + +#include //this actually includes mach_port.h (see above) + +// =========================================================================== +// definitions +// =========================================================================== + + +// --------------------------------------------------------------------------- +// wxHIDDevice +// +// A wrapper around OS X HID Manager procedures. +// The tutorial "Working With HID Class Device Interfaces" Is +// Quite good, as is the sample program associated with it +// (Depite the author's protests!). +// --------------------------------------------------------------------------- +class WXDLLIMPEXP_CORE wxHIDDevice +{ +public: + wxHIDDevice() : m_ppDevice(NULL), m_ppQueue(NULL), m_pCookies(NULL) {} + + bool Create (int nClass = -1, int nType = -1, int nDev = 1); + + static size_t GetCount(int nClass = -1, int nType = -1); + + void AddCookie(CFTypeRef Data, int i); + void AddCookieInQueue(CFTypeRef Data, int i); + void InitCookies(size_t dwSize, bool bQueue = false); + + //Must be implemented by derived classes + //builds the cookie array - + //first call InitCookies to initialize the cookie + //array, then AddCookie to add a cookie at a certain point in an array + virtual void BuildCookies(CFArrayRef Array) = 0; + + //checks to see whether the cookie at nIndex is active (element value != 0) + bool IsActive(int nIndex); + + //checks to see whether an element in the internal cookie array + //exists + bool HasElement(int nIndex); + + //closes the device and cleans the queue and cookies + virtual ~wxHIDDevice(); + +protected: + IOHIDDeviceInterface** m_ppDevice; //this, essentially + IOHIDQueueInterface** m_ppQueue; //queue (if we want one) + IOHIDElementCookie* m_pCookies; //cookies + + wxString m_szProductName; //product name + int m_nProductId; //product id + int m_nManufacturerId; //manufacturer id + mach_port_t m_pPort; //mach port to use +}; + +// --------------------------------------------------------------------------- +// wxHIDKeyboard +// +// Semi-simple implementation that opens a connection to the first +// keyboard of the machine. Used in wxGetKeyState. +// --------------------------------------------------------------------------- +class WXDLLIMPEXP_CORE wxHIDKeyboard : public wxHIDDevice +{ +public: + static int GetCount(); + bool Create(int nDev = 1); + void AddCookie(CFTypeRef Data, int i); + virtual void BuildCookies(CFArrayRef Array); + void DoBuildCookies(CFArrayRef Array); +}; + +#endif //__DARWIN__ + +#endif + // _WX_MACCARBONHID_H_ diff --git a/include/wx/osx/core/joystick.h b/include/wx/osx/core/joystick.h new file mode 100644 index 0000000000..a909070072 --- /dev/null +++ b/include/wx/osx/core/joystick.h @@ -0,0 +1,93 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.h +// Purpose: wxJoystick class +// Author: Ryan Norton +// Modified by: +// Created: 2/13/2005 +// RCS-ID: $Id$ +// Copyright: (c) Ryan Norton +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#include "wx/event.h" + +class WXDLLIMPEXP_FWD_CORE wxJoystickThread; + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + + wxJoystick(int joystick = wxJOYSTICK1); + virtual ~wxJoystick(); + + // 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; + wxJoystickThread* m_thread; + class wxHIDJoystick* m_hid; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h new file mode 100644 index 0000000000..9d70b22c7a --- /dev/null +++ b/include/wx/osx/core/private.h @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/corefoundation/private.h +// Purpose: Private declarations: as this header is only included by +// wxWidgets itself, it may contain identifiers which don't start +// with "wx". +// Author: Stefan Csomor +// Modified by: +// Created: 1998-01-01 +// RCS-ID: $Id: private.h 53819 2008-05-29 14:11:45Z SC $ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRIVATE_H_ +#define _WX_PRIVATE_H_ + +#include "wx/defs.h" + +#include + +#include "wx/mac/corefoundation/cfstring.h" +#include "wx/mac/corefoundation/cfdataref.h" + +#if wxUSE_GUI + +#include + +class WXDLLIMPEXP_CORE wxMacCGContextStateSaver +{ + DECLARE_NO_COPY_CLASS(wxMacCGContextStateSaver) + +public: + wxMacCGContextStateSaver( CGContextRef cg ) + { + m_cg = cg; + CGContextSaveGState( cg ); + } + ~wxMacCGContextStateSaver() + { + CGContextRestoreGState( m_cg ); + } +private: + CGContextRef m_cg; +}; + + +// Quartz + +WXDLLIMPEXP_CORE CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap ); + +WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithCFData( CFDataRef data ); +WXDLLIMPEXP_CORE CGDataConsumerRef wxMacCGDataConsumerCreateWithCFData( CFMutableDataRef data ); +WXDLLIMPEXP_CORE CGDataProviderRef wxMacCGDataProviderCreateWithMemoryBuffer( const wxMemoryBuffer& buf ); + +CGColorSpaceRef WXDLLIMPEXP_CORE wxMacGetGenericRGBColorSpace(void); + +#endif // wxUSE_GUI + +//--------------------------------------------------------------------------- +// cocoa bridging utilities +//--------------------------------------------------------------------------- + +bool wxMacInitCocoa(); + +class WXDLLIMPEXP_CORE wxMacAutoreleasePool +{ +public : + wxMacAutoreleasePool(); + ~wxMacAutoreleasePool(); +private : + void* m_pool; +}; + +// NSObject + +void wxMacCocoaRelease( void* obj ); +void wxMacCocoaAutorelease( void* obj ); +void wxMacCocoaRetain( void* obj ); + + +#endif + // _WX_PRIVATE_H_ diff --git a/include/wx/osx/core/private/strconv_cf.h b/include/wx/osx/core/private/strconv_cf.h new file mode 100644 index 0000000000..07a98a1de0 --- /dev/null +++ b/include/wx/osx/core/private/strconv_cf.h @@ -0,0 +1,338 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: include/wx/mac/corefoundation/strconv_cf.h +// Purpose: Unicode conversion classes +// Author: David Elliott, Ryan Norton +// Modified by: +// Created: 2007-07-06 +// RCS-ID: $Id$ +// Copyright: (c) 2004 Ryan Norton +// (c) 2007 David Elliott +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#include "wx/strconv.h" + +#include +#include + +// ============================================================================ +// CoreFoundation conversion classes +// ============================================================================ + +inline CFStringEncoding wxCFStringEncFromFontEnc(wxFontEncoding encoding) +{ + CFStringEncoding enc = kCFStringEncodingInvalidId ; + + switch (encoding) + { + case wxFONTENCODING_DEFAULT : + enc = CFStringGetSystemEncoding(); + break ; + + case wxFONTENCODING_ISO8859_1 : + enc = kCFStringEncodingISOLatin1 ; + break ; + case wxFONTENCODING_ISO8859_2 : + enc = kCFStringEncodingISOLatin2; + break ; + case wxFONTENCODING_ISO8859_3 : + enc = kCFStringEncodingISOLatin3 ; + break ; + case wxFONTENCODING_ISO8859_4 : + enc = kCFStringEncodingISOLatin4; + break ; + case wxFONTENCODING_ISO8859_5 : + enc = kCFStringEncodingISOLatinCyrillic; + break ; + case wxFONTENCODING_ISO8859_6 : + enc = kCFStringEncodingISOLatinArabic; + break ; + case wxFONTENCODING_ISO8859_7 : + enc = kCFStringEncodingISOLatinGreek; + break ; + case wxFONTENCODING_ISO8859_8 : + enc = kCFStringEncodingISOLatinHebrew; + break ; + case wxFONTENCODING_ISO8859_9 : + enc = kCFStringEncodingISOLatin5; + break ; + case wxFONTENCODING_ISO8859_10 : + enc = kCFStringEncodingISOLatin6; + break ; + case wxFONTENCODING_ISO8859_11 : + enc = kCFStringEncodingISOLatinThai; + break ; + case wxFONTENCODING_ISO8859_13 : + enc = kCFStringEncodingISOLatin7; + break ; + case wxFONTENCODING_ISO8859_14 : + enc = kCFStringEncodingISOLatin8; + break ; + case wxFONTENCODING_ISO8859_15 : + enc = kCFStringEncodingISOLatin9; + break ; + + case wxFONTENCODING_KOI8 : + enc = kCFStringEncodingKOI8_R; + break ; + case wxFONTENCODING_ALTERNATIVE : // MS-DOS CP866 + enc = kCFStringEncodingDOSRussian; + break ; + +// case wxFONTENCODING_BULGARIAN : +// enc = ; +// break ; + + case wxFONTENCODING_CP437 : + enc = kCFStringEncodingDOSLatinUS ; + break ; + case wxFONTENCODING_CP850 : + enc = kCFStringEncodingDOSLatin1; + break ; + case wxFONTENCODING_CP852 : + enc = kCFStringEncodingDOSLatin2; + break ; + case wxFONTENCODING_CP855 : + enc = kCFStringEncodingDOSCyrillic; + break ; + case wxFONTENCODING_CP866 : + enc = kCFStringEncodingDOSRussian ; + break ; + case wxFONTENCODING_CP874 : + enc = kCFStringEncodingDOSThai; + break ; + case wxFONTENCODING_CP932 : + enc = kCFStringEncodingDOSJapanese; + break ; + case wxFONTENCODING_CP936 : + enc = kCFStringEncodingDOSChineseSimplif ; + break ; + case wxFONTENCODING_CP949 : + enc = kCFStringEncodingDOSKorean; + break ; + case wxFONTENCODING_CP950 : + enc = kCFStringEncodingDOSChineseTrad; + break ; + case wxFONTENCODING_CP1250 : + enc = kCFStringEncodingWindowsLatin2; + break ; + case wxFONTENCODING_CP1251 : + enc = kCFStringEncodingWindowsCyrillic ; + break ; + case wxFONTENCODING_CP1252 : + enc = kCFStringEncodingWindowsLatin1 ; + break ; + case wxFONTENCODING_CP1253 : + enc = kCFStringEncodingWindowsGreek; + break ; + case wxFONTENCODING_CP1254 : + enc = kCFStringEncodingWindowsLatin5; + break ; + case wxFONTENCODING_CP1255 : + enc = kCFStringEncodingWindowsHebrew ; + break ; + case wxFONTENCODING_CP1256 : + enc = kCFStringEncodingWindowsArabic ; + break ; + case wxFONTENCODING_CP1257 : + enc = kCFStringEncodingWindowsBalticRim; + break ; +// This only really encodes to UTF7 (if that) evidently +// case wxFONTENCODING_UTF7 : +// enc = kCFStringEncodingNonLossyASCII ; +// break ; + case wxFONTENCODING_UTF8 : + enc = kCFStringEncodingUTF8 ; + break ; + case wxFONTENCODING_EUC_JP : + enc = kCFStringEncodingEUC_JP; + break ; +/* Don't support conversion to/from UTF16 as wxWidgets can do this better. + * In particular, ToWChar would fail miserably using strlen on an input UTF16. + case wxFONTENCODING_UTF16 : + enc = kCFStringEncodingUnicode ; + break ; +*/ + case wxFONTENCODING_MACROMAN : + enc = kCFStringEncodingMacRoman ; + break ; + case wxFONTENCODING_MACJAPANESE : + enc = kCFStringEncodingMacJapanese ; + break ; + case wxFONTENCODING_MACCHINESETRAD : + enc = kCFStringEncodingMacChineseTrad ; + break ; + case wxFONTENCODING_MACKOREAN : + enc = kCFStringEncodingMacKorean ; + break ; + case wxFONTENCODING_MACARABIC : + enc = kCFStringEncodingMacArabic ; + break ; + case wxFONTENCODING_MACHEBREW : + enc = kCFStringEncodingMacHebrew ; + break ; + case wxFONTENCODING_MACGREEK : + enc = kCFStringEncodingMacGreek ; + break ; + case wxFONTENCODING_MACCYRILLIC : + enc = kCFStringEncodingMacCyrillic ; + break ; + case wxFONTENCODING_MACDEVANAGARI : + enc = kCFStringEncodingMacDevanagari ; + break ; + case wxFONTENCODING_MACGURMUKHI : + enc = kCFStringEncodingMacGurmukhi ; + break ; + case wxFONTENCODING_MACGUJARATI : + enc = kCFStringEncodingMacGujarati ; + break ; + case wxFONTENCODING_MACORIYA : + enc = kCFStringEncodingMacOriya ; + break ; + case wxFONTENCODING_MACBENGALI : + enc = kCFStringEncodingMacBengali ; + break ; + case wxFONTENCODING_MACTAMIL : + enc = kCFStringEncodingMacTamil ; + break ; + case wxFONTENCODING_MACTELUGU : + enc = kCFStringEncodingMacTelugu ; + break ; + case wxFONTENCODING_MACKANNADA : + enc = kCFStringEncodingMacKannada ; + break ; + case wxFONTENCODING_MACMALAJALAM : + enc = kCFStringEncodingMacMalayalam ; + break ; + case wxFONTENCODING_MACSINHALESE : + enc = kCFStringEncodingMacSinhalese ; + break ; + case wxFONTENCODING_MACBURMESE : + enc = kCFStringEncodingMacBurmese ; + break ; + case wxFONTENCODING_MACKHMER : + enc = kCFStringEncodingMacKhmer ; + break ; + case wxFONTENCODING_MACTHAI : + enc = kCFStringEncodingMacThai ; + break ; + case wxFONTENCODING_MACLAOTIAN : + enc = kCFStringEncodingMacLaotian ; + break ; + case wxFONTENCODING_MACGEORGIAN : + enc = kCFStringEncodingMacGeorgian ; + break ; + case wxFONTENCODING_MACARMENIAN : + enc = kCFStringEncodingMacArmenian ; + break ; + case wxFONTENCODING_MACCHINESESIMP : + enc = kCFStringEncodingMacChineseSimp ; + break ; + case wxFONTENCODING_MACTIBETAN : + enc = kCFStringEncodingMacTibetan ; + break ; + case wxFONTENCODING_MACMONGOLIAN : + enc = kCFStringEncodingMacMongolian ; + break ; + case wxFONTENCODING_MACETHIOPIC : + enc = kCFStringEncodingMacEthiopic ; + break ; + case wxFONTENCODING_MACCENTRALEUR : + enc = kCFStringEncodingMacCentralEurRoman ; + break ; + case wxFONTENCODING_MACVIATNAMESE : + enc = kCFStringEncodingMacVietnamese ; + break ; + case wxFONTENCODING_MACARABICEXT : + enc = kCFStringEncodingMacExtArabic ; + break ; + case wxFONTENCODING_MACSYMBOL : + enc = kCFStringEncodingMacSymbol ; + break ; + case wxFONTENCODING_MACDINGBATS : + enc = kCFStringEncodingMacDingbats ; + break ; + case wxFONTENCODING_MACTURKISH : + enc = kCFStringEncodingMacTurkish ; + break ; + case wxFONTENCODING_MACCROATIAN : + enc = kCFStringEncodingMacCroatian ; + break ; + case wxFONTENCODING_MACICELANDIC : + enc = kCFStringEncodingMacIcelandic ; + break ; + case wxFONTENCODING_MACROMANIAN : + enc = kCFStringEncodingMacRomanian ; + break ; + case wxFONTENCODING_MACCELTIC : + enc = kCFStringEncodingMacCeltic ; + break ; + case wxFONTENCODING_MACGAELIC : + enc = kCFStringEncodingMacGaelic ; + break ; + /* CFString is known to support this back to the original CarbonLib */ + /* http://developer.apple.com/samplecode/CarbonMDEF/listing2.html */ + case wxFONTENCODING_MACKEYBOARD : + /* We don't wish to pollute the namespace too much, even though we're a private header. */ + /* The constant is well-defined as 41 and is not expected to change. */ + enc = 41 /*kTextEncodingMacKeyboardGlyphs*/ ; + break ; + + default : + // because gcc is picky + break ; + } + + return enc ; +} + + +class wxMBConv_cf : public wxMBConv +{ +public: + wxMBConv_cf() + { + Init(CFStringGetSystemEncoding()) ; + } + + wxMBConv_cf(const wxMBConv_cf& conv) + { + m_encoding = conv.m_encoding; + } + +#if wxUSE_FONTMAP + wxMBConv_cf(const char* name) + { + Init( wxCFStringEncFromFontEnc(wxFontMapperBase::Get()->CharsetToEncoding(name, false) ) ) ; + } +#endif + + wxMBConv_cf(wxFontEncoding encoding) + { + Init( wxCFStringEncFromFontEnc(encoding) ); + } + + virtual ~wxMBConv_cf() + { + } + + void Init( CFStringEncoding encoding) + { + m_encoding = encoding ; + } + + virtual size_t ToWChar(wchar_t * dst, size_t dstSize, const char * src, size_t srcSize = wxNO_LEN) const; + virtual size_t FromWChar(char *dst, size_t dstSize, const wchar_t *src, size_t srcSize = wxNO_LEN) const; + + virtual wxMBConv *Clone() const { return new wxMBConv_cf(*this); } + + bool IsOk() const + { + return m_encoding != kCFStringEncodingInvalidId && + CFStringIsEncodingAvailable(m_encoding); + } + +private: + CFStringEncoding m_encoding ; +}; + diff --git a/include/wx/osx/core/stdpaths.h b/include/wx/osx/core/stdpaths.h new file mode 100644 index 0000000000..3fcb8d5676 --- /dev/null +++ b/include/wx/osx/core/stdpaths.h @@ -0,0 +1,67 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/mac/corefoundation/stdpaths.h +// Purpose: wxStandardPaths for CoreFoundation systems +// Author: David Elliott +// Modified by: +// Created: 2004-10-27 +// RCS-ID: $Id$ +// Copyright: (c) 2004 David Elliott +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MAC_STDPATHS_H_ +#define _WX_MAC_STDPATHS_H_ + +struct __CFBundle; +struct __CFURL; + +typedef const __CFURL * wxCFURLRef; +typedef __CFBundle * wxCFBundleRef; + +// ---------------------------------------------------------------------------- +// wxStandardPaths +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxStandardPathsCF : public wxStandardPathsBase +{ +public: + wxStandardPathsCF(); + virtual ~wxStandardPathsCF(); + + // wxMac specific: allow user to specify a different bundle + wxStandardPathsCF(wxCFBundleRef bundle); + void SetBundle(wxCFBundleRef bundle); + + // implement base class pure virtuals + virtual wxString GetExecutablePath() const; + virtual wxString GetConfigDir() const; + virtual wxString GetUserConfigDir() const; + virtual wxString GetDataDir() const; + virtual wxString GetLocalDataDir() const; + virtual wxString GetUserDataDir() const; + virtual wxString GetPluginsDir() const; + virtual wxString GetResourcesDir() const; + virtual wxString + GetLocalizedResourcesDir(const wxString& lang, + ResourceCat category = ResourceCat_None) const; + virtual wxString GetDocumentsDir() const; + +protected: + // this function can be called with any of CFBundleCopyXXXURL function + // pointer as parameter + wxString GetFromFunc(wxCFURLRef (*func)(wxCFBundleRef)) const; + + wxCFBundleRef m_bundle; +}; + +// If using UNIX (i.e. darwin) then use UNIX standard paths +#if defined(__UNIX__) +#include "wx/unix/stdpaths.h" +#else +// If compiling wxMac for CarbonLib then we are wxStandardPaths +class WXDLLIMPEXP_BASE wxStandardPaths: public wxStandardPathsCF +{ +}; +#endif + +#endif // _WX_MAC_STDPATHS_H_ diff --git a/include/wx/osx/cursor.h b/include/wx/osx/cursor.h new file mode 100644 index 0000000000..b0d7d2a260 --- /dev/null +++ b/include/wx/osx/cursor.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/cursor.h" +#else +#include "wx/mac/carbon/cursor.h" +#endif diff --git a/include/wx/osx/dataform.h b/include/wx/osx/dataform.h new file mode 100644 index 0000000000..e4a953d14a --- /dev/null +++ b/include/wx/osx/dataform.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dataform.h" +#else +#include "wx/mac/carbon/dataform.h" +#endif diff --git a/include/wx/osx/dataobj.h b/include/wx/osx/dataobj.h new file mode 100644 index 0000000000..463e151b6c --- /dev/null +++ b/include/wx/osx/dataobj.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dataobj.h" +#else +#include "wx/mac/carbon/dataobj.h" +#endif diff --git a/include/wx/osx/dataobj2.h b/include/wx/osx/dataobj2.h new file mode 100644 index 0000000000..c03578a2ed --- /dev/null +++ b/include/wx/osx/dataobj2.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dataobj2.h" +#else +#include "wx/mac/carbon/dataobj2.h" +#endif diff --git a/include/wx/osx/dataview.h b/include/wx/osx/dataview.h new file mode 100644 index 0000000000..ffae4f69ea --- /dev/null +++ b/include/wx/osx/dataview.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +# error "Native wxDataViewCtrl for classic environment not defined. Please use generic control." +#else +# include "wx/mac/carbon/dataview.h" +#endif diff --git a/include/wx/osx/dc.h b/include/wx/osx/dc.h new file mode 100644 index 0000000000..ac1e66b22e --- /dev/null +++ b/include/wx/osx/dc.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dc.h" +#else +#include "wx/mac/carbon/dc.h" +#endif diff --git a/include/wx/osx/dcclient.h b/include/wx/osx/dcclient.h new file mode 100644 index 0000000000..8f824811b2 --- /dev/null +++ b/include/wx/osx/dcclient.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dcclient.h" +#else +#include "wx/mac/carbon/dcclient.h" +#endif diff --git a/include/wx/osx/dcmemory.h b/include/wx/osx/dcmemory.h new file mode 100644 index 0000000000..5ae0e64a28 --- /dev/null +++ b/include/wx/osx/dcmemory.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dcmemory.h" +#else +#include "wx/mac/carbon/dcmemory.h" +#endif diff --git a/include/wx/osx/dcprint.h b/include/wx/osx/dcprint.h new file mode 100644 index 0000000000..74537d6392 --- /dev/null +++ b/include/wx/osx/dcprint.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dcprint.h" +#else +#include "wx/mac/carbon/dcprint.h" +#endif diff --git a/include/wx/osx/dcscreen.h b/include/wx/osx/dcscreen.h new file mode 100644 index 0000000000..8e710bed4b --- /dev/null +++ b/include/wx/osx/dcscreen.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dcscreen.h" +#else +#include "wx/mac/carbon/dcscreen.h" +#endif diff --git a/include/wx/osx/dialog.h b/include/wx/osx/dialog.h new file mode 100644 index 0000000000..abc6c003ed --- /dev/null +++ b/include/wx/osx/dialog.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dialog.h" +#else +#include "wx/mac/carbon/dialog.h" +#endif diff --git a/include/wx/osx/dirdlg.h b/include/wx/osx/dirdlg.h new file mode 100644 index 0000000000..1861746529 --- /dev/null +++ b/include/wx/osx/dirdlg.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dirdlg.h" +#else +#include "wx/mac/carbon/dirdlg.h" +#endif diff --git a/include/wx/osx/dnd.h b/include/wx/osx/dnd.h new file mode 100644 index 0000000000..496aa76383 --- /dev/null +++ b/include/wx/osx/dnd.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/dnd.h" +#else +#include "wx/mac/carbon/dnd.h" +#endif diff --git a/include/wx/osx/evtloop.h b/include/wx/osx/evtloop.h new file mode 100644 index 0000000000..86509da311 --- /dev/null +++ b/include/wx/osx/evtloop.h @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/mac/evtloop.h +// Purpose: simply forwards to wx/mac/carbon/evtloop.h for consistency with +// the other Mac headers +// Author: Vadim Zeitlin +// Modified by: +// Created: 2006-01-12 +// RCS-ID: $Id$ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifdef __WXMAC_CLASSIC__ + #error "wxEventLoop is not implemented for Classic build." +#else + #include "wx/mac/carbon/evtloop.h" +#endif + diff --git a/include/wx/osx/filedlg.h b/include/wx/osx/filedlg.h new file mode 100644 index 0000000000..8ed7194bdf --- /dev/null +++ b/include/wx/osx/filedlg.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/filedlg.h" +#else +#include "wx/mac/carbon/filedlg.h" +#endif diff --git a/include/wx/osx/font.h b/include/wx/osx/font.h new file mode 100644 index 0000000000..ae2770d072 --- /dev/null +++ b/include/wx/osx/font.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/font.h" +#else +#include "wx/mac/carbon/font.h" +#endif diff --git a/include/wx/osx/fontdlg.h b/include/wx/osx/fontdlg.h new file mode 100644 index 0000000000..ab9fba13ca --- /dev/null +++ b/include/wx/osx/fontdlg.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/fontdlg.h" +#else +#include "wx/mac/carbon/fontdlg.h" +#endif diff --git a/include/wx/osx/frame.h b/include/wx/osx/frame.h new file mode 100644 index 0000000000..fceb903d24 --- /dev/null +++ b/include/wx/osx/frame.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/frame.h" +#else +#include "wx/mac/carbon/frame.h" +#endif diff --git a/include/wx/osx/gauge.h b/include/wx/osx/gauge.h new file mode 100644 index 0000000000..cac67868fa --- /dev/null +++ b/include/wx/osx/gauge.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/gauge.h" +#else +#include "wx/mac/carbon/gauge.h" +#endif diff --git a/include/wx/osx/glcanvas.h b/include/wx/osx/glcanvas.h new file mode 100644 index 0000000000..3dfff78fa3 --- /dev/null +++ b/include/wx/osx/glcanvas.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/glcanvas.h" +#else +#include "wx/mac/carbon/glcanvas.h" +#endif \ No newline at end of file diff --git a/include/wx/osx/helpxxxx.h b/include/wx/osx/helpxxxx.h new file mode 100644 index 0000000000..aaea7f2871 --- /dev/null +++ b/include/wx/osx/helpxxxx.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/helpxxxx.h" +#else +#include "wx/mac/carbon/helpxxxx.h" +#endif \ No newline at end of file diff --git a/include/wx/osx/icon.h b/include/wx/osx/icon.h new file mode 100644 index 0000000000..e2be1b3f1f --- /dev/null +++ b/include/wx/osx/icon.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/icon.h" +#else +#include "wx/mac/carbon/icon.h" +#endif diff --git a/include/wx/osx/imaglist.h b/include/wx/osx/imaglist.h new file mode 100644 index 0000000000..3dd3d032ad --- /dev/null +++ b/include/wx/osx/imaglist.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/imaglist.h" +#else +#include "wx/mac/carbon/imaglist.h" +#endif diff --git a/include/wx/osx/joystick.h b/include/wx/osx/joystick.h new file mode 100644 index 0000000000..7614c25668 --- /dev/null +++ b/include/wx/osx/joystick.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/joystick.h" +#else +#include "wx/mac/carbon/joystick.h" +#endif diff --git a/include/wx/osx/listbox.h b/include/wx/osx/listbox.h new file mode 100644 index 0000000000..a51668a188 --- /dev/null +++ b/include/wx/osx/listbox.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/listbox.h" +#else +#include "wx/mac/carbon/listbox.h" +#endif diff --git a/include/wx/osx/listctrl.h b/include/wx/osx/listctrl.h new file mode 100644 index 0000000000..be9ffdfed1 --- /dev/null +++ b/include/wx/osx/listctrl.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/listctrl.h" +#else +#include "wx/mac/carbon/listctrl.h" +#endif \ No newline at end of file diff --git a/include/wx/osx/mdi.h b/include/wx/osx/mdi.h new file mode 100644 index 0000000000..d8c57f9acf --- /dev/null +++ b/include/wx/osx/mdi.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/mdi.h" +#else +#include "wx/mac/carbon/mdi.h" +#endif diff --git a/include/wx/osx/menu.h b/include/wx/osx/menu.h new file mode 100644 index 0000000000..70c1e12792 --- /dev/null +++ b/include/wx/osx/menu.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/menu.h" +#else +#include "wx/mac/carbon/menu.h" +#endif diff --git a/include/wx/osx/menuitem.h b/include/wx/osx/menuitem.h new file mode 100644 index 0000000000..3c3748cb29 --- /dev/null +++ b/include/wx/osx/menuitem.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/menuitem.h" +#else +#include "wx/mac/carbon/menuitem.h" +#endif diff --git a/include/wx/osx/metafile.h b/include/wx/osx/metafile.h new file mode 100644 index 0000000000..fe7274d9fb --- /dev/null +++ b/include/wx/osx/metafile.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/metafile.h" +#else +#include "wx/mac/carbon/metafile.h" +#endif diff --git a/include/wx/osx/mimetype.h b/include/wx/osx/mimetype.h new file mode 100644 index 0000000000..7195dcc61c --- /dev/null +++ b/include/wx/osx/mimetype.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/mimetype.h" +#else +#include "wx/mac/carbon/mimetype.h" +#endif diff --git a/include/wx/osx/minifram.h b/include/wx/osx/minifram.h new file mode 100644 index 0000000000..d0035febba --- /dev/null +++ b/include/wx/osx/minifram.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/minifram.h" +#else +#include "wx/mac/carbon/minifram.h" +#endif diff --git a/include/wx/osx/msgdlg.h b/include/wx/osx/msgdlg.h new file mode 100644 index 0000000000..d3c1e31de5 --- /dev/null +++ b/include/wx/osx/msgdlg.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/msgdlg.h" +#else +#include "wx/mac/carbon/msgdlg.h" +#endif diff --git a/include/wx/osx/nonownedwnd.h b/include/wx/osx/nonownedwnd.h new file mode 100644 index 0000000000..15c53efc27 --- /dev/null +++ b/include/wx/osx/nonownedwnd.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#error "no implementation" +#else +#include "wx/mac/carbon/nonownedwnd.h" +#endif \ No newline at end of file diff --git a/include/wx/osx/notebook.h b/include/wx/osx/notebook.h new file mode 100644 index 0000000000..a47ba1b171 --- /dev/null +++ b/include/wx/osx/notebook.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/notebook.h" +#else +#include "wx/mac/carbon/notebook.h" +#endif diff --git a/include/wx/osx/palette.h b/include/wx/osx/palette.h new file mode 100644 index 0000000000..57e1f2ff5e --- /dev/null +++ b/include/wx/osx/palette.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/palette.h" +#else +#include "wx/mac/carbon/palette.h" +#endif diff --git a/include/wx/osx/pen.h b/include/wx/osx/pen.h new file mode 100644 index 0000000000..3803315a61 --- /dev/null +++ b/include/wx/osx/pen.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/pen.h" +#else +#include "wx/mac/carbon/pen.h" +#endif diff --git a/include/wx/osx/pnghand.h b/include/wx/osx/pnghand.h new file mode 100644 index 0000000000..bd6e57aab9 --- /dev/null +++ b/include/wx/osx/pnghand.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/pnghand.h" +#else +#include "wx/mac/carbon/pnghand.h" +#endif diff --git a/include/wx/osx/pngread.h b/include/wx/osx/pngread.h new file mode 100644 index 0000000000..cbd51857c9 --- /dev/null +++ b/include/wx/osx/pngread.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/pngread.h" +#else +#include "wx/mac/carbon/pngread.h" +#endif diff --git a/include/wx/osx/popupwin.h b/include/wx/osx/popupwin.h new file mode 100644 index 0000000000..e230fccf5f --- /dev/null +++ b/include/wx/osx/popupwin.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#error "wxPopupWindow is not supported under this platform." +#else +#include "wx/mac/carbon/popupwin.h" +#endif diff --git a/include/wx/osx/printdlg.h b/include/wx/osx/printdlg.h new file mode 100644 index 0000000000..b3ff46f8ca --- /dev/null +++ b/include/wx/osx/printdlg.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/printdlg.h" +#else +#include "wx/mac/carbon/printdlg.h" +#endif diff --git a/include/wx/osx/printmac.h b/include/wx/osx/printmac.h new file mode 100644 index 0000000000..b267cd33cf --- /dev/null +++ b/include/wx/osx/printmac.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/printmac.h" +#else +#include "wx/mac/carbon/printmac.h" +#endif diff --git a/include/wx/osx/private.h b/include/wx/osx/private.h new file mode 100644 index 0000000000..75cf558a22 --- /dev/null +++ b/include/wx/osx/private.h @@ -0,0 +1,7 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/private.h" +#elif defined(__WXOSX_IPHONE__) +#include "wx/mac/corefoundation/private.h" +#else +#include "wx/mac/carbon/private.h" +#endif diff --git a/include/wx/osx/private/print.h b/include/wx/osx/private/print.h new file mode 100644 index 0000000000..99e4aad109 --- /dev/null +++ b/include/wx/osx/private/print.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/private/print.h" +#else +#include "wx/mac/carbon/private/print.h" +#endif diff --git a/include/wx/osx/private/timer.h b/include/wx/osx/private/timer.h new file mode 100644 index 0000000000..4532e42f54 --- /dev/null +++ b/include/wx/osx/private/timer.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/private/timer.h" +#else +#include "wx/mac/carbon/private/timer.h" +#endif diff --git a/include/wx/osx/radiobox.h b/include/wx/osx/radiobox.h new file mode 100644 index 0000000000..752554dff0 --- /dev/null +++ b/include/wx/osx/radiobox.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/radiobox.h" +#else +#include "wx/mac/carbon/radiobox.h" +#endif diff --git a/include/wx/osx/radiobut.h b/include/wx/osx/radiobut.h new file mode 100644 index 0000000000..14ec77d4db --- /dev/null +++ b/include/wx/osx/radiobut.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/radiobut.h" +#else +#include "wx/mac/carbon/radiobut.h" +#endif diff --git a/include/wx/osx/region.h b/include/wx/osx/region.h new file mode 100644 index 0000000000..2bdcd52252 --- /dev/null +++ b/include/wx/osx/region.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/region.h" +#else +#include "wx/mac/carbon/region.h" +#endif diff --git a/include/wx/osx/scrolbar.h b/include/wx/osx/scrolbar.h new file mode 100644 index 0000000000..90bf27701e --- /dev/null +++ b/include/wx/osx/scrolbar.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/scrolbar.h" +#else +#include "wx/mac/carbon/scrolbar.h" +#endif diff --git a/include/wx/osx/setup0.h b/include/wx/osx/setup0.h new file mode 100644 index 0000000000..dba42e11ea --- /dev/null +++ b/include/wx/osx/setup0.h @@ -0,0 +1,1319 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: setup.h +// Purpose: Configuration for the library +// Author: Stefan Csomor +// Modified by: Stefan Csomor +// Created: 1998-01-01 +// RCS-ID: $Id$ +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + + +/* --- start common options --- */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.6 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_6 0 + +// This setting determines the compatibility with 2.8 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_8 1 + +// MSW-only: Set to 0 for accurate dialog units, else 1 for old behaviour when +// default system font is used for wxWindow::GetCharWidth/Height() instead of +// the current font. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxDIALOG_UNIT_COMPATIBILITY 0 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as wxWidgets memory debugging subsystem built in since version 5.0 and you +// may prefer to use it instead of built in memory debugging code because it is +// faster and more fool proof. +// +// Using VC++ CRT memory debugging is enabled by default in debug mode +// (__WXDEBUG__) if wxUSE_GLOBAL_MEMORY_OPERATORS is *not* enabled (i.e. is 0) +// and if __NO_VC_CRTDBG__ is not defined. + +// If 1, enables wxDebugContext, for writing error messages to file, etc. If +// __WXDEBUG__ is not defined, will still use the normal memory operators. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_CONTEXT 0 + +// If 1, enables debugging versions of wxObject::new and wxObject::delete *IF* +// __WXDEBUG__ is also defined. +// +// WARNING: this code may not work with all architectures, especially if +// alignment is an issue. This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 1 if you are not using a memory debugging tool, else 0 +#define wxUSE_MEMORY_TRACING 0 + +// In debug mode, cause new and delete to be redefined globally. +// If this causes problems (e.g. link errors which is a common problem +// especially if you use another library which also redefines the global new +// and delete), set this to 0. +// This switch is currently ignored for mingw / cygwin +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +// In debug mode, causes new to be defined to be WXDEBUG_NEW (see object.h). If +// this causes problems (e.g. link errors), set this to 0. You may need to set +// this to 0 if using templates (at least for VC++). This switch is currently +// ignored for mingw / cygwin / CodeWarrior +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +// wxHandleFatalExceptions() may be used to catch the program faults at run +// time and, instead of terminating the program with a usual GPF message box, +// call the user-defined wxApp::OnFatalException() function. If you set +// wxUSE_ON_FATAL_EXCEPTION to 0, wxHandleFatalExceptions() will not work. +// +// This setting is for Win32 only and can only be enabled if your compiler +// supports Win32 structured exception handling (currently only VC++ does) +// +// Default is 1 +// +// Recommended setting: 1 if your compiler supports it. +#define wxUSE_ON_FATAL_EXCEPTION 1 + +// Set this to 1 to be able to generate a human-readable (unlike +// machine-readable minidump created by wxCrashReport::Generate()) stack back +// trace when your program crashes using wxStackWalker +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, set to 0 if your programs never crash +#define wxUSE_STACKWALKER 1 + +// Set this to 1 to compile in wxDebugReport class which allows you to create +// and optionally upload to your web site a debug report consisting of back +// trace of the crash (if wxUSE_STACKWALKER == 1) and other information. +// +// Default is 1 if supported by the compiler. +// +// Recommended setting: 1, it is compiled into a separate library so there +// is no overhead if you don't use it +#define wxUSE_DEBUGREPORT 1 + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// These settings are obsolete: the library is always built in Unicode mode +// now, only set wxUSE_UNICODE to 0 to compile legacy code in ANSI mode if +// absolutely necessary -- updating it is strongly recommended as the ANSI mode +// will disappear completely in future wxWidgets releases. +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 1 +#endif + +// wxUSE_WCHAR_T is required by wxWidgets now, don't change. +#define wxUSE_WCHAR_T 1 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Note that like wxUSE_THREADS this option is automatically set to 0 if +// wxNO_EXCEPTIONS is defined. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 (this is still work in progress...) +#define wxUSE_EXTENDED_RTTI 0 + +// Set wxUSE_STL to 1 to derive wxList(Foo) and wxArray(Foo) from +// std::list and std::vector, with a compatibility interface, +// and for wxHashMap to be implemented with templates. +// +// Default is 0 +// +// Recommended setting: YMMV +#define wxUSE_STL 0 + +// Support for message/error logging. This includes wxLogXXX() functions and +// wxLog and derived classes. Don't set this to 0 unless you really know what +// you are doing. +// +// Default is 1 +// +// Recommended setting: 1 (always) +#define wxUSE_LOG 1 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 1 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 1 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 1 + +// Support for command line parsing using wxCmdLineParser class. +// +// Default is 1 +// +// Recommended setting: 1 (can be set to 0 if you don't use the cmd line) +#define wxUSE_CMDLINE_PARSER 1 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// Notice that if wxNO_THREADS is defined, wxUSE_THREADS is automatically reset +// to 0 in wx/chkconf.h, so, for example, if you set USE_THREADS to 0 in +// build/msw/config.* file this value will have no effect. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 1 + +// If enabled, compiles wxWidgets streams classes +// +// wx stream classes are used for image IO, process IO redirection, network +// protocols implementation and much more and so disabling this results in a +// lot of other functionality being lost. +// +// Default is 1 +// +// Recommended setting: 1 as setting it to 0 disables many other things +#define wxUSE_STREAMS 1 + +// This is not a real option but is used as the default value for +// wxUSE_STD_IOSTREAM and wxUSE_STD_STRING. +// +// Currently the Digital Mars and Watcom compilers come without standard C++ +// library headers by default, wxUSE_STD_STRING can be set to 1 if you do have +// them (e.g. from STLPort). +// +// VC++ 5.0 does include standard C++ library headers, however they produce +// many warnings that can't be turned off when compiled at warning level 4. +#if defined(__DMC__) || defined(__WATCOMC__) \ + || (defined(_MSC_VER) && _MSC_VER < 1200) + #define wxUSE_STD_DEFAULT 0 +#else + #define wxUSE_STD_DEFAULT 1 +#endif + +// Use standard C++ streams if 1 instead of wx streams in some places. If +// disabled (default), wx streams are used everywhere and wxWidgets doesn't +// depend on the standard streams library. +// +// Notice that enabling this does not replace wx streams with std streams +// everywhere, in a lot of places wx streams are used no matter what. +// +// Default is 0 +// +// Recommended setting: 1 if you use the standard streams anyhow and so +// dependency on the standard streams library is not a +// problem +#define wxUSE_STD_IOSTREAM wxUSE_STD_DEFAULT + +// Enable conversion to standard C++ string if 1. +// +// Default is 1 for most compilers. +// +// Recommended setting: 1 unless you want to ensure your program doesn't use +// the standard C++ library at all. +#define wxUSE_STD_STRING wxUSE_STD_DEFAULT + +// Support for positional parameters (e.g. %1$d, %2$s ...) in wxVsnprintf. +// Note that if the system's implementation does not support positional +// parameters, setting this to 1 forces the use of the wxWidgets implementation +// of wxVsnprintf. The standard vsnprintf() supports positional parameters on +// many Unix systems but usually doesn't under Windows. +// +// Positional parameters are very useful when translating a program since using +// them in formatting strings allow translators to correctly reorder the +// translated sentences. +// +// Default is 1 +// +// Recommended setting: 1 if you want to support multiple languages +#define wxUSE_PRINTF_POS_PARAMS 1 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_BASE64 to 1, to compile in Base64 support. This is required for +// storing binary data in wxConfig on most platforms. +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_BASE64 1 + +// Set this to 1 to be able to use wxEventLoop even in console applications +// (i.e. using base library only, without GUI). This is mostly useful for +// processing socket events but is also necessary to use timers in console +// applications +// +// Default is 1. +// +// Recommended setting: 1 (but can be safely disabled if you don't use it) +#define wxUSE_CONSOLE_EVENTLOOP 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 1 +#define wxUSE_FFILE 1 + +// Use wxFSVolume class providing access to the configured/active mount points +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely disabled if you don't use it) +#define wxUSE_FSVOLUME 1 + +// Use wxStandardPaths class which allows to retrieve some standard locations +// in the file system +// +// Default is 1 +// +// Recommended setting: 1 (may be disabled to save space, but not much) +#define wxUSE_STDPATHS 1 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 1 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 1 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 1 + +// Provide wxFoo_l() functions similar to standard foo() functions but taking +// an extra locale parameter. +// +// Notice that this is fully implemented only for the systems providing POSIX +// xlocale support or Microsoft Visual C++ >= 8 (which provides proprietary +// almost-equivalent of xlocale functions), otherwise wxFoo_l() functions will +// only work for the current user locale and "C" locale. You can use +// wxHAS_XLOCALE_SUPPORT to test whether the full support is available. +// +// Default is 1 +// +// Recommended setting: 1 but may be disabled if you are writing programs +// running only in C locale anyhow +#define wxUSE_XLOCALE 1 + +// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which +// allow to manipulate dates, times and time intervals. wxDateTime replaces the +// old wxTime and wxDate classes which are still provided for backwards +// compatibility (and implemented in terms of wxDateTime). +// +// Note that this class is relatively new and is still officially in alpha +// stage because some features are not yet (fully) implemented. It is already +// quite useful though and should only be disabled if you are aiming at +// absolutely minimal version of the library. +// +// Requires: wxUSE_LONGLONG +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_DATETIME 1 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 1 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 1 + +// Setting wxUSE_CONFIG to 1 enables the use of wxConfig and related classes +// which allow the application to store its settings in the persistent +// storage. Setting this to 1 will also enable on-demand creation of the +// global config object in wxApp. +// +// See also wxUSE_CONFIG_NATIVE below. +// +// Recommended setting: 1 +#define wxUSE_CONFIG 1 + +// If wxUSE_CONFIG is 1, you may choose to use either the native config +// classes under Windows (using .INI files under Win16 and the registry under +// Win32) or the portable text file format used by the config classes under +// Unix. +// +// Default is 1 to use native classes. Note that you may still use +// wxFileConfig even if you set this to 1 - just the config object created by +// default for the applications needs will be a wxRegConfig or wxIniConfig and +// not wxFileConfig. +// +// Recommended setting: 1 +#define wxUSE_CONFIG_NATIVE 1 + +// If wxUSE_DIALUP_MANAGER is 1, compile in wxDialUpManager class which allows +// to connect/disconnect from the network and be notified whenever the dial-up +// network connection is established/terminated. Requires wxUSE_DYNAMIC_LOADER. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DIALUP_MANAGER 1 + +// Compile in classes for run-time DLL loading and function calling. +// Required by wxUSE_DIALUP_MANAGER. +// +// This setting is for Win32 only +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DYNLIB_CLASS 1 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 1 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 1 + +// Set to 1 to use ipv6 socket classes (requires wxUSE_SOCKETS) +// +// Notice that currently setting this option under Windows will result in +// programs which can only run on recent OS versions (with ws2_32.dll +// installed) which is why it is disabled by default. +// +// Default is 1. +// +// Recommended setting: 1 if you need IPv6 support +#define wxUSE_IPV6 0 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 1 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 1 + +// Set to 1 to enable virtual archive filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ARCHIVE 1 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 1 + +// wxArchive classes for accessing archives such as zip and tar +#define wxUSE_ARCHIVE_STREAMS 1 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 1 + +// Set to 1 to compile wxTarInput/OutputStream classes. +#define wxUSE_TARSTREAM 1 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 1 + +// If enabled, the code written by Apple will be used to write, in a portable +// way, float on the disk. See extended.c for the license which is different +// from wxWidgets one. +// +// Default is 1. +// +// Recommended setting: 1 unless you don't like the license terms (unlikely) +#define wxUSE_APPLE_IEEE 1 + +// Joystick support class +#define wxUSE_JOYSTICK 1 + +// wxFontEnumerator class +#define wxUSE_FONTENUM 1 + +// wxFontMapper class +#define wxUSE_FONTMAP 1 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 1 + +// wxProtocol and related classes: if you want to use either of wxFTP, wxHTTP +// or wxURL you need to set this to 1. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_PROTOCOL 1 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 1 +#define wxUSE_PROTOCOL_FTP 1 +#define wxUSE_PROTOCOL_HTTP 1 + +// Define this to use wxURL class. +#define wxUSE_URL 1 + +// Define this to use native platform url and protocol support. +// Currently valid only for MS-Windows. +// Note: if you set this to 1, you can open ftp/http/gopher sites +// and obtain a valid input stream for these sites +// even when you set wxUSE_PROTOCOL_FTP/HTTP to 0. +// Doing so reduces the code size. +// +// This code is experimental and subject to change. +#define wxUSE_URL_NATIVE 0 + +// Support for wxVariant class used in several places throughout the library, +// notably in wxDataViewCtrl API. +// +// Default is 1. +// +// Recommended setting: 1 unless you want to reduce the library size as much as +// possible in which case setting this to 0 can gain up to 100KB. +#define wxUSE_VARIANT 1 + +// Support for regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 1 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 1 + +// wxSound class +#define wxUSE_SOUND 1 + +// Use wxMediaCtrl +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_MEDIACTRL 1 + +// Use GStreamer for Unix (req a lot of dependancies) +// +// Default is 0 +// +// Recommended setting: 1 (wxMediaCtrl won't work by default without it) +#define wxUSE_GSTREAMER 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 1 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is the same as wxUSE_XRC, i.e. 1 by default. +// +// Recommended setting: 1 (required by XRC) +#define wxUSE_XML wxUSE_XRC + +// Use wxWidget's AUI docking system +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_AUI 1 + +// Use wxStyledTextCtrl, a wxWidgets implementation of Scintilla. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STC 1 + + +// Enable the new wxGraphicsPath and wxGraphicsContext classes for an advanced +// 2D drawing API. (Still somewhat experimental) +// +// Please note that on Windows you will need to link with gdiplus.lib (use +// USE_GDIPLUS=1 for makefile builds) and distribute gdiplus.dll with your +// application if you want it to be runnable on pre-XP systems. +// +// Default is 0 +// +// Recommended setting: 1 +#ifndef wxUSE_GRAPHICS_CONTEXT +#define wxUSE_GRAPHICS_CONTEXT 0 +#endif + +// ---------------------------------------------------------------------------- +// Individual GUI controls +// ---------------------------------------------------------------------------- + +// You must set wxUSE_CONTROLS to 1 if you are using any controls at all +// (without it, wxControl class is not compiled) +// +// Default is 1 +// +// Recommended setting: 1 (don't change except for very special programs) +#define wxUSE_CONTROLS 1 + +// wxPopupWindow class is a top level transient window. It is currently used +// to implement wxTipWindow +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0 if you don't wxUSE_TIPWINDOW) +#define wxUSE_POPUPWIN 1 + +// wxTipWindow allows to implement the custom tooltips, it is used by the +// context help classes. Requires wxUSE_POPUPWIN. +// +// Default is 1 +// +// Recommended setting: 1 (may be set to 0) +#define wxUSE_TIPWINDOW 1 + +// Each of the settings below corresponds to one wxWidgets control. They are +// all switched on by default but may be disabled if you are sure that your +// program (including any standard dialogs it can show!) doesn't need them and +// if you desperately want to save some space. If you use any of these you must +// set wxUSE_CONTROLS as well. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_ANIMATIONCTRL 1 // wxAnimationCtrl +#define wxUSE_BUTTON 1 // wxButton +#define wxUSE_BMPBUTTON 1 // wxBitmapButton +#define wxUSE_CALENDARCTRL 1 // wxCalendarCtrl +#define wxUSE_CHECKBOX 1 // wxCheckBox +#define wxUSE_CHECKLISTBOX 1 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 1 // wxChoice +#define wxUSE_COLLPANE 1 // wxCollapsiblePane +#define wxUSE_COLOURPICKERCTRL 1 // wxColourPickerCtrl +#define wxUSE_COMBOBOX 1 // wxComboBox +#define wxUSE_DATAVIEWCTRL 1 // wxDataViewCtrl +#define wxUSE_DATEPICKCTRL 1 // wxDatePickerCtrl +#define wxUSE_DIRPICKERCTRL 1 // wxDirPickerCtrl +#define wxUSE_EDITABLELISTBOX 1 // wxEditableListBox +#define wxUSE_FILECTRL 1 // wxFileCtrl +#define wxUSE_FILEPICKERCTRL 1 // wxFilePickerCtrl +#define wxUSE_FONTPICKERCTRL 1 // wxFontPickerCtrl +#define wxUSE_GAUGE 1 // wxGauge +#define wxUSE_HYPERLINKCTRL 1 // wxHyperlinkCtrl +#define wxUSE_LISTBOX 1 // wxListBox +#define wxUSE_LISTCTRL 1 // wxListCtrl +#define wxUSE_RADIOBOX 1 // wxRadioBox +#define wxUSE_RADIOBTN 1 // wxRadioButton +#define wxUSE_SCROLLBAR 1 // wxScrollBar +#define wxUSE_SEARCHCTRL 1 // wxSearchCtrl +#define wxUSE_SLIDER 1 // wxSlider +#define wxUSE_SPINBTN 1 // wxSpinButton +#define wxUSE_SPINCTRL 1 // wxSpinCtrl +#define wxUSE_STATBOX 1 // wxStaticBox +#define wxUSE_STATLINE 1 // wxStaticLine +#define wxUSE_STATTEXT 1 // wxStaticText +#define wxUSE_STATBMP 1 // wxStaticBitmap +#define wxUSE_TEXTCTRL 1 // wxTextCtrl +#define wxUSE_TOGGLEBTN 1 // requires wxButton +#define wxUSE_TREECTRL 1 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1 for the platforms where native status bar is supported. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 1 +#define wxUSE_TOOLBAR_NATIVE 1 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used to logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 1 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 1 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 1 + +// wxTreebook control is similar to wxNotebook but uses wxTreeCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TREEBOOK 1 + +// wxToolbook control is similar to wxNotebook but uses wxToolBar instead of +// tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLBOOK 1 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxTaskBarIcon is a small notification icon shown in the system toolbar or +// dock. +// +// Default is 1. +// +// Recommended setting: 1 (but can be set to 0 if you don't need it) +#define wxUSE_TASKBARICON 1 + +// wxGrid class +// +// Default is 1, set to 0 to cut down compilation time and binaries size if you +// don't use it. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 1 + +// wxMiniFrame class: a frame with narrow title bar +// +// Default is 1. +// +// Recommended setting: 1 (it doesn't cost almost anything) +#define wxUSE_MINIFRAME 1 + +// wxComboCtrl and related classes: combobox with custom popup window and +// not necessarily a listbox. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 except for wxUniv where it +// it used by wxComboBox +#define wxUSE_COMBOCTRL 1 + +// wxOwnerDrawnComboBox is a custom combobox allowing to paint the combobox +// items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0, except where it is +// needed as a base class for generic wxBitmapComboBox. +#define wxUSE_ODCOMBOBOX 1 + +// wxBitmapComboBox is a combobox that can have images in front of text items. +// +// Default is 1. +// +// Recommended setting: 1 but can be safely set to 0 +#define wxUSE_BITMAPCOMBOBOX 1 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 1 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 1 + +// Use wxCaret: a class implementing a "cursor" in a text control (called caret +// under Windows). +// +// Default is 1. +// +// Recommended setting: 1 (can be safely set to 0, not used by the library) +#define wxUSE_CARET 1 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// their geometries as well as finding the display on which the given point or +// window lies. +// +// Default is 1. +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 1 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 1 + +// Use wxImageList. This class is needed by wxNotebook, wxTreeCtrl and +// wxListCtrl. +// +// Default is 1. +// +// Recommended setting: 1 (set it to 0 if you don't use any of the controls +// enumerated above, then this class is mostly useless too) +#define wxUSE_IMAGLIST 1 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxNotificationMessage. +// +// wxNotificationMessage allows to show non-intrusive messages to the user +// using balloons, banners, popups or whatever is the appropriate method for +// the current platform. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTIFICATION_MESSAGE 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 1 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 1 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 1 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 1 + +// Use reference counted ID management: this means that wxWidgets will track +// the automatically allocated ids (those used when you use wxID_ANY when +// creating a window, menu or toolbar item &c) instead of just supposing that +// the program never runs out of them. This is mostly useful only under wxMSW +// where the total ids range is limited to SHRT_MIN..SHRT_MAX and where +// long-running programs can run into problems with ids reuse without this. On +// the other platforms, where the ids have the full int range, this shouldn't +// be necessary. +#ifdef __WXMSW__ +#define wxUSE_AUTOID_MANAGEMENT 1 +#else +#define wxUSE_AUTOID_MANAGEMENT 0 +#endif + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 1 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 1 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 1 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 1 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 1 + +// TODO: setting to choose the generic or native one + +// Use file open/save dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in many places in the library itself) +#define wxUSE_FILEDLG 1 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 1 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 1 + +// Use wxMessageDialog and wxMessageBox. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_MSGDLG 1 + +// progress dialog class for lengthy operations +#define wxUSE_PROGRESSDLG 1 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 1 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 1 + +// number entry dialog +#define wxUSE_NUMBERDLG 1 + +// splash screen class +#define wxUSE_SPLASH 1 + +// wizards +#define wxUSE_WIZARDDLG 1 + +// Compile in wxAboutBox() function showing the standard "About" dialog. +// +// Default is 1 +// +// Recommended setting: 1 but can be set to 0 to save some space if you don't +// use this function +#define wxUSE_ABOUTDLG 1 + +// ---------------------------------------------------------------------------- +// Metafiles support +// ---------------------------------------------------------------------------- + +// Windows supports the graphics format known as metafile which is, though not +// portable, is widely used under Windows and so is supported by wxWin (under +// Windows only, of course). Win16 (Win3.1) used the so-called "Window +// MetaFiles" or WMFs which were replaced with "Enhanced MetaFiles" or EMFs in +// Win32 (Win9x, NT, 2000). Both of these are supported in wxWin and, by +// default, WMFs will be used under Win16 and EMFs under Win32. This may be +// changed by setting wxUSE_WIN_METAFILES_ALWAYS to 1 and/or setting +// wxUSE_ENH_METAFILE to 0. You may also set wxUSE_METAFILE to 0 to not compile +// in any metafile related classes at all. +// +// Default is 1 for wxUSE_ENH_METAFILE and 0 for wxUSE_WIN_METAFILES_ALWAYS. +// +// Recommended setting: default or 0 for everything for portable programs. +#define wxUSE_METAFILE 1 +#define wxUSE_ENH_METAFILE 1 +#define wxUSE_WIN_METAFILES_ALWAYS 0 + +// ---------------------------------------------------------------------------- +// Big GUI components +// ---------------------------------------------------------------------------- + +// Set to 0 to disable MDI support. +// +// Requires wxUSE_NOTEBOOK under platforms other than MSW. +// +// Default is 1. +// +// Recommended setting: 1, can be safely set to 0. +#define wxUSE_MDI 1 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 1 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 1 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 1 + +// wxHTML sublibrary allows to display HTML in wxWindow programs and much, +// much more. +// +// Default is 1. +// +// Recommended setting: 1 (wxHTML is great!), set to 0 if you want compile a +// smaller library. +#define wxUSE_HTML 1 + +// Setting wxUSE_GLCANVAS to 1 enables OpenGL support. You need to have OpenGL +// headers and libraries to be able to compile the library with wxUSE_GLCANVAS +// set to 1. Note that for some compilers (notably Microsoft Visual C++) you +// will need to manually add opengl32.lib and glu32.lib to the list of +// libraries linked with your program if you use OpenGL. +// +// Default is 0. +// +// Recommended setting: 1 if you intend to use OpenGL, 0 otherwise +#define wxUSE_GLCANVAS 0 + +// wxRichTextCtrl allows editing of styled text. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 if you want compile a +// smaller library. +#define wxUSE_RICHTEXT 1 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 1 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 1 + +// Use wxDropTarget and wxDropSource classes for drag and drop (this is +// different from "built in" drag and drop in wxTreeCtrl which is always +// available). Requires wxUSE_DATAOBJ. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DRAG_AND_DROP 1 + +// Use wxAccessible for enhanced and customisable accessibility. +// Depends on wxUSE_OLE. +// +// Default is 0. +// +// Recommended setting (at present): 0 +#define wxUSE_ACCESSIBILITY 0 + +// ---------------------------------------------------------------------------- +// miscellaneous settings +// ---------------------------------------------------------------------------- + +// wxSingleInstanceChecker class allows to verify at startup if another program +// instance is running. +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 1 + +#define wxUSE_DRAGIMAGE 1 + +#define wxUSE_IPC 1 + // 0 for no interprocess comms +#define wxUSE_HELP 1 + // 0 for no help facility + +// Should we use MS HTML help for wxHelpController? If disabled, neither +// wxCHMHelpController nor wxBestHelpController are available. +// +// Default is 1 under MSW, 0 is always used for the other platforms. +// +// Recommended setting: 1, only set to 0 if you have trouble compiling +// wxCHMHelpController (could be a problem with really ancient compilers) +#define wxUSE_MS_HTML_HELP 1 + + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 1 + +#define wxUSE_CONSTRAINTS 1 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 1 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 1 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// wxDC classes for various output formats +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 1 + +// Set to 1 to compile in support for wxSVGFileDC, a wxDC subclass which allows +// to create fiels in SVG (Scalable Vector Graphics) format. +#define wxUSE_SVG 1 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set this option to 1 to use , 0 to use . +// +// Note that newer compilers (including VC++ 7.1 and later) don't support +// wxUSE_IOSTREAMH == 1 and so will be used anyhow. +// +// Default is 0. +// +// Recommended setting: 0, only set to 1 if you use a really old compiler +#define wxUSE_IOSTREAMH 0 + +// ---------------------------------------------------------------------------- +// image format support +// ---------------------------------------------------------------------------- + +// wxImage supports many different image formats which can be configured at +// compile-time. BMP is always supported, others are optional and can be safely +// disabled if you don't plan to use images in such format sometimes saving +// substantial amount of code in the final library. +// +// Some formats require an extra library which is included in wxWin sources +// which is mentioned if it is the case. + +// Set to 1 for wxImage support (recommended). +#define wxUSE_IMAGE 1 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 1 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 1 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 1 + +// Set to 1 for TGA format support (loading only) +#define wxUSE_TGA 1 + +// Set to 1 for GIF format support +#define wxUSE_GIF 1 + +// Set to 1 for PNM format support +#define wxUSE_PNM 1 + +// Set to 1 for PCX format support +#define wxUSE_PCX 1 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 1 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 1 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 1 + +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + +/* --- end common options --- */ + +// ---------------------------------------------------------------------------- +// Mac-specific settings +// ---------------------------------------------------------------------------- + +// override some settings for Metrowerks +// +// VZ: isn't this file only used when building with Metrowerks anyhow? +// CS: no, it is also used by the XCode projects +#ifdef __MWERKS__ + #undef wxUSE_DEBUG_CONTEXT + #define wxUSE_DEBUG_CONTEXT 1 + + #undef wxUSE_STD_IOSTREAM + // CS: I have to set this to 0 now, as shared builds are having problems + #define wxUSE_STD_IOSTREAM 0 +#endif + +// things not implemented under Mac +#undef wxUSE_POPUPWIN +#define wxUSE_POPUPWIN 0 + +#undef wxUSE_TIPWINDOW +#define wxUSE_TIPWINDOW 0 + +#undef wxUSE_TOGGLEBTN +#define wxUSE_TOGGLEBTN 0 + +#undef wxUSE_STACKWALKER +#define wxUSE_STACKWALKER 0 + +// wxWebKit is a wrapper for Apple's WebKit framework, use it if you want to +// embed the Safari browser control +// 0 by default because of Jaguar compatibility problems +#define wxUSE_WEBKIT 0 + + +// Set to 0 for no libmspack +#define wxUSE_LIBMSPACK 0 + +// native toolbar does not support embedding controls yet, please test by setting to 1 +#define wxMAC_USE_NATIVE_TOOLBAR 0 + +// make sure we have the proper dispatcher for the console event loop +#define wxUSE_SELECT_DISPATCHER 1 +#define wxUSE_EPOLL_DISPATCHER 0 + + + +#endif + // _WX_SETUP_H_ diff --git a/include/wx/osx/slider.h b/include/wx/osx/slider.h new file mode 100644 index 0000000000..679c7db5de --- /dev/null +++ b/include/wx/osx/slider.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/slider.h" +#else +#include "wx/mac/carbon/slider.h" +#endif diff --git a/include/wx/osx/sound.h b/include/wx/osx/sound.h new file mode 100644 index 0000000000..b282748a9a --- /dev/null +++ b/include/wx/osx/sound.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/sound.h" +#else +#include "wx/mac/carbon/sound.h" +#endif diff --git a/include/wx/osx/spinbutt.h b/include/wx/osx/spinbutt.h new file mode 100644 index 0000000000..af5d5ef1a6 --- /dev/null +++ b/include/wx/osx/spinbutt.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/spinbutt.h" +#else +#include "wx/mac/carbon/spinbutt.h" +#endif diff --git a/include/wx/osx/spinctrl.h b/include/wx/osx/spinctrl.h new file mode 100644 index 0000000000..77da03667c --- /dev/null +++ b/include/wx/osx/spinctrl.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/spinctrl.h" +#else +#include "wx/mac/carbon/spinctrl.h" +#endif diff --git a/include/wx/osx/srchctrl.h b/include/wx/osx/srchctrl.h new file mode 100644 index 0000000000..91f957a521 --- /dev/null +++ b/include/wx/osx/srchctrl.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/generic/srchctlg.h" +#else +#include "wx/mac/carbon/srchctrl.h" +#endif diff --git a/include/wx/osx/statbmp.h b/include/wx/osx/statbmp.h new file mode 100644 index 0000000000..6db8aa80ae --- /dev/null +++ b/include/wx/osx/statbmp.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/statbmp.h" +#else +#include "wx/mac/carbon/statbmp.h" +#endif diff --git a/include/wx/osx/statbox.h b/include/wx/osx/statbox.h new file mode 100644 index 0000000000..b0cbc8774c --- /dev/null +++ b/include/wx/osx/statbox.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/statbox.h" +#else +#include "wx/mac/carbon/statbox.h" +#endif diff --git a/include/wx/osx/statline.h b/include/wx/osx/statline.h new file mode 100644 index 0000000000..68324363ed --- /dev/null +++ b/include/wx/osx/statline.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/statline.h" +#else +#include "wx/mac/carbon/statline.h" +#endif diff --git a/include/wx/osx/stattext.h b/include/wx/osx/stattext.h new file mode 100644 index 0000000000..4e57c31441 --- /dev/null +++ b/include/wx/osx/stattext.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/stattext.h" +#else +#include "wx/mac/carbon/stattext.h" +#endif diff --git a/include/wx/osx/statusbr.h b/include/wx/osx/statusbr.h new file mode 100644 index 0000000000..01e17c5667 --- /dev/null +++ b/include/wx/osx/statusbr.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/statusbr.h" +#else +#include "wx/mac/carbon/statusbr.h" +#endif diff --git a/include/wx/osx/tabctrl.h b/include/wx/osx/tabctrl.h new file mode 100644 index 0000000000..356b4a9e46 --- /dev/null +++ b/include/wx/osx/tabctrl.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/tabctrl.h" +#else +#include "wx/mac/carbon/tabctrl.h" +#endif diff --git a/include/wx/osx/taskbarosx.h b/include/wx/osx/taskbarosx.h new file mode 100644 index 0000000000..07815224cb --- /dev/null +++ b/include/wx/osx/taskbarosx.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/taskbarosx.h" +#else +#include "wx/mac/carbon/taskbarosx.h" +#endif diff --git a/include/wx/osx/textctrl.h b/include/wx/osx/textctrl.h new file mode 100644 index 0000000000..fe1bd4caea --- /dev/null +++ b/include/wx/osx/textctrl.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/textctrl.h" +#else +#include "wx/mac/carbon/textctrl.h" +#endif diff --git a/include/wx/osx/tglbtn.h b/include/wx/osx/tglbtn.h new file mode 100644 index 0000000000..c7104ac928 --- /dev/null +++ b/include/wx/osx/tglbtn.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/tglbtn.h" +#else +#include "wx/mac/carbon/tglbtn.h" +#endif \ No newline at end of file diff --git a/include/wx/osx/toolbar.h b/include/wx/osx/toolbar.h new file mode 100644 index 0000000000..8f553dbdb3 --- /dev/null +++ b/include/wx/osx/toolbar.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/toolbar.h" +#else +#include "wx/mac/carbon/toolbar.h" +#endif diff --git a/include/wx/osx/tooltip.h b/include/wx/osx/tooltip.h new file mode 100644 index 0000000000..46a0bf8180 --- /dev/null +++ b/include/wx/osx/tooltip.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/tooltip.h" +#else +#include "wx/mac/carbon/tooltip.h" +#endif diff --git a/include/wx/osx/toplevel.h b/include/wx/osx/toplevel.h new file mode 100644 index 0000000000..fbc25b5623 --- /dev/null +++ b/include/wx/osx/toplevel.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/toplevel.h" +#else +#include "wx/mac/carbon/toplevel.h" +#endif diff --git a/include/wx/osx/treectrl.h b/include/wx/osx/treectrl.h new file mode 100644 index 0000000000..09a33f0dae --- /dev/null +++ b/include/wx/osx/treectrl.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/treectl.h" +#else +#include "wx/mac/carbon/treectrl.h" +#endif \ No newline at end of file diff --git a/include/wx/osx/uma.h b/include/wx/osx/uma.h new file mode 100644 index 0000000000..16995b9c47 --- /dev/null +++ b/include/wx/osx/uma.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/uma.h" +#else +#include "wx/mac/carbon/uma.h" +#endif diff --git a/include/wx/osx/window.h b/include/wx/osx/window.h new file mode 100644 index 0000000000..14b131e37b --- /dev/null +++ b/include/wx/osx/window.h @@ -0,0 +1,5 @@ +#ifdef __WXMAC_CLASSIC__ +#include "wx/mac/classic/window.h" +#else +#include "wx/mac/carbon/window.h" +#endif -- 2.45.2