From ffecfa5aeb540b54914739dbb8603edbbd4c00a0 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 19 Oct 2004 13:40:30 +0000 Subject: [PATCH] Committed William Osborne's wxPalmOS port git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/palmos/.cdtproject | 22 + build/palmos/.project | 126 ++ build/palmos/auto-generated.mk | 72 + build/palmos/makefile | 456 ++++++ build/palmos/makefile-engine.mk | 746 ++++++++++ docs/palmos/readme.txt | 66 + include/wx/app.h | 4 +- include/wx/apptrait.h | 8 +- include/wx/bitmap.h | 4 +- include/wx/brush.h | 4 +- include/wx/chkconf.h | 4 +- include/wx/colour.h | 4 +- include/wx/control.h | 2 + include/wx/cursor.h | 4 +- include/wx/dc.h | 4 +- include/wx/dcclient.h | 4 +- include/wx/dcmemory.h | 4 +- include/wx/dcprint.h | 4 +- include/wx/dcscreen.h | 4 +- include/wx/dialog.h | 4 +- include/wx/encinfo.h | 3 +- include/wx/evtloop.h | 4 +- include/wx/filefn.h | 4 +- include/wx/font.h | 4 +- include/wx/fontutil.h | 4 +- include/wx/frame.h | 4 +- include/wx/gdiobj.h | 4 +- include/wx/help.h | 4 + include/wx/icon.h | 4 +- include/wx/menu.h | 2 + include/wx/menuitem.h | 2 + include/wx/metafile.h | 8 + include/wx/minifram.h | 4 +- include/wx/msgdlg.h | 2 + include/wx/palmos/AppResources.h | 94 ++ .../wx/palmos/Icons/AppIcon_Large-X2-8.bmp | Bin 0 -> 3366 bytes .../wx/palmos/Icons/AppIcon_Small-X2-8.bmp | Bin 0 -> 1654 bytes include/wx/palmos/Version.xrd | 9 + include/wx/palmos/accel.h | 58 + include/wx/palmos/app.h | 117 ++ include/wx/palmos/apptbase.h | 54 + include/wx/palmos/apptrait.h | 45 + include/wx/palmos/bitmap.h | 293 ++++ include/wx/palmos/bmpbuttn.h | 65 + include/wx/palmos/brush.h | 65 + include/wx/palmos/button.h | 94 ++ include/wx/palmos/caret.h | 68 + include/wx/palmos/checkbox.h | 65 + include/wx/palmos/checklst.h | 98 ++ include/wx/palmos/chkconf.h | 118 ++ include/wx/palmos/choice.h | 127 ++ include/wx/palmos/clipbrd.h | 102 ++ include/wx/palmos/colordlg.h | 61 + include/wx/palmos/colour.h | 114 ++ include/wx/palmos/combobox.h | 114 ++ include/wx/palmos/control.h | 136 ++ include/wx/palmos/crashrpt.h | 69 + include/wx/palmos/cursor.h | 59 + include/wx/palmos/dc.h | 276 ++++ include/wx/palmos/dcclient.h | 122 ++ include/wx/palmos/dcmemory.h | 45 + include/wx/palmos/dcprint.h | 68 + include/wx/palmos/dcscreen.h | 41 + include/wx/palmos/dialog.h | 130 ++ include/wx/palmos/dib.h | 243 ++++ include/wx/palmos/dirdlg.h | 49 + include/wx/palmos/display.h | 56 + include/wx/palmos/dragimag.h | 275 ++++ include/wx/palmos/enhmeta.h | 180 +++ include/wx/palmos/evtloop.h | 50 + include/wx/palmos/fdrepdlg.h | 63 + include/wx/palmos/filedlg.h | 48 + include/wx/palmos/font.h | 162 +++ include/wx/palmos/fontdlg.h | 44 + include/wx/palmos/fontenum.h | 45 + include/wx/palmos/frame.h | 169 +++ include/wx/palmos/gauge.h | 69 + include/wx/palmos/gccpriv.h | 105 ++ include/wx/palmos/gdiimage.h | 182 +++ include/wx/palmos/gdiobj.h | 65 + include/wx/palmos/glcanvas.h | 164 +++ include/wx/palmos/help.h | 60 + include/wx/palmos/icon.h | 107 ++ include/wx/palmos/imaglist.h | 231 +++ include/wx/palmos/iniconf.h | 95 ++ include/wx/palmos/joystick.h | 94 ++ include/wx/palmos/listbox.h | 166 +++ include/wx/palmos/listctrl.h | 423 ++++++ include/wx/palmos/mdi.h | 231 +++ include/wx/palmos/menu.h | 240 +++ include/wx/palmos/menuitem.h | 96 ++ include/wx/palmos/metafile.h | 174 +++ include/wx/palmos/mimetype.h | 126 ++ include/wx/palmos/minifram.h | 56 + include/wx/palmos/msgdlg.h | 47 + include/wx/palmos/mslu.h | 72 + include/wx/palmos/msvcrt.h | 69 + include/wx/palmos/notebook.h | 196 +++ include/wx/palmos/palette.h | 65 + include/wx/palmos/pen.h | 145 ++ include/wx/palmos/popupwin.h | 49 + include/wx/palmos/printdlg.h | 80 + include/wx/palmos/printpalm.h | 69 + include/wx/palmos/radiobox.h | 163 +++ include/wx/palmos/radiobut.h | 74 + include/wx/palmos/regconf.h | 112 ++ include/wx/palmos/region.h | 195 +++ include/wx/palmos/registry.h | 244 ++++ include/wx/palmos/scrolbar.h | 74 + include/wx/palmos/setup.h | 1107 ++++++++++++++ include/wx/palmos/setup0.h | 1107 ++++++++++++++ include/wx/palmos/slider.h | 108 ++ include/wx/palmos/sound.h | 55 + include/wx/palmos/spinbutt.h | 70 + include/wx/palmos/spinctrl.h | 121 ++ include/wx/palmos/statbmp.h | 104 ++ include/wx/palmos/statbox.h | 58 + include/wx/palmos/statline.h | 58 + include/wx/palmos/stattext.h | 59 + include/wx/palmos/statusbr.h | 84 ++ include/wx/palmos/tabctrl.h | 164 +++ include/wx/palmos/taskbar.h | 86 ++ include/wx/palmos/textctrl.h | 261 ++++ include/wx/palmos/tglbtn.h | 61 + include/wx/palmos/timer.h | 44 + include/wx/palmos/toolbar.h | 119 ++ include/wx/palmos/tooltip.h | 60 + include/wx/palmos/toplevel.h | 146 ++ include/wx/palmos/treectrl.h | 512 +++++++ include/wx/palmos/window.h | 522 +++++++ include/wx/palmos/wxWidgets.def | 7 + include/wx/palmos/wxWidgets.sld | 9 + include/wx/palmos/wxWidgets.xrd | 501 +++++++ include/wx/pen.h | 4 +- include/wx/platform.h | 4 +- include/wx/printdlg.h | 2 + include/wx/region.h | 4 +- include/wx/renderer.h | 2 +- include/wx/statusbr.h | 4 + include/wx/string.h | 4 + include/wx/taskbar.h | 4 +- include/wx/toolbar.h | 2 + include/wx/toplevel.h | 5 +- include/wx/treectrl.h | 2 + include/wx/window.h | 9 +- include/wx/wxchar.h | 11 +- src/common/appbase.cpp | 4 +- src/common/appcmn.cpp | 2 +- src/common/cmndata.cpp | 2 +- src/common/containr.cpp | 4 +- src/common/fontcmn.cpp | 2 +- src/common/gdicmn.cpp | 2 +- src/common/init.cpp | 2 + src/common/msgout.cpp | 4 +- src/common/utilscmn.cpp | 2 +- src/generic/imaglist.cpp | 4 +- src/generic/notebook.cpp | 4 + src/palmos/accel.cpp | 97 ++ src/palmos/app.cpp | 313 ++++ src/palmos/base.cpp | 55 + src/palmos/bitmap.cpp | 525 +++++++ src/palmos/bmpbuttn.cpp | 139 ++ src/palmos/brush.cpp | 136 ++ src/palmos/button.cpp | 248 ++++ src/palmos/caret.cpp | 115 ++ src/palmos/checkbox.cpp | 166 +++ src/palmos/checklst.cpp | 291 ++++ src/palmos/choice.cpp | 284 ++++ src/palmos/clipbrd.cpp | 210 +++ src/palmos/colordlg.cpp | 147 ++ src/palmos/colour.cpp | 114 ++ src/palmos/combobox.cpp | 265 ++++ src/palmos/control.cpp | 201 +++ src/palmos/crashrpt.cpp | 537 +++++++ src/palmos/cursor.cpp | 138 ++ src/palmos/data.cpp | 22 + src/palmos/dc.cpp | 510 +++++++ src/palmos/dcclient.cpp | 163 +++ src/palmos/dcmemory.cpp | 95 ++ src/palmos/dcprint.cpp | 148 ++ src/palmos/dcscreen.cpp | 40 + src/palmos/dialog.cpp | 265 ++++ src/palmos/dialup.cpp | 1290 +++++++++++++++++ src/palmos/dib.cpp | 170 +++ src/palmos/dir.cpp | 119 ++ src/palmos/dirdlg.cpp | 143 ++ src/palmos/display.cpp | 276 ++++ src/palmos/dragimag.cpp | 159 ++ src/palmos/dummy.cpp | 30 + src/palmos/dummydll.cpp | 25 + src/palmos/enhmeta.cpp | 180 +++ src/palmos/evtloop.cpp | 164 +++ src/palmos/fdrepdlg.cpp | 210 +++ src/palmos/filedlg.cpp | 106 ++ src/palmos/font.cpp | 535 +++++++ src/palmos/fontdlg.cpp | 68 + src/palmos/fontenum.cpp | 155 ++ src/palmos/fontutil.cpp | 77 + src/palmos/frame.cpp | 395 +++++ src/palmos/gauge.cpp | 177 +++ src/palmos/gdiimage.cpp | 119 ++ src/palmos/gdiobj.cpp | 45 + src/palmos/glcanvas.cpp | 279 ++++ src/palmos/help.cpp | 89 ++ src/palmos/icon.cpp | 97 ++ src/palmos/imaglist.cpp | 142 ++ src/palmos/iniconf.cpp | 220 +++ src/palmos/joystick.cpp | 257 ++++ src/palmos/listbox.cpp | 324 +++++ src/palmos/listctrl.cpp | 741 ++++++++++ src/palmos/main.cpp | 66 + src/palmos/mdi.cpp | 441 ++++++ src/palmos/menu.cpp | 677 +++++++++ src/palmos/menuitem.cpp | 226 +++ src/palmos/metafile.cpp | 216 +++ src/palmos/mimetype.cpp | 827 +++++++++++ src/palmos/minifram.cpp | 29 + src/palmos/msgdlg.cpp | 161 ++ src/palmos/mslu.cpp | 211 +++ src/palmos/nativdlg.cpp | 84 ++ src/palmos/notebook.cpp | 412 ++++++ src/palmos/ownerdrw.cpp | 130 ++ src/palmos/palette.cpp | 83 ++ src/palmos/pen.cpp | 122 ++ src/palmos/popupwin.cpp | 72 + src/palmos/printdlg.cpp | 117 ++ src/palmos/printpalm.cpp | 130 ++ src/palmos/radiobox.cpp | 321 ++++ src/palmos/radiobut.cpp | 157 ++ src/palmos/regconf.cpp | 207 +++ src/palmos/region.cpp | 243 ++++ src/palmos/registry.cpp | 1027 +++++++++++++ src/palmos/renderer.cpp | 191 +++ src/palmos/scrolbar.cpp | 138 ++ src/palmos/settings.cpp | 113 ++ src/palmos/slider.cpp | 235 +++ src/palmos/snglinst.cpp | 97 ++ src/palmos/sound.cpp | 76 + src/palmos/spinbutt.cpp | 178 +++ src/palmos/spinctrl.cpp | 251 ++++ src/palmos/statbmp.cpp | 162 +++ src/palmos/statbox.cpp | 127 ++ src/palmos/statline.cpp | 126 ++ src/palmos/stattext.cpp | 127 ++ src/palmos/statusbr.cpp | 250 ++++ src/palmos/tabctrl.cpp | 189 +++ src/palmos/taskbar.cpp | 153 ++ src/palmos/textctrl.cpp | 747 ++++++++++ src/palmos/tglbtn.cpp | 116 ++ src/palmos/thread.cpp | 598 ++++++++ src/palmos/timer.cpp | 105 ++ src/palmos/toolbar.cpp | 289 ++++ src/palmos/tooltip.cpp | 151 ++ src/palmos/toplevel.cpp | 291 ++++ src/palmos/treectrl.cpp | 791 ++++++++++ src/palmos/utils.cpp | 235 +++ src/palmos/utilsexc.cpp | 102 ++ src/palmos/utilsgui.cpp | 179 +++ src/palmos/volume.cpp | 268 ++++ src/palmos/window.cpp | 1160 +++++++++++++++ 260 files changed, 40716 insertions(+), 44 deletions(-) create mode 100644 build/palmos/.cdtproject create mode 100644 build/palmos/.project create mode 100644 build/palmos/auto-generated.mk create mode 100644 build/palmos/makefile create mode 100644 build/palmos/makefile-engine.mk create mode 100644 docs/palmos/readme.txt create mode 100644 include/wx/palmos/AppResources.h create mode 100644 include/wx/palmos/Icons/AppIcon_Large-X2-8.bmp create mode 100644 include/wx/palmos/Icons/AppIcon_Small-X2-8.bmp create mode 100644 include/wx/palmos/Version.xrd create mode 100644 include/wx/palmos/accel.h create mode 100644 include/wx/palmos/app.h create mode 100644 include/wx/palmos/apptbase.h create mode 100644 include/wx/palmos/apptrait.h create mode 100644 include/wx/palmos/bitmap.h create mode 100644 include/wx/palmos/bmpbuttn.h create mode 100644 include/wx/palmos/brush.h create mode 100644 include/wx/palmos/button.h create mode 100644 include/wx/palmos/caret.h create mode 100644 include/wx/palmos/checkbox.h create mode 100644 include/wx/palmos/checklst.h create mode 100644 include/wx/palmos/chkconf.h create mode 100644 include/wx/palmos/choice.h create mode 100644 include/wx/palmos/clipbrd.h create mode 100644 include/wx/palmos/colordlg.h create mode 100644 include/wx/palmos/colour.h create mode 100644 include/wx/palmos/combobox.h create mode 100644 include/wx/palmos/control.h create mode 100644 include/wx/palmos/crashrpt.h create mode 100644 include/wx/palmos/cursor.h create mode 100644 include/wx/palmos/dc.h create mode 100644 include/wx/palmos/dcclient.h create mode 100644 include/wx/palmos/dcmemory.h create mode 100644 include/wx/palmos/dcprint.h create mode 100644 include/wx/palmos/dcscreen.h create mode 100644 include/wx/palmos/dialog.h create mode 100644 include/wx/palmos/dib.h create mode 100644 include/wx/palmos/dirdlg.h create mode 100644 include/wx/palmos/display.h create mode 100644 include/wx/palmos/dragimag.h create mode 100644 include/wx/palmos/enhmeta.h create mode 100644 include/wx/palmos/evtloop.h create mode 100644 include/wx/palmos/fdrepdlg.h create mode 100644 include/wx/palmos/filedlg.h create mode 100644 include/wx/palmos/font.h create mode 100644 include/wx/palmos/fontdlg.h create mode 100644 include/wx/palmos/fontenum.h create mode 100644 include/wx/palmos/frame.h create mode 100644 include/wx/palmos/gauge.h create mode 100644 include/wx/palmos/gccpriv.h create mode 100644 include/wx/palmos/gdiimage.h create mode 100644 include/wx/palmos/gdiobj.h create mode 100644 include/wx/palmos/glcanvas.h create mode 100644 include/wx/palmos/help.h create mode 100644 include/wx/palmos/icon.h create mode 100644 include/wx/palmos/imaglist.h create mode 100644 include/wx/palmos/iniconf.h create mode 100644 include/wx/palmos/joystick.h create mode 100644 include/wx/palmos/listbox.h create mode 100644 include/wx/palmos/listctrl.h create mode 100644 include/wx/palmos/mdi.h create mode 100644 include/wx/palmos/menu.h create mode 100644 include/wx/palmos/menuitem.h create mode 100644 include/wx/palmos/metafile.h create mode 100644 include/wx/palmos/mimetype.h create mode 100644 include/wx/palmos/minifram.h create mode 100644 include/wx/palmos/msgdlg.h create mode 100644 include/wx/palmos/mslu.h create mode 100644 include/wx/palmos/msvcrt.h create mode 100644 include/wx/palmos/notebook.h create mode 100644 include/wx/palmos/palette.h create mode 100644 include/wx/palmos/pen.h create mode 100644 include/wx/palmos/popupwin.h create mode 100644 include/wx/palmos/printdlg.h create mode 100644 include/wx/palmos/printpalm.h create mode 100644 include/wx/palmos/radiobox.h create mode 100644 include/wx/palmos/radiobut.h create mode 100644 include/wx/palmos/regconf.h create mode 100644 include/wx/palmos/region.h create mode 100644 include/wx/palmos/registry.h create mode 100644 include/wx/palmos/scrolbar.h create mode 100644 include/wx/palmos/setup.h create mode 100644 include/wx/palmos/setup0.h create mode 100644 include/wx/palmos/slider.h create mode 100644 include/wx/palmos/sound.h create mode 100644 include/wx/palmos/spinbutt.h create mode 100644 include/wx/palmos/spinctrl.h create mode 100644 include/wx/palmos/statbmp.h create mode 100644 include/wx/palmos/statbox.h create mode 100644 include/wx/palmos/statline.h create mode 100644 include/wx/palmos/stattext.h create mode 100644 include/wx/palmos/statusbr.h create mode 100644 include/wx/palmos/tabctrl.h create mode 100644 include/wx/palmos/taskbar.h create mode 100644 include/wx/palmos/textctrl.h create mode 100644 include/wx/palmos/tglbtn.h create mode 100644 include/wx/palmos/timer.h create mode 100644 include/wx/palmos/toolbar.h create mode 100644 include/wx/palmos/tooltip.h create mode 100644 include/wx/palmos/toplevel.h create mode 100644 include/wx/palmos/treectrl.h create mode 100644 include/wx/palmos/window.h create mode 100644 include/wx/palmos/wxWidgets.def create mode 100644 include/wx/palmos/wxWidgets.sld create mode 100644 include/wx/palmos/wxWidgets.xrd create mode 100644 src/palmos/accel.cpp create mode 100644 src/palmos/app.cpp create mode 100644 src/palmos/base.cpp create mode 100644 src/palmos/bitmap.cpp create mode 100644 src/palmos/bmpbuttn.cpp create mode 100644 src/palmos/brush.cpp create mode 100644 src/palmos/button.cpp create mode 100644 src/palmos/caret.cpp create mode 100644 src/palmos/checkbox.cpp create mode 100644 src/palmos/checklst.cpp create mode 100644 src/palmos/choice.cpp create mode 100644 src/palmos/clipbrd.cpp create mode 100644 src/palmos/colordlg.cpp create mode 100644 src/palmos/colour.cpp create mode 100644 src/palmos/combobox.cpp create mode 100644 src/palmos/control.cpp create mode 100644 src/palmos/crashrpt.cpp create mode 100644 src/palmos/cursor.cpp create mode 100644 src/palmos/data.cpp create mode 100644 src/palmos/dc.cpp create mode 100644 src/palmos/dcclient.cpp create mode 100644 src/palmos/dcmemory.cpp create mode 100644 src/palmos/dcprint.cpp create mode 100644 src/palmos/dcscreen.cpp create mode 100644 src/palmos/dialog.cpp create mode 100644 src/palmos/dialup.cpp create mode 100644 src/palmos/dib.cpp create mode 100644 src/palmos/dir.cpp create mode 100644 src/palmos/dirdlg.cpp create mode 100644 src/palmos/display.cpp create mode 100644 src/palmos/dragimag.cpp create mode 100644 src/palmos/dummy.cpp create mode 100644 src/palmos/dummydll.cpp create mode 100644 src/palmos/enhmeta.cpp create mode 100644 src/palmos/evtloop.cpp create mode 100644 src/palmos/fdrepdlg.cpp create mode 100644 src/palmos/filedlg.cpp create mode 100644 src/palmos/font.cpp create mode 100644 src/palmos/fontdlg.cpp create mode 100644 src/palmos/fontenum.cpp create mode 100644 src/palmos/fontutil.cpp create mode 100644 src/palmos/frame.cpp create mode 100644 src/palmos/gauge.cpp create mode 100644 src/palmos/gdiimage.cpp create mode 100644 src/palmos/gdiobj.cpp create mode 100644 src/palmos/glcanvas.cpp create mode 100644 src/palmos/help.cpp create mode 100644 src/palmos/icon.cpp create mode 100644 src/palmos/imaglist.cpp create mode 100644 src/palmos/iniconf.cpp create mode 100644 src/palmos/joystick.cpp create mode 100644 src/palmos/listbox.cpp create mode 100644 src/palmos/listctrl.cpp create mode 100644 src/palmos/main.cpp create mode 100644 src/palmos/mdi.cpp create mode 100644 src/palmos/menu.cpp create mode 100644 src/palmos/menuitem.cpp create mode 100644 src/palmos/metafile.cpp create mode 100644 src/palmos/mimetype.cpp create mode 100644 src/palmos/minifram.cpp create mode 100644 src/palmos/msgdlg.cpp create mode 100644 src/palmos/mslu.cpp create mode 100644 src/palmos/nativdlg.cpp create mode 100644 src/palmos/notebook.cpp create mode 100644 src/palmos/ownerdrw.cpp create mode 100644 src/palmos/palette.cpp create mode 100644 src/palmos/pen.cpp create mode 100644 src/palmos/popupwin.cpp create mode 100644 src/palmos/printdlg.cpp create mode 100644 src/palmos/printpalm.cpp create mode 100644 src/palmos/radiobox.cpp create mode 100644 src/palmos/radiobut.cpp create mode 100644 src/palmos/regconf.cpp create mode 100644 src/palmos/region.cpp create mode 100644 src/palmos/registry.cpp create mode 100644 src/palmos/renderer.cpp create mode 100644 src/palmos/scrolbar.cpp create mode 100644 src/palmos/settings.cpp create mode 100644 src/palmos/slider.cpp create mode 100644 src/palmos/snglinst.cpp create mode 100644 src/palmos/sound.cpp create mode 100644 src/palmos/spinbutt.cpp create mode 100644 src/palmos/spinctrl.cpp create mode 100644 src/palmos/statbmp.cpp create mode 100644 src/palmos/statbox.cpp create mode 100644 src/palmos/statline.cpp create mode 100644 src/palmos/stattext.cpp create mode 100644 src/palmos/statusbr.cpp create mode 100644 src/palmos/tabctrl.cpp create mode 100644 src/palmos/taskbar.cpp create mode 100644 src/palmos/textctrl.cpp create mode 100644 src/palmos/tglbtn.cpp create mode 100644 src/palmos/thread.cpp create mode 100644 src/palmos/timer.cpp create mode 100644 src/palmos/toolbar.cpp create mode 100644 src/palmos/tooltip.cpp create mode 100644 src/palmos/toplevel.cpp create mode 100644 src/palmos/treectrl.cpp create mode 100644 src/palmos/utils.cpp create mode 100644 src/palmos/utilsexc.cpp create mode 100644 src/palmos/utilsgui.cpp create mode 100644 src/palmos/volume.cpp create mode 100644 src/palmos/window.cpp diff --git a/build/palmos/.cdtproject b/build/palmos/.cdtproject new file mode 100644 index 0000000000..586a6a913b --- /dev/null +++ b/build/palmos/.cdtproject @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/palmos/.project b/build/palmos/.project new file mode 100644 index 0000000000..c8debc9bac --- /dev/null +++ b/build/palmos/.project @@ -0,0 +1,126 @@ + + + wxWidgets + + + + + + com.palmsource.eclipse.palmoscore.palmOSMakeBuilder + + + CREATOR_ID + STRT + + + DB_HIDDEN + false + + + TARGET + Simulator + + + DB_TYPE + appl + + + VERSION + 1 + + + SDK + com.palmsource.eclipse.sdk.palmos6 + + + DB_RESET_INSTALL + false + + + APP_NAME + wxWidgets + + + PROJECT_NAME + wxWidgets + + + OS_API + Protein + + + PROJECT_TYPE + appl + + + DB_BACKUP + true + + + DB_PREVENT_COPY + false + + + DEBUG_OR_RELEASE + Debug + + + + + org.eclipse.cdt.make.core.makeBuilder + + + org.eclipse.cdt.core.errorOutputParser + org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.VCErrorParser; + + + org.eclipse.cdt.make.core.fullBuildTarget + clean all + + + org.eclipse.cdt.make.core.incrementalBuildTarget + all + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.buildLocation + + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.enabledIncrementalBuild + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + false + + + + + + com.palmsource.eclipse.palmos6dev.palmOSProteinNature + com.palmsource.eclipse.palmoscore.palmOSNature + org.eclipse.cdt.core.cnature + org.eclipse.cdt.make.core.makeNature + org.eclipse.cdt.core.ccnature + + diff --git a/build/palmos/auto-generated.mk b/build/palmos/auto-generated.mk new file mode 100644 index 0000000000..42b70323f5 --- /dev/null +++ b/build/palmos/auto-generated.mk @@ -0,0 +1,72 @@ +# This file auto-generated by Palm OS Make builder. Don't modify directly!!! + +# This value is unescaped. Either quote the value or escape special characters when you use it. +ifeq ($(TOOLS_DIR), ) + TOOLS_DIR = C:/Program Files/PalmSource/Palm OS Developer Suite/PalmOSTools/ +endif + +# This value is unescaped. Either quote the value or escape special characters when you use it. +ifeq ($(SDK_LOCATION), ) + SDK_LOCATION = C:/Program Files/PalmSource/Palm OS Developer Suite/sdk-6/ +endif + +ifeq ($(SDK_VERSION), ) + SDK_VERSION = sdk-6 +endif + +ifeq ($(CREATOR_ID), ) + CREATOR_ID = STRT +endif + +ifeq ($(DB_HIDDEN), ) + DB_HIDDEN = false +endif + +ifeq ($(TARGET), ) + TARGET = Simulator +endif + +ifeq ($(DB_TYPE), ) + DB_TYPE = appl +endif + +ifeq ($(VERSION), ) + VERSION = 1 +endif + +ifeq ($(DB_RESET_INSTALL), ) + DB_RESET_INSTALL = false +endif + +ifeq ($(SDK), ) + SDK = com.palmsource.eclipse.sdk.palmos6 +endif + +ifeq ($(APP_NAME), ) + APP_NAME = wxWidgets +endif + +ifeq ($(OS_API), ) + OS_API = Protein +endif + +ifeq ($(PROJECT_NAME), ) + PROJECT_NAME = wxWidgets +endif + +ifeq ($(PROJECT_TYPE), ) + PROJECT_TYPE = appl +endif + +ifeq ($(DB_BACKUP), ) + DB_BACKUP = true +endif + +ifeq ($(DB_PREVENT_COPY), ) + DB_PREVENT_COPY = false +endif + +ifeq ($(DEBUG_OR_RELEASE), ) + DEBUG_OR_RELEASE = Debug +endif + diff --git a/build/palmos/makefile b/build/palmos/makefile new file mode 100644 index 0000000000..4af137dc84 --- /dev/null +++ b/build/palmos/makefile @@ -0,0 +1,456 @@ +## -------------------------------------------------------------------------- +# Palm OS Generic Protein Makefile for Eclipse v1.0.0 +# +# Fill in this file to specify your project and the source that you want +# to build, and the settings involved in the build. The makefile-engine.mk +# will then do the hard work of the makefile and dependency handling. +# +# After starting a new project, please remember the following steps... +# 1. Add all sources and resources in SOURCES and RESOURCES +# 2. Review the other settings as needed. +# +## -------------------------------------------------------------------------- + +SHELL = /bin/sh +## conditionally include an auto-generated.mk for dynamic definitions +-include auto-generated.mk + +## -------------------------------------------------------------------------- +# Set up the artifact name. +# The database name and other file names are based on the application name +## -------------------------------------------------------------------------- + +ARTIFACT_NAME = wxWidgets +EMPTY = +SPACE =$(EMPTY) $(EMPTY) +ESCAPED_ARTIFACT_NAME = $(subst $(SPACE),\ ,$(ARTIFACT_NAME)) + +PROJECT_NAME = wxWidgets +PRC_NAME = wxWidgets.prc + +## -------------------------------------------------------------------------- +# Sources and Resources and Definition files +# List all the sources (.c/.cpp), resources (.xrd), and definition file (.sld) +# in your project. Use project relative path names with forward slashes +# (src/code.cpp). Please do not use spaces in directory or file names. +# +# A note about XRD resource files: If you have existing .rsrc or .rcp files, +# refer to the documentation for the GenerateXRD tool to convert them into +# XRD files for use with all Palm OS SDKs. +## -------------------------------------------------------------------------- + +# TODO: Update all sources and resources + +SOURCES = ../../samples/minimal/minimal.cpp \ +../../src/common/accesscmn.cpp \ +../../src/common/appbase.cpp \ +../../src/common/appcmn.cpp \ +../../src/common/artprov.cpp \ +../../src/common/artstd.cpp \ +../../src/common/bmpbase.cpp \ +../../src/common/bookctrl.cpp \ +../../src/common/choiccmn.cpp \ +../../src/common/clipcmn.cpp \ +../../src/common/clntdata.cpp \ +../../src/common/cmdproc.cpp \ +../../src/common/cmndata.cpp \ +../../src/common/config.cpp \ +../../src/common/containr.cpp \ +../../src/common/cshelp.cpp \ +../../src/common/ctrlcmn.cpp \ +../../src/common/ctrlsub.cpp \ +../../src/common/datacmn.cpp \ +../../src/common/datetime.cpp \ +../../src/common/datstrm.cpp \ +../../src/common/db.cpp \ +../../src/common/dbgrid.cpp \ +../../src/common/dbtable.cpp \ +../../src/common/dcbase.cpp \ +../../src/common/dircmn.cpp \ +../../src/common/dlgcmn.cpp \ +../../src/common/dndcmn.cpp \ +../../src/common/dobjcmn.cpp \ +../../src/common/docmdi.cpp \ +../../src/common/docview.cpp \ +../../src/common/dpycmn.cpp \ +../../src/common/dseldlg.cpp \ +../../src/common/dynarray.cpp \ +../../src/common/dynlib.cpp \ +../../src/common/dynload.cpp \ +../../src/common/effects.cpp \ +../../src/common/encconv.cpp \ +../../src/common/event.cpp \ +../../src/common/fddlgcmn.cpp \ +../../src/common/ffile.cpp \ +../../src/common/file.cpp \ +../../src/common/fileconf.cpp \ +../../src/common/filesys.cpp \ +../../src/common/fldlgcmn.cpp \ +../../src/common/fmapbase.cpp \ +../../src/common/fontcmn.cpp \ +../../src/common/fontmap.cpp \ +../../src/common/framecmn.cpp \ +../../src/common/fs_inet.cpp \ +../../src/common/fs_mem.cpp \ +../../src/common/fs_zip.cpp \ +../../src/common/ftp.cpp \ +../../src/common/gaugecmn.cpp \ +../../src/common/gbsizer.cpp \ +../../src/common/gdicmn.cpp \ +../../src/common/geometry.cpp \ +../../src/common/gifdecod.cpp \ +../../src/common/hash.cpp \ +../../src/common/hashmap.cpp \ +../../src/common/helpbase.cpp \ +../../src/common/http.cpp \ +../../src/common/iconbndl.cpp \ +../../src/common/imagall.cpp \ +../../src/common/imagbmp.cpp \ +../../src/common/image.cpp \ +../../src/common/imagfill.cpp \ +../../src/common/imaggif.cpp \ +../../src/common/imagiff.cpp \ +../../src/common/imagjpeg.cpp \ +../../src/common/imagpcx.cpp \ +../../src/common/imagpng.cpp \ +../../src/common/imagpnm.cpp \ +../../src/common/imagtiff.cpp \ +../../src/common/imagxpm.cpp \ +../../src/common/init.cpp \ +../../src/common/intl.cpp \ +../../src/common/ipcbase.cpp \ +../../src/common/layout.cpp \ +../../src/common/lboxcmn.cpp \ +../../src/common/list.cpp \ +../../src/common/log.cpp \ +../../src/common/longlong.cpp \ +../../src/common/matrix.cpp \ +../../src/common/memory.cpp \ +../../src/common/menucmn.cpp \ +../../src/common/mimecmn.cpp \ +../../src/common/module.cpp \ +../../src/common/msgout.cpp \ +../../src/common/mstream.cpp \ +../../src/common/nbkbase.cpp \ +../../src/common/object.cpp \ +../../src/common/paper.cpp \ +../../src/common/popupcmn.cpp \ +../../src/common/prntbase.cpp \ +../../src/common/process.cpp \ +../../src/common/protocol.cpp \ +../../src/common/quantize.cpp \ +../../src/common/radiocmn.cpp \ +../../src/common/regex.cpp \ +../../src/common/rendcmn.cpp \ +../../src/common/rgncmn.cpp \ +../../src/common/sckaddr.cpp \ +../../src/common/sckfile.cpp \ +../../src/common/sckipc.cpp \ +../../src/common/sckstrm.cpp \ +../../src/common/settcmn.cpp \ +../../src/common/sizer.cpp \ +../../src/common/socket.cpp \ +../../src/common/statbar.cpp \ +../../src/common/strconv.cpp \ +../../src/common/stream.cpp \ +../../src/common/string.cpp \ +../../src/common/sysopt.cpp \ +../../src/common/taskbarcmn.cpp \ +../../src/common/tbarbase.cpp \ +../../src/common/textbuf.cpp \ +../../src/common/textcmn.cpp \ +../../src/common/textfile.cpp \ +../../src/common/timercmn.cpp \ +../../src/common/tokenzr.cpp \ +../../src/common/toplvcmn.cpp \ +../../src/common/treebase.cpp \ +../../src/common/txtstrm.cpp \ +../../src/common/url.cpp \ +../../src/common/utilscmn.cpp \ +../../src/common/valgen.cpp \ +../../src/common/validate.cpp \ +../../src/common/valtext.cpp \ +../../src/common/variant.cpp \ +../../src/common/wfstream.cpp \ +../../src/common/wincmn.cpp \ +../../src/common/wxchar.cpp \ +../../src/common/xpmdecod.cpp \ +../../src/common/xti.cpp \ +../../src/common/xtistrm.cpp \ +../../src/common/xtixml.cpp \ +../../src/common/zipstrm.cpp \ +../../src/common/zstream.cpp \ +../../src/generic/renderg.cpp \ +../../src/generic/statusbr.cpp \ +../../src/palmos/accel.cpp \ +../../src/palmos/app.cpp \ +../../src/palmos/base.cpp \ +../../src/palmos/bitmap.cpp \ +../../src/palmos/bmpbuttn.cpp \ +../../src/palmos/brush.cpp \ +../../src/palmos/button.cpp \ +../../src/palmos/caret.cpp \ +../../src/palmos/checkbox.cpp \ +../../src/palmos/checklst.cpp \ +../../src/palmos/choice.cpp \ +../../src/palmos/clipbrd.cpp \ +../../src/palmos/colordlg.cpp \ +../../src/palmos/colour.cpp \ +../../src/palmos/combobox.cpp \ +../../src/palmos/control.cpp \ +../../src/palmos/crashrpt.cpp \ +../../src/palmos/cursor.cpp \ +../../src/palmos/data.cpp \ +../../src/palmos/dc.cpp \ +../../src/palmos/dcclient.cpp \ +../../src/palmos/dcmemory.cpp \ +../../src/palmos/dcprint.cpp \ +../../src/palmos/dcscreen.cpp \ +../../src/palmos/dialog.cpp \ +../../src/palmos/dialup.cpp \ +../../src/palmos/dib.cpp \ +../../src/palmos/dir.cpp \ +../../src/palmos/dirdlg.cpp \ +../../src/palmos/display.cpp \ +../../src/palmos/dragimag.cpp \ +../../src/palmos/dummy.cpp \ +../../src/palmos/enhmeta.cpp \ +../../src/palmos/evtloop.cpp \ +../../src/palmos/fdrepdlg.cpp \ +../../src/palmos/filedlg.cpp \ +../../src/palmos/font.cpp \ +../../src/palmos/fontdlg.cpp \ +../../src/palmos/fontenum.cpp \ +../../src/palmos/fontutil.cpp \ +../../src/palmos/frame.cpp \ +../../src/palmos/gauge.cpp \ +../../src/palmos/gdiimage.cpp \ +../../src/palmos/gdiobj.cpp \ +../../src/palmos/glcanvas.cpp \ +../../src/palmos/help.cpp \ +../../src/palmos/icon.cpp \ +../../src/palmos/imaglist.cpp \ +../../src/palmos/iniconf.cpp \ +../../src/palmos/joystick.cpp \ +../../src/palmos/listbox.cpp \ +../../src/palmos/listctrl.cpp \ +../../src/palmos/main.cpp \ +../../src/palmos/mdi.cpp \ +../../src/palmos/menu.cpp \ +../../src/palmos/menuitem.cpp \ +../../src/palmos/metafile.cpp \ +../../src/palmos/mimetype.cpp \ +../../src/palmos/minifram.cpp \ +../../src/palmos/msgdlg.cpp \ +../../src/palmos/mslu.cpp \ +../../src/palmos/nativdlg.cpp \ +../../src/palmos/notebook.cpp \ +../../src/palmos/ownerdrw.cpp \ +../../src/palmos/palette.cpp \ +../../src/palmos/pen.cpp \ +../../src/palmos/popupwin.cpp \ +../../src/palmos/printdlg.cpp \ +../../src/palmos/printpalm.cpp \ +../../src/palmos/radiobox.cpp \ +../../src/palmos/radiobut.cpp \ +../../src/palmos/regconf.cpp \ +../../src/palmos/region.cpp \ +../../src/palmos/registry.cpp \ +../../src/palmos/renderer.cpp \ +../../src/palmos/scrolbar.cpp \ +../../src/palmos/settings.cpp \ +../../src/palmos/slider.cpp \ +../../src/palmos/snglinst.cpp \ +../../src/palmos/sound.cpp \ +../../src/palmos/spinbutt.cpp \ +../../src/palmos/spinctrl.cpp \ +../../src/palmos/statbmp.cpp \ +../../src/palmos/statbox.cpp \ +../../src/palmos/statusbar.cpp \ +../../src/palmos/statline.cpp \ +../../src/palmos/stattext.cpp \ +../../src/palmos/taskbar.cpp \ +../../src/palmos/toolbar.cpp \ +../../src/palmos/textctrl.cpp \ +../../src/palmos/tglbtn.cpp \ +../../src/palmos/thread.cpp \ +../../src/palmos/timer.cpp \ +../../src/palmos/tooltip.cpp \ +../../src/palmos/toplevel.cpp \ +../../src/palmos/treectrl.cpp \ +../../src/palmos/utils.cpp \ +../../src/palmos/utilsexc.cpp \ +../../src/palmos/utilsgui.cpp \ +../../src/palmos/volume.cpp \ +../../src/palmos/window.cpp + +RESOURCES = ../../include/wx/palmos/wxWidgets.xrd ../../include/wx/palmos/Version.xrd +DEFS_FILE = ../../include/wx/palmos/wxWidgets.def +SLD_FILE = ../../include/wx/palmos/wxWidgets.sld + +## -------------------------------------------------------------------------- +# Review Database information +# Register Creator ID at: http://dev.palmos.com/creatorid/ +## -------------------------------------------------------------------------- + +CREATOR_ID = bapp +DB_TYPE = appl + +DATABASE_RESET = +DATABASE_BACKUP = -b +DATABASE_HIDDEN = +DATABASE_PROTECT = +DATABASE_VERSION = 1 + +LOCALE = enUS +DATABASE_NAME = $(APP_NAME) + +## -------------------------------------------------------------------------- +# Choose SDK +# Supported values: +# sdk-6 +## -------------------------------------------------------------------------- + +SDK_VERSION = sdk-6 + +ifeq ($(SDK_LOCATION),) +SDK_LOCATION=../../ +endif +## -------------------------------------------------------------------------- +# Build Settings +# Review the following for your needs. +# The default settings build with debug information and no optimization and +# a target platform of an actual device. +## -------------------------------------------------------------------------- + +# +# Set Debug or Release configuration for this project via the project +# properties (right-click on the project and select Properties). +# +DEBUG_OR_RELEASE=Debug + +# +# Set the target platform for the build; either Device or Simulator +# Use Device as a target for emulator builds. +# +TARGET_PLATFORM=Simulator + +# Specify the level of optimization that you want: +# NONE, SOME, FULL, INTRAPROCEDURAL, INTERPROCEDURAL, INLINING. +# Leave blank to select FULL for release builds, and NONE for +# debug builds. +# INTRAPROCEDURAL, INTERPROCEDURAL, INLINING are applicable to +# device builds only; simulator builds will translate those levels +# to FULL. +OPTIMIZE_LEVEL = NONE + +# Specify warning level +# NONE = suppress all warnings +# ALL = enable all warnings +# = default warnings +WARNING_LEVEL = + +# Specify exception handling support +# true = enable it +# false = don't enable it +ENABLE_EXCEPTION_HANDLING=true + +# List additional libraries to link with +# (Full or project relative path) +ADDITIONAL_LINK_LIBRARIES = +ADDITIONAL_SIM_LINK_LIBRARIES = + +# Additional paths to look for #include "header" +# (Source file directories are automatically included) +# Please note that both local and system include paths should +# either use "cygwin" syntax or if in Windows syntax the should +# be quoted. ie: ../MyLibrary/headers or "C:\Source\MyLibrary\headers" +# Additionally, you must explicly specify the "-I" prior to each +# path included in this variable. Spaces are used to separate +# each path from each other. +LOCAL_INCLUDE_PATHS = -Irsc -I../../include +LOCAL_SIM_INCLUDE_PATHS = -Irsc -I../../include + +# Additional paths to look for #include
+# (Palm OS SDK directories are automatically included) +# Additionally, you must explicly specify the "-I" prior to each +# path included in this variable. Spaces are used to separate +# each path from each other. +SYSTEM_INCLUDE_PATHS = +SYSTEM_SIM_INCLUDE_PATHS = + +# Specify any needed preprocessor symbols. +# If you set DEFINES to "ASSERTLEVEL=1", the compiler will see "-DASSERTLEVEL=1" +# (separate individual entries with spaces) +DEFINES = +SIM_DEFINES = + +# Specify additional compiler flags for all files +ADDITIONAL_COMPILER_FLAGS = +ADDITIONAL_SIM_COMPILER_FLAGS = + +# Specify additional linker flags +ADDITIONAL_LINKER_FLAGS = +ADDITIONAL_SIM_LINKER_FLAGS = + +# Specify additional archival flags (for static libraries) +ADDITIONAL_AR_FLAGS = +ADDITIONAL_SIM_AR_FLAGS = + + +# Tools Directory +# Normally you wouldn't want to override this since the necessary tools +# are in the PATH. But if you experimenting with other tools, then +# reset the directory here +# If overridden, end with a trailing '/' + +ifeq ($(TOOLS_DIR), ) +TOOLS_DIR = ../../../PalmOSTools/ +endif + +## -------------------------------------------------------------------------- +# Resource Settings +## -------------------------------------------------------------------------- + +# Specify the target text encoding +# LATIN, JAPANESE, SIMPLIFIED_CHINESE +TEXTENCODING = LATIN + +# Specify error levels for locale and text encoding +# NOCHECK +# STRICT +# +LOCALE_CHECKING = + +# Specific if encoding should be checked +# FALSE, TRUE +STRICT_ENCODING = FALSE + +## -------------------------------------------------------------------------- +# Output Settings +## -------------------------------------------------------------------------- + +# Modify if you want object and output files to be in different locations +# (However, please note that all three object directories must be different +# for the makefile engine to properly operate.) +# OUTPUT_DIR is the "main" output directory, where all linked and binary objects +# will be put. + +DEBUG_DEVICE_OUTPUT_DIR := DebugDevice +RELEASE_DEVICE_OUTPUT_DIR := ReleaseDevice +DEBUG_SIMULATOR_OUTPUT_DIR := DebugSim +RELEASE_SIMULATOR_OUTPUT_DIR := ReleaseSim +RSC_OBJ_DIR := ResourceObjs + +## -------------------------------------------------------------------------- +# Makefiles +## -------------------------------------------------------------------------- + + +## include the makefile engine +include makefile-engine.mk + +## conditionally include your own custom.mk for your specific overrides or definitions +## this is useful if you don't want to use the auto-generated.mk values +## for some reason +-include custom.mk diff --git a/build/palmos/makefile-engine.mk b/build/palmos/makefile-engine.mk new file mode 100644 index 0000000000..817be3e202 --- /dev/null +++ b/build/palmos/makefile-engine.mk @@ -0,0 +1,746 @@ +## Palm OS Protein Generic Makefile Engine for Eclipse v1.0.0 +# +# Last edit: 7/22/04 +# +# This makefile engine is capable of compiling Protein +# applications for Palm OS. +# +# This makefile engine assumes that the following variables are +# set outside of this makefile by a referencing master makefile +# (see a master makefile generated by a Palm OS Developer +# Suite wizard for detailed explanation of each variable): +# +# SOURCES +# RESOURCES +# DATABASE_RESET +# DATABASE_BACKUP +# DATABASE_HIDDEN +# DATABASE_PROTECT +# DATABASE_BUNDLE +# DATABASE_VERSION +# DATABASE_NAME +# PROJECT_TYPE +# DEBUG_OR_RELEASE +# OPTIMIZE_LEVEL +# WARNING_LEVEL +# ENABLE_EXCEPTIONS +# ENABLE_ASSERTIONS +# ADDITIONAL_LINK_LIBRARIES +# ADDITIONAL_SIM_LINK_LIBRARIES +# LOCAL_INCLUDE_PATHS +# LOCAL_SIM_INCLUDE_PATHS +# SYSTEM_INCLUDE_PATHS +# SYSTEM_SIM_INCLUDE_PATHS +# DEFINES +# SIM_DEFINES +# ADDITIONAL_COMPILER_FLAGS +# ADDITIONAL_SIM_COMPILER_FLAGS +# ADDITIONAL_LINKER_FLAGS +# ADDITIONAL_SIM_LINKER_FLAGS +# ADDITIONAL_AR_FLAGS +# ADDITIONAL_SIM_AR_FLAGS +# TEXTENCODING +# LOCALE_CHECKING +# STRICT_ENCODING +# SDK_LOCATION +# TARGET_PLATFORM +# +# Additionally, the user of this makefile engine may obtain the +# dynamic values for: +# SDK_LOCATION +# SDK_VERSION +# TOOLS_DIR +# by doing an optional include of a makefile segment that is +# generated during the Palm OS Developer Suite standard make build. +# The makefile line to accomplish this is: +# -include auto-generated.mk +# All master makefiles generated by Palm OS Developer Suite +# wizards include this line already to pick up and use these +# dynamic definitions. +# +# All variable values may be overridden by editing the make command +# for the project (Project->Properties->C/C++ Make Project->Make Builder, +# Build Command field). +# + +############################################################################### +# Defaults + +comma:= , + +ifeq ($(TOOLS_DIR), ) + TOOLS_DIR = +endif + +# Locale (defaults to English) +ifeq ($(LOCALE), ) + LOCALE := enUS +endif + +ifeq ($(CREATOR_ID), ) + CREATOR_ID = STRT +endif + +ifeq ($(DB_TYPE), ) + DB_TYPE = appl +endif + +ifeq ($(SLD_FILE), ) + SLD_FILE = none +endif + +ifeq ($(DEBUG_DEVICE_OUTPUT_DIR), ) + DEBUG_DEVICE_OUTPUT_DIR = DebugDevice +endif + +ifeq ($(RELEASE_DEVICE_OUTPUT_DIR), ) + RELEASE_DEVICE_OUTPUT_DIR = ReleaseDevice +endif + +ifeq ($(DEBUG_SIMULATOR_OUTPUT_DIR), ) + DEBUG_SIMULATOR_OUTPUT_DIR = DebugSim +endif + +ifeq ($(RELEASE_SIMULATOR_OUTPUT_DIR), ) + RELEASE_SIMULATOR_OUTPUT_DIR = ReleaseSim +endif + +ifeq ($(SDK_VERSION), ) + SDK_VERSION = sdk-6 +endif + +ifeq ($(ENABLE_EXCEPTIONS), ) + ENABLE_EXCEPTIONS=TRUE +endif + +############################################################################### +# App/PRC/Database Names +# +# The difference between App Name and Database name is that App Name may +# contain spaces while the database name is the App name with spaces removed. +# (Coded in such a way that if the user already explicitly defined these +# variables previously, we'll go with those). + +ifeq ($(DATABASE_NAME), ) +ifeq ($(ESCAPED_ARTIFACT_NAME), ) + # Database name defaults if ARTIFACT_NAME is empty + DATABASE_NAME = StartApp +else + DATABASE_NAME = $(ESCAPED_ARTIFACT_NAME) +endif +endif + +ifeq ($(PRC_NAME), ) +ifeq ($(ESCAPED_ARTIFACT_NAME), ) + # PRC name defaults if ESCAPED_ARTIFACT_NAME is empty + PRC_NAME = Start.prc +else + PRC_NAME = $(DATABASE_NAME).prc +endif +endif + +ifeq ($(LIB_NAME), ) +ifeq ($(ESCAPED_ARTIFACT_NAME), ) + # LIB name defaults if ESCAPED_ARTIFACT_NAME is empty + LIB_NAME = Start.a +else + LIB_NAME = $(DATABASE_NAME).a +endif +endif + +ifeq ($(SIM_LIB_NAME), ) +ifeq ($(ESCAPED_ARTIFACT_NAME), ) + # SIM LIB name defaults if ESCAPED_ARTIFACT_NAME is empty + SIM_LIB_NAME = Start.lib +else + SIM_LIB_NAME = $(DATABASE_NAME).lib +endif +endif + +############################################################################### +# Compile and Link Settings + +TARGET_FORMAT=PalmOS6 + +# Compiler settings... compiler + optimizations + debug +# This is a makefile for Palm OS 6 so the compilers used are as follows: +# Device target compiler is pacc +# Simulator target compiler is gcc + +CC = "$(TOOLS_DIR)pacc" +SIM_CC = gcc + +CFLAGS += -D__PALMOS_KERNEL__=1 -D__PALMOS__=0x06000000 +SIM_CFLAGS += -fexceptions -mno-cygwin -mwindows -D__PALMOS_KERNEL__=1 -D__PALMOS__=0x06000000 -D_SUPPORTS_NAMESPACE=0 -D_SUPPORTS_RTTI=1 -DTARGET_PLATFORM=TARGET_PLATFORM_PALMSIM_WIN32 -DTARGET_HOST=TARGET_HOST_PALMOS + +# Warning level for device target +ifeq ($(WARNING_LEVEL), ALL) + CFLAGS += -W4 +else +ifeq ($(WARNING_LEVEL), SOME) + CFLAGS += -W2 +else +ifeq ($(WARNING_LEVEL), NONE) + CFLAGS += -W0 +endif +endif +endif + +# Warning level for simulator target +ifeq ($(SIM_WARNING_LEVEL), ALL) + SIM_CFLAGS += -Wall +else +ifeq ($(SIM_WARNING_LEVEL), NONE) + SIM_CFLAGS += -w +endif +endif + +# Warnings as errors for device builds +ifeq ($(WARNING_AS_ERROR), TRUE) + CFLAGS += -Werror +endif + +# Warnings as errors for simulator builds +ifeq ($(SIM_WARNING_AS_ERROR), TRUE) + SIM_CFLAGS += -Werror +endif + +# Adding after other warnings flags so this is always in effect +SIM_CFLAGS += -Wno-multichar + +# Verbose output for device build +ifeq ($(VERBOSE), TRUE) + CFLAGS += -v +endif + +# Verbose output for simulator build +ifeq ($(SIM_VERBOSE), TRUE) + SIM_CFLAGS += -v +endif + +# Dislay logo +ifeq ($(ARM_LOGO), TRUE) + CFLAGS += -logo +else + CFLAGS += -nologo +endif + +# Exception handling support +ifeq ($(ENABLE_EXCEPTIONS), TRUE) + CFLAGS += -ex + LDFLAGS += -ex +endif + +# Assertion handling support +ifeq ($(ENABLE_ASSERTIONS), TRUE) + CFLAGS += -UNDEBUG +else + CFLAGS += -DNDEBUG=1 +endif + +# Additional linker flags +ifdef ADDITIONAL_PALINK_FLAGS + LDFLAGS += $(ADDITIONAL_PALINK_FLAGS) +endif + +# Optimization settings +ifeq ($(OPTIMIZE_LEVEL), INLINING) + OPTIMIZER_FLAG = -O5 + SIM_OPTIMIZER_FLAG = -O3 +else +ifeq ($(OPTIMIZE_LEVEL), INTERPROCEDURAL) + OPTIMIZER_FLAG = -O4 + SIM_OPTIMIZER_FLAG = -O3 +else +ifeq ($(OPTIMIZE_LEVEL), FULL) + OPTIMIZER_FLAG = -O3 + SIM_OPTIMIZER_FLAG = -O3 +else +ifeq ($(OPTIMIZE_LEVEL), INTRAPROCEDURAL) + OPTIMIZER_FLAG = -O2 + SIM_OPTIMIZER_FLAG = -O3 +else +ifeq ($(OPTIMIZE_LEVEL), SOME) + OPTIMIZER_FLAG = -O1 + SIM_OPTIMIZER_FLAG = -O1 +else +ifeq ($(OPTIMIZE_LEVEL), NONE) + OPTIMIZER_FLAG = -O0 + SIM_OPTIMIZER_FLAG = -O0 +else +# Default to 0 for debug, 3 for release +ifeq ($(DEBUG_OR_RELEASE), Debug) + OPTIMIZER_FLAG = -O0 + SIM_OPTIMIZER_FLAG = -O0 +else + OPTIMIZER_FLAG = -O3 + SIM_OPTIMIZER_FLAG = -O3 +endif +endif +endif +endif +endif +endif +endif + +# Debug settings (can override optimize settings) +ifeq ($(DEBUG_OR_RELEASE), Debug) + DEBUG_FLAG += -g + BUILD_TYPE_FLAG = -DBUILD_TYPE=BUILD_TYPE_DEBUG + TRACE_OUTPUT_FLAG = -DTRACE_OUTPUT=TRACE_OUTPUT_ON +else + BUILD_TYPE_FLAG = -DBUILD_TYPE=BUILD_TYPE_RELEASE + TRACE_OUTPUT_FLAG = -DTRACE_OUTPUT=TRACE_OUTPUT_OFF +endif + +ifeq ($(DEBUG_OR_RELEASE), Debug) + OBJ_DIR = $(DEBUG_DEVICE_OUTPUT_DIR) + SIM_OBJ_DIR = $(DEBUG_SIMULATOR_OUTPUT_DIR) +else + OBJ_DIR = $(RELEASE_DEVICE_OUTPUT_DIR) + SIM_OBJ_DIR = $(RELEASE_SIMULATOR_OUTPUT_DIR) +endif + + +CFLAGS += $(OPTIMIZER_FLAG) $(DEBUG_FLAG) $(BUILD_TYPE_FLAG) $(TRACE_OUTPUT_FLAG) +SIM_CFLAGS += $(SIM_OPTIMIZER_FLAG) $(DEBUG_FLAG) $(BUILD_TYPE_FLAG) $(TRACE_OUTPUT_FLAG) + +# Linker settings (must come after setting DEBUG_FLAG) +LD = "$(TOOLS_DIR)pacc" +SIM_LD = gcc + +LDFLAGS += $(DEBUG_FLAG) -nologo -Wl,-nolocals +SIM_LDFLAGS += $(DEBUG_FLAG) -mno-cygwin -mwindows $(SIM_OBJ_DIR)/gcc_link.def -shared -nostdlib -u___divdi3 -u___moddi3 -u___udivdi3 -u___umoddi3 +SIM_LIBS = -L "$(TOOLS_DIR)misclibs" -lpxstlport -lpxsupc++ -lpxgcc -lgcc +ifeq ($(DEBUG_OR_RELEASE), Debug) + LDFLAGS += -Wl,-debug -Wl,-libpath -Wl,"$(SDK_LOCATION)libraries/ARM_4T/Debug/Default" + SIM_LIBS += "$(SDK_LOCATION)libraries/Simulator/Debug/PalmOS.lib" +else + LDFLAGS += -Wl,-libpath -Wl,"$(SDK_LOCATION)libraries/ARM_4T/Release/Default" + SIM_LIBS += "$(SDK_LOCATION)libraries/Simulator/Release/PalmOS.lib" +endif + +LDOBJS = PalmOS.a SystemGlue.a FloatMgr.sa + +ifeq ($(TARGET_PLATFORM), Device) + NATIVE_OBJ_DIR := $(OBJ_DIR) + RSC_OBJ_DIR := $(OBJ_DIR) +else + NATIVE_OBJ_DIR := $(SIM_OBJ_DIR) + RSC_OBJ_DIR := $(SIM_OBJ_DIR) +endif + +# Librarian settings +AR="$(TOOLS_DIR)palib" +SIM_AR=ar + +ARFLAGS= -c -a +SIM_ARFLAGS=-rc + +LINKER_OUTPUT := $(OBJ_DIR)/$(DATABASE_NAME).axf +SIM_LINKER_OUTPUT := $(SIM_OBJ_DIR)/$(DATABASE_NAME).dll + +TARGET := $(OBJ_DIR)/$(PRC_NAME) +SIM_TARGET := $(SIM_OBJ_DIR)/$(PRC_NAME) + +STATIC_LIB_TARGET := $(OBJ_DIR)/$(LIB_NAME) +SIM_STATIC_LIB_TARGET := $(SIM_OBJ_DIR)/$(SIM_LIB_NAME) + +############################################################################### +# Resource flags (PalmRC) + +RFLAGS += + +# Default text encoding is Latin +ifeq ($(PRC_TEXT_ENCODING), ) + PRC_TEXT_ENCODING = LATIN +endif + +ifeq ($(PRC_TEXT_ENCODING), LATIN) + RFLAGS += -target 4.0 +else +ifeq ($(PRC_TEXT_ENCODING), JAPANESE) + RFLAGS += -target 4.0J +else +ifeq ($(PRC_TEXT_ENCODING), SIMPLIFIED_CHINESE) + RFLAGS += -target 4.0CS +endif +endif +endif + +ifeq ($(PRC_NO_LOCALE_CHECK), TRUE) + RFLAGS += -noLocaleCheck +endif + +ifeq ($(PRC_STRICT_LOCALE), TRUE) + RFLAGS += -strictLocale +endif + +ifeq ($(PRC_STRICT_ENCODING), TRUE) + RFLAGS += -strictTextEncoding +endif + +ifdef PRC_OVERLAY_FILTER + RFLAGS += -overlayFilter $(PRC_OVERLAY_FILTER) +endif + +ifeq ($(PRC_NO_WARN_SIZE), TRUE) + RFLAGS += -noWarnSize +endif + +ifeq ($(PRC_QUIET), TRUE) + RFLAGS += -quiet +endif + +ifeq ($(PRCMERGE_QUIET), TRUE) + PRCFLAGS += -quiet +endif + +############################################################################### + +# function for converting sources to object file names in one of output directories +define SOURCE_LIST_TO_OBJS + $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \ + $(basename $(notdir $(file)))))) +endef + +# function for converting sources to object file names in $(SIM_OBJ_DIR) +define SOURCE_LIST_TO_SIM_OBJS + $(addprefix $(SIM_OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(SOURCES), \ + $(basename $(notdir $(file)))))) +endef + +# function for converting resources into resource object files +define RESOURCE_LIST_TO_OBJS + $(addprefix $(RSC_OBJ_DIR)/, $(addsuffix .trc, $(foreach file, $(RESOURCES), \ + $(basename $(file))))) +endef + +OBJS = $(SOURCE_LIST_TO_OBJS) +SIM_OBJS = $(SOURCE_LIST_TO_SIM_OBJS) +SOURCE_PATHS += $(sort $(foreach file, $(SOURCES), $(dir $(file)))) +RESOURCE_OBJS = $(RESOURCE_LIST_TO_OBJS) +RESOURCE_PATHS += $(sort $(foreach file, $(RESOURCES), $(dir $(file)))) +SLD_BASENAME := $(addsuffix _Startup, $(basename $(notdir $(SLD_FILE)))) +SLD_OBJ := $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(SLD_BASENAME))) +SLD_SIM_OBJ := $(addprefix $(SIM_OBJ_DIR)/, $(addsuffix .o, $(SLD_BASENAME))) + +VPATH := +VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SOURCE_PATHS) $(RESOURCE_PATHS) ))) + +SYSTEM_INCLUDES = $(SYSTEM_INCLUDE_PATHS) -I "$(SDK_LOCATION)headers" -I "$(SDK_LOCATION)headers/posix" +INCLUDES = $(LOCAL_INCLUDE_PATHS) $(foreach path, $(SOURCE_PATHS), $(addprefix -I, $(path))) $(SYSTEM_INCLUDES) $(PRE_INCLUDE_PATHS) +CPP_INCLUDES = -I "$(TOOLS_DIR)include/stlport" + +SIM_SYSTEM_INCLUDES = $(SYSTEM_SIM_INCLUDE_PATHS) -I "$(SDK_LOCATION)headers" -I "$(SDK_LOCATION)headers/posix" +SIM_INCLUDES = $(LOCAL_SIM_INCLUDE_PATHS) $(foreach path, $(SOURCE_PATHS), $(addprefix -I, $(path))) $(SIM_SYSTEM_INCLUDES) $(SIM_PRE_INCLUDE_PATHS) +SIM_CPP_INCLUDES = -I "$(TOOLS_DIR)include/stlport" + +# Now add additional settings specified by user +LDFLAGS += $(ADDITIONAL_LINK_LIBRARIES) +LDFLAGS += $(foreach libpath, $(ADDITIONAL_LINK_LIBPATH), $(addprefix -libpath , $(libpath))) +LDFLAGS += $(foreach option, $(ADDITIONAL_LINKER_FLAGS), $(addprefix -Wl$(comma), $(option))) +CFLAGS += $(foreach define, $(DEFINES), $(addprefix -D, $(define))) +CFLAGS += $(foreach define, $(UNDEFINES), $(addprefix -U, $(define))) +CFLAGS += $(ADDITIONAL_COMPILER_FLAGS) + +SIM_LDFLAGS += $(ADDITIONAL_SIM_LINK_LIBRARIES) +SIM_LDFLAGS += $(ADDITIONAL_SIM_LINKER_FLAGS) +SIM_LDFLAGS += $(foreach libpath, $(ADDITIONAL_SIM_LINK_LIBPATH), $(addprefix -L, $(libpath))) +SIM_CFLAGS += $(foreach define, $(SIM_DEFINES), $(addprefix -D, $(define))) +SIM_CFLAGS += $(foreach define, $(SIM_UNDEFINES), $(addprefix -U, $(define))) +SIM_CFLAGS += $(ADDITIONAL_SIM_COMPILER_FLAGS) + +# Specifyc additional archival flags (for static libraries) +ARFLAGS += $(ADDITIONAL_AR_FLAGS) +SIM_ARFLAGS += $(ADDITIONAL_SIM_AR_FLAGS) + +RFLAGS += $(ADDITIONAL_PRC_FLAGS) +PRCFLAGS += $(ADDITIONAL_PRCMERGE_FLAGS) + +############################################################################### +# Flags for PRC creation + +PRCFLAGS += -dbFlagExtendedDB -dbFlagExecutable + +PRCFLAGS += -dbVersion $(DATABASE_VERSION) $(DATABASE_PROTECT) $(DATABASE_HIDDEN) $(DATABASE_BACKUP) $(DATABASE_RESET) $(DATABASE_BUNDLE) + + +############################################################################### +# Flags for pslib + +PSLIB_DEV_FLAGS = +PSLIB_SIM_FLAGS = -outSimgcc +ifeq ($(PROJECT_TYPE), slib) + PSLIB_DEV_FLAGS += -outEntryNums $(OBJ_DIR)/$(DATABASE_NAME)_Client.h -outObjStubs $(OBJ_DIR)/$(DATABASE_NAME)_Client.sa + PSLIB_SIM_FLAGS += -outEntryNums $(SIM_OBJ_DIR)/$(DATABASE_NAME)_Client.h -outSimStubs $(SIM_OBJ_DIR)/$(DATABASE_NAME)_Client.slib +endif + + + +############################################################################### +# Project make target determination + +ifeq ($(TARGET_PLATFORM), Device) + +ifeq ($(PROJECT_TYPE), ) + PROJECT_TARGET = device +endif + +ifeq ($(PROJECT_TYPE), appl) + PROJECT_TARGET = device +endif +ifeq ($(PROJECT_TYPE), slib) + PROJECT_TARGET = device_shared_lib +endif +ifeq ($(PROJECT_TYPE), lib) + PROJECT_TARGET = device_static_lib +endif + +else + +ifeq ($(PROJECT_TYPE), ) + PROJECT_TARGET = simulator +endif + +ifeq ($(PROJECT_TYPE), appl) + PROJECT_TARGET = simulator +endif +ifeq ($(PROJECT_TYPE), slib) + PROJECT_TARGET = simulator_shared_lib +endif +ifeq ($(PROJECT_TYPE), lib) + PROJECT_TARGET = simulator_static_lib +endif + +endif + +############################################################################### +# Eclipse requires an all target to get the work done + +all: $(PROJECT_TARGET) + +# This rule is only valid for projects created as application projects. +# Don't invoke this make target directly; instead change the value of +# TARGET_PLATFORM to Device in the main makefile +device: $(OBJ_DIR) $(TARGET) + +# This rule is only valid for projects created as application projects. +# Don't invoke this make target directly; instead change the value of +# TARGET_PLATFORM to Simulator in the main makefile +simulator: $(SIM_OBJ_DIR) $(SIM_TARGET) + +# This rule is only valid for projects created as shared library projects. +# Don't invoke this make target directly; instead change the value of +# TARGET_PLATFORM to Device in the main makefile +device_shared_lib: $(OBJ_DIR) $(TARGET) + +# This rule is only valid for projects created as shared library projects. +# Don't invoke this make target directly; instead change the value of +# TARGET_PLATFORM to Simulator in the main makefile +simulator_shared_lib: $(SIM_OBJ_DIR) $(SIM_TARGET) + +# This rule is only valid for projects created as static library projects. +# Don't invoke this make target directly; instead change the value of +# TARGET_PLATFORM to Device in the main makefile +device_static_lib: $(OBJ_DIR) $(STATIC_LIB_TARGET) + +# This rule is only valid for projects created as static library projects. +# Don't invoke this make target directly; instead change the value of +# TARGET_PLATFORM to Simulator in the main makefile +simulator_static_lib: $(SIM_OBJ_DIR) $(SIM_STATIC_LIB_TARGET) + + +# rule to create the object file directories if needed +$(OBJ_DIR): + @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 + +$(SIM_OBJ_DIR): + @[ -d $(SIM_OBJ_DIR) ] || mkdir $(SIM_OBJ_DIR) > /dev/null 2>&1 + +# main C/C++ sources +$(OBJ_DIR)/%.o : %.c makefile + $(CC) -c $< $(INCLUDES) $(CFLAGS) -o $@ +$(OBJ_DIR)/%.o : %.cpp makefile + $(CC) -c $< $(INCLUDES) $(CPP_INCLUDES) $(CFLAGS) -o $@ +$(OBJ_DIR)/%.o : %.cp makefile + $(CC) -c $< $(INCLUDES) $(CPP_INCLUDES) $(CFLAGS) -o $@ +$(OBJ_DIR)/%.o : %.cc makefile + $(CC) -c $< $(INCLUDES) $(CPP_INCLUDES) $(CFLAGS) -o $@ +$(OBJ_DIR)/%.o : %.C makefile + $(CC) -c $< $(INCLUDES) $(CFLAGS) -o $@ +$(OBJ_DIR)/%.o : %.CC makefile + $(CC) -c $< $(INCLUDES) $(CPP_INCLUDES) $(CFLAGS) -o $@ +$(OBJ_DIR)/%.o : %.CPP makefile + $(CC) -c $< $(INCLUDES) $(CPP_INCLUDES) $(CFLAGS) -o $@ + +# Simulator C/C++ sources +$(SIM_OBJ_DIR)/%.o : %.c makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) -std=c99 $(SIM_CFLAGS) -o $@ +$(SIM_OBJ_DIR)/%.o : %.cpp makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) $(SIM_CPP_INCLUDES) -frtti $(SIM_CFLAGS) -o $@ +$(SIM_OBJ_DIR)/%.o : %.cp makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) $(SIM_CPP_INCLUDES) -frtti $(SIM_CFLAGS) -o $@ +$(SIM_OBJ_DIR)/%.o : %.cc makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) $(SIM_CPP_INCLUDES) -frtti $(SIM_CFLAGS) -o $@ +$(SIM_OBJ_DIR)/%.o : %.C makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) -std=c99 $(SIM_CFLAGS) -o $@ +$(SIM_OBJ_DIR)/%.o : %.CC makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) $(SIM_CPP_INCLUDES) -frtti $(SIM_CFLAGS) -o $@ +$(SIM_OBJ_DIR)/%.o : %.CPP makefile + $(SIM_CC) -c $< $(SIM_INCLUDES) $(SIM_CPP_INCLUDES) -frtti $(SIM_CFLAGS) -o $@ + + +# XRD source processing +$(RSC_OBJ_DIR)/%.trc : %.xrd makefile + "$(TOOLS_DIR)PalmRC" -p $(TARGET_FORMAT) -makeDeps $(@D)/$(*F).deps $(RFLAGS) -locale $(LOCALE) "`cygpath -w -a ./$<`" -o $@ +$(RSC_OBJ_DIR)/%.trc : %.XRD makefile + "$(TOOLS_DIR)PalmRC" -p $(TARGET_FORMAT) -makeDeps $(@D)/$(*F).deps $(RFLAGS) -locale $(LOCALE) "`cygpath -w -a ./$<`" -o $@ + + +# Definition file source processing +$(SLD_OBJ) : makefile + @echo "...Processing definition file for Device..." + "$(TOOLS_DIR)pslib" -inDef "$(SLD_FILE)" $(PSLIB_DEV_FLAGS) -outObjStartup $@ -type '$(DB_TYPE)' -creator '$(CREATOR_ID)' -execName $(DATABASE_NAME) + +$(SLD_SIM_OBJ) : makefile + @echo "...Processing definition file for Simulator..." + "$(TOOLS_DIR)pslib" -inDef "$(SLD_FILE)" $(PSLIB_SIM_FLAGS) -outSimStartup $@ -outSimRsrc $(SIM_OBJ_DIR)/acod0000.bin -outSimDefs $(SIM_OBJ_DIR)/gcc_link.def -type '$(DB_TYPE)' -creator '$(CREATOR_ID)' -execName $(DATABASE_NAME) + +# Linking step +$(LINKER_OUTPUT) : $(OBJS) + @echo "...Linking for Device Target..." + $(LD) -o $(LINKER_OUTPUT) $(OBJS) $(SLD_OBJ) $(LDOBJS) $(LDFLAGS) + +$(SIM_LINKER_OUTPUT) : $(SIM_OBJS) + @echo "...Linking for Simulator Target..." + $(SIM_LD) --entry 0 -o $(SIM_LINKER_OUTPUT) $(SIM_OBJS) $(SLD_SIM_OBJ) $(SIM_LDFLAGS) $(SIM_LIBS) + + +# Final target creation +$(TARGET): $(SLD_OBJ) $(LINKER_OUTPUT) $(RESOURCE_OBJS) + @echo "...Creating PRC for Device: $(TARGET)" + "$(TOOLS_DIR)pelf2bin" -format 6 -directory $(OBJ_DIR) -code acod -data adat -rsrc 0x0000 $(LINKER_OUTPUT) + "$(TOOLS_DIR)PRCMerge" -dbType '$(DB_TYPE)' -dbCreator '$(CREATOR_ID)' -dbName $(DATABASE_NAME) $(PRCFLAGS) -o $(TARGET) $(RESOURCE_OBJS) $(OBJ_DIR)/adat0000.bin $(OBJ_DIR)/acod0000.bin + @echo ...Done with Device build... + @echo + +$(SIM_TARGET): $(SLD_SIM_OBJ) $(SIM_LINKER_OUTPUT) $(RESOURCE_OBJS) + @echo "...Creating PRC for Simulator: $(SIM_TARGET)" + cp -f "$(SDK_LOCATION)misctools/Resources/amdd_fake" $(SIM_OBJ_DIR)/adat0000.bin + "$(TOOLS_DIR)PRCMerge" -dbType '$(DB_TYPE)' -dbCreator '$(CREATOR_ID)' -dbName $(DATABASE_NAME) $(PRCFLAGS) -o $(SIM_TARGET) $(RESOURCE_OBJS) $(SIM_OBJ_DIR)/adat0000.bin $(SIM_OBJ_DIR)/acod0000.bin + @echo ...Done with Simulator build... + @echo + +$(STATIC_LIB_TARGET) : $(OBJS) + @echo "...Linking Static Library for Device Target..." + $(AR) $(ARFLAGS) $(STATIC_LIB_TARGET) $(OBJS) + +$(SIM_STATIC_LIB_TARGET) : $(SIM_OBJS) + @echo "...Linking Static Library for Simulator Target..." + $(SIM_AR) $(SIM_ARFLAGS) $(SIM_STATIC_LIB_TARGET) $(SIM_OBJS) + + +FORCE: + +# Eclipse requires a clean command +clean :: FORCE + -rm -rf $(NATIVE_OBJ_DIR)/* + + +printvars :: FORCE + @echo "SDK_LOCATION" + @echo $(SDK_LOCATION) + @echo "CFLAGS" + @echo $(CFLAGS) + @echo "SIM_CFLAGS" + @echo $(SIM_CFLAGS) + @echo "LDFLAGS" + @echo $(LDFLAGS) + @echo "SIM_LDFLAGS" + @echo $(SIM_LDFLAGS) + @echo "OBJS" + @echo $(OBJS) + @echo "SIM_OBJS" + @echo $(SIM_OBJS) + @echo "SLD_OBJ" + @echo $(SLD_OBJ) + @echo "SLD_SIM_OBJ" + @echo $(SLD_SIM_OBJ) + @echo "TARGET" + @echo $(TARGET) + @echo "SIM_TARGET" + @echo $(SIM_TARGET) + @echo "SOURCE_PATHS" + @echo $(SOURCE_PATHS) + @echo "RESOURCE_OBJS" + @echo $(RESOURCE_OBJS) + @echo "RESOURCE_PATHS" + @echo $(RESOURCE_PATHS) + @echo "OBJ_DIR" + @echo $(OBJ_DIR) + @echo "SIM_OBJ_DIR" + @echo $(SIM_OBJ_DIR) + @echo "RSC_OBJ_DIR" + @echo $(RSC_OBJ_DIR) + @echo "LINKER_OUTPUT" + @echo $(LINKER_OUTPUT) + @echo "SIM_LINKER_OUTPUT" + @echo $(SIM_LINKER_OUTPUT) + @echo "SIM_GCC_SLIBS" + @echo $(SIM_GCC_SLIBS) + @echo "SIM_GCC_SLIB_PATHS" + @echo $(SIM_GCC_SLIB_PATHS) + @echo "VPATH" + @echo $(VPATH) + + +# +# dependency generation +# Generate dependencies with depend target "make depend" +# + +DEPFLAG = -MM + +# +# Adds $(SIM_OBJ_DIR) to target .o file +# ...Search for string starting at the beginning of the line [^] +# ...that contain anything followed by .o [.*\.o] +# ...and remember that string [\(...\)] +# ...replace that string with $(SIM_OBJ_DIR)/ [$$(SIM_OBJ_DIR)/\1] +# ($ is doubled so that make doesn't interpret the variable syntax) +# +SOURCE_SEDSCRIPT = sed -e's%^\(.*\.o\)%$$(OBJ_DIR)/\1%' +SOURCE_SIM_SEDSCRIPT = sed -e's%^\(.*\.o\)%$$(SIM_OBJ_DIR)/\1%' + +# Command adds $(RSC_OBJ_DIR) and converts .xrd to .trc +RESOURCE_TARGET_SEDSCRIPT = sed -e';s%^\(.*\).xrd%$$(RSC_OBJ_DIR)/\1.trc%' + +# Command to escape spaces in a path +ESCAPE_SPACES_SEDSCRIPT = sed 's/ /\\\ /g' + +# Take out all newlines (and/or returns) and replace with spaces +# ...putting all dependencies on the same line +RESOURCE_PREREQ_SEDSCRIPT = tr '\r\n' ' ' + +depend :: FORCE + @echo "" > .dependencies + @$(SIM_CC) $(SIM_INCLUDES) $(SIM_CFLAGS) $(DEPFLAG) $(SOURCES) | $(SOURCE_SIM_SEDSCRIPT) >> .dependencies + @$(SIM_CC) $(SIM_INCLUDES) $(SIM_CFLAGS) $(DEPFLAG) $(SOURCES) | $(SOURCE_SEDSCRIPT) >> .dependencies + @for i in $(RESOURCES); do \ + echo "$$i: \\" | $(RESOURCE_TARGET_SEDSCRIPT) >> .resdependencies; \ + "$(TOOLS_DIR)PalmRC" -p $(TARGET_FORMAT) $(RFLAGS) -locale $(LOCALE) -makedeps $$i.tmp "`cygpath -w -a ./$$i`"; \ + cygpath -m -f $$i.tmp | $(ESCAPE_SPACES_SEDSCRIPT) >> $$i.deps; \ + rm -rf $$i.tmp; \ + cat $$i.deps | $(RESOURCE_PREREQ_SEDSCRIPT) >> .resdependencies; \ + echo "" >> .resdependencies; \ + rm -rf $$i.deps; \ + cat .resdependencies >> .dependencies; \ + rm -rf .resdependencies; \ + done + + +cleandepend :: FORCE + -rm -f .dependencies + +-include .dependencies diff --git a/docs/palmos/readme.txt b/docs/palmos/readme.txt new file mode 100644 index 0000000000..79a11db72f --- /dev/null +++ b/docs/palmos/readme.txt @@ -0,0 +1,66 @@ +wxWidgets 2.5.3 CVS 10-18-2004 +------------------------------ + +This is a Palm OS 6 port of the wxWidgets toolkit. Included in the source +package is the complete source necessary to build the Palm OS port using the +Palm OS Developer Studio. Also included is the diff showing the changes that +need to be incorporated into the wxWidgets 2.5.3 CVS source tree before the +Palm OS port can be integrated. + +I am releasing this port to the wxWidgets team under the terms of the wxWindows +license. A copy of the wxWindows license is included in the source package. + +No third party libraries or code were used in making this port. The port consists +entirely of code I personally wrote combined with code that was included in the +wxWidgets 2.5.3 CSV source tree. Whenever possible, I have used the Palm OS 6 API, +in places where the API was not practical to use, I wrote my own functions. + +I am submitting this source package as an entry in the wxWidgets Palm OS 6 port +challenge. Details on this challenge are available at http://www.wxwindows.org/palmos.htm + +Please note that this port is in a very early state. Currently the port +provides limited functionality for the wxFrame, wxMenu, wxStatusBar, +wxTopLevelWindow, and wxWindow classes. The other classes in the wxWidgets +toolkit still need to be ported. In it's current state, the Palm OS 6 port +is capable of running the minimal wxWidgets sample + +The easiest way to see the port in action is to build the source package with +the Palm OS Developer Studio available at http://www.palmos.com/dev/dl/dl_tools/dl_pods/ +Here are the steps that you need to follow to build the package: + +1) Unpack the ZIP file into a directory located within the Palm OS Developer + Studio workspace directory. The path to the folder should look something + like this: "C:\Program Files\PalmSource\Palm OS Developer Suite\workspace\wxWidgets" + +2) Open Palm OS Developer Studio and click on File->Import. + +3) Select "Existing Project into Workspace" as the import source and click Next. + +4) On the next screen click the Browse button next to Project contents and select + the folder you unpacked the source package into. Click on Finish to continue. + +5) You should now see the project listed in the Project pane on the right side of the + window. Click on the name of the project. Now click on the Project menu and select + "Rebuild Project" + +6) After the build is complete, click on the Run menu and select "" The Palm OS 6 simulator + should start. If this is the first time you have used the simulator, you will be prompted + to choose a ROM file. You can find the ROM files in a folder like "C:\Program + Files\PalmSource\Palm OS Developer Suite\sdk-6\tools\Simulator\6.0.1\ROM" It doesn't + really matter whether you choose a Release or a Debug ROM (the debug ROM generates extra + reports when an application crashes.) + +7) You should see the Palm logo appear in the simulator window. You may get a dialog box + asking you to choose a language. Click OK to continue. You should see the simulator + initialize the built-in Palm applications. After a few moments, the wxWidgets minimal + sample should start. Have fun! + +Since this source package was based on the wxWidgets 2.5.3 CVS source tree dated October 18, +2004 I don't anticipate any problems with merging the sources into the 2.5.3 source tree. + +If you have any questions or comments about the port, please feel free to send an email to +the wxWidgets developer list or directly to me at wbo@freeshell.org + +Enjoy! +William Osborne +wbo@freeshell.org \ No newline at end of file diff --git a/include/wx/app.h b/include/wx/app.h index 29f9f34c18..a68433c157 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -561,7 +561,9 @@ protected: // ---------------------------------------------------------------------------- #if wxUSE_GUI - #if defined(__WXMSW__) + #if defined(__PALMOS__) + #include "wx/palmos/app.h" + #elif defined(__WXMSW__) #include "wx/msw/app.h" #elif defined(__WXMOTIF__) #include "wx/motif/app.h" diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index 5c6c9a19a4..c36ffd1546 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -134,7 +134,9 @@ public: // NB: test for __UNIX__ before __WXMAC__ as under Darwin we want to use the // Unix code (and otherwise __UNIX__ wouldn't be defined) -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/apptbase.h" +#elif defined(__WXMSW__) #include "wx/msw/apptbase.h" #elif defined(__UNIX__) && !defined(__EMX__) #include "wx/unix/apptbase.h" @@ -217,7 +219,9 @@ public: // include the platform-specific version of the classes above // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/apptrait.h" +#elif defined(__WXMSW__) #include "wx/msw/apptrait.h" #elif defined(__UNIX__) && !defined(__EMX__) #include "wx/unix/apptrait.h" diff --git a/include/wx/bitmap.h b/include/wx/bitmap.h index 8c34a26f7e..c17ef0ad6f 100644 --- a/include/wx/bitmap.h +++ b/include/wx/bitmap.h @@ -163,7 +163,9 @@ protected: }; #endif -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/bitmap.h" +#elif defined(__WXMSW__) #include "wx/msw/bitmap.h" #elif defined(__WXMOTIF__) #include "wx/x11/bitmap.h" diff --git a/include/wx/brush.h b/include/wx/brush.h index ce4cdccf7f..4d14799f17 100644 --- a/include/wx/brush.h +++ b/include/wx/brush.h @@ -1,7 +1,9 @@ #ifndef _WX_BRUSH_H_BASE_ #define _WX_BRUSH_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/brush.h" +#elif defined(__WXMSW__) #include "wx/msw/brush.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/brush.h" diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 5ced93cfef..8b8a8c77b7 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -15,7 +15,9 @@ Compiler-specific checking. */ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +# include "wx/palmos/chkconf.h" +#elif defined(__WXMSW__) # include "wx/msw/chkconf.h" #elif defined(__WXMAC__) # include "wx/mac/chkconf.h" diff --git a/include/wx/colour.h b/include/wx/colour.h index a8d4381599..1c44ce4ef7 100644 --- a/include/wx/colour.h +++ b/include/wx/colour.h @@ -1,7 +1,9 @@ #ifndef _WX_COLOUR_H_BASE_ #define _WX_COLOUR_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/colour.h" +#elif defined(__WXMSW__) #include "wx/msw/colour.h" #elif defined(__WXMOTIF__) #include "wx/motif/colour.h" diff --git a/include/wx/control.h b/include/wx/control.h index b6136bd449..64306ff8da 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -100,6 +100,8 @@ protected: #if defined(__WXUNIVERSAL__) #include "wx/univ/control.h" +#elif defined(__PALMOS__) + #include "wx/palmos/control.h" #elif defined(__WXMSW__) #include "wx/msw/control.h" #elif defined(__WXMOTIF__) diff --git a/include/wx/cursor.h b/include/wx/cursor.h index 4f845c6605..d6dcec4abd 100644 --- a/include/wx/cursor.h +++ b/include/wx/cursor.h @@ -1,7 +1,9 @@ #ifndef _WX_CURSOR_H_BASE_ #define _WX_CURSOR_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/cursor.h" +#elif defined(__WXMSW__) #include "wx/msw/cursor.h" #elif defined(__WXMOTIF__) #include "wx/motif/cursor.h" diff --git a/include/wx/dc.h b/include/wx/dc.h index cf1b3fdcbc..59e72ba8c0 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -786,7 +786,9 @@ private: // now include the declaration of wxDC class // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/dc.h" +#elif defined(__WXMSW__) #include "wx/msw/dc.h" #elif defined(__WXMOTIF__) #include "wx/motif/dc.h" diff --git a/include/wx/dcclient.h b/include/wx/dcclient.h index 30990302d2..4bdbf47e40 100644 --- a/include/wx/dcclient.h +++ b/include/wx/dcclient.h @@ -1,7 +1,9 @@ #ifndef _WX_DCCLIENT_H_BASE_ #define _WX_DCCLIENT_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/dcclient.h" +#elif defined(__WXMSW__) #include "wx/msw/dcclient.h" #elif defined(__WXMOTIF__) #include "wx/motif/dcclient.h" diff --git a/include/wx/dcmemory.h b/include/wx/dcmemory.h index 44bf096afc..0c51105858 100644 --- a/include/wx/dcmemory.h +++ b/include/wx/dcmemory.h @@ -1,7 +1,9 @@ #ifndef _WX_DCMEMORY_H_BASE_ #define _WX_DCMEMORY_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/dcmemory.h" +#elif defined(__WXMSW__) #include "wx/msw/dcmemory.h" #elif defined(__WXMOTIF__) #include "wx/motif/dcmemory.h" diff --git a/include/wx/dcprint.h b/include/wx/dcprint.h index 040f8dc390..337207ebda 100644 --- a/include/wx/dcprint.h +++ b/include/wx/dcprint.h @@ -1,7 +1,9 @@ #ifndef _WX_DCPRINT_H_BASE_ #define _WX_DCPRINT_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/dcprint.h" +#elif defined(__WXMSW__) #include "wx/msw/dcprint.h" #endif #if defined(__WXPM__) diff --git a/include/wx/dcscreen.h b/include/wx/dcscreen.h index 268b42cec1..c6a65fc720 100644 --- a/include/wx/dcscreen.h +++ b/include/wx/dcscreen.h @@ -1,7 +1,9 @@ #ifndef _WX_DCSCREEN_H_BASE_ #define _WX_DCSCREEN_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/dcscreen.h" +#elif defined(__WXMSW__) #include "wx/msw/dcscreen.h" #elif defined(__WXMOTIF__) #include "wx/motif/dcscreen.h" diff --git a/include/wx/dialog.h b/include/wx/dialog.h index 11abe1f4fa..ce21810e37 100644 --- a/include/wx/dialog.h +++ b/include/wx/dialog.h @@ -71,7 +71,9 @@ protected: #if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__) #include "wx/univ/dialog.h" #else - #if defined(__WXMSW__) + #if defined(__PALMOS__) + #include "wx/palmos/dialog.h" + #elif defined(__WXMSW__) #include "wx/msw/dialog.h" #elif defined(__WXMOTIF__) #include "wx/motif/dialog.h" diff --git a/include/wx/encinfo.h b/include/wx/encinfo.h index 7013ba60b1..e399597117 100644 --- a/include/wx/encinfo.h +++ b/include/wx/encinfo.h @@ -35,6 +35,7 @@ struct WXDLLEXPORT wxNativeEncodingInfo { wxString facename; // may be empty meaning "any" +#ifndef __PALMOS__ wxFontEncoding encoding; // so that we know what this struct represents #if defined(__WXMSW__) || \ @@ -60,7 +61,7 @@ struct WXDLLEXPORT wxNativeEncodingInfo #else #error "Unsupported toolkit" #endif - +#endif // this struct is saved in config by wxFontMapper, so it should know to // serialise itself (implemented in platform-specific code) bool FromString(const wxString& s); diff --git a/include/wx/evtloop.h b/include/wx/evtloop.h index d77cbf13de..07ba0008e0 100644 --- a/include/wx/evtloop.h +++ b/include/wx/evtloop.h @@ -72,7 +72,9 @@ protected: // can sometimes be very useful (e.g. under MSW this is necessary for // integration with MFC) but currently this is done for MSW only, other ports // should follow a.s.a.p. -#ifdef __WXMSW__ +#if defined(__PALMOS__) + #include "wx/palmos/evtloop.h" +#elif defined(__WXMSW__) #include "wx/msw/evtloop.h" #else diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 9331963fdd..298212e17d 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -174,7 +174,9 @@ enum wxSeekMode // detect compilers which have support for huge files (currently only // Digital Mars doesn't) + #ifndef __PALMOS__ #include "wx/msw/private.h" + #endif #undef wxHAS_HUGE_FILES #if defined(__MINGW32__) @@ -300,7 +302,7 @@ enum wxSeekMode #endif // constants (unless already defined by the user code) - #if !defined(__BORLANDC__) && !defined(__WATCOMC__) + #if !defined(__BORLANDC__) && !defined(__WATCOMC__) && !defined(__PALMOS__) #ifndef O_RDONLY #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY diff --git a/include/wx/font.h b/include/wx/font.h index dae2cc4f76..b8d436bb9c 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -231,7 +231,9 @@ private: }; // include the real class declaration -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/font.h" +#elif defined(__WXMSW__) #include "wx/msw/font.h" #elif defined(__WXMOTIF__) #include "wx/motif/font.h" diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h index 1a1b917ba1..3e485e569a 100644 --- a/include/wx/fontutil.h +++ b/include/wx/fontutil.h @@ -26,7 +26,7 @@ #include "wx/font.h" // for wxFont and wxFontEncoding -#if defined(__WXMSW__) +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/wrapwin.h" #endif @@ -109,7 +109,7 @@ public: // set the XFLD void SetXFontName(const wxString& xFontName); -#elif defined(__WXMSW__) +#elif defined(__WXMSW__) && !defined(__PALMOS__) LOGFONT lf; #elif defined(__WXPM__) // OS/2 native structures that define a font diff --git a/include/wx/frame.h b/include/wx/frame.h index f58e43d45d..bd7cc361d6 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -250,7 +250,9 @@ protected: #if defined(__WXUNIVERSAL__) // && !defined(__WXMICROWIN__) #include "wx/univ/frame.h" #else // !__WXUNIVERSAL__ - #if defined(__WXMSW__) + #if defined(__PALMOS__) + #include "wx/palmos/frame.h" + #elif defined(__WXMSW__) #include "wx/msw/frame.h" #elif defined(__WXGTK__) #include "wx/gtk/frame.h" diff --git a/include/wx/gdiobj.h b/include/wx/gdiobj.h index 916a339bc0..ad84296999 100644 --- a/include/wx/gdiobj.h +++ b/include/wx/gdiobj.h @@ -1,7 +1,9 @@ #ifndef _WX_GDIOBJ_H_BASE_ #define _WX_GDIOBJ_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/gdiobj.h" +#elif defined(__WXMSW__) #include "wx/msw/gdiobj.h" #elif defined(__WXMOTIF__) #include "wx/motif/gdiobj.h" diff --git a/include/wx/help.h b/include/wx/help.h index 8fd7026427..20cea7fc26 100644 --- a/include/wx/help.h +++ b/include/wx/help.h @@ -9,6 +9,10 @@ #include "wx/msw/wince/helpwce.h" #define wxHelpController wxWinceHelpController +#elif defined(__PALMOS__) + #include "wx/palmos/help.h" + + #define wxHelpController wxPalmHelpController #elif defined(__WXMSW__) #include "wx/msw/helpwin.h" diff --git a/include/wx/icon.h b/include/wx/icon.h index 1f273ebb07..c0af6c26c2 100644 --- a/include/wx/icon.h +++ b/include/wx/icon.h @@ -3,7 +3,9 @@ #include "wx/iconloc.h" -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/icon.h" +#elif defined(__WXMSW__) #include "wx/msw/icon.h" #elif defined(__WXMOTIF__) #include "wx/motif/icon.h" diff --git a/include/wx/menu.h b/include/wx/menu.h index be2b692a1a..79dd28ef61 100644 --- a/include/wx/menu.h +++ b/include/wx/menu.h @@ -498,6 +498,8 @@ protected: #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menu.h" +#elif defined(__PALMOS__) + #include "wx/palmos/menu.h" #elif defined(__WXMSW__) #include "wx/msw/menu.h" #elif defined(__WXMOTIF__) diff --git a/include/wx/menuitem.h b/include/wx/menuitem.h index d5733e58cd..dd3af54c3b 100644 --- a/include/wx/menuitem.h +++ b/include/wx/menuitem.h @@ -155,6 +155,8 @@ private: #else // !wxUSE_BASE_CLASSES_ONLY #if defined(__WXUNIVERSAL__) #include "wx/univ/menuitem.h" +#elif defined(__PALMOS__) + #include "wx/palmos/menuitem.h" #elif defined(__WXMSW__) #include "wx/msw/menuitem.h" #elif defined(__WXMOTIF__) diff --git a/include/wx/metafile.h b/include/wx/metafile.h index 524e572ef6..ad4053a648 100644 --- a/include/wx/metafile.h +++ b/include/wx/metafile.h @@ -21,7 +21,11 @@ #if defined(__WXMSW__) #if wxUSE_ENH_METAFILE + #if defined(__PALMOS__) + #include "wx/palmos/enhmeta.h" + #else #include "wx/msw/enhmeta.h" + #endif // map all metafile classes to enh metafile #if !wxUSE_WIN_METAFILES_ALWAYS @@ -34,8 +38,12 @@ #define wxMETAFILE_IS_ENH #endif // wxUSE_WIN_METAFILES_ALWAYS #else // !wxUSE_ENH_METAFILE + #if defined(__PALMOS__) + #include "wx/palmos/metafile.h" + #else #include "wx/msw/metafile.h" #endif + #endif #elif defined(__WXPM__) #include "wx/os2/metafile.h" #elif defined(__WXMAC__) diff --git a/include/wx/minifram.h b/include/wx/minifram.h index 6e1682ad45..0a8bd8c307 100644 --- a/include/wx/minifram.h +++ b/include/wx/minifram.h @@ -1,7 +1,9 @@ #ifndef _WX_MINIFRAM_H_BASE_ #define _WX_MINIFRAMH_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/minifram.h" +#elif defined(__WXMSW__) #include "wx/msw/minifram.h" #elif defined(__WXMOTIF__) #include "wx/motif/minifram.h" diff --git a/include/wx/msgdlg.h b/include/wx/msgdlg.h index ac9c91b8b5..4a9c57af73 100644 --- a/include/wx/msgdlg.h +++ b/include/wx/msgdlg.h @@ -7,6 +7,8 @@ #if defined(__WXUNIVERSAL__) || defined(__WXGPE__) #include "wx/generic/msgdlgg.h" +#elif defined(__PALMOS__) +#include "wx/palmos/msgdlg.h" #elif defined(__WXMSW__) #include "wx/msw/msgdlg.h" #elif defined(__WXMOTIF__) diff --git a/include/wx/palmos/AppResources.h b/include/wx/palmos/AppResources.h new file mode 100644 index 0000000000..26507e6cd3 --- /dev/null +++ b/include/wx/palmos/AppResources.h @@ -0,0 +1,94 @@ +// Header generated by Constructor for Palm OS (R) 1.9 +// +// Generated at 3:29:52 PM on Tuesday, June 24, 2003 +// +// Generated for file: BasicApp.xrd +// +// THIS IS AN AUTOMATICALLY GENERATED HEADER FILE +// DO NOT EDIT - CHANGES MADE TO THIS FILE WILL BE LOST +// +// Palm App Name: "BasicApp" +// +// Palm App Version: "1.0a1" + + +// Resource: tFRM 1000 +#define MainForm 1000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0) +#define MainContentLabel 1603 //(Left Origin = 32, Top Origin = 50, Usable = 1, Font = Bold) +#define MainForm2Button 1001 //(Left Origin = 1, Top Origin = 147, Width = 39, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define MainDialogButton 1002 //(Left Origin = 46, Top Origin = 147, Width = 39, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 1200 +#define DialogForm 1200 //(Left Origin = 2, Top Origin = 58, Width = 156, Height = 100, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 1200, Menu Bar ID = 0, Default Button ID = 1202) +#define DialogOKButton 1201 //(Left Origin = 5, Top Origin = 83, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DialogCancelButton 1202 //(Left Origin = 47, Top Origin = 83, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) +#define DialogContentLabel 1203 //(Left Origin = 10, Top Origin = 23, Usable = 1, Font = Bold) + +// Resource: tFRM 1300 +#define Form2Form 1300 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) +#define Form2DoneButton 1301 //(Left Origin = 1, Top Origin = 147, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + +// Resource: tFRM 2000 +#define AboutForm 2000 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0) +#define AboutTitleLabel 2002 //(Left Origin = 54, Top Origin = 25, Usable = 1, Font = Bold 12) +#define AboutText1Label 2003 //(Left Origin = 23, Top Origin = 54, Usable = 1, Font = Standard) +#define AboutText2Label 2004 //(Left Origin = 50, Top Origin = 104, Usable = 1, Font = Bold) +#define AboutOKButton 2005 //(Left Origin = 58, Top Origin = 139, Width = 40, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard) + + +// Resource: MBAR 1000 +#define MainFormMenuBar 1000 + + +// Resource: MENU 1000 +#define MainOptionsMenu 1000 +#define MainOptionsAboutBasicApp 1000 + + +// Resource: tSTR 1200 +#define HelpID1200String 1200 // "Placeholder text for the modal dialog Tips button." + + +// Resource: PICT 1000 +#define Largeicon1bitBitmap 1000 + +// Resource: PICT 1001 +#define Largeicon2bitBitmap 1001 + +// Resource: PICT 1002 +#define Largeicon8bitBitmap 1002 + +// Resource: PICT 1003 +#define LargeiconX21bitBitmap 1003 + +// Resource: PICT 1004 +#define LargeiconX22bitBitmap 1004 + +// Resource: PICT 1005 +#define LargeiconX28bitBitmap 1005 + +// Resource: PICT 1006 +#define Smallicon1bitBitmap 1006 + +// Resource: PICT 1007 +#define Smallicon2bitBitmap 1007 + +// Resource: PICT 1008 +#define Smallicon8bitBitmap 1008 + +// Resource: PICT 1009 +#define SmalliconX21bitBitmap 1009 + +// Resource: PICT 1010 +#define SmalliconX22bitBitmap 1010 + +// Resource: PICT 1011 +#define SmalliconX28bitBitmap 1011 + + +// Resource: taif 1000 +#define Largeicons12and8bitsAppIconFamily 1000 + +// Resource: taif 1001 +#define Smallicons12and8bitsAppIconFamily 1001 + diff --git a/include/wx/palmos/Icons/AppIcon_Large-X2-8.bmp b/include/wx/palmos/Icons/AppIcon_Large-X2-8.bmp new file mode 100644 index 0000000000000000000000000000000000000000..865b2a179e3cfec0375448a8c4f6c957e8016d74 GIT binary patch literal 3366 zcmeH|J&qbd5QWQ<151_zd;|i^fg_jX1FT3La)nBK07xut$Q9}eT!DlG)D^e_S7?84 z20X*8e^^^W1lz3#vtM^rSHJFIAHIHgXI=a9+Uz4wpV24u%HDKbAMfAxI)m1lwL*yk zIieT5-~}&u!3&=7geN@V2~R~dMhhhhS%AUMmD2f?wIJP1xncKH*UlX7 zaECkG;i|M-Sc@njoQY&1hGK$+gGB=W1OMfO!yWE$hdW$5>xx&QDhkddRZkvVqWGZD z!2iI1Ip=VPJKW(8mlK@<+N?GPXM%Q1o*)lmvw{DC|LP8RxWgUpaEEs$$}pJ&XHf2t zhfz!n3=8}Z{8xm-9qw?4J6ydx2$?Q};S7+67}=$*s!T1RVU5T_ZC|BpS%tv+!{l4r z=_Z=ZW;2`5=eAfZY`I+8YPGV>W@Fp!)^@v{9S#RO9*?%)?+JSBIv@6kZq-=(na%8( z0Zf01`7aOnk)E_a9Kp%!_I=XYO=BkY@~4&`YBL*`*Voq8lXhP*X5;d%tL>g*E{|lr zzNWU;z737@xr><7&7n54b9H~K?fEeyyDrxm--7jed=G{0ulF#c+G zcR)hISb=+Zqvfxz*VS)8Kdyd#igkVe81c=ouXIiy;`7S;b^hg`6IhldmPti}k~|Zi z_{1kZ@rf5+c;ST?Ufr>%PAVFdq+{X}pZLTl-cR9$7hZVb)h8_6CKU}z>Iy#biBEju z-BEbqg%@6UKg%-sP|={I7<>qy_{1kZ@xlu)yzs&cUzX%UMT3$e`4B$wiBEjug%@6U z;e{72Ha=7|D9J|-z@RO6Hh$xo^(C94{1Z( zMlN~`GaNh|GUPwx-$^8%c;bmC-Zxu^??HPg+@_wMkCY5Q3_9dL=`TRwvix$KbtkbggkC!ToXi6_2>*nxF8xMHWnM^%VJU_<^x{@syy;)y4o zct7ih=+HZ0T!D|Cj;pWQWA+hU?n+14*YDB$*lxiOAJgBy&bl$;?CdNqE-vEo@-nWk zuVc5{#ogUq+~42F!^1;7K0e0N(^KsCdri0N;}y5`zt-MAfNdG%`HI*tzqhq0ZhQUc zvDM?WVXfb6>z(z8qr)5huh+M^Zr-T>Jgnv4>+AJ=_SN8({=d|ZlWqMk@;L^+`EM6F f=KG>rQV + + + + + "1.0" + + + diff --git a/include/wx/palmos/accel.h b/include/wx/palmos/accel.h new file mode 100644 index 0000000000..77dffb4899 --- /dev/null +++ b/include/wx/palmos/accel.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/accel.h +// Purpose: wxAcceleratorTable class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ACCEL_H_ +#define _WX_ACCEL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "accel.h" +#endif + +// ---------------------------------------------------------------------------- +// the accel table has all accelerators for a given window or menu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxAcceleratorTable : public wxObject +{ +public: + // default ctor + wxAcceleratorTable(); + + // copy ctor + wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); } + + // load from .rc resource (Windows specific) + wxAcceleratorTable(const wxString& resource); + + // initialize from array + wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]); + + virtual ~wxAcceleratorTable(); + + wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if ( *this != accel ) Ref(accel); return *this; } + bool operator==(const wxAcceleratorTable& accel) const + { return m_refData == accel.m_refData; } // FIXME: this is wrong (VZ) + bool operator!=(const wxAcceleratorTable& accel) const + { return !(*this == accel); } + + bool Ok() const; + void SetHACCEL(WXHACCEL hAccel); + WXHACCEL GetHACCEL() const; + + // translate the accelerator, return TRUE if done + bool Translate(wxWindow *window, WXMSG *msg) const; + +private: + DECLARE_DYNAMIC_CLASS(wxAcceleratorTable) +}; + +#endif + // _WX_ACCEL_H_ diff --git a/include/wx/palmos/app.h b/include/wx/palmos/app.h new file mode 100644 index 0000000000..7e2c362e08 --- /dev/null +++ b/include/wx/palmos/app.h @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: app.h +// Purpose: wxApp class +// Author: William Osborne +// Modified by: +// Created: 10/17/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_APP_H_ +#define _WX_APP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "app.h" +#endif + +#include "wx/event.h" +#include "wx/icon.h" + +class WXDLLIMPEXP_CORE wxFrame; +class WXDLLIMPEXP_CORE wxWindow; +class WXDLLIMPEXP_CORE wxApp; +class WXDLLIMPEXP_CORE wxKeyEvent; +class WXDLLIMPEXP_BASE wxLog; + +// Represents the application. Derive OnInit and declare +// a new App object to start application +class WXDLLEXPORT wxApp : public wxAppBase +{ + DECLARE_DYNAMIC_CLASS(wxApp) + +public: + wxApp(); + virtual ~wxApp(); + + // override base class (pure) virtuals + virtual bool Initialize(int& argc, wxChar **argv); + virtual void CleanUp(); + + virtual bool Yield(bool onlyIfNeeded = false); + virtual void WakeUpIdle(); + + virtual void SetPrintMode(int mode) { m_printMode = mode; } + virtual int GetPrintMode() const { return m_printMode; } + + // implementation only + void OnIdle(wxIdleEvent& event); + void OnEndSession(wxCloseEvent& event); + void OnQueryEndSession(wxCloseEvent& event); + +#if wxUSE_EXCEPTIONS + virtual bool OnExceptionInMainLoop(); +#endif // wxUSE_EXCEPTIONS + + // deprecated functions, use wxEventLoop directly instead +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( void DoMessage(WXMSG *pMsg) ); + wxDEPRECATED( bool DoMessage() ); + wxDEPRECATED( bool ProcessMessage(WXMSG* pMsg) ); +#endif // WXWIN_COMPATIBILITY_2_4 + +protected: + int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT + +public: + // Implementation + static bool RegisterWindowClasses(); + static bool UnregisterWindowClasses(); + +#if wxUSE_RICHEDIT + // initialize the richedit DLL of (at least) given version, return true if + // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) + static bool InitRichEdit(int version = 2); +#endif // wxUSE_RICHEDIT + + // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it + // wasn't found at all + static int GetComCtl32Version(); + + // the SW_XXX value to be used for the frames opened by the application + // (currently seems unused which is a bug -- TODO) + static int m_nCmdShow; + +protected: + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxApp) +}; + +// ---------------------------------------------------------------------------- +// Palm OS specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition +// ---------------------------------------------------------------------------- + +#ifndef SW_SHOWNORMAL + #define SW_SHOWNORMAL 1 +#endif + +extern int WXDLLEXPORT +wxEntry(); + +#include +#define IMPLEMENT_WXWIN_MAIN \ + uint32_t PilotMain(uint16_t cmd, MemPtr cmdPBP, uint16_t launchFlags) \ + { \ + switch (cmd) { \ + case sysAppLaunchCmdNormalLaunch: \ + wxEntry(); \ + break; \ + default: \ + break; \ + } \ + return errNone; \ + } + +#endif // _WX_APP_H_ + diff --git a/include/wx/palmos/apptbase.h b/include/wx/palmos/apptbase.h new file mode 100644 index 0000000000..404c417894 --- /dev/null +++ b/include/wx/palmos/apptbase.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/apptbase.h +// Purpose: declaration of wxAppTraits for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_APPTBASE_H_ +#define _WX_PALMOS_APPTBASE_H_ + +// ---------------------------------------------------------------------------- +// wxAppTraits: the MSW version adds extra hooks needed by MSW-only code +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxAppTraits : public wxAppTraitsBase +{ +public: + // wxExecute() support methods + // --------------------------- + + // called before starting to wait for the child termination, may return + // some opaque data which will be passed later to AfterChildWaitLoop() + virtual void *BeforeChildWaitLoop() = 0; + + // process pending Windows messages, even in console app + virtual void AlwaysYield() = 0; + + // called after starting to wait for the child termination, the parameter + // is the return value of BeforeChildWaitLoop() + virtual void AfterChildWaitLoop(void *data) = 0; + + + // wxThread helpers + // ---------------- + + // process a message while waiting for a(nother) thread, should return + // false if and only if we have to exit the application + virtual bool DoMessageFromThreadWait() = 0; + + // other miscellaneous helpers + // --------------------------- + + // under MSW this function returns same version for both console and GUI + // applications so we can implement it directly in the base class and only + // override it wxGUIAppTraits to fill in toolkit information + virtual wxToolkitInfo& GetToolkitInfo(); +}; + +#endif // _WX_PALMOS_APPTBASE_H_ + diff --git a/include/wx/palmos/apptrait.h b/include/wx/palmos/apptrait.h new file mode 100644 index 0000000000..24e0ef34a6 --- /dev/null +++ b/include/wx/palmos/apptrait.h @@ -0,0 +1,45 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/apptrait.h +// Purpose: class implementing wxAppTraits for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_APPTRAIT_H_ +#define _WX_MSW_APPTRAIT_H_ + +// ---------------------------------------------------------------------------- +// wxGUI/ConsoleAppTraits: must derive from wxAppTraits, not wxAppTraitsBase +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase +{ +public: + virtual void *BeforeChildWaitLoop(); + virtual void AlwaysYield(); + virtual void AfterChildWaitLoop(void *data); + + virtual bool DoMessageFromThreadWait(); +}; + +#if wxUSE_GUI + +class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase +{ +public: + virtual void *BeforeChildWaitLoop(); + virtual void AlwaysYield(); + virtual void AfterChildWaitLoop(void *data); + + virtual bool DoMessageFromThreadWait(); + virtual wxToolkitInfo& GetToolkitInfo(); +}; + +#endif // wxUSE_GUI + +#endif // _WX_MSW_APPTRAIT_H_ + diff --git a/include/wx/palmos/bitmap.h b/include/wx/palmos/bitmap.h new file mode 100644 index 0000000000..9e7ab124a3 --- /dev/null +++ b/include/wx/palmos/bitmap.h @@ -0,0 +1,293 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/bitmap.h +// Purpose: wxBitmap class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BITMAP_H_ +#define _WX_BITMAP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "bitmap.h" +#endif + +#include "wx/palmos/gdiimage.h" +#include "wx/gdicmn.h" +#include "wx/palette.h" + +class WXDLLEXPORT wxBitmap; +class WXDLLEXPORT wxBitmapHandler; +class WXDLLEXPORT wxBitmapRefData; +class WXDLLEXPORT wxControl; +class WXDLLEXPORT wxCursor; +class WXDLLEXPORT wxDC; +#if wxUSE_WXDIB +class WXDLLEXPORT wxDIB; +#endif +class WXDLLEXPORT wxIcon; +class WXDLLEXPORT wxImage; +class WXDLLEXPORT wxMask; +class WXDLLEXPORT wxPalette; +class WXDLLEXPORT wxPixelDataBase; + +// ---------------------------------------------------------------------------- +// wxBitmap: a mono or colour bitmap +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmap : public wxGDIImage +{ +public: + // default ctor creates an invalid bitmap, you must Create() it later + wxBitmap() { Init(); } + + // Copy constructors + wxBitmap(const wxBitmap& bitmap) { Init(); Ref(bitmap); } + + // Initialize with raw data + wxBitmap(const char bits[], int width, int height, int depth = 1); + + // Initialize with XPM data + wxBitmap(const char **data) { CreateFromXpm(data); } + wxBitmap(char **data) { CreateFromXpm((const char **)data); } + + // Load a file or resource + wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE); + + // New constructor for generalised creation from data + wxBitmap(void *data, long type, int width, int height, int depth = 1); + + // Create a new, uninitialized bitmap of the given size and depth (if it + // is omitted, will create a bitmap compatible with the display) + // + // NB: this ctor will create a DIB for 24 and 32bpp bitmaps, use ctor + // taking a DC argument if you want to force using DDB in this case + wxBitmap(int width, int height, int depth = -1); + + // Create a bitmap compatible with the given DC + wxBitmap(int width, int height, const wxDC& dc); + +#if wxUSE_IMAGE && wxUSE_WXDIB + // Convert from wxImage + wxBitmap(const wxImage& image, int depth = -1) + { (void)CreateFromImage(image, depth); } + + // Create a DDB compatible with the given DC from wxImage + wxBitmap(const wxImage& image, const wxDC& dc) + { (void)CreateFromImage(image, dc); } +#endif // wxUSE_IMAGE + + // we must have this, otherwise icons are silently copied into bitmaps using + // the copy ctor but the resulting bitmap is invalid! + wxBitmap(const wxIcon& icon) { Init(); CopyFromIcon(icon); } + + wxBitmap& operator=(const wxBitmap& bitmap) + { + if ( m_refData != bitmap.m_refData ) + Ref(bitmap); + return *this; + } + + wxBitmap& operator=(const wxIcon& icon) + { + (void)CopyFromIcon(icon); + + return *this; + } + + wxBitmap& operator=(const wxCursor& cursor) + { + (void)CopyFromCursor(cursor); + + return *this; + } + + virtual ~wxBitmap(); + +#if wxUSE_IMAGE && wxUSE_WXDIB + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + + // get the given part of bitmap + wxBitmap GetSubBitmap( const wxRect& rect ) const; + + // copies the contents and mask of the given (colour) icon to the bitmap + bool CopyFromIcon(const wxIcon& icon); + + // copies the contents and mask of the given cursor to the bitmap + bool CopyFromCursor(const wxCursor& cursor); + +#if wxUSE_WXDIB + // copies from a device independent bitmap + bool CopyFromDIB(const wxDIB& dib); +#endif + + virtual bool Create(int width, int height, int depth = -1); + virtual bool Create(int width, int height, const wxDC& dc); + virtual bool Create(void *data, long type, int width, int height, int depth = 1); + virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE); + virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); + + wxBitmapRefData *GetBitmapData() const + { return (wxBitmapRefData *)m_refData; } + + // raw bitmap access support functions + void *GetRawData(wxPixelDataBase& data, int bpp); + void UngetRawData(wxPixelDataBase& data); + +#if wxUSE_PALETTE + wxPalette* GetPalette() const; + void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + wxMask *GetMask() const; + void SetMask(wxMask *mask); + + bool operator==(const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; } + bool operator!=(const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; } + + // these functions are internal and shouldn't be used, they risk to + // disappear in the future + bool HasAlpha() const; + void UseAlpha(); + +#if WXWIN_COMPATIBILITY_2_4 + // these functions do nothing and are only there for backwards + // compatibility + wxDEPRECATED( int GetQuality() const ); + wxDEPRECATED( void SetQuality(int quality) ); +#endif // WXWIN_COMPATIBILITY_2_4 + + // implementation only from now on + // ------------------------------- + +public: + void SetHBITMAP(WXHBITMAP bmp) { SetHandle((WXHANDLE)bmp); } + WXHBITMAP GetHBITMAP() const { return (WXHBITMAP)GetHandle(); } + +#ifdef __WXDEBUG__ + void SetSelectedInto(wxDC *dc); + wxDC *GetSelectedInto() const; +#endif // __WXDEBUG__ + +protected: + // common part of all ctors + void Init(); + + virtual wxGDIImageRefData *CreateData() const; + + // creates the bitmap from XPM data, supposed to be called from ctor + bool CreateFromXpm(const char **bits); + + // creates an uninitialized bitmap, called from Create()s above + bool DoCreate(int w, int h, int depth, WXHDC hdc); + +#if wxUSE_IMAGE && wxUSE_WXDIB + // creates the bitmap from wxImage, supposed to be called from ctor + bool CreateFromImage(const wxImage& image, int depth); + + // creates a DDB from wxImage, supposed to be called from ctor + bool CreateFromImage(const wxImage& image, const wxDC& dc); + + // common part of the 2 methods above (hdc may be 0) + bool CreateFromImage(const wxImage& image, int depth, WXHDC hdc); +#endif // wxUSE_IMAGE + +private: +#ifdef __WIN32__ + // common part of CopyFromIcon/CopyFromCursor for Win32 + bool CopyFromIconOrCursor(const wxGDIImage& icon); +#endif // __WIN32__ + + DECLARE_DYNAMIC_CLASS(wxBitmap) +}; + +// ---------------------------------------------------------------------------- +// wxMask: a mono bitmap used for drawing bitmaps transparently. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMask : public wxObject +{ +public: + wxMask(); + + // Construct a mask from a bitmap and a colour indicating the transparent + // area + wxMask(const wxBitmap& bitmap, const wxColour& colour); + + // Construct a mask from a bitmap and a palette index indicating the + // transparent area + wxMask(const wxBitmap& bitmap, int paletteIndex); + + // Construct a mask from a mono bitmap (copies the bitmap). + wxMask(const wxBitmap& bitmap); + + // construct a mask from the givne bitmap handle + wxMask(WXHBITMAP hbmp) { m_maskBitmap = hbmp; } + + virtual ~wxMask(); + + bool Create(const wxBitmap& bitmap, const wxColour& colour); + bool Create(const wxBitmap& bitmap, int paletteIndex); + bool Create(const wxBitmap& bitmap); + + // Implementation + WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; } + void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; } + +protected: + WXHBITMAP m_maskBitmap; + + DECLARE_DYNAMIC_CLASS(wxMask) +}; + +// ---------------------------------------------------------------------------- +// wxBitmapHandler is a class which knows how to load/save bitmaps to/from file +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapHandler : public wxGDIImageHandler +{ +public: + wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; } + wxBitmapHandler(const wxString& name, const wxString& ext, long type) + : wxGDIImageHandler(name, ext, type) + { + } + + // keep wxBitmapHandler derived from wxGDIImageHandler compatible with the + // old class which worked only with bitmaps + virtual bool Create(wxBitmap *bitmap, + void *data, + long flags, + int width, int height, int depth = 1); + virtual bool LoadFile(wxBitmap *bitmap, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight); + virtual bool SaveFile(wxBitmap *bitmap, + const wxString& name, + int type, + const wxPalette *palette = NULL); + + virtual bool Create(wxGDIImage *image, + void *data, + long flags, + int width, int height, int depth = 1); + virtual bool Load(wxGDIImage *image, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight); + virtual bool Save(wxGDIImage *image, + const wxString& name, + int type); + +private: + DECLARE_DYNAMIC_CLASS(wxBitmapHandler) +}; + +#endif + // _WX_BITMAP_H_ diff --git a/include/wx/palmos/bmpbuttn.h b/include/wx/palmos/bmpbuttn.h new file mode 100644 index 0000000000..0cdd4e03f3 --- /dev/null +++ b/include/wx/palmos/bmpbuttn.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: bmpbuttn.h +// Purpose: wxBitmapButton class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BMPBUTTN_H_ +#define _WX_BMPBUTTN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "bmpbuttn.h" +#endif + +#include "wx/button.h" +#include "wx/bitmap.h" + +#define wxDEFAULT_BUTTON_MARGIN 4 + +class WXDLLEXPORT wxBitmapButton: public wxBitmapButtonBase +{ +public: + wxBitmapButton() + { m_marginX = m_marginY = 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); + + // Implementation + virtual void SetDefault(); + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + virtual void DrawFace( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonFocus( WXHDC dc, int left, int top, int right, int bottom, bool sel ); + virtual void DrawButtonDisable( WXHDC dc, int left, int top, int right, int bottom, bool with_marg ); + +protected: + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) +}; + +#endif + // _WX_BMPBUTTN_H_ diff --git a/include/wx/palmos/brush.h b/include/wx/palmos/brush.h new file mode 100644 index 0000000000..2a7586612b --- /dev/null +++ b/include/wx/palmos/brush.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/brush.h +// Purpose: wxBrush class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BRUSH_H_ +#define _WX_BRUSH_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "brush.h" +#endif + +#include "wx/gdicmn.h" +#include "wx/gdiobj.h" +#include "wx/bitmap.h" + +class WXDLLEXPORT wxBrush; + +// ---------------------------------------------------------------------------- +// wxBrush +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBrush : public wxGDIObject +{ +public: + wxBrush(); + wxBrush(const wxColour& col, int style = wxSOLID); + wxBrush(const wxBitmap& stipple); + wxBrush(const wxBrush& brush) { Ref(brush); } + virtual ~wxBrush(); + + virtual void SetColour(const wxColour& col); + virtual void SetColour(unsigned char r, unsigned char g, unsigned char b); + virtual void SetStyle(int style); + virtual void SetStipple(const wxBitmap& stipple); + + wxBrush& operator=(const wxBrush& brush); + bool operator==(const wxBrush& brush) const; + bool operator!=(const wxBrush& brush) const { return !(*this == brush); } + + wxColour GetColour() const; + int GetStyle() const; + wxBitmap *GetStipple() const; + + bool Ok() const { return m_refData != NULL; } + + // return the HBRUSH for this brush + virtual WXHANDLE GetResourceHandle() const; + +protected: + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + +private: + DECLARE_DYNAMIC_CLASS(wxBrush) +}; + +#endif + // _WX_BRUSH_H_ diff --git a/include/wx/palmos/button.h b/include/wx/palmos/button.h new file mode 100644 index 0000000000..07f4ed15f9 --- /dev/null +++ b/include/wx/palmos/button.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/button.h +// Purpose: wxButton class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_BUTTON_H_ +#define _WX_BUTTON_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "button.h" +#endif + +// ---------------------------------------------------------------------------- +// Pushbutton +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxButton : public wxButtonBase +{ +public: + wxButton() { } + wxButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + + virtual ~wxButton(); + + virtual void SetDefault(); + + // implementation from now on + virtual void Command(wxCommandEvent& event); + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWCommand(WXUINT param, WXWORD id); + + virtual void ApplyParentThemeBackground(const wxColour& bg) + { + // avoide switching into owner-drawn mode + wxControl::SetBackgroundColour(bg); + } + +#ifdef __WIN32__ + // coloured buttons support + virtual bool SetBackgroundColour(const wxColour &colour); + virtual bool SetForegroundColour(const wxColour &colour); + + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + +private: + void MakeOwnerDrawn(); +#endif // __WIN32__ + +protected: + // send a notification event, return TRUE if processed + bool SendClickEvent(); + + // default button handling + void SetTmpDefault(); + void UnsetTmpDefault(); + + // set or unset BS_DEFPUSHBUTTON style + static void SetDefaultStyle(wxButton *btn, bool on); + + // usually overridden base class virtuals + virtual wxSize DoGetBestSize() const; + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const ; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton) +}; + +#endif + // _WX_BUTTON_H_ diff --git a/include/wx/palmos/caret.h b/include/wx/palmos/caret.h new file mode 100644 index 0000000000..4a59ce34d3 --- /dev/null +++ b/include/wx/palmos/caret.h @@ -0,0 +1,68 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/caret.h +// Purpose: wxCaret class - the Palm OS implementation of wxCaret +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CARET_H_ +#define _WX_CARET_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "caret.h" +#endif + +class WXDLLEXPORT wxCaret : public wxCaretBase +{ +public: + wxCaret() { Init(); } + // create the caret of given (in pixels) width and height and associate + // with the given window + wxCaret(wxWindow *window, int width, int height) + { + Init(); + + (void)Create(window, width, height); + } + // same as above + wxCaret(wxWindowBase *window, const wxSize& size) + { + Init(); + + (void)Create(window, size); + } + + // process wxWindow notifications + virtual void OnSetFocus(); + virtual void OnKillFocus(); + +protected: + void Init() + { + wxCaretBase::Init(); + + m_hasCaret = FALSE; + } + + // override base class virtuals + virtual void DoMove(); + virtual void DoShow(); + virtual void DoHide(); + virtual void DoSize(); + + // helper function which creates the system caret + bool PalmOSCreateCaret(); + +private: + bool m_hasCaret; + + DECLARE_NO_COPY_CLASS(wxCaret) +}; + +#endif // _WX_CARET_H_ + + diff --git a/include/wx/palmos/checkbox.h b/include/wx/palmos/checkbox.h new file mode 100644 index 0000000000..53bfe783e1 --- /dev/null +++ b/include/wx/palmos/checkbox.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/checkbox.h +// Purpose: wxCheckBox class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHECKBOX_H_ +#define _WX_CHECKBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "checkbox.h" +#endif + +// Checkbox item (single checkbox) +class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase +{ +public: + wxCheckBox() { } + wxCheckBox(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const; + + virtual void SetLabel(const wxString& label); + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void Command(wxCommandEvent& event); + +protected: + virtual wxSize DoGetBestSize() const; + + virtual void DoSet3StateValue(wxCheckBoxState value); + + virtual wxCheckBoxState DoGet3StateValue() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox) +}; + +#endif + // _WX_CHECKBOX_H_ diff --git a/include/wx/palmos/checklst.h b/include/wx/palmos/checklst.h new file mode 100644 index 0000000000..af3989e392 --- /dev/null +++ b/include/wx/palmos/checklst.h @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: checklst.h +// Purpose: wxCheckListBox class - a listbox with checkable items +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef __CHECKLST__H_ +#define __CHECKLST__H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "checklst.h" +#endif + +#if !wxUSE_OWNER_DRAWN + #error "wxCheckListBox class requires owner-drawn functionality." +#endif + +class WXDLLEXPORT wxOwnerDrawn; +class WXDLLEXPORT wxCheckListBoxItem; // fwd decl, defined in checklst.cpp + +class WXDLLEXPORT wxCheckListBox : public wxCheckListBoxBase +{ +public: + // ctors + wxCheckListBox(); + 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); + 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); + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + // override base class virtuals + virtual void Delete(int n); + + virtual bool SetFont( const wxFont &font ); + + // items may be checked + virtual bool IsChecked(size_t uiIndex) const; + virtual void Check(size_t uiIndex, bool bCheck = TRUE); + + // return the index of the item at this position or wxNOT_FOUND + int HitTest(const wxPoint& pt) const { return DoHitTestItem(pt.x, pt.y); } + int HitTest(wxCoord x, wxCoord y) const { return DoHitTestItem(x, y); } + + // accessors + size_t GetItemHeight() const { return m_nItemHeight; } + +protected: + // we create our items ourselves and they have non-standard size, + // so we need to override these functions + virtual wxOwnerDrawn *CreateLboxItem(size_t n); + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); + + // this can't be called DoHitTest() because wxWindow already has this method + int DoHitTestItem(wxCoord x, wxCoord y) const; + + // pressing space or clicking the check box toggles the item + void OnKeyDown(wxKeyEvent& event); + void OnLeftClick(wxMouseEvent& event); + +private: + size_t m_nItemHeight; // height of checklistbox items (the same for all) + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckListBox) +}; + +#endif //_CHECKLST_H diff --git a/include/wx/palmos/chkconf.h b/include/wx/palmos/chkconf.h new file mode 100644 index 0000000000..3f274cee63 --- /dev/null +++ b/include/wx/palmos/chkconf.h @@ -0,0 +1,118 @@ +/* + * Name: wx/palmos/chkconf.h + * Purpose: Compiler-specific configuration checking + * Author: William Osborne + * Modified by: + * Created: 10/13/04 + * RCS-ID: $Id: + * Copyright: (c) William Osborne + * Licence: wxWindows licence + */ + +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ + +#ifndef _WX_PALMOS_CHKCONF_H_ +#define _WX_PALMOS_CHKCONF_H_ + +/* + * disable the settings which don't work for some compilers + */ + +/* + * If using PostScript-in-MSW in Univ, must enable PostScript + */ + +#if defined(__WXUNIVERSAL__) && wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT +#undef wxUSE_POSTSCRIPT +#define wxUSE_POSTSCRIPT 1 +#endif + +#ifndef wxUSE_NORLANDER_HEADERS +#if (defined(__WATCOMC__) && (__WATCOMC__ >= 1200)) || defined(__WINE__) || ((defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95)))) +# define wxUSE_NORLANDER_HEADERS 1 +#else +# define wxUSE_NORLANDER_HEADERS 0 +#endif +#endif + +/* + * GCC does not have SEH (__try/__catch) + */ + +#if defined(__GNUG__) + #undef wxUSE_ON_FATAL_EXCEPTION + #define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +/* + * wxUSE_DEBUG_NEW_ALWAYS doesn't work with CodeWarrior + */ + +#if defined(__MWERKS__) + #undef wxUSE_DEBUG_NEW_ALWAYS + #define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +#if defined(__GNUWIN32__) +/* These don't work as expected for mingw32 and cygwin32 */ +#undef wxUSE_MEMORY_TRACING +#define wxUSE_MEMORY_TRACING 0 + +#undef wxUSE_GLOBAL_MEMORY_OPERATORS +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 + +/* Cygwin betas don't have wcslen */ +#if defined(__CYGWIN__) || defined(__CYGWIN32__) +# if ! ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) +# undef wxUSE_WCHAR_T +# define wxUSE_WCHAR_T 0 +# endif +#endif + +#endif + /* __GNUWIN32__ */ + +/* MFC duplicates these operators */ +#if wxUSE_MFC +#undef wxUSE_GLOBAL_MEMORY_OPERATORS +#define wxUSE_GLOBAL_MEMORY_OPERATORS 0 + +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + /* wxUSE_MFC */ + +#if (defined(__GNUWIN32__) && !wxUSE_NORLANDER_HEADERS) +/* GnuWin32 doesn't have appropriate headers for e.g. IUnknown. */ +#undef wxUSE_DRAG_AND_DROP +#define wxUSE_DRAG_AND_DROP 0 +#endif + +#if !wxUSE_OWNER_DRAWN +#undef wxUSE_CHECKLISTBOX +#define wxUSE_CHECKLISTBOX 0 +#endif + +#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) +/* BC++ 4.0 can't compile JPEG library */ +#undef wxUSE_LIBJPEG +#define wxUSE_LIBJPEG 0 +#endif + +/* wxUSE_DEBUG_NEW_ALWAYS = 1 not compatible with BC++ in DLL mode */ +#if defined(__BORLANDC__) && (defined(WXMAKINGDLL) || defined(WXUSINGDLL)) +#undef wxUSE_DEBUG_NEW_ALWAYS +#define wxUSE_DEBUG_NEW_ALWAYS 0 +#endif + +#if defined(__WXMSW__) && (defined(__WATCOMC__) && __WATCOMC__ < 1200) +#undef wxUSE_WCHAR_T +#define wxUSE_WCHAR_T 0 +#endif + +#endif + /* _WX_PALMOS_CHKCONF_H_ */ + diff --git a/include/wx/palmos/choice.h b/include/wx/palmos/choice.h new file mode 100644 index 0000000000..91bd1c0abc --- /dev/null +++ b/include/wx/palmos/choice.h @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: choice.h +// Purpose: wxChoice class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CHOICE_H_ +#define _WX_CHOICE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "choice.h" +#endif + +// ---------------------------------------------------------------------------- +// Choice item +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxChoice : public wxChoiceBase +{ +public: + // ctors + wxChoice() { } + virtual ~wxChoice(); + + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + + // implement base class pure virtuals + virtual int DoAppend(const wxString& item); + virtual int DoInsert(const wxString& item, int pos); + virtual void Delete(int n); + virtual void Clear(); + + virtual int GetCount() const; + virtual int GetSelection() const; + virtual void SetSelection(int n); + + virtual int FindString(const wxString& s) const; + virtual wxString GetString(int n) const; + virtual void SetString(int n, const wxString& s); + + // MSW only + virtual bool MSWCommand(WXUINT param, WXWORD id); + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +protected: + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual void DoSetItemClientData( int n, void* clientData ); + virtual void* DoGetItemClientData( int n ) const; + virtual void DoSetItemClientObject( int n, wxClientData* clientData ); + virtual wxClientData* DoGetItemClientObject( int n ) const; + + // MSW implementation + virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *w, int *h) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // update the height of the drop down list to fit the number of items we + // have (without changing the visible height) + void UpdateVisibleHeight(); + + // create and initialize the control + bool CreateAndInit(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name); + + // free all memory we have (used by Clear() and dtor) + void Free(); + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) +}; + +#endif // _WX_CHOICE_H_ diff --git a/include/wx/palmos/clipbrd.h b/include/wx/palmos/clipbrd.h new file mode 100644 index 0000000000..36d540cf27 --- /dev/null +++ b/include/wx/palmos/clipbrd.h @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/clipbrd.h +// Purpose: wxClipboad class and clipboard functions for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CLIPBRD_H_ +#define _WX_CLIPBRD_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "clipbrd.h" +#endif + +#if wxUSE_CLIPBOARD + +#include "wx/list.h" +#include "wx/module.h" +#include "wx/dataobj.h" // for wxDataFormat + +// These functions superceded by wxClipboard, but retained in order to +// implement wxClipboard, and for compatibility. + +// open/close the clipboard +WXDLLEXPORT bool wxOpenClipboard(); +WXDLLEXPORT bool wxIsClipboardOpened(); +#define wxClipboardOpen wxIsClipboardOpened +WXDLLEXPORT bool wxCloseClipboard(); + +// get/set data +WXDLLEXPORT bool wxEmptyClipboard(); +WXDLLEXPORT bool wxSetClipboardData(wxDataFormat dataFormat, + const void *data, + int width = 0, int height = 0); +WXDLLEXPORT void* wxGetClipboardData(wxDataFormat dataFormat, + long *len = NULL); + +// clipboard formats +WXDLLEXPORT bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat); +WXDLLEXPORT wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat); +WXDLLEXPORT int wxRegisterClipboardFormat(wxChar *formatName); +WXDLLEXPORT bool wxGetClipboardFormatName(wxDataFormat dataFormat, + wxChar *formatName, + int maxCount); + +//----------------------------------------------------------------------------- +// wxClipboard +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxDataObject; +class WXDLLEXPORT wxClipboard : public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxClipboard) + +public: + wxClipboard(); + ~wxClipboard(); + + // open the clipboard before SetData() and GetData() + virtual bool Open(); + + // close the clipboard after SetData() and GetData() + virtual void Close(); + + // query whether the clipboard is opened + virtual bool IsOpened() const; + + // set the clipboard data. all other formats will be deleted. + virtual bool SetData( wxDataObject *data ); + + // add to the clipboard data. + virtual bool AddData( wxDataObject *data ); + + // ask if data in correct format is available + virtual bool IsSupported( wxDataFormat format ); + + // fill data with data on the clipboard (if available) + virtual bool GetData( wxDataObject& data ); + + // clears wxTheClipboard and the system's clipboard if possible + virtual void Clear(); + + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush(); + + // X11 has two clipboards which get selected by this call. Empty on MSW. + void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { } + +private: + bool m_clearOnExit; + bool m_isOpened; +}; + +#endif // wxUSE_CLIPBOARD +#endif + // _WX_CLIPBRD_H_ diff --git a/include/wx/palmos/colordlg.h b/include/wx/palmos/colordlg.h new file mode 100644 index 0000000000..227d5abf79 --- /dev/null +++ b/include/wx/palmos/colordlg.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/colordlg.h +// Purpose: wxColourDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLORDLG_H_ +#define _WX_COLORDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "colordlg.h" +#endif + +#include "wx/setup.h" +#include "wx/dialog.h" +#include "wx/cmndata.h" + +// ---------------------------------------------------------------------------- +// wxColourDialog: dialog for choosing a colours +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxColourDialog : public wxDialog +{ +public: + wxColourDialog(); + wxColourDialog(wxWindow *parent, wxColourData *data = NULL); + + bool Create(wxWindow *parent, wxColourData *data = NULL); + + wxColourData& GetColourData() { return m_colourData; } + + // override some base class virtuals + virtual void SetTitle(const wxString& title); + virtual wxString GetTitle() const; + + virtual int ShowModal(); + + virtual void DoGetPosition( int *x, int *y ) const; + +protected: + 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); + + wxColourData m_colourData; + wxString m_title; + + wxPoint m_pos; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourDialog) +}; + +#endif + // _WX_COLORDLG_H_ diff --git a/include/wx/palmos/colour.h b/include/wx/palmos/colour.h new file mode 100644 index 0000000000..e95c1c5a66 --- /dev/null +++ b/include/wx/palmos/colour.h @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/colour.h +// Purpose: wxColour class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COLOUR_H_ +#define _WX_COLOUR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "colour.h" +#endif + +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// Colour +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxColour : public wxObject +{ +public: + // constructors + // ------------ + + // default + wxColour() { Init(); } + + // from separate RGB + wxColour( unsigned char red, unsigned char green, unsigned char blue ) + { Set(red, green, blue); } + + // from packed RGB + wxColour( unsigned long colRGB ) { Set(colRGB); } + + // implicit conversion from the colour name + wxColour(const wxString &colourName) { InitFromName(colourName); } + wxColour(const wxChar *colourName) { InitFromName(colourName); } + + + // copy ctors and assignment operators + wxColour(const wxColour& col); + wxColour& operator=( const wxColour& col); + + // dtor + ~wxColour(); + + + // other methods + // ------------- + + // to have the matching Create also for this class + void Create( unsigned char red, unsigned char green, unsigned char blue ) + { Set(red, green, blue); } + + // Set() functions + void Set(unsigned char red, unsigned char green, unsigned char blue); + void Set(unsigned long colRGB) + { + // we don't need to know sizeof(long) here because we assume that the three + // least significant bytes contain the R, G and B values + Set((unsigned char)colRGB, + (unsigned char)(colRGB >> 8), + (unsigned char)(colRGB >> 16)); + } + + // accessors + // --------- + + bool Ok() const { return m_isInit; } + + unsigned char Red() const { return m_red; } + unsigned char Green() const { return m_green; } + unsigned char Blue() const { return m_blue; } + + // comparison + bool operator==(const wxColour& colour) const + { + return m_isInit == colour.m_isInit + && m_red == colour.m_red + && m_green == colour.m_green + && m_blue == colour.m_blue; + } + + bool operator != (const wxColour& colour) const { return !(*this == colour); } + + WXCOLORREF GetPixel() const { return m_pixel; }; + + void InitFromName(const wxString& colourName); + +public: + WXCOLORREF m_pixel; + +protected: + // Helper function + void Init(); + +private: + bool m_isInit; + unsigned char m_red; + unsigned char m_blue; + unsigned char m_green; + +private: + DECLARE_DYNAMIC_CLASS(wxColour) +}; + +#endif + // _WX_COLOUR_H_ diff --git a/include/wx/palmos/combobox.h b/include/wx/palmos/combobox.h new file mode 100644 index 0000000000..c70c5fbec1 --- /dev/null +++ b/include/wx/palmos/combobox.h @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/combobox.h +// Purpose: wxComboBox class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_COMBOBOX_H_ +#define _WX_COMBOBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "combobox.h" +#endif + +#include "wx/choice.h" + +#if wxUSE_COMBOBOX + +// ---------------------------------------------------------------------------- +// Combobox control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxComboBox: public wxChoice +{ +public: + wxComboBox() { } + + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, n, choices, style, validator, name); + } + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, + const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + + // List functions: see wxChoice + + // Text field functions + wxString GetValue() const { return GetLabel(); } + virtual void SetValue(const wxString& value); + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + virtual void SetSelection(int n) { wxChoice::SetSelection(n); } + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // implementation only from now on + virtual bool MSWCommand(WXUINT param, WXWORD id); + bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + WXHWND GetEditHWND() const; + +protected: + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) +}; + +#endif // wxUSE_COMBOBOX +#endif + // _WX_COMBOBOX_H_ diff --git a/include/wx/palmos/control.h b/include/wx/palmos/control.h new file mode 100644 index 0000000000..a74f58cc0b --- /dev/null +++ b/include/wx/palmos/control.h @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: control.h +// Purpose: wxControl class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CONTROL_H_ +#define _WX_CONTROL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "control.h" +#endif + +#include "wx/dynarray.h" + +// General item class +class WXDLLEXPORT wxControl : public wxControlBase +{ +public: + wxControl() { } + + wxControl(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxControlNameStr); + + virtual ~wxControl(); + + // Simulates an event + virtual void Command(wxCommandEvent& event) { ProcessCommand(event); } + + + // implementation from now on + // -------------------------- + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + // Calls the callback and appropriate event handlers + bool ProcessCommand(wxCommandEvent& event); + + // MSW-specific +#ifdef __WIN95__ + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); +#endif // Win95 + + // For ownerdraw items + virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; }; + virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; }; + + const wxArrayLong& GetSubcontrols() const { return m_subControls; } + + void OnEraseBackground(wxEraseEvent& event); + + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +protected: + // choose the default border for this window + virtual wxBorder GetDefaultBorder() const; + + // return default best size (doesn't really make any sense, override this) + virtual wxSize DoGetBestSize() const; + + // create the control of the given Windows class: this is typically called + // from Create() method of the derived class passing its label, pos and + // size parameter (style parameter is not needed because m_windowStyle is + // supposed to had been already set and so is used instead when this + // function is called) + bool MSWCreateControl(const wxChar *classname, + const wxString& label, + const wxPoint& pos, + const wxSize& size); + + // NB: the method below is deprecated now, with MSWGetStyle() the method + // above should be used instead! Once all the controls are updated to + // implement MSWGetStyle() this version will disappear. + // + // create the control of the given class with the given style (combination + // of WS_XXX flags, i.e. Windows style, not wxWidgets one), returns + // FALSE if creation failed + // + // All parameters except classname and style are optional, if the + // size/position are not given, they should be set later with SetSize() + // and, label (the title of the window), of course, is left empty. The + // extended style is determined from the style and the app 3D settings + // automatically if it's not specified explicitly. + bool MSWCreateControl(const wxChar *classname, + WXDWORD style, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& label = wxEmptyString, + WXDWORD exstyle = (WXDWORD)-1); + + // default style for the control include WS_TABSTOP if it AcceptsFocus() + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // this is a helper for the derived class GetClassDefaultAttributes() + // implementation: it returns the right colours for the classes which + // contain something else (e.g. wxListBox, wxTextCtrl, ...) instead of + // being simple controls (such as wxButton, wxCheckBox, ...) + static wxVisualAttributes + GetCompositeControlsDefaultAttributes(wxWindowVariant variant); + + + // for controls like radiobuttons which are really composite this array + // holds the ids (not HWNDs!) of the sub controls + wxArrayLong m_subControls; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxControl) + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_CONTROL_H_ diff --git a/include/wx/palmos/crashrpt.h b/include/wx/palmos/crashrpt.h new file mode 100644 index 0000000000..f7ce335d04 --- /dev/null +++ b/include/wx/palmos/crashrpt.h @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/crashrpt.h +// Purpose: helpers for the structured exception handling (SEH) +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_SEH_H_ +#define _WX_MSW_SEH_H_ + +#include "wx/defs.h" + +#if wxUSE_ON_FATAL_EXCEPTION + +// ---------------------------------------------------------------------------- +// report generation flags +// ---------------------------------------------------------------------------- + +enum +{ + // we always report where the crash occured + wxCRASH_REPORT_LOCATION = 0, + + // if this flag is given, the call stack is dumped + // + // this results in dump/crash report as small as possible, this is the + // default flag + wxCRASH_REPORT_STACK = 1, + + // if this flag is given, the values of the local variables are dumped + // + // note that this will result in huge file containing the dump of the + // entire process memory space when using mini dumps! + wxCRASH_REPORT_LOCALS = 2, + + // if this flag is given, the values of all global variables are dumped + // + // this creates a much larger mini dump and also takes more time to + // generate if our own crash reporting code is used + wxCRASH_REPORT_GLOBALS = 4 +}; + +// ---------------------------------------------------------------------------- +// wxCrashReport: this class is used to create crash reports +// ---------------------------------------------------------------------------- + +struct WXDLLIMPEXP_BASE wxCrashReport +{ + // set the name of the file to which the report is written, it is + // constructed from the .exe name by default + static void SetFileName(const wxChar *filename); + + // return the current file name + static const wxChar *GetFileName(); + + // write the exception report to the file, return true if it could be done + // or false otherwise + static bool Generate(int flags = wxCRASH_REPORT_LOCATION | + wxCRASH_REPORT_STACK); +}; + +#endif // wxUSE_ON_FATAL_EXCEPTION + +#endif // _WX_MSW_SEH_H_ + diff --git a/include/wx/palmos/cursor.h b/include/wx/palmos/cursor.h new file mode 100644 index 0000000000..300548bee8 --- /dev/null +++ b/include/wx/palmos/cursor.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/cursor.h +// Purpose: wxCursor class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_CURSOR_H_ +#define _WX_CURSOR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "cursor.h" +#endif + +#include "wx/palmos/gdiimage.h" + +class WXDLLEXPORT wxImage; + +// Cursor +class WXDLLEXPORT wxCursor : public wxGDIImage +{ +public: + // constructors + wxCursor(); + wxCursor(const wxCursor& cursor) { Ref(cursor); } + wxCursor(const wxImage& image); + wxCursor(const char bits[], int width, int height, + int hotSpotX = -1, int hotSpotY = -1, + const char maskBits[] = NULL); + wxCursor(const wxString& name, + long flags = wxBITMAP_TYPE_CUR_RESOURCE, + int hotSpotX = 0, int hotSpotY = 0); + wxCursor(int idCursor); + virtual ~wxCursor(); + + wxCursor& operator=(const wxCursor& cursor) + { if (*this == cursor) return (*this); Ref(cursor); return *this; } + + bool operator==(const wxCursor& cursor) const; + bool operator!=(const wxCursor& cursor) const + { return !(*this == cursor); } + + // implementation only + void SetHCURSOR(WXHCURSOR cursor) { SetHandle((WXHANDLE)cursor); } + WXHCURSOR GetHCURSOR() const { return (WXHCURSOR)GetHandle(); } + +protected: + virtual wxGDIImageRefData *CreateData() const; + +private: + DECLARE_DYNAMIC_CLASS(wxCursor) +}; + +#endif + // _WX_CURSOR_H_ diff --git a/include/wx/palmos/dc.h b/include/wx/palmos/dc.h new file mode 100644 index 0000000000..fa18e1372f --- /dev/null +++ b/include/wx/palmos/dc.h @@ -0,0 +1,276 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dc.h +// Purpose: wxDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DC_H_ +#define _WX_DC_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "dc.h" +#endif + +#include "wx/defs.h" +#include "wx/dc.h" + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +#if wxUSE_DC_CACHEING +/* + * Cached blitting, maintaining a cache + * of bitmaps required for transparent blitting + * instead of constant creation/deletion + */ + +class wxDCCacheEntry: public wxObject +{ +public: + wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth); + wxDCCacheEntry(WXHDC hDC, int depth); + ~wxDCCacheEntry(); + + WXHBITMAP m_bitmap; + WXHDC m_dc; + int m_width; + int m_height; + int m_depth; +}; +#endif + +class WXDLLEXPORT wxDC : public wxDCBase +{ +public: + wxDC(); + ~wxDC(); + + // implement base class pure virtuals + // ---------------------------------- + + virtual void Clear(); + + virtual bool StartDoc(const wxString& message); + virtual void EndDoc(); + + virtual void StartPage(); + virtual void EndPage(); + + virtual void SetFont(const wxFont& font); + virtual void SetPen(const wxPen& pen); + virtual void SetBrush(const wxBrush& brush); + virtual void SetBackground(const wxBrush& brush); + virtual void SetBackgroundMode(int mode); +#if wxUSE_PALETTE + virtual void SetPalette(const wxPalette& palette); +#endif // wxUSE_PALETTE + + virtual void DestroyClippingRegion(); + + virtual wxCoord GetCharHeight() const; + virtual wxCoord GetCharWidth() const; + virtual void DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent = NULL, + wxCoord *externalLeading = NULL, + wxFont *theFont = NULL) const; + virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; + + virtual bool CanDrawBitmap() const; + virtual bool CanGetTextExtent() const; + virtual int GetDepth() const; + virtual wxSize GetPPI() const; + + virtual void SetMapMode(int mode); + virtual void SetUserScale(double x, double y); + virtual void SetSystemScale(double x, double y); + virtual void SetLogicalScale(double x, double y); + virtual void SetLogicalOrigin(wxCoord x, wxCoord y); + virtual void SetDeviceOrigin(wxCoord x, wxCoord y); + virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); + virtual void SetLogicalFunction(int function); + + // implementation from now on + // -------------------------- + + virtual void SetRop(WXHDC cdc); + virtual void SelectOldObjects(WXHDC dc); + + wxWindow *GetWindow() const { return m_canvas; } + void SetWindow(wxWindow *win) + { + m_canvas = win; + +#if wxUSE_PALETTE + // if we have palettes use the correct one for this window + InitializePalette(); +#endif // wxUSE_PALETTE + } + + WXHDC GetHDC() const { return m_hDC; } + void SetHDC(WXHDC dc, bool bOwnsDC = FALSE) + { + m_hDC = dc; + m_bOwnsDC = bOwnsDC; + + // we might have a pre existing clipping region, make sure that we + // return it if asked -- but avoid calling ::GetClipBox() right now as + // it could be unnecessary wasteful + m_clipping = true; + m_clipX1 = + m_clipX2 = 0; + } + + const wxBitmap& GetSelectedBitmap() const { return m_selectedBitmap; } + wxBitmap& GetSelectedBitmap() { return m_selectedBitmap; } + + // update the internal clip box variables + void UpdateClipBox(); + +#if wxUSE_DC_CACHEING + static wxDCCacheEntry* FindBitmapInCache(WXHDC hDC, int w, int h); + static wxDCCacheEntry* FindDCInCache(wxDCCacheEntry* notThis, WXHDC hDC); + + static void AddToBitmapCache(wxDCCacheEntry* entry); + static void AddToDCCache(wxDCCacheEntry* entry); + static void ClearCache(); +#endif + +protected: + virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, + int style = wxFLOOD_SURFACE); + + virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; + + virtual void DoDrawPoint(wxCoord x, wxCoord y); + virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); + + virtual void DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc); + virtual void DoDrawCheckMark(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, + double sa, double ea); + + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + double radius); + virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + + virtual void DoCrossHair(wxCoord x, wxCoord y); + + virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = FALSE); + + virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); + virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, + double angle); + + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + // this is gnarly - we can't even call this function DoSetClippingRegion() + // because of virtual function hiding + virtual void DoSetClippingRegionAsRegion(const wxRegion& region); + virtual void DoSetClippingRegion(wxCoord x, wxCoord y, + wxCoord width, wxCoord height); + virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, + wxCoord *width, wxCoord *height) + { + GetClippingBox(x, y, width, height); + } + virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, + wxCoord *w, wxCoord *h) const; + + virtual void DoGetSize(int *width, int *height) const; + virtual void DoGetSizeMM(int* width, int* height) const; + + virtual void DoDrawLines(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset); + virtual void DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + int fillStyle = wxODDEVEN_RULE); + + +#if wxUSE_PALETTE + // MSW specific, select a logical palette into the HDC + // (tell windows to translate pixel from other palettes to our custom one + // and vice versa) + // Realize tells it to also reset the system palette to this one. + void DoSelectPalette(bool realize = FALSE); + + // Find out what palette our parent window has, then select it into the dc + void InitializePalette(); +#endif // wxUSE_PALETTE + + // common part of DoDrawText() and DoDrawRotatedText() + void DrawAnyText(const wxString& text, wxCoord x, wxCoord y); + + // common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() + void SetClippingHrgn(WXHRGN hrgn); + + // MSW-specific member variables + // ----------------------------- + + // the window associated with this DC (may be NULL) + wxWindow *m_canvas; + + wxBitmap m_selectedBitmap; + + // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it + bool m_bOwnsDC:1; + + // our HDC + WXHDC m_hDC; + + // Store all old GDI objects when do a SelectObject, so we can select them + // back in (this unselecting user's objects) so we can safely delete the + // DC. + WXHBITMAP m_oldBitmap; + WXHPEN m_oldPen; + WXHBRUSH m_oldBrush; + WXHFONT m_oldFont; + +#if wxUSE_PALETTE + WXHPALETTE m_oldPalette; +#endif // wxUSE_PALETTE + +#if wxUSE_DC_CACHEING + static wxList sm_bitmapCache; + static wxList sm_dcCache; +#endif + + DECLARE_DYNAMIC_CLASS(wxDC) + DECLARE_NO_COPY_CLASS(wxDC) +}; + +// ---------------------------------------------------------------------------- +// wxDCTemp: a wxDC which doesn't free the given HDC (used by wxWidgets +// only/mainly) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCTemp : public wxDC +{ +public: + wxDCTemp(WXHDC hdc) { SetHDC(hdc); } + virtual ~wxDCTemp() { SetHDC((WXHDC)NULL); } + +private: + DECLARE_NO_COPY_CLASS(wxDCTemp) +}; + +#endif + // _WX_DC_H_ diff --git a/include/wx/palmos/dcclient.h b/include/wx/palmos/dcclient.h new file mode 100644 index 0000000000..8100f65680 --- /dev/null +++ b/include/wx/palmos/dcclient.h @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcclient.h +// Purpose: wxClientDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCCLIENT_H_ +#define _WX_DCCLIENT_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "dcclient.h" +#endif + +#include "wx/dc.h" +#include "wx/dynarray.h" + +// ---------------------------------------------------------------------------- +// array types +// ---------------------------------------------------------------------------- + +// this one if used by wxPaintDC only +struct WXDLLEXPORT wxPaintDCInfo; + +WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); + +// ---------------------------------------------------------------------------- +// DC classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowDC : public wxDC +{ +public: + // default ctor + wxWindowDC(); + + // Create a DC corresponding to the whole window + wxWindowDC(wxWindow *win); + +protected: + // intiialize the newly created DC + void InitDC(); + + // override some base class virtuals + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowDC) +}; + +class WXDLLEXPORT wxClientDC : public wxWindowDC +{ +public: + // default ctor + wxClientDC(); + + // Create a DC corresponding to the client area of the window + wxClientDC(wxWindow *win); + + virtual ~wxClientDC(); + +protected: + void InitDC(); + + // override some base class virtuals + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxClientDC) +}; + +class WXDLLEXPORT wxPaintDC : public wxClientDC +{ +public: + wxPaintDC(); + + // Create a DC corresponding for painting the window in OnPaint() + wxPaintDC(wxWindow *win); + + virtual ~wxPaintDC(); + + // find the entry for this DC in the cache (keyed by the window) + static WXHDC FindDCInCache(wxWindow* win); + +protected: + static wxArrayDCInfo ms_cache; + + // find the entry for this DC in the cache (keyed by the window) + wxPaintDCInfo *FindInCache(size_t *index = NULL) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC) +}; + +/* + * wxPaintDCEx + * This class is used when an application sends an HDC with the WM_PAINT + * message. It is used in HandlePaint and need not be used by an application. + */ + +class WXDLLEXPORT wxPaintDCEx : public wxPaintDC +{ +public: + wxPaintDCEx(wxWindow *canvas, WXHDC dc); + virtual ~wxPaintDCEx(); +private: + int saveState; + + DECLARE_CLASS(wxPaintDCEx) + DECLARE_NO_COPY_CLASS(wxPaintDCEx) +}; + +#endif + // _WX_DCCLIENT_H_ diff --git a/include/wx/palmos/dcmemory.h b/include/wx/palmos/dcmemory.h new file mode 100644 index 0000000000..9c125ff42f --- /dev/null +++ b/include/wx/palmos/dcmemory.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dcmemory.h +// Purpose: wxMemoryDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCMEMORY_H_ +#define _WX_DCMEMORY_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dcmemory.h" +#endif + +#include "wx/dcclient.h" + +class WXDLLEXPORT wxMemoryDC : public wxDC +{ +public: + wxMemoryDC(); + wxMemoryDC(wxDC *dc); // Create compatible DC + + virtual void SelectObject(const wxBitmap& bitmap); + +protected: + // override some base class virtuals + virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); + virtual void DoGetSize(int* width, int* height) const; + + // create DC compatible with the given one or screen if dc == NULL + bool CreateCompatible(wxDC *dc); + + // initialize the newly created DC + void Init(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC) +}; + +#endif + // _WX_DCMEMORY_H_ diff --git a/include/wx/palmos/dcprint.h b/include/wx/palmos/dcprint.h new file mode 100644 index 0000000000..87246e6cd4 --- /dev/null +++ b/include/wx/palmos/dcprint.h @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dcprint.h +// Purpose: wxPrinterDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCPRINT_H_ +#define _WX_DCPRINT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "dcprint.h" +#endif + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dc.h" +#include "wx/cmndata.h" + +class WXDLLEXPORT wxPrinterDC : public wxDC +{ +public: + // Create a printer DC (obsolete function: use wxPrintData version now) + wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT); + + // Create from print data + wxPrinterDC(const wxPrintData& data); + + wxPrinterDC(WXHDC theDC); + + // override some base class virtuals + virtual bool StartDoc(const wxString& message); + virtual void EndDoc(); + virtual void StartPage(); + virtual void EndPage(); + +protected: + virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, + bool useMask = FALSE); + virtual bool DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + + // init the dc + void Init(); + + wxPrintData m_printData; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPrinterDC) +}; + +// Gets an HDC for the default printer configuration +// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation); + +// Gets an HDC for the specified printer configuration +WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_DCPRINT_H_ + diff --git a/include/wx/palmos/dcscreen.h b/include/wx/palmos/dcscreen.h new file mode 100644 index 0000000000..d6901d7d3b --- /dev/null +++ b/include/wx/palmos/dcscreen.h @@ -0,0 +1,41 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dcscreen.h +// Purpose: wxScreenDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DCSCREEN_H_ +#define _WX_DCSCREEN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dcscreen.h" +#endif + +#include "wx/dcclient.h" + +class WXDLLEXPORT wxScreenDC : public wxWindowDC +{ +public: + // Create a DC representing the whole screen + wxScreenDC(); + + // Compatibility with X's requirements for drawing on top of all windows + static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; } + static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; } + static bool EndDrawingOnTop() { return TRUE; } + +protected: + virtual void DoGetSize(int *width, int *height) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC) +}; + +#endif + // _WX_DCSCREEN_H_ + diff --git a/include/wx/palmos/dialog.h b/include/wx/palmos/dialog.h new file mode 100644 index 0000000000..631096f61b --- /dev/null +++ b/include/wx/palmos/dialog.h @@ -0,0 +1,130 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dialog.h +// Purpose: wxDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIALOG_H_ +#define _WX_DIALOG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "dialog.h" +#endif + +#include "wx/panel.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; + +class WXDLLEXPORT wxDialogModalData; + +// Dialog boxes +class WXDLLEXPORT wxDialog : public wxDialogBase +{ +public: + wxDialog() { Init(); } + + // full ctor + 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(); + + (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_DIALOG_STYLE, + const wxString& name = wxDialogNameStr); + + virtual ~wxDialog(); + + // return true if we're showing the dialog modally + virtual bool IsModal() const { return m_modalData != NULL; } + + // show the dialog modally and return the value passed to EndModal() + virtual int ShowModal(); + + // may be called to terminate the dialog with the given return code + virtual void EndModal(int retCode); + + // implementation only from now on + // ------------------------------- + + // override some base class virtuals + virtual bool Show(bool show = TRUE); + + virtual void Raise(); + + // event handlers + void OnCharHook(wxKeyEvent& event); + void OnCloseWindow(wxCloseEvent& event); + + // Standard buttons + void OnOK(wxCommandEvent& event); + void OnApply(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // Windows callbacks + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +#if wxUSE_CTL3D + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); +#endif // wxUSE_CTL3D + + // obsolete methods + // ---------------- + + // use the other ctor + wxDEPRECATED( wxDialog(wxWindow *parent, + const wxString& title, bool modal, + int x = -1, int y= -1, int width = 500, int height = 500, + long style = wxDEFAULT_DIALOG_STYLE, + const wxString& name = wxDialogNameStr) ); + + // just call Show() or ShowModal() + wxDEPRECATED( void SetModal(bool flag) ); + + // use IsModal() + wxDEPRECATED( bool IsModalShowing() const ); + +protected: + // find the window to use as parent for this dialog if none has been + // specified explicitly by the user + // + // may return NULL + wxWindow *FindSuitableParent() const; + + // common part of all ctors + void Init(); + +private: + wxWindow* m_oldFocus; + bool m_endModalCalled; // allow for closing within InitDialog + + // this pointer is non-NULL only while the modal event loop is running + wxDialogModalData *m_modalData; + + + DECLARE_DYNAMIC_CLASS(wxDialog) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxDialog) +}; + +#endif + // _WX_DIALOG_H_ diff --git a/include/wx/palmos/dib.h b/include/wx/palmos/dib.h new file mode 100644 index 0000000000..444cdc0c1e --- /dev/null +++ b/include/wx/palmos/dib.h @@ -0,0 +1,243 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dib.h +// Purpose: wxDIB class representing device independent bitmaps +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_DIB_H_ +#define _WX_PALMOS_DIB_H_ + +class WXDLLEXPORT wxBitmap; +class WXDLLEXPORT wxPalette; + +#include "wx/msw/private.h" + +#if wxUSE_WXDIB + +// ---------------------------------------------------------------------------- +// wxDIB: represents a DIB section +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDIB +{ +public: + // ctors and such + // -------------- + + // create an uninitialized DIB with the given width, height and depth (only + // 24 and 32 bpp DIBs are currently supported) + // + // after using this ctor, GetData() and GetHandle() may be used if IsOk() + // returns true + wxDIB(int width, int height, int depth) + { Init(); (void)Create(width, height, depth); } + + // create a DIB from the DDB + wxDIB(const wxBitmap& bmp) + { Init(); (void)Create(bmp); } + + // load a DIB from file (any depth is supoprted here unlike above) + // + // as above, use IsOk() to see if the bitmap was loaded successfully + wxDIB(const wxString& filename) + { Init(); (void)Load(filename); } + + // same as the corresponding ctors but with return value + bool Create(int width, int height, int depth); + bool Create(const wxBitmap& bmp); + bool Load(const wxString& filename); + + // dtor is not virtual, this class is not meant to be used polymorphically + ~wxDIB(); + + + // operations + // ---------- + +#ifndef __WXWINCE__ + // create a bitmap compatiblr with the given HDC (or screen by default) and + // return its handle, the caller is responsible for freeing it (using + // DeleteObject()) + HBITMAP CreateDDB(HDC hdc = 0) const; +#endif // !__WXWINCE__ + + // get the handle from the DIB and reset it, i.e. this object won't destroy + // the DIB after this (but the caller should do it) + HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; } + +#if wxUSE_PALETTE + // create a palette for this DIB (always a trivial/default one for 24bpp) + wxPalette *CreatePalette() const; +#endif // wxUSE_PALETTE + + // save the DIB as a .BMP file to the file with the given name + bool Save(const wxString& filename); + + + // accessors + // --------- + + // return true if DIB was successfully created, false otherwise + bool IsOk() const { return m_handle != 0; } + + // get the bitmap size + wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } + int GetWidth() const { DoGetObject(); return m_width; } + int GetHeight() const { DoGetObject(); return m_height; } + + // get the number of bits per pixel, or depth + int GetDepth() const { DoGetObject(); return m_depth; } + + // get the DIB handle + HBITMAP GetHandle() const { return m_handle; } + + // get raw pointer to bitmap bits, you should know what you do if you + // decide to use it + void *GetData() const { DoGetObject(); return m_data; } + + + // HBITMAP conversion + // ------------------ + + // these functions are only used by wxWidgets internally right now, please + // don't use them directly if possible as they're subject to change + +#ifndef __WXWINCE__ + // creates a DDB compatible with the given (or screen) DC from either + // a plain DIB or a DIB section (in which case the last parameter must be + // non NULL) + static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, + HDC hdc = 0, + void *bits = NULL); + + // create a plain DIB (not a DIB section) from a DDB, the caller is + // responsable for freeing it using ::GlobalFree() + static HGLOBAL ConvertFromBitmap(HBITMAP hbmp); + + // creates a DIB from the given DDB or calculates the space needed by it: + // if pbi is NULL, only the space is calculated, otherwise pbi is supposed + // to point at BITMAPINFO of the correct size which is filled by this + // function (this overload is needed for wxBitmapDataObject code in + // src/msw/ole/dataobj.cpp) + static size_t ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp); +#endif // __WXWINCE__ + + + // wxImage conversion + // ------------------ + +#if wxUSE_IMAGE + // create a DIB from the given image, the DIB will be either 24 or 32 (if + // the image has alpha channel) bpp + wxDIB(const wxImage& image) { Init(); (void)Create(image); } + + // same as the above ctor but with the return code + bool Create(const wxImage& image); + + // create wxImage having the same data as this DIB + wxImage ConvertToImage() const; +#endif // wxUSE_IMAGE + + + // helper functions + // ---------------- + + // return the size of one line in a DIB with given width and depth: the + // point here is that as the scan lines need to be DWORD aligned so we may + // need to add some padding + static unsigned long GetLineSize(int width, int depth) + { + return ((width*depth + 31) & ~31) >> 3; + } + +private: + // common part of all ctors + void Init(); + + // free resources + void Free(); + + // initialize the contents from the provided DDB (Create() must have been + // already called) + bool CopyFromDDB(HBITMAP hbmp); + + + // the DIB section handle, 0 if invalid + HBITMAP m_handle; + + // NB: we could store only m_handle and not any of the other fields as + // we may always retrieve them from it using ::GetObject(), but we + // decide to still store them for efficiency concerns -- however if we + // don't have them from the very beginning (e.g. DIB constructed from a + // bitmap), we only retrieve them when necessary and so these fields + // should *never* be accessed directly, even from inside wxDIB code + + // function which must be called before accessing any members and which + // gets their values from m_handle, if not done yet + void DoGetObject() const; + + // pointer to DIB bits, may be NULL + void *m_data; + + // size and depth of the image + int m_width, + m_height, + m_depth; + + // in some cases we could be using a handle which we didn't create and in + // this case we shouldn't free it neither -- this flag tell us if this is + // the case + bool m_ownsHandle; + + + // DIBs can't be copied + wxDIB(const wxDIB&); + wxDIB& operator=(const wxDIB&); +}; + +// ---------------------------------------------------------------------------- +// inline functions implementation +// ---------------------------------------------------------------------------- + +inline +void wxDIB::Init() +{ + m_handle = 0; + m_ownsHandle = true; + + m_data = NULL; + + m_width = + m_height = + m_depth = 0; +} + +inline +void wxDIB::Free() +{ + if ( m_handle && m_ownsHandle ) + { + if ( !::DeleteObject(m_handle) ) + { + wxLogLastError(wxT("DeleteObject(hDIB)")); + } + + Init(); + } +} + +inline wxDIB::~wxDIB() +{ + Free(); +} + +#endif + // wxUSE_WXDIB + +#endif // _WX_PALMOS_DIB_H_ + diff --git a/include/wx/palmos/dirdlg.h b/include/wx/palmos/dirdlg.h new file mode 100644 index 0000000000..3269508b77 --- /dev/null +++ b/include/wx/palmos/dirdlg.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dirdlg.h +// Purpose: wxDirDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DIRDLG_H_ +#define _WX_DIRDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dirdlg.h" +#endif + +class WXDLLEXPORT wxDirDialog : public wxDialog +{ +public: + wxDirDialog(wxWindow *parent, + const wxString& message = wxDirSelectorPromptStr, + const wxString& defaultPath = wxEmptyString, + long style = 0, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + const wxString& name = wxDirDialogNameStr); + + void SetMessage(const wxString& message) { m_message = message; } + void SetPath(const wxString& path); + void SetStyle(long style) { SetWindowStyle(style); } + + wxString GetMessage() const { return m_message; } + wxString GetPath() const { return m_path; } + long GetStyle() const { return GetWindowStyle(); } + + virtual int ShowModal(); + +protected: + wxString m_message; + wxString m_path; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxDirDialog) +}; + +#endif + // _WX_DIRDLG_H_ diff --git a/include/wx/palmos/display.h b/include/wx/palmos/display.h new file mode 100644 index 0000000000..c49313bec7 --- /dev/null +++ b/include/wx/palmos/display.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: display.h +// Purpose: wxDisplay class customization for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "display.h" +#endif + +#ifndef _WX_PALMOS_DISPLAY_H_ +#define _WX_PALMOS_DISPLAY_H_ + +class WXDLLEXPORT wxDisplay : public wxDisplayBase +{ +public: + // this function may be called *before* using any other wxDisplay methods + // to tell it to use DirectX functions instead of the standard Windows ones + static void UseDirectX(bool useDX); + + // create the display object for the given physical display + wxDisplay(size_t index = 0); + + virtual ~wxDisplay(); + + // implement base class pure virtuals + virtual bool IsOk() const; + virtual wxRect GetGeometry() const; + virtual wxString GetName() const; + + virtual wxArrayVideoModes + GetModes(const wxVideoMode& mode = wxVideoMode()) const; + virtual wxVideoMode GetCurrentMode() const; + virtual bool ChangeMode(const wxVideoMode& mode = wxVideoMode()); + +private: + // get the display name to use with EnumDisplaySettings() + wxString GetNameForEnumSettings() const; + + // we have different implementations using DirectDraw and without it + wxArrayVideoModes DoGetModesDirectX(const wxVideoMode& modeMatch) const; + bool DoChangeModeDirectX(const wxVideoMode& mode); + + wxArrayVideoModes DoGetModesWindows(const wxVideoMode& modeMatch) const; + bool DoChangeModeWindows(const wxVideoMode& mode); + + + DECLARE_NO_COPY_CLASS(wxDisplay) +}; + +#endif // _WX_PALMOS_DISPLAY_H_ diff --git a/include/wx/palmos/dragimag.h b/include/wx/palmos/dragimag.h new file mode 100644 index 0000000000..1a934527f1 --- /dev/null +++ b/include/wx/palmos/dragimag.h @@ -0,0 +1,275 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/dragimag.h +// Purpose: wxDragImage class: a kind of a cursor, that can cope +// with more sophisticated images +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_DRAGIMAG_H_ +#define _WX_DRAGIMAG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "dragimag.h" +#endif + +#include "wx/bitmap.h" +#include "wx/icon.h" +#include "wx/cursor.h" +#include "wx/treectrl.h" +#include "wx/listctrl.h" + +// If 1, use a simple wxCursor instead of ImageList_SetDragCursorImage +#define wxUSE_SIMPLER_DRAGIMAGE 0 + +/* + To use this class, create a wxDragImage when you start dragging, for example: + + void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) + { +#ifdef __WXMSW__ + ::UpdateWindow((HWND) GetHWND()); // We need to implement this in wxWidgets +#endif + + CaptureMouse(); + + m_dragImage = new wxDragImage(* this, itemId); + m_dragImage->BeginDrag(wxPoint(0, 0), this); + m_dragImage->Move(pt, this); + m_dragImage->Show(this); + ... + } + + In your OnMouseMove function, hide the image, do any display updating required, + then move and show the image again: + + void MyTreeCtrl::OnMouseMove(wxMouseEvent& event) + { + if (m_dragMode == MY_TREE_DRAG_NONE) + { + event.Skip(); + return; + } + + // Prevent screen corruption by hiding the image + if (m_dragImage) + m_dragImage->Hide(this); + + // Do some updating of the window, such as highlighting the drop target + ... + +#ifdef __WXMSW__ + if (updateWindow) + ::UpdateWindow((HWND) GetHWND()); +#endif + + // Move and show the image again + m_dragImage->Move(event.GetPosition(), this); + m_dragImage->Show(this); + } + + Eventually we end the drag and delete the drag image. + + void MyTreeCtrl::OnLeftUp(wxMouseEvent& event) + { + ... + + // End the drag and delete the drag image + if (m_dragImage) + { + m_dragImage->EndDrag(this); + delete m_dragImage; + m_dragImage = NULL; + } + ReleaseMouse(); + } +*/ + +/* + Notes for Unix version: + Can we simply use cursors instead, creating a cursor dynamically, setting it into the window + in BeginDrag, and restoring the old cursor in EndDrag? + For a really bog-standard implementation, we could simply use a normal dragging cursor + and ignore the image. +*/ + +/* + * wxDragImage + */ + +class WXDLLEXPORT wxDragImage: public wxObject +{ +public: + + // Ctors & dtor + //////////////////////////////////////////////////////////////////////////// + + wxDragImage(); + wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + // Deprecated form of the above + wxDragImage(const wxBitmap& image, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(image, cursor, cursorHotspot); + } + + wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(image, cursor); + } + + // Deprecated form of the above + wxDragImage(const wxIcon& image, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(image, cursor, cursorHotspot); + } + + wxDragImage(const wxString& str, const wxCursor& cursor = wxNullCursor) + { + Init(); + + Create(str, cursor); + } + + // Deprecated form of the above + wxDragImage(const wxString& str, const wxCursor& cursor, const wxPoint& cursorHotspot) + { + Init(); + + Create(str, cursor, cursorHotspot); + } + +#if wxUSE_TREECTRL + wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) + { + Init(); + + Create(treeCtrl, id); + } +#endif + +#if wxUSE_LISTCTRL + wxDragImage(const wxListCtrl& listCtrl, long id) + { + Init(); + + Create(listCtrl, id); + } +#endif + + ~wxDragImage(); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Create a drag image from a bitmap and optional cursor + bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor); + bool Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(image, cursor); + } + + // Create a drag image from an icon and optional cursor + bool Create(const wxIcon& image, const wxCursor& cursor = wxNullCursor); + bool Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(image, cursor); + } + + // Create a drag image from a string and optional cursor + bool Create(const wxString& str, const wxCursor& cursor = wxNullCursor); + bool Create(const wxString& str, const wxCursor& cursor, const wxPoint& WXUNUSED(cursorHotspot)) + { + wxLogDebug(wxT("wxDragImage::Create: use of a cursor hotspot is now deprecated. Please omit this argument.")); + return Create(str, cursor); + } + +#if wxUSE_TREECTRL + // Create a drag image for the given tree control item + bool Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); +#endif + +#if wxUSE_LISTCTRL + // Create a drag image for the given list control item + bool Create(const wxListCtrl& listCtrl, long id); +#endif + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = FALSE, wxRect* rect = (wxRect*) NULL); + + // Begin drag. hotspot is the location of the drag position relative to the upper-left + // corner of the image. This is full screen only. fullScreenRect gives the + // position of the window on the screen, to restrict the drag to. + bool BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect); + + // End drag + bool EndDrag(); + + // Move the image: call from OnMouseMove. Pt is in window client coordinates if window + // is non-NULL, or in screen coordinates if NULL. + bool Move(const wxPoint& pt); + + // Show the image + bool Show(); + + // Hide the image + bool Hide(); + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Initialize variables + void Init(); + + // Returns the native image list handle + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +#if !wxUSE_SIMPLER_DRAGIMAGE + // Returns the native image list handle for the cursor + WXHIMAGELIST GetCursorHIMAGELIST() const { return m_hCursorImageList; } +#endif + +protected: + WXHIMAGELIST m_hImageList; + +#if wxUSE_SIMPLER_DRAGIMAGE + wxCursor m_oldCursor; +#else + WXHIMAGELIST m_hCursorImageList; +#endif + + wxCursor m_cursor; +// wxPoint m_cursorHotspot; // Obsolete + wxPoint m_position; + wxWindow* m_window; + wxRect m_boundingRect; + bool m_fullScreen; + +private: + DECLARE_DYNAMIC_CLASS(wxDragImage) + DECLARE_NO_COPY_CLASS(wxDragImage) +}; + +#endif + // _WX_DRAGIMAG_H_ diff --git a/include/wx/palmos/enhmeta.h b/include/wx/palmos/enhmeta.h new file mode 100644 index 0000000000..3613bcb9ea --- /dev/null +++ b/include/wx/palmos/enhmeta.h @@ -0,0 +1,180 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/enhmeta.h +// Purpose: wxEnhMetaFile class for Win32 +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_ENHMETA_H_ +#define _WX_PALMOS_ENHMETA_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "enhmeta.h" +#endif + +#include "wx/dc.h" + +#if wxUSE_DRAG_AND_DROP + #include "wx/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// wxEnhMetaFile: encapsulation of Win32 HENHMETAFILE +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEnhMetaFile : public wxObject +{ +public: + wxEnhMetaFile(const wxString& file = wxEmptyString) : m_filename(file) + { Init(); } + wxEnhMetaFile(const wxEnhMetaFile& metafile) + { Init(); Assign(metafile); } + wxEnhMetaFile& operator=(const wxEnhMetaFile& metafile) + { Free(); Assign(metafile); return *this; } + + virtual ~wxEnhMetaFile() + { Free(); } + + // display the picture stored in the metafile on the given DC + bool Play(wxDC *dc, wxRect *rectBound = (wxRect *)NULL); + + // accessors + bool Ok() const { return m_hMF != 0; } + + wxSize GetSize() const; + int GetWidth() const { return GetSize().x; } + int GetHeight() const { return GetSize().y; } + + const wxString& GetFileName() const { return m_filename; } + + // copy the metafile to the clipboard: the width and height parameters are + // for backwards compatibility (with wxMetaFile) only, they are ignored by + // this method + bool SetClipboard(int width = 0, int height = 0); + + // implementation + WXHANDLE GetHENHMETAFILE() const { return m_hMF; } + void SetHENHMETAFILE(WXHANDLE hMF) { Free(); m_hMF = hMF; } + +protected: + void Init() { m_hMF = 0; } + void Free(); + void Assign(const wxEnhMetaFile& mf); + +private: + wxString m_filename; + WXHANDLE m_hMF; + + DECLARE_DYNAMIC_CLASS(wxEnhMetaFile) +}; + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDC: allows to create a wxEnhMetaFile +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEnhMetaFileDC : public wxDC +{ +public: + // the ctor parameters specify the filename (empty for memory metafiles), + // the metafile picture size and the optional description/comment + wxEnhMetaFileDC(const wxString& filename = wxEmptyString, + int width = 0, int height = 0, + const wxString& description = wxEmptyString); + + virtual ~wxEnhMetaFileDC(); + + // obtain a pointer to the new metafile (caller should delete it) + wxEnhMetaFile *Close(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC) +}; + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDataObject is a specialization of wxDataObject for enh metafile +// ---------------------------------------------------------------------------- + +// notice that we want to support both CF_METAFILEPICT and CF_ENHMETAFILE and +// so we derive from wxDataObject and not from wxDataObjectSimple +class WXDLLEXPORT wxEnhMetaFileDataObject : public wxDataObject +{ +public: + // ctors + wxEnhMetaFileDataObject() { } + wxEnhMetaFileDataObject(const wxEnhMetaFile& 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 wxEnhMetaFile& metafile) + { m_metafile = metafile; } + virtual wxEnhMetaFile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual wxDataFormat GetPreferredFormat(Direction dir) const; + virtual size_t GetFormatCount(Direction dir) const; + virtual void GetAllFormats(wxDataFormat *formats, Direction dir) const; + virtual size_t GetDataSize(const wxDataFormat& format) const; + virtual bool GetDataHere(const wxDataFormat& format, void *buf) const; + virtual bool SetData(const wxDataFormat& format, size_t len, + const void *buf); + +protected: + wxEnhMetaFile m_metafile; + + DECLARE_NO_COPY_CLASS(wxEnhMetaFileDataObject) +}; + + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileSimpleDataObject does derive from wxDataObjectSimple which +// makes it more convenient to use (it can be used with wxDataObjectComposite) +// at the price of not supoprting any more CF_METAFILEPICT but only +// CF_ENHMETAFILE +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEnhMetaFileSimpleDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxEnhMetaFileSimpleDataObject() : wxDataObjectSimple(wxDF_ENHMETAFILE) { } + wxEnhMetaFileSimpleDataObject(const wxEnhMetaFile& metafile) + : wxDataObjectSimple(wxDF_ENHMETAFILE), 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 SetEnhMetafile(const wxEnhMetaFile& metafile) + { m_metafile = metafile; } + virtual wxEnhMetaFile GetEnhMetafile() 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: + wxEnhMetaFile m_metafile; + + DECLARE_NO_COPY_CLASS(wxEnhMetaFileSimpleDataObject) +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif // _WX_PALMOS_ENHMETA_H_ diff --git a/include/wx/palmos/evtloop.h b/include/wx/palmos/evtloop.h new file mode 100644 index 0000000000..b0dadde7e5 --- /dev/null +++ b/include/wx/palmos/evtloop.h @@ -0,0 +1,50 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/evtloop.h +// Purpose: wxEventLoop class for Palm OS +// Author: William Osborne +// Modified by: +// Created: 2004-10-14 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_EVTLOOP_H_ +#define _WX_PALMOS_EVTLOOP_H_ + +// ---------------------------------------------------------------------------- +// wxEventLoop +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxEventLoop : public wxEventLoopBase +{ +public: + wxEventLoop(); + + // implement base class pure virtuals + virtual int Run(); + virtual void Exit(int rc = 0); + virtual bool Pending() const; + virtual bool Dispatch(); + virtual bool IsRunning() const; + + // MSW-specific methods + // -------------------- + + // preprocess a message, return true if processed (i.e. no further + // dispatching required) + virtual bool PreProcessMessage(WXMSG *msg); + + // process a single message + virtual void ProcessMessage(WXMSG *msg); + +protected: + // should we exit the loop? + bool m_shouldExit; + + // the loop exit code + int m_exitcode; +}; + +#endif // _WX_PALMOS_EVTLOOP_H_ + diff --git a/include/wx/palmos/fdrepdlg.h b/include/wx/palmos/fdrepdlg.h new file mode 100644 index 0000000000..63998397a9 --- /dev/null +++ b/include/wx/palmos/fdrepdlg.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/fdrepdlg.h +// Purpose: wxFindReplaceDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "mswfdrepdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog: dialog for searching / replacing text +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFindReplaceDialog : public wxFindReplaceDialogBase +{ +public: + // ctors and such + wxFindReplaceDialog() { Init(); } + wxFindReplaceDialog(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int style = 0); + + bool Create(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int style = 0); + + virtual ~wxFindReplaceDialog(); + + // implementation only from now on + + wxFindReplaceDialogImpl *GetImpl() const { return m_impl; } + + // override some base class virtuals + virtual bool Show(bool show = TRUE); + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + +protected: + 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); + + void Init(); + + wxString m_title; + + wxFindReplaceDialogImpl *m_impl; + + DECLARE_DYNAMIC_CLASS(wxFindReplaceDialog) + DECLARE_NO_COPY_CLASS(wxFindReplaceDialog) +}; + + diff --git a/include/wx/palmos/filedlg.h b/include/wx/palmos/filedlg.h new file mode 100644 index 0000000000..b145962b3a --- /dev/null +++ b/include/wx/palmos/filedlg.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/filedlg.h +// Purpose: wxFileDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FILEDLG_H_ +#define _WX_FILEDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "filedlg.h" +#endif + +//------------------------------------------------------------------------- +// wxFileDialog +//------------------------------------------------------------------------- + +class WXDLLEXPORT wxFileDialog: public wxFileDialogBase +{ +public: + wxFileDialog(wxWindow *parent, + const wxString& message = wxFileSelectorPromptStr, + const wxString& defaultDir = wxEmptyString, + const wxString& defaultFile = wxEmptyString, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = 0, + const wxPoint& pos = wxDefaultPosition); + + virtual void SetPath(const wxString& path); + virtual void GetPaths(wxArrayString& paths) const; + virtual void GetFilenames(wxArrayString& files) const; + + virtual int ShowModal(); + +private: + wxArrayString m_fileNames; + + DECLARE_DYNAMIC_CLASS(wxFileDialog) + DECLARE_NO_COPY_CLASS(wxFileDialog) +}; + +#endif // _WX_FILEDLG_H_ + diff --git a/include/wx/palmos/font.h b/include/wx/palmos/font.h new file mode 100644 index 0000000000..024a9380f9 --- /dev/null +++ b/include/wx/palmos/font.h @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: font.h +// Purpose: wxFont class +// Author: William Osborne +// Modified by: +// Created: 10/14/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONT_H_ +#define _WX_FONT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "font.h" +#endif + +#include + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFont : public wxFontBase +{ +public: + // ctors and such + wxFont() { Init(); } + wxFont(const wxFont& font) : wxFontBase(font) { Init(); Ref(font); } + + wxFont(int size, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Init(); + + (void)Create(size, family, style, weight, underlined, face, encoding); + } + + wxFont(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + Init(); + + (void)Create(pixelSize, family, style, weight, + underlined, face, encoding); + } + + wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) + { + Init(); + + Create(info, hFont); + } + + 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) + { + return DoCreate(size, wxDefaultSize, false, family, style, + weight, underlined, face, encoding); + } + + bool Create(const wxSize& pixelSize, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT) + { + return DoCreate(-1, pixelSize, true, family, style, + weight, underlined, face, encoding); + } + + bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); + + virtual ~wxFont(); + + // assignment + wxFont& operator=(const wxFont& font); + + // implement base class pure virtuals + virtual int GetPointSize() const; + virtual wxSize GetPixelSize() const; + virtual bool IsUsingSizeInPixels() 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 SetPixelSize(const wxSize& pixelSize); + virtual void SetFamily(int family); + virtual void SetStyle(int style); + virtual void SetWeight(int weight); + virtual void SetFaceName(const wxString& faceName); + virtual void SetUnderlined(bool underlined); + virtual void SetEncoding(wxFontEncoding encoding); + + virtual bool IsFixedWidth() const; + + // implementation only from now on + // ------------------------------- + + virtual bool IsFree() const; + virtual bool RealizeResource(); + virtual WXHANDLE GetResourceHandle() const; + virtual bool FreeResource(bool force = false); + + // for consistency with other wxMSW classes + WXHFONT GetHFONT() const; + + /* + virtual bool UseResource(); + virtual bool ReleaseResource(); + */ + +protected: + // real font creation function, used in all cases + bool DoCreate(int size, + const wxSize& pixelSize, + bool sizeUsingPixels, + int family, + int style, + int weight, + bool underlined = false, + const wxString& face = wxEmptyString, + wxFontEncoding encoding = wxFONTENCODING_DEFAULT); + + virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); + + // common part of all ctors + void Init(); + + void Unshare(); + +private: + DECLARE_DYNAMIC_CLASS(wxFont) +}; + +#endif + // _WX_FONT_H_ diff --git a/include/wx/palmos/fontdlg.h b/include/wx/palmos/fontdlg.h new file mode 100644 index 0000000000..7392cb0f3d --- /dev/null +++ b/include/wx/palmos/fontdlg.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: fontdlg.h +// Purpose: wxFontDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_FONTDLG_H_ +#define _WX_PALMOS_FONTDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "fontdlg.h" +#endif + +// ---------------------------------------------------------------------------- +// wxFontDialog +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFontDialog : public wxFontDialogBase +{ +public: + wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ } + wxFontDialog(wxWindow *parent) + : wxFontDialogBase(parent) { Create(parent); } + wxFontDialog(wxWindow *parent, const wxFontData& data) + : wxFontDialogBase(parent, data) { Create(parent, data); } + + virtual int ShowModal(); + + // deprecated interface, don't use + wxFontDialog(wxWindow *parent, const wxFontData *data) + : wxFontDialogBase(parent, data) { Create(parent, data); } + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog) +}; + +#endif + // _WX_PALMOS_FONTDLG_H_ + diff --git a/include/wx/palmos/fontenum.h b/include/wx/palmos/fontenum.h new file mode 100644 index 0000000000..0013ecc779 --- /dev/null +++ b/include/wx/palmos/fontenum.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: fontenum.h +// Purpose: wxFontEnumerator class for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FONTENUM_H_ +#define _WX_FONTENUM_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "fontenum.h" +#endif + +/* + * wxFontEnumerator: for gathering font information + */ + +class wxFontEnumerator: public wxObject +{ +DECLARE_CLASS(wxFontEnumerator) +public: + wxFontEnumerator() {}; + + // Enumerate the fonts. + bool Enumerate(); + + // Stop enumeration if FALSE is returned. + // By default, the enumerator stores the facenames in a list for + // retrieval via GetFacenames(). + virtual bool OnFont(const wxFont& font); + + // Return the list of facenames. + wxStringList& GetFacenames() { return (wxStringList&) m_faceNames; } +protected: + wxStringList m_faceNames; +}; + +#endif + // _WX_FONTENUM_H_ + diff --git a/include/wx/palmos/frame.h b/include/wx/palmos/frame.h new file mode 100644 index 0000000000..fab8f6c8a5 --- /dev/null +++ b/include/wx/palmos/frame.h @@ -0,0 +1,169 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/frame.h +// Purpose: wxFrame class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_FRAME_H_ +#define _WX_FRAME_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "frame.h" +#endif + +class WXDLLEXPORT wxFrame : public wxFrameBase +{ +public: + // construction + wxFrame() { Init(); } + wxFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr); + + virtual ~wxFrame(); + + // implement base class pure virtuals + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual void Raise(); + + // implementation only from now on + // ------------------------------- + + // event handlers + void OnSysColourChanged(wxSysColourChangedEvent& event); + void OnPaint(wxPaintEvent& event); + + // Toolbar +#if wxUSE_TOOLBAR + virtual wxToolBar* CreateToolBar(long style = -1, + wxWindowID id = -1, + const wxString& name = wxToolBarNameStr); + + virtual void PositionToolBar(); +#endif // wxUSE_TOOLBAR + + // Status bar +#if wxUSE_STATUSBAR + virtual wxStatusBar* OnCreateStatusBar(int number = 1, + long style = wxST_SIZEGRIP, + wxWindowID id = 0, + const wxString& name = wxStatusLineNameStr); + + virtual void PositionStatusBar(); + + // Hint to tell framework which status bar to use: the default is to use + // native one for the platforms which support it (Win32), the generic one + // otherwise + + // TODO: should this go into a wxFrameworkSettings class perhaps? + static void UseNativeStatusBar(bool useNative) + { m_useNativeStatusBar = useNative; }; + static bool UsesNativeStatusBar() + { return m_useNativeStatusBar; }; +#endif // wxUSE_STATUSBAR + + WXHMENU GetWinMenu() const { return m_hMenu; } + + // event handlers + bool HandlePaint(); + bool HandleSize(int x, int y, WXUINT flag); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); + + // tooltip management +#if wxUSE_TOOLTIPS + WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } + void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } +#endif // tooltips + + // a MSW only function which sends a size event to the window using its + // current size - this has an effect of refreshing the window layout + virtual void SendSizeEvent(); + + virtual wxPoint GetClientAreaOrigin() const; + +#if wxUSE_MENUS_NATIVE + bool HandleMenuOpen(); + bool HandleMenuSelect(int ItemID); +#endif // wxUSE_MENUS_NATIVE + +protected: + // common part of all ctors + void Init(); + + // override base class virtuals + virtual void DoGetClientSize(int *width, int *height) const; + virtual void DoSetClientSize(int width, int height); + +#if wxUSE_MENUS_NATIVE + // perform MSW-specific action when menubar is changed + virtual void AttachMenuBar(wxMenuBar *menubar); + + // a plug in for MDI frame classes which need to do something special when + // the menubar is set + virtual void InternalSetMenuBar(); +#endif // wxUSE_MENUS_NATIVE + + // propagate our state change to all child frames + void IconizeChildFrames(bool bIconize); + + // we add menu bar accel processing + bool MSWTranslateMessage(WXMSG* pMsg); + + // window proc for the frames + WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + // handle WM_INITMENUPOPUP message + bool HandleInitMenuPopup(WXHMENU hMenu); + + virtual bool IsMDIChild() const { return FALSE; } + + // get default (wxWidgets) icon for the frame + virtual WXHICON GetDefaultIcon() const; + +#if wxUSE_STATUSBAR + static bool m_useNativeStatusBar; + wxStatusBar *StatusBar; +#endif // wxUSE_STATUSBAR + + // Data to save/restore when calling ShowFullScreen + int m_fsStatusBarFields; // 0 for no status bar + int m_fsStatusBarHeight; + int m_fsToolBarHeight; + +private: +#if wxUSE_TOOLTIPS + WXHWND m_hwndToolTip; +#endif // tooltips + + // used by IconizeChildFrames(), see comments there + bool m_wasMinimized; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) +}; + +#endif + // _WX_FRAME_H_ diff --git a/include/wx/palmos/gauge.h b/include/wx/palmos/gauge.h new file mode 100644 index 0000000000..5cf542c979 --- /dev/null +++ b/include/wx/palmos/gauge.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gauge.h +// Purpose: wxGauge class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _GAUGE_H_ +#define _GAUGE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "gauge95.h" +#endif + +#if wxUSE_GAUGE + +WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr; + +// Group box +class WXDLLEXPORT wxGauge : public wxGaugeBase +{ +public: + wxGauge() { } + + 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) + { + (void)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); + + // overriden base class virtuals + virtual bool SetForegroundColour(const wxColour& col); + virtual bool SetBackgroundColour(const wxColour& col); + +protected: + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + virtual wxSize DoGetBestSize() const; + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGauge) +}; + +#endif // wxUSE_GAUGE + +#endif + // _GAUGE_H_ diff --git a/include/wx/palmos/gccpriv.h b/include/wx/palmos/gccpriv.h new file mode 100644 index 0000000000..a7ec8e86a6 --- /dev/null +++ b/include/wx/palmos/gccpriv.h @@ -0,0 +1,105 @@ +/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */ +/* MinGW w32api specific stuff */ + +#ifndef _WX_MSW_GCCPRIV_H_ +#define _WX_MSW_GCCPRIV_H_ + +#if defined(__MINGW32__) && !defined(__GNUWIN32__) + #define __GNUWIN32__ +#endif + +#if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H ) + #if ( __GNUC__ > 2 ) || ( ( __GNUC__ == 2 ) && ( __GNUC_MINOR__ >= 95 ) ) + #include <_mingw.h> + #if __MINGW32_MAJOR_VERSION >= 1 + #define HAVE_W32API_H + #endif + #endif +#elif defined( __CYGWIN__ ) && !defined( HAVE_W32API_H ) + #if ( __GNUC__ > 2 ) + #define HAVE_W32API_H + #endif +#endif + +#if (defined(__WATCOMC__) && __WATCOMC__ >= 1200) + #define HAVE_W32API_H +#endif + +/* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */ +#if defined( HAVE_W32API_H ) +#include +#endif + +/* Watcom can't handle defined(xxx) here: */ +#if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION) + #define wxCHECK_W32API_VERSION( major, minor ) \ + ( ( ( __W32API_MAJOR_VERSION > (major) ) \ + || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) ) +#else + #define wxCHECK_W32API_VERSION( major, minor ) (0) +#endif + +/* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which + are more ms-like (header author is Anders Norlander, hence the name) */ +#if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95))) + #ifndef wxUSE_NORLANDER_HEADERS + #define wxUSE_NORLANDER_HEADERS 1 + #endif +#else + #ifndef wxUSE_NORLANDER_HEADERS + #define wxUSE_NORLANDER_HEADERS 0 + #endif +#endif + +/* "old" GNUWIN32 is the one without Norlander's headers: it lacks the + standard Win32 headers and we define the used stuff ourselves for it + in wx/msw/gnuwin32/extra.h */ +#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS + #define __GNUWIN32_OLD__ +#endif + +/* Cygwin 1.0 */ +#if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9)) + #define __CYGWIN10__ +#endif + +/* Mingw runtime 1.0-20010604 has some missing _tXXXX functions, + so let's define them ourselves: */ +#if defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) \ + && !wxCHECK_W32API_VERSION( 1, 1 ) + #ifndef _tsetlocale + #if wxUSE_UNICODE + #define _tsetlocale _wsetlocale + #else + #define _tsetlocale setlocale + #endif + #endif + #ifndef _tgetenv + #if wxUSE_UNICODE + #define _tgetenv _wgetenv + #else + #define _tgetenv getenv + #endif + #endif + #ifndef _tfopen + #if wxUSE_UNICODE + #define _tfopen _wfopen + #else + #define _tfopen fopen + #endif + #endif +#endif + +// current mingw32 headers forget to define _puttchar, this will probably be +// fixed in the next versions but for now do it ourselves +#if defined( __MINGW32__ ) && !defined( _puttchar ) + #ifdef wxUSE_UNICODE + #define _puttchar putwchar + #else + #define _puttchar puttchar + #endif +#endif + + +#endif + /* _WX_MSW_GCCPRIV_H_ */ diff --git a/include/wx/palmos/gdiimage.h b/include/wx/palmos/gdiimage.h new file mode 100644 index 0000000000..18e24d5c83 --- /dev/null +++ b/include/wx/palmos/gdiimage.h @@ -0,0 +1,182 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/palmos/gdiimage.h +// Purpose: wxGDIImage class: base class for wxBitmap, wxIcon, wxCursor +// under Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// NB: this is a private header, it is not intended to be directly included by +// user code (but may be included from other, public, wxWin headers + +#ifndef _WX_PALMOS_GDIIMAGE_H_ +#define _WX_PALMOS_GDIIMAGE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "gdiimage.h" +#endif + +#include "wx/gdiobj.h" // base class +#include "wx/gdicmn.h" // wxBITMAP_TYPE_INVALID +#include "wx/list.h" + +class WXDLLEXPORT wxGDIImageRefData; +class WXDLLEXPORT wxGDIImageHandler; +class WXDLLEXPORT wxGDIImage; + +WX_DECLARE_EXPORTED_LIST(wxGDIImageHandler, wxGDIImageHandlerList); + +// ---------------------------------------------------------------------------- +// wxGDIImageRefData: common data fields for all derived classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImageRefData : public wxGDIRefData +{ +public: + wxGDIImageRefData() + { + m_width = m_height = m_depth = 0; + + m_handle = 0; + } + + // accessors + bool IsOk() const { return m_handle != 0; } + + void SetSize(int w, int h) { m_width = w; m_height = h; } + + // free the ressources we allocated + virtual void Free() = 0; + + // for compatibility, the member fields are public + + // the size of the image + int m_width, m_height; + + // the depth of the image + int m_depth; + + // the handle to it + union + { + WXHANDLE m_handle; // for untyped access + WXHBITMAP m_hBitmap; + WXHICON m_hIcon; + WXHCURSOR m_hCursor; + }; +}; + +// ---------------------------------------------------------------------------- +// wxGDIImageHandler: a class which knows how to load/save wxGDIImages. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImageHandler : public wxObject +{ +public: + // ctor + wxGDIImageHandler() { m_type = wxBITMAP_TYPE_INVALID; } + wxGDIImageHandler(const wxString& name, + const wxString& ext, + long type) + : m_name(name), m_extension(ext) + { + m_type = type; + } + + // accessors + void SetName(const wxString& name) { m_name = name; } + void SetExtension(const wxString& ext) { m_extension = ext; } + void SetType(long type) { m_type = type; } + + wxString GetName() const { return m_name; } + wxString GetExtension() const { return m_extension; } + long GetType() const { return m_type; } + + // real handler operations: to implement in derived classes + virtual bool Create(wxGDIImage *image, + void *data, + long flags, + int width, int height, int depth = 1) = 0; + virtual bool Load(wxGDIImage *image, + const wxString& name, + long flags, + int desiredWidth, int desiredHeight) = 0; + virtual bool Save(wxGDIImage *image, + const wxString& name, + int type) = 0; + +protected: + wxString m_name; + wxString m_extension; + long m_type; +}; + +// ---------------------------------------------------------------------------- +// wxGDIImage: this class supports GDI image handlers which may be registered +// dynamically and will be used for loading/saving the images in the specified +// format. It also falls back to wxImage if no appropriate image is found. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIImage : public wxGDIObject +{ +public: + // handlers list interface + static wxGDIImageHandlerList& GetHandlers() { return ms_handlers; } + + static void AddHandler(wxGDIImageHandler *handler); + static void InsertHandler(wxGDIImageHandler *handler); + static bool RemoveHandler(const wxString& name); + + static wxGDIImageHandler *FindHandler(const wxString& name); + static wxGDIImageHandler *FindHandler(const wxString& extension, long type); + static wxGDIImageHandler *FindHandler(long type); + + static void InitStandardHandlers(); + static void CleanUpHandlers(); + + // access to the ref data casted to the right type + wxGDIImageRefData *GetGDIImageData() const + { return (wxGDIImageRefData *)m_refData; } + + // create data if we don't have it yet + void EnsureHasData() { if ( IsNull() ) m_refData = CreateData(); } + + // accessors + WXHANDLE GetHandle() const + { return IsNull() ? 0 : GetGDIImageData()->m_handle; } + void SetHandle(WXHANDLE handle) + { EnsureHasData(); GetGDIImageData()->m_handle = handle; } + + bool Ok() const { return GetHandle() != 0; } + + int GetWidth() const { return IsNull() ? 0 : GetGDIImageData()->m_width; } + int GetHeight() const { return IsNull() ? 0 : GetGDIImageData()->m_height; } + int GetDepth() const { return IsNull() ? 0 : GetGDIImageData()->m_depth; } + + void SetWidth(int w) { EnsureHasData(); GetGDIImageData()->m_width = w; } + void SetHeight(int h) { EnsureHasData(); GetGDIImageData()->m_height = h; } + void SetDepth(int d) { EnsureHasData(); GetGDIImageData()->m_depth = d; } + + void SetSize(int w, int h) + { + EnsureHasData(); + GetGDIImageData()->SetSize(w, h); + } + void SetSize(const wxSize& size) { SetSize(size.x, size.y); } + + // forward some of base class virtuals to wxGDIImageRefData + bool FreeResource(bool force = FALSE); + virtual WXHANDLE GetResourceHandle() const; + +protected: + // create the data for the derived class here + virtual wxGDIImageRefData *CreateData() const = 0; + + static wxGDIImageHandlerList ms_handlers; +}; + +#endif // _WX_PALMOS_GDIIMAGE_H_ diff --git a/include/wx/palmos/gdiobj.h b/include/wx/palmos/gdiobj.h new file mode 100644 index 0000000000..f53d68507b --- /dev/null +++ b/include/wx/palmos/gdiobj.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/gdiobj.h +// Purpose: wxGDIObject class: base class for other GDI classes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_GDIOBJ_H_ +#define _WX_GDIOBJ_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "gdiobj.h" +#endif + +#include "wx/object.h" // base class + +// ---------------------------------------------------------------------------- +// wxGDIRefData is the base class for wxXXXData structures which contain the +// real data for the GDI object and are shared among all wxWin objects sharing +// the same native GDI object +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIRefData : public wxObjectRefData +{ + // this class is intentionally left blank +}; + +// ---------------------------------------------------------------------------- +// wxGDIObject +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxGDIObject : public wxObject +{ +public: + wxGDIObject() { m_visible = FALSE; }; + + // Creates the resource + virtual bool RealizeResource() { return FALSE; }; + + // Frees the resource + virtual bool FreeResource(bool WXUNUSED(force) = FALSE) { return FALSE; } + + virtual bool IsFree() const { return FALSE; } + + bool IsNull() const { return (m_refData == 0); } + + // Returns handle. + virtual WXHANDLE GetResourceHandle() const { return 0; } + + virtual bool GetVisible() { return m_visible; } + virtual void SetVisible(bool v) { m_visible = v; } + +protected: + bool m_visible; // TRUE only if we should delete this object ourselves + +private: + DECLARE_DYNAMIC_CLASS(wxGDIObject) +}; + +#endif + // _WX_GDIOBJ_H_ diff --git a/include/wx/palmos/glcanvas.h b/include/wx/palmos/glcanvas.h new file mode 100644 index 0000000000..4d89567993 --- /dev/null +++ b/include/wx/palmos/glcanvas.h @@ -0,0 +1,164 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/glcanvas.h +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets under Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "glcanvas.h" +#endif + +#ifndef _WX_GLCANVAS_H_ +#define _WX_GLCANVAS_H_ + +#include "wx/palette.h" +#include "wx/scrolwin.h" + +#include +#include "wx/msw/winundef.h" + +#include + +//--------------------------------------------------------------------------- +// Constants for attriblist +//--------------------------------------------------------------------------- + +// The generic GL implementation doesn't support most of these options, +// such as stereo, auxiliary buffers, alpha channel, and accum buffer. +// Other implementations may actually support them. + +enum +{ + WX_GL_RGBA=1, /* use true color palette */ + WX_GL_BUFFER_SIZE, /* bits for buffer if not WX_GL_RGBA */ + WX_GL_LEVEL, /* 0 for main buffer, >0 for overlay, <0 for underlay */ + WX_GL_DOUBLEBUFFER, /* use doublebuffer */ + WX_GL_STEREO, /* use stereoscopic display */ + WX_GL_AUX_BUFFERS, /* number of auxiliary buffers */ + WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */ + WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */ + WX_GL_MIN_BLUE, /* use blue buffer with most bits (> MIN_BLUE bits) */ + WX_GL_MIN_ALPHA, /* use blue buffer with most bits (> MIN_ALPHA bits) */ + WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */ + WX_GL_STENCIL_SIZE, /* bits for stencil buffer */ + WX_GL_MIN_ACCUM_RED, /* use red accum buffer with most bits (> MIN_ACCUM_RED bits) */ + WX_GL_MIN_ACCUM_GREEN, /* use green buffer with most bits (> MIN_ACCUM_GREEN bits) */ + WX_GL_MIN_ACCUM_BLUE, /* use blue buffer with most bits (> MIN_ACCUM_BLUE bits) */ + WX_GL_MIN_ACCUM_ALPHA /* use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) */ +}; + +class WXDLLIMPEXP_GL wxGLCanvas; /* forward reference */ + +class WXDLLIMPEXP_GL wxGLContext: public wxObject +{ +public: + wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette); + + wxGLContext( bool isRGB, wxGLCanvas *win, + const wxPalette& WXUNUSED(palette), + const wxGLContext *other /* for sharing display lists */ ); + + ~wxGLContext(); + + + void SetCurrent(); + + void SetColour(const wxChar *colour); + + void SwapBuffers(); + + + inline wxWindow* GetWindow() const { return m_window; } + + inline WXHDC GetHDC() const { return m_hDC; } + + inline HGLRC GetGLRC() const { return m_glContext; } + +public: + HGLRC m_glContext; + WXHDC m_hDC; + wxWindow* m_window; +}; + +class WXDLLIMPEXP_GL wxGLCanvas: public wxWindow +{ + DECLARE_CLASS(wxGLCanvas) +public: + wxGLCanvas(wxWindow *parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxGLCanvasName, int *attribList = 0, + const wxPalette& palette = wxNullPalette); + + wxGLCanvas(wxWindow *parent, + const wxGLContext *shared = (wxGLContext *) NULL, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + int *attribList = (int *) NULL, + const wxPalette& palette = wxNullPalette); + + wxGLCanvas(wxWindow *parent, + const wxGLCanvas *shared = (wxGLCanvas *)NULL, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxGLCanvasName, + int *attribList = 0, + const wxPalette& palette = wxNullPalette); + + ~wxGLCanvas(); + + // Replaces wxWindow::Create functionality, since + // we need to use a different window class + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name); + + void SetCurrent(); + +#ifdef __WXUNIVERSAL__ + virtual bool SetCurrent(bool doit) { return wxWindow::SetCurrent(doit); }; +#endif + + void SetColour(const wxChar *colour); + + void SwapBuffers(); + + void OnSize(wxSizeEvent& event); + + void OnQueryNewPalette(wxQueryNewPaletteEvent& event); + + void OnPaletteChanged(wxPaletteChangedEvent& event); + + inline wxGLContext* GetContext() const { return m_glContext; } + + inline WXHDC GetHDC() const { return m_hDC; } + + void SetupPixelFormat(int *attribList = (int *) NULL); + + void SetupPalette(const wxPalette& palette); + + wxPalette CreateDefaultPalette(); + + inline wxPalette* GetPalette() const { return (wxPalette *) &m_palette; } + +protected: + wxGLContext* m_glContext; // this is typedef-ed ptr, in fact + wxPalette m_palette; + WXHDC m_hDC; + + DECLARE_EVENT_TABLE() +}; + +#endif + // _WX_GLCANVAS_H_ + diff --git a/include/wx/palmos/help.h b/include/wx/palmos/help.h new file mode 100644 index 0000000000..2aa2b0d719 --- /dev/null +++ b/include/wx/palmos/help.h @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: helpwin.h +// Purpose: Help system: WinHelp implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_HELP_H_ +#define _WX_HELP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "help.h" +#endif + +#include "wx/wx.h" + +#if wxUSE_HELP + +#include "wx/helpbase.h" + +class WXDLLEXPORT wxPalmHelpController: public wxHelpControllerBase +{ + DECLARE_CLASS(wxPalmHelpController) + +public: + wxPalmHelpController() {}; + ~wxPalmHelpController() {}; + + // Must call this to set the filename + virtual bool Initialize(const wxString& file); + virtual bool Initialize(const wxString& file, int WXUNUSED(server) ) { return Initialize( file ); } + + // If file is "", reloads file given in Initialize + virtual bool LoadFile(const wxString& file = wxEmptyString); + virtual bool DisplayContents(); + virtual bool DisplaySection(int sectionNo); + virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); } + virtual bool DisplayBlock(long blockNo); + virtual bool DisplayContextPopup(int contextId); + virtual bool KeywordSearch(const wxString& k, + wxHelpSearchMode mode = wxHELP_SEARCH_ALL); + virtual bool Quit(); + + inline wxString GetHelpFile() const { return m_helpFile; } + +protected: + // Append extension if necessary. + wxString GetValidFilename(const wxString& file) const; + +private: + wxString m_helpFile; +}; + +#endif // wxUSE_HELP +#endif +// _WX_HELP_H_ diff --git a/include/wx/palmos/icon.h b/include/wx/palmos/icon.h new file mode 100644 index 0000000000..ff5867fb71 --- /dev/null +++ b/include/wx/palmos/icon.h @@ -0,0 +1,107 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/icon.h +// Purpose: wxIcon class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_ICON_H_ +#define _WX_ICON_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "icon.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/palmos/gdiimage.h" + +// --------------------------------------------------------------------------- +// icon data +// --------------------------------------------------------------------------- + +// notice that although wxIconRefData inherits from wxBitmapRefData, it is not +// a valid wxBitmapRefData +class WXDLLEXPORT wxIconRefData : public wxGDIImageRefData +{ +public: + wxIconRefData() { } + virtual ~wxIconRefData() { Free(); } + + virtual void Free(); +}; + +// --------------------------------------------------------------------------- +// Icon +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxIcon : public wxGDIImage +{ +public: + // ctors + // default + wxIcon() { } + + // copy + wxIcon(const wxIcon& icon) { Ref(icon); } + + // from raw data + wxIcon(const char bits[], int width, int height); + + // from XPM data + wxIcon(const char **data) { CreateIconFromXpm(data); } + + wxIcon(char **data) { CreateIconFromXpm((const char **)data); } + + // from resource/file + wxIcon(const wxString& name, + long type = wxBITMAP_TYPE_ICO_RESOURCE, + int desiredWidth = -1, int desiredHeight = -1); + + wxIcon(const wxIconLocation& loc); + + virtual ~wxIcon(); + + virtual bool LoadFile(const wxString& name, + long type = wxBITMAP_TYPE_ICO_RESOURCE, + int desiredWidth = -1, int desiredHeight = -1); + + wxIcon& operator = (const wxIcon& icon) + { if ( *this != icon ) Ref(icon); return *this; } + bool operator == (const wxIcon& icon) const + { return m_refData == icon.m_refData; } + bool operator != (const wxIcon& icon) const + { return m_refData != icon.m_refData; } + + // implementation only from now on + wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; } + + void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); } + WXHICON GetHICON() const { return (WXHICON)GetHandle(); } + + // 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); + +protected: + virtual wxGDIImageRefData *CreateData() const + { + return new wxIconRefData; + } + + // create from XPM data + void CreateIconFromXpm(const char **data); + +private: + DECLARE_DYNAMIC_CLASS(wxIcon) +}; + +#endif + // _WX_ICON_H_ diff --git a/include/wx/palmos/imaglist.h b/include/wx/palmos/imaglist.h new file mode 100644 index 0000000000..fc79c029d2 --- /dev/null +++ b/include/wx/palmos/imaglist.h @@ -0,0 +1,231 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/imaglist.h +// Purpose: wxImageList class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_IMAGLIST_H_ +#define _WX_IMAGLIST_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "imaglist.h" +#endif + +#include "wx/bitmap.h" + +/* + * wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to + * images for their items by an index into an image list. + * A wxImageList is capable of creating images with optional masks from + * a variety of sources - a single bitmap plus a colour to indicate the mask, + * two bitmaps, or an icon. + * + * Image lists can also create and draw images used for drag and drop functionality. + * This is not yet implemented in wxImageList. We need to discuss a generic API + * for doing drag and drop and see whether it ties in with the Win95 view of it. + * See below for candidate functions and an explanation of how they might be + * used. + */ + +// Flags for Draw +#define wxIMAGELIST_DRAW_NORMAL 0x0001 +#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002 +#define wxIMAGELIST_DRAW_SELECTED 0x0004 +#define wxIMAGELIST_DRAW_FOCUSED 0x0008 + +// Flag values for Set/GetImageList +enum { + wxIMAGE_LIST_NORMAL, // Normal icons + wxIMAGE_LIST_SMALL, // Small icons + wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation) +}; + +// Eventually we'll make this a reference-counted wxGDIObject. For +// now, the app must take care of ownership issues. That is, the +// image lists must be explicitly deleted after the control(s) that uses them +// is (are) deleted, or when the app exits. +class WXDLLEXPORT wxImageList : public wxObject +{ +public: + /* + * Public interface + */ + + wxImageList(); + + // Creates an image list. + // Specify the width and height of the images in the list, + // whether there are masks associated with them (e.g. if creating images + // from icons), and the initial size of the list. + wxImageList(int width, int height, bool mask = TRUE, int initialCount = 1) + { + Create(width, height, mask, initialCount); + } + ~wxImageList(); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Returns the number of images in the image list. + int GetImageCount() const; + + // Returns the size (same for all images) of the images in the list + bool GetSize(int index, int &width, int &height) const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Creates an image list + // width, height specify the size of the images in the list (all the same). + // mask specifies whether the images have masks or not. + // initialNumber is the initial number of images to reserve. + bool Create(int width, int height, bool mask = TRUE, int initialNumber = 1); + + // Adds a bitmap, and optionally a mask bitmap. + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Add. + int Add(const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + + // Adds a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates *new* bitmaps, so you may delete + // 'bitmap' after calling Add. + int Add(const wxBitmap& bitmap, const wxColour& maskColour); + + // Adds a bitmap and mask from an icon. + int Add(const wxIcon& icon); + + // Replaces a bitmap, optionally passing a mask bitmap. + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap' and 'mask' after calling Replace. + bool Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask = wxNullBitmap); + +/* Not supported by Win95 + // Replacing a bitmap, using the specified colour to create the mask bitmap + // Note that wxImageList creates new bitmaps, so you may delete + // 'bitmap'. + bool Replace(int index, const wxBitmap& bitmap, const wxColour& maskColour); +*/ + + // Replaces a bitmap and mask from an icon. + // You can delete 'icon' after calling Replace. + bool Replace(int index, const wxIcon& icon); + + // Removes the image at the given index. + bool Remove(int index); + + // Remove all images + bool RemoveAll(); + + // Draws the given image on a dc at the specified position. + // If 'solidBackground' is TRUE, Draw sets the image list background + // colour to the background colour of the wxDC, to speed up + // drawing by eliminating masked drawing where possible. + bool Draw(int index, wxDC& dc, int x, int y, + int flags = wxIMAGELIST_DRAW_NORMAL, + bool solidBackground = FALSE); + + // TODO: miscellaneous functionality +/* + wxIcon *MakeIcon(int index); + bool SetOverlayImage(int index, int overlayMask); + +*/ + + // TODO: Drag-and-drop related functionality. + +#if 0 + // Creates a new drag image by combining the given image (typically a mouse cursor image) + // with the current drag image. + bool SetDragCursorImage(int index, const wxPoint& hotSpot); + + // If successful, returns a pointer to the temporary image list that is used for dragging; + // otherwise, NULL. + // dragPos: receives the current drag position. + // hotSpot: receives the offset of the drag image relative to the drag position. + static wxImageList *GetDragImageList(wxPoint& dragPos, wxPoint& hotSpot); + + // Call this function to begin dragging an image. This function creates a temporary image list + // that is used for dragging. The image combines the specified image and its mask with the + // current cursor. In response to subsequent mouse move messages, you can move the drag image + // by using the DragMove member function. To end the drag operation, you can use the EndDrag + // member function. + bool BeginDrag(int index, const wxPoint& hotSpot); + + // Ends a drag operation. + bool EndDrag(); + + // Call this function to move the image that is being dragged during a drag-and-drop operation. + // This function is typically called in response to a mouse move message. To begin a drag + // operation, use the BeginDrag member function. + static bool DragMove(const wxPoint& point); + + // During a drag operation, locks updates to the window specified by lockWindow and displays + // the drag image at the position specified by point. + // The coordinates are relative to the window's upper left corner, so you must compensate + // for the widths of window elements, such as the border, title bar, and menu bar, when + // specifying the coordinates. + // If lockWindow is NULL, this function draws the image in the display context associated + // with the desktop window, and coordinates are relative to the upper left corner of the screen. + // This function locks all other updates to the given window during the drag operation. + // If you need to do any drawing during a drag operation, such as highlighting the target + // of a drag-and-drop operation, you can temporarily hide the dragged image by using the + // wxImageList::DragLeave function. + + // lockWindow: pointer to the window that owns the drag image. + // point: position at which to display the drag image. Coordinates are relative to the + // upper left corner of the window (not the client area). + + static bool DragEnter( wxWindow *lockWindow, const wxPoint& point ); + + // Unlocks the window specified by pWndLock and hides the drag image, allowing the + // window to be updated. + static bool DragLeave( wxWindow *lockWindow ); + + /* Here's roughly how you'd use these functions if implemented in this Win95-like way: + + 1) Starting to drag: + + wxImageList *dragImageList = new wxImageList(16, 16, TRUE); + dragImageList->Add(myDragImage); // Provide an image to combine with the current cursor + dragImageList->BeginDrag(0, wxPoint(0, 0)); + wxShowCursor(FALSE); // wxShowCursor not yet implemented in wxWin + myWindow->CaptureMouse(); + + 2) Dragging: + + // Called within mouse move event. Could also use dragImageList instead of assuming + // these are static functions. + // These two functions could possibly be combined into one, since DragEnter is + // a bit obscure. + wxImageList::DragMove(wxPoint(x, y)); // x, y are current cursor position + wxImageList::DragEnter(NULL, wxPoint(x, y)); // NULL assumes dragging across whole screen + + 3) Finishing dragging: + + dragImageList->EndDrag(); + myWindow->ReleaseMouse(); + wxShowCursor(TRUE); +*/ + +#endif + + // Implementation + //////////////////////////////////////////////////////////////////////////// + + // Returns the native image list handle + WXHIMAGELIST GetHIMAGELIST() const { return m_hImageList; } + +protected: + WXHIMAGELIST m_hImageList; + + DECLARE_DYNAMIC_CLASS(wxImageList) +}; + +#endif + // _WX_IMAGLIST_H_ diff --git a/include/wx/palmos/iniconf.h b/include/wx/palmos/iniconf.h new file mode 100644 index 0000000000..acc36af1fc --- /dev/null +++ b/include/wx/palmos/iniconf.h @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: include/wx/palmos/iniconf.h +// Purpose: INI-file based wxConfigBase implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _INICONF_H +#define _INICONF_H + +// ---------------------------------------------------------------------------- +// wxIniConfig is a wxConfig implementation which uses MS Windows INI files to +// store the data. Because INI files don't really support arbitrary nesting of +// groups, we do the following: +// (1) in win.ini file we store all entries in the [vendor] section and +// the value group1/group2/key is mapped to the value group1_group2_key +// in this section, i.e. all path separators are replaced with underscore +// (2) in appname.ini file we map group1/group2/group3/key to the entry +// group2_group3_key in [group1] +// +// Of course, it might lead to indesirable results if '_' is also used in key +// names (i.e. group/key is the same as group_key) and also GetPath() result +// may be not what you would expect it to be. +// +// Another limitation: the keys and section names are never case-sensitive +// which might differ from wxFileConfig it it was compiled with +// wxCONFIG_CASE_SENSITIVE option. +// ---------------------------------------------------------------------------- + +// for this class, "local" file is the file appname.ini and the global file +// is the [vendor] subsection of win.ini (default for "vendor" is to be the +// same as appname). The file name (strAppName parameter) may, in fact, +// contain the full path to the file. If it doesn't, the file is searched for +// in the Windows directory. +class WXDLLEXPORT wxIniConfig : public wxConfigBase +{ +public: + // ctor & dtor + // if strAppName doesn't contain the extension and is not an absolute path, + // ".ini" is appended to it. if strVendor is empty, it's taken to be the + // same as strAppName. + wxIniConfig(const wxString& strAppName = wxEmptyString, const wxString& strVendor = wxEmptyString, + const wxString& localFilename = wxEmptyString, const wxString& globalFilename = wxEmptyString, long style = wxCONFIG_USE_LOCAL_FILE); + virtual ~wxIniConfig(); + + // implement inherited pure virtual functions + virtual void SetPath(const wxString& strPath); + virtual const wxString& GetPath() const; + + virtual bool GetFirstGroup(wxString& str, long& lIndex) const; + virtual bool GetNextGroup (wxString& str, long& lIndex) const; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const; + virtual bool GetNextEntry (wxString& str, long& lIndex) const; + + virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const; + virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const; + + virtual bool HasGroup(const wxString& strName) const; + virtual bool HasEntry(const wxString& strName) const; + + // return TRUE if the current group is empty + bool IsEmpty() const; + + virtual bool Flush(bool bCurrentOnly = FALSE); + + virtual bool RenameEntry(const wxString& oldName, const wxString& newName); + virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + + virtual bool DeleteEntry(const wxString& Key, bool bGroupIfEmptyAlso = TRUE); + virtual bool DeleteGroup(const wxString& szKey); + virtual bool DeleteAll(); + +protected: + // read/write + bool DoReadString(const wxString& key, wxString *pStr) const; + bool DoReadLong(const wxString& key, long *plResult) const; + + bool DoWriteString(const wxString& key, const wxString& szValue); + bool DoWriteLong(const wxString& key, long lValue); + +private: + // helpers + wxString GetPrivateKeyName(const wxString& szKey) const; + wxString GetKeyName(const wxString& szKey) const; + + wxString m_strLocalFilename; // name of the private INI file + wxString m_strGroup, // current group in appname.ini file + m_strPath; // the rest of the path (no trailing '_'!) +}; + +#endif //_INICONF_H diff --git a/include/wx/palmos/joystick.h b/include/wx/palmos/joystick.h new file mode 100644 index 0000000000..2f30f3fb66 --- /dev/null +++ b/include/wx/palmos/joystick.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.h +// Purpose: wxJoystick class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_JOYSTICK_H_ +#define _WX_JOYSTICK_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "joystick.h" +#endif + +#include "wx/event.h" + +class WXDLLIMPEXP_ADV wxJoystick: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxJoystick) + public: + /* + * Public interface + */ + + wxJoystick(int joystick = wxJOYSTICK1); + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + wxPoint GetPosition(void) const; + int GetZPosition(void) const; + int GetButtonState(void) const; + int GetPOVPosition(void) const; + int GetPOVCTSPosition(void) const; + int GetRudderPosition(void) const; + int GetUPosition(void) const; + int GetVPosition(void) const; + int GetMovementThreshold(void) const; + void SetMovementThreshold(int threshold) ; + + // Capabilities + //////////////////////////////////////////////////////////////////////////// + + static int GetNumberJoysticks(void); + + bool IsOk(void) const; // Checks that the joystick is functioning + int GetManufacturerId(void) const ; + int GetProductId(void) const ; + wxString GetProductName(void) const ; + int GetXMin(void) const; + int GetYMin(void) const; + int GetZMin(void) const; + int GetXMax(void) const; + int GetYMax(void) const; + int GetZMax(void) const; + int GetNumberButtons(void) const; + int GetNumberAxes(void) const; + int GetMaxButtons(void) const; + int GetMaxAxes(void) const; + int GetPollingMin(void) const; + int GetPollingMax(void) const; + int GetRudderMin(void) const; + int GetRudderMax(void) const; + int GetUMin(void) const; + int GetUMax(void) const; + int GetVMin(void) const; + int GetVMax(void) const; + + bool HasRudder(void) const; + bool HasZ(void) const; + bool HasU(void) const; + bool HasV(void) const; + bool HasPOV(void) const; + bool HasPOV4Dir(void) const; + bool HasPOVCTS(void) const; + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // pollingFreq = 0 means that movement events are sent when above the threshold. + // If pollingFreq > 0, events are received every this many milliseconds. + bool SetCapture(wxWindow* win, int pollingFreq = 0); + bool ReleaseCapture(void); + +protected: + int m_joystick; +}; + +#endif + // _WX_JOYSTICK_H_ diff --git a/include/wx/palmos/listbox.h b/include/wx/palmos/listbox.h new file mode 100644 index 0000000000..52c3a51fb5 --- /dev/null +++ b/include/wx/palmos/listbox.h @@ -0,0 +1,166 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/listbox.h +// Purpose: wxListBox class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTBOX_H_ +#define _WX_LISTBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "listbox.h" +#endif + +#if wxUSE_LISTBOX + +// ---------------------------------------------------------------------------- +// simple types +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + class WXDLLEXPORT wxOwnerDrawn; + + // define the array of list box items + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray); +#endif // wxUSE_OWNER_DRAWN + +// forward decl for GetSelections() +class wxArrayInt; + +// ---------------------------------------------------------------------------- +// List box control +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxListBox : public wxListBoxBase +{ +public: + // ctors and such + wxListBox(); + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, n, choices, style, validator, name); + } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + + virtual ~wxListBox(); + + // implement base class pure virtuals + virtual void Clear(); + virtual void Delete(int n); + + virtual int GetCount() const; + virtual wxString GetString(int n) const; + virtual void SetString(int n, const wxString& s); + virtual int FindString(const wxString& s) const; + + virtual bool IsSelected(int n) const; + virtual void SetSelection(int n, bool select = TRUE); + virtual int GetSelection() const; + virtual int GetSelections(wxArrayInt& aSelections) const; + + virtual int DoAppend(const wxString& item); + virtual void DoInsertItems(const wxArrayString& items, int pos); + virtual void DoSetItems(const wxArrayString& items, void **clientData); + + virtual void DoSetFirstItem(int n); + + virtual void DoSetItemClientData(int n, void* clientData); + virtual void* DoGetItemClientData(int n) const; + virtual void DoSetItemClientObject(int n, wxClientData* clientData); + virtual wxClientData* DoGetItemClientObject(int n) const; + + // wxCheckListBox support +#if wxUSE_OWNER_DRAWN + bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item); + bool MSWOnDraw(WXDRAWITEMSTRUCT *item); + + // plug-in for derived classes + virtual wxOwnerDrawn *CreateLboxItem(size_t n); + + // allows to get the item and use SetXXX functions to set it's appearance + wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; } + + // get the index of the given item + int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); } +#endif // wxUSE_OWNER_DRAWN + + // Windows-specific code to set the horizontal extent of the listbox, if + // necessary. If s is non-NULL, it's used to calculate the horizontal + // extent. Otherwise, all strings are used. + virtual void SetHorizontalExtent(const wxString& s = wxEmptyString); + + // Windows callbacks + bool MSWCommand(WXUINT param, WXWORD id); + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL) + { + return GetCompositeControlsDefaultAttributes(variant); + } + +protected: + WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // free memory (common part of Clear() and dtor) + void Free(); + + int m_noItems; + int m_selected; + + virtual wxSize DoGetBestSize() const; + +#if wxUSE_OWNER_DRAWN + // control items + wxListBoxItemsArray m_aItems; +#endif + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox) +}; + +#endif // wxUSE_LISTBOX + +#endif + // _WX_LISTBOX_H_ diff --git a/include/wx/palmos/listctrl.h b/include/wx/palmos/listctrl.h new file mode 100644 index 0000000000..50168fb9b0 --- /dev/null +++ b/include/wx/palmos/listctrl.h @@ -0,0 +1,423 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/listctrl.h +// Purpose: wxListCtrl class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LISTCTRL_H_ +#define _WX_LISTCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "listctrl.h" +#endif + +#if wxUSE_LISTCTRL + +#include "wx/control.h" +#include "wx/event.h" +#include "wx/hash.h" +#include "wx/textctrl.h" + + +class WXDLLEXPORT wxImageList; + +/* + The wxListCtrl can show lists of items in four different modes: + wxLC_LIST: multicolumn list view, with optional small icons (icons could be + optional for some platforms). Columns are computed automatically, + i.e. you don't set columns as in wxLC_REPORT. In other words, + the list wraps, unlike a wxListBox. + wxLC_REPORT: single or multicolumn report view (with optional header) + wxLC_ICON: large icon view, with optional labels + wxLC_SMALL_ICON: small icon view, with optional labels + + You can change the style dynamically, either with SetSingleStyle or + SetWindowStyleFlag. + + Further window styles: + + wxLC_ALIGN_TOP icons align to the top (default) + wxLC_ALIGN_LEFT icons align to the left + wxLC_AUTOARRANGE icons arrange themselves + wxLC_USER_TEXT the app provides label text on demand, except for column headers + wxLC_EDIT_LABELS labels are editable: app will be notified. + wxLC_NO_HEADER no header in report mode + wxLC_NO_SORT_HEADER can't click on header + wxLC_SINGLE_SEL single selection + wxLC_SORT_ASCENDING sort ascending (must still supply a comparison callback in SortItems) + wxLC_SORT_DESCENDING sort descending (ditto) + + Items are referred to by their index (position in the list starting from zero). + + Label text is supplied via insertion/setting functions and is stored by the + control, unless the wxLC_USER_TEXT style has been specified, in which case + the app will be notified when text is required (see sample). + + Images are dealt with by (optionally) associating 3 image lists with the control. + Zero-based indexes into these image lists indicate which image is to be used for + which item. Each image in an image list can contain a mask, and can be made out + of either a bitmap, two bitmaps or an icon. See ImagList.h for more details. + + Notifications are passed via the wxWidgets 2.0 event system, or using virtual + functions in wxWidgets 1.66. + + See the sample wxListCtrl app for API usage. + + TODO: + - addition of further convenience functions + to avoid use of wxListItem in some functions + - state/overlay images: probably not needed. + - in Win95, you can be called back to supply other information + besides text, such as state information. This saves no memory + and is probably superfluous to requirements. + - testing of whole API, extending current sample. + + + */ + +class WXDLLEXPORT wxListCtrl: public wxControl +{ +public: + /* + * Public interface + */ + + wxListCtrl() { Init(); } + + wxListCtrl(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = _T("wxListCtrl")) + { + Init(); + + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxListCtrl(); + + bool Create(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxLC_ICON, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = _T("wxListCtrl")); + + + // Attributes + //////////////////////////////////////////////////////////////////////////// + + // Set the control colours + bool SetForegroundColour(const wxColour& col); + bool SetBackgroundColour(const wxColour& col); + + // Gets information about this column + bool GetColumn(int col, wxListItem& item) const; + + // Sets information about this column + bool SetColumn(int col, wxListItem& item) ; + + // Gets the column width + int GetColumnWidth(int col) const; + + // Sets the column width + bool SetColumnWidth(int col, int width) ; + + // Gets the number of items that can fit vertically in the + // visible area of the list control (list or report view) + // or the total number of items in the list control (icon + // or small icon view) + int GetCountPerPage() const; + + // return the total area occupied by all the items (icon/small icon only) + wxRect GetViewRect() const; + + // Gets the edit control for editing labels. + wxTextCtrl* GetEditControl() const; + + // Gets information about the item + bool GetItem(wxListItem& info) const ; + + // Sets information about the item + bool SetItem(wxListItem& info) ; + + // Sets a string field at a particular column + long SetItem(long index, int col, const wxString& label, int imageId = -1); + + // Gets the item state + int GetItemState(long item, long stateMask) const ; + + // Sets the item state + bool SetItemState(long item, long state, long stateMask) ; + + // Sets the item image + bool SetItemImage(long item, int image, int selImage) ; + + // Gets the item text + wxString GetItemText(long item) const ; + + // Sets the item text + void SetItemText(long item, const wxString& str) ; + + // Gets the item data + long GetItemData(long item) const ; + + // Sets the item data + bool SetItemData(long item, long data) ; + + // Gets the item rectangle + bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ; + + // Gets the item position + bool GetItemPosition(long item, wxPoint& pos) const ; + + // Sets the item position + bool SetItemPosition(long item, const wxPoint& pos) ; + + // Gets the number of items in the list control + int GetItemCount() const; + + // Gets the number of columns in the list control + int GetColumnCount() const { return m_colCount; } + + // get the horizontal and vertical components of the item spacing + wxSize GetItemSpacing() const; + + // Foreground colour of an item. + void SetItemTextColour( long item, const wxColour& col); + wxColour GetItemTextColour( long item ) const; + + // Background colour of an item. + void SetItemBackgroundColour( long item, const wxColour &col); + wxColour GetItemBackgroundColour( long item ) const; + + // Gets the number of selected items in the list control + int GetSelectedItemCount() const; + + // Gets the text colour of the listview + wxColour GetTextColour() const; + + // Sets the text colour of the listview + void SetTextColour(const wxColour& col); + + // Gets the index of the topmost visible item when in + // list or report view + long GetTopItem() const ; + + // Add or remove a single window style + void SetSingleStyle(long style, bool add = TRUE) ; + + // Set the whole window style + void SetWindowStyleFlag(long style) ; + + // Searches for an item, starting from 'item'. + // item can be -1 to find the first item that matches the + // specified flags. + // Returns the item or -1 if unsuccessful. + long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const ; + + // 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) ; + void AssignImageList(wxImageList *imageList, int which) ; + + // are we in report mode? + bool InReportView() const { return HasFlag(wxLC_REPORT); } + + // are we in virtual report mode? + bool IsVirtual() const { return HasFlag(wxLC_VIRTUAL); } + + // refresh items selectively (only useful for virtual list controls) + void RefreshItem(long item); + void RefreshItems(long itemFrom, long itemTo); + + // Operations + //////////////////////////////////////////////////////////////////////////// + + // Arranges the items + bool Arrange(int flag = wxLIST_ALIGN_DEFAULT); + + // Deletes an item + bool DeleteItem(long item); + + // Deletes all items + bool DeleteAllItems() ; + + // Deletes a column + bool DeleteColumn(int col); + + // Deletes all columns + bool DeleteAllColumns(); + + // Clears items, and columns if there are any. + void ClearAll(); + + // Edit the label + wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl)); + + // End label editing, optionally cancelling the edit + bool EndEditLabel(bool cancel); + + // Ensures this item is visible + bool EnsureVisible(long item) ; + + // Find an item whose label matches this string, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, const wxString& str, bool partial = FALSE); + + // Find an item whose data matches this data, starting from the item after 'start' + // or the beginning if 'start' is -1. + long FindItem(long start, long data); + + // Find an item nearest this position in the specified direction, starting from + // the item after 'start' or the beginning if 'start' is -1. + long FindItem(long start, const wxPoint& pt, int direction); + + // Determines which item (if any) is at the specified point, + // giving details in 'flags' (see wxLIST_HITTEST_... flags above) + long HitTest(const wxPoint& point, int& flags); + + // Inserts an item, returning the index of the new item if successful, + // -1 otherwise. + 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); + + // set the number of items in a virtual list control + void SetItemCount(long count); + + // 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); + + // IMPLEMENTATION + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // bring the control in sync with current m_windowStyle value + void UpdateStyle(); + + // Event handlers + //////////////////////////////////////////////////////////////////////////// + // Necessary for drawing hrules and vrules, if specified + void OnPaint(wxPaintEvent& event); + + + virtual bool ShouldInheritColours() const { return false; } + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + + // obsolete stuff, for compatibility only -- don't use + wxDEPRECATED( int GetItemSpacing(bool isSmall) const); + +protected: + // common part of all ctors + void Init(); + + // free memory taken by all internal data + void FreeAllInternalData(); + + // convert our styles to Windows + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + + 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) + bool m_ownsImageListNormal, + m_ownsImageListSmall, + m_ownsImageListState; + + int m_colCount; // Windows doesn't have GetColumnCount so must + // keep track of inserted/deleted columns + long m_count; // Keep track of item count to save calls to + // ListView_GetItemCount + bool m_ignoreChangeMessages; + + // TRUE if we have any internal data (user data & attributes) + bool m_AnyInternalData; + + // TRUE if we have any items with custom attributes + bool m_hasAnyAttr; + + // these functions are only used for virtual list view controls, i.e. the + // ones with wxLC_VIRTUAL style + + // 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 + virtual int OnGetItemImage(long item) const; + + // return the attribute for the item (may return NULL if none) + virtual wxListItemAttr *OnGetItemAttr(long item) const; + +private: + // process NM_CUSTOMDRAW notification message + WXLPARAM OnCustomDraw(WXLPARAM lParam); + + DECLARE_DYNAMIC_CLASS(wxListCtrl) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxListCtrl) +}; + +#endif // wxUSE_LISTCTRL + +#endif // _WX_LISTCTRL_H_ + diff --git a/include/wx/palmos/mdi.h b/include/wx/palmos/mdi.h new file mode 100644 index 0000000000..425e51e39c --- /dev/null +++ b/include/wx/palmos/mdi.h @@ -0,0 +1,231 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/mdi.h +// Purpose: MDI (Multiple Document Interface) classes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MDI_H_ +#define _WX_MDI_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "mdi.h" +#endif + +#include "wx/frame.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr; +WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr; + +class WXDLLEXPORT wxMDIClientWindow; +class WXDLLEXPORT wxMDIChildFrame; + +// --------------------------------------------------------------------------- +// wxMDIParentFrame +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIParentFrame : public wxFrame +{ +public: + wxMDIParentFrame(); + wxMDIParentFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + + ~wxMDIParentFrame(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, + const wxString& name = wxFrameNameStr); + + // accessors + // --------- + + // Get the active MDI child window (Windows only) + wxMDIChildFrame *GetActiveChild() const; + + // Get the client window + wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } + + // Create the client window class (don't Create the window, + // just return a new class) + virtual wxMDIClientWindow *OnCreateClient(void); + + // MDI windows menu + wxMenu* GetWindowMenu() const { return m_windowMenu; }; + void SetWindowMenu(wxMenu* menu) ; + + // MDI operations + // -------------- + virtual void Cascade(); + virtual void Tile(); + virtual void ArrangeIcons(); + virtual void ActivateNext(); + virtual void ActivatePrevious(); + + // handlers + // -------- + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void OnSize(wxSizeEvent& event); + + bool HandleActivate(int state, bool minimized, WXHWND activate); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + // override window proc for MDI-specific message processing + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual WXLRESULT MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM); + virtual bool MSWTranslateMessage(WXMSG* msg); + +protected: +#if wxUSE_MENUS_NATIVE + virtual void InternalSetMenuBar(); +#endif // wxUSE_MENUS_NATIVE + + virtual WXHICON GetDefaultIcon() const; + + wxMDIClientWindow * m_clientWindow; + wxMDIChildFrame * m_currentChild; + wxMenu* m_windowMenu; + + // TRUE if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; + +private: + friend class WXDLLEXPORT wxMDIChildFrame; + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) + DECLARE_NO_COPY_CLASS(wxMDIParentFrame) +}; + +// --------------------------------------------------------------------------- +// wxMDIChildFrame +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIChildFrame : public wxFrame +{ +public: + wxMDIChildFrame() { Init(); } + wxMDIChildFrame(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE, + const wxString& name = wxFrameNameStr) + { + Init(); + + Create(parent, id, title, pos, size, style, name); + } + + ~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); + + virtual bool IsTopLevel() const { return FALSE; } + + // MDI operations + virtual void Maximize(bool maximize = TRUE); + virtual void Restore(); + virtual void Activate(); + + // Implementation only from now on + // ------------------------------- + + // Handlers + bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); + bool HandleWindowPosChanging(void *lpPos); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + bool HandleGetMinMaxInfo(void *mmInfo); + + virtual WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWTranslateMessage(WXMSG *msg); + + virtual void MSWDestroyWindow(); + + bool ResetWindowStyle(void *vrect); + + void OnIdle(wxIdleEvent& event); + +protected: + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoSetClientSize(int width, int height); + virtual void InternalSetMenuBar(); + virtual bool IsMDIChild() const { return TRUE; } + + virtual WXHICON GetDefaultIcon() const; + + // common part of all ctors + void Init(); + +private: + bool m_needsResize; // flag which tells us to artificially resize the frame + + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIChildFrame) +}; + +// --------------------------------------------------------------------------- +// wxMDIClientWindow +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxMDIClientWindow : public wxWindow +{ +public: + wxMDIClientWindow() { Init(); } + wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + Init(); + + CreateClient(parent, style); + } + + // 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); + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); +protected: + void Init() { m_scrollX = m_scrollY = 0; } + + int m_scrollX, m_scrollY; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMDIClientWindow) +}; + +#endif + // _WX_MDI_H_ diff --git a/include/wx/palmos/menu.h b/include/wx/palmos/menu.h new file mode 100644 index 0000000000..94f424000d --- /dev/null +++ b/include/wx/palmos/menu.h @@ -0,0 +1,240 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/menu.h +// Purpose: wxMenu, wxMenuBar classes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MENU_H_ +#define _WX_MENU_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "menu.h" +#endif + +#if wxUSE_ACCEL + #include "wx/accel.h" + #include "wx/dynarray.h" + + WX_DEFINE_EXPORTED_ARRAY_PTR(wxAcceleratorEntry *, wxAcceleratorArray); +#endif // wxUSE_ACCEL + +class WXDLLEXPORT wxFrame; + +#if defined(__WXWINCE__) && wxUSE_TOOLBAR +class WXDLLEXPORT wxToolBar; +#endif + +#include "wx/arrstr.h" + +// ---------------------------------------------------------------------------- +// Menu +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenu : public wxMenuBase +{ +public: + // ctors & dtor + wxMenu(const wxString& title, long style = 0) + : wxMenuBase(title, style) { Init(); } + + wxMenu(long style = 0) : wxMenuBase(style) { Init(); } + + virtual ~wxMenu(); + + // implement base class virtuals + virtual wxMenuItem* DoAppend(wxMenuItem *item); + virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item); + virtual wxMenuItem* DoRemove(wxMenuItem *item); + + virtual void Break(); + + virtual void SetTitle(const wxString& title); + + // deprecated functions +#if wxUSE_MENU_CALLBACK + wxMenu(const wxString& title, const wxFunction func) + : wxMenuBase(title) + { + Init(); + + Callback(func); + } +#endif // wxUSE_MENU_CALLBACK + + // implementation only from now on + // ------------------------------- + + virtual void Attach(wxMenuBarBase *menubar); + + bool PalmCommand(WXUINT param, WXWORD id); + + // semi-private accessors + // get the window which contains this menu + wxWindow *GetWindow() const; + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + +#if wxUSE_ACCEL + // called by wxMenuBar to build its accel table from the accels of all menus + bool HasAccels() const { return !m_accels.IsEmpty(); } + size_t GetAccelCount() const { return m_accels.GetCount(); } + size_t CopyAccels(wxAcceleratorEntry *accels) const; + + // called by wxMenuItem when its accels changes + void UpdateAccel(wxMenuItem *item); + + // helper used by wxMenu itself (returns the index in m_accels) + int FindAccel(int id) const; +#endif // wxUSE_ACCEL + +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 break 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; + +#if wxUSE_ACCEL + // the accelerators for our menu items + wxAcceleratorArray m_accels; +#endif // wxUSE_ACCEL + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenu) +}; + +// ---------------------------------------------------------------------------- +// Menu Bar (a la Windows) +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuInfo : public wxObject +{ +public : + wxMenuInfo() { m_menu = NULL ; } + virtual ~wxMenuInfo() { } + + void Create( wxMenu *menu , const wxString &title ) + { m_menu = menu ; m_title = title ; } + wxMenu* GetMenu() const { return m_menu ; } + wxString GetTitle() const { return m_title ; } +private : + wxMenu *m_menu ; + wxString m_title ; + + DECLARE_DYNAMIC_CLASS(wxMenuInfo) ; +} ; + +WX_DECLARE_EXPORTED_LIST(wxMenuInfo, wxMenuInfoList ); + +class WXDLLEXPORT wxMenuBar : public wxMenuBarBase +{ +public: + // ctors & dtor + // default constructor + wxMenuBar(); + + wxMenuBar(long style); + // menubar takes ownership of the menus arrays but copies the titles + wxMenuBar(int n, wxMenu *menus[], const wxString titles[]); + virtual ~wxMenuBar(); + + // menubar construction + bool Append( wxMenuInfo *info ) { return Append( info->GetMenu() , info->GetTitle() ) ; } + const wxMenuInfoList& GetMenuInfos() const ; + + 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 void EnableTop( size_t pos, bool flag ); + virtual void SetLabelTop( size_t pos, const wxString& label ); + virtual wxString GetLabelTop( size_t pos ) const; + + // implementation from now on + WXHMENU Create(); + virtual void Detach(); + virtual void Attach(wxFrame *frame); + + void LoadMenu(); + int ProcessCommand(int ItemID); + +#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) + // Under WinCE, a menubar is owned by the frame's toolbar + void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; } + wxToolBar* GetToolBar() const { return m_toolBar; } +#endif + +#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) + WXHWND GetCommandBar() const { return m_commandBar; } + bool AddAdornments(long style); +#endif + +#if wxUSE_ACCEL + // get the accel table for all the menus + const wxAcceleratorTable& GetAccelTable() const { return m_accelTable; } + + // update the accel table (must be called after adding/deletign a menu) + void RebuildAccelTable(); +#endif // wxUSE_ACCEL + + // get the menu handle + WXHMENU GetHMenu() const { return m_hMenu; } + + // if the menubar is modified, the display is not updated automatically, + // call this function to update it (m_menuBarFrame should be !NULL) + void Refresh(); + + // To avoid compile warning + void Refresh( bool eraseBackground, + const wxRect *rect = (const wxRect *) NULL ) { wxWindow::Refresh(eraseBackground, rect); } + +protected: + // common part of all ctors + void Init(); + + wxArrayString m_titles ; + wxMenuInfoList m_menuInfos; + + WXHMENU m_hMenu; + + // Return the Palm position for a wxMenu which is sometimes different from + // the wxWidgets position. + int PalmPositionForWxMenu(wxMenu *menu, int wxpos); +#if wxUSE_ACCEL + // the accelerator table for all accelerators in all our menus + wxAcceleratorTable m_accelTable; +#endif // wxUSE_ACCEL + +#if defined(__WXWINCE__) && wxUSE_TOOLBAR + wxToolBar* m_toolBar; +#endif + // Not using a combined wxToolBar/wxMenuBar? then use + // a commandbar in WinCE .NET to implement the + // menubar, since there is no ::SetMenu function. +#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) + WXHWND m_commandBar; + bool m_adornmentsAdded; +#endif + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuBar) +}; + +#endif // _WX_MENU_H_ diff --git a/include/wx/palmos/menuitem.h b/include/wx/palmos/menuitem.h new file mode 100644 index 0000000000..fcf4d9b3f9 --- /dev/null +++ b/include/wx/palmos/menuitem.h @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: menuitem.h +// Purpose: wxMenuItem class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MENUITEM_H +#define _MENUITEM_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "menuitem.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + #include "wx/ownerdrw.h" // base class +#endif + +// ---------------------------------------------------------------------------- +// wxMenuItem: an item in the menu, optionally implements owner-drawn behaviour +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMenuItem : public wxMenuItemBase +#if wxUSE_OWNER_DRAWN + , public wxOwnerDrawn +#endif +{ +public: + // ctor & dtor + wxMenuItem(wxMenu *parentMenu = (wxMenu *)NULL, + int id = wxID_SEPARATOR, + const wxString& name = wxEmptyString, + const wxString& help = wxEmptyString, + wxItemKind kind = wxITEM_NORMAL, + wxMenu *subMenu = (wxMenu *)NULL); + virtual ~wxMenuItem(); + + // override base class virtuals + virtual void SetText(const wxString& strName); + virtual void SetCheckable(bool checkable); + + virtual void Enable(bool bDoEnable = TRUE); + virtual void Check(bool bDoCheck = TRUE); + virtual bool IsChecked() const; + + // unfortunately needed to resolve ambiguity between + // wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable() + bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); } + + // the id for a popup menu is really its menu handle (as required by + // ::AppendMenu() API), so this function will return either the id or the + // menu handle depending on what we're + int GetRealId() const; + + // mark item as belonging to the given radio group + void SetAsRadioGroupStart(); + void SetRadioGroupStart(int start); + void SetRadioGroupEnd(int end); + + // compatibility only, don't use in new code + wxMenuItem(wxMenu *parentMenu, + int id, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu = (wxMenu *)NULL); + +private: + // common part of all ctors + void Init(); + + // 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; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMenuItem) +}; + +#endif //_MENUITEM_H diff --git a/include/wx/palmos/metafile.h b/include/wx/palmos/metafile.h new file mode 100644 index 0000000000..f6fd527065 --- /dev/null +++ b/include/wx/palmos/metafile.h @@ -0,0 +1,174 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/metafile.h +// Purpose: wxMetaFile, wxMetaFileDC and wxMetaFileDataObject classes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_METAFIILE_H_ +#define _WX_METAFIILE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "metafile.h" +#endif + +#include "wx/setup.h" + +#if wxUSE_METAFILE + +#include "wx/dc.h" +#include "wx/gdiobj.h" + +#if wxUSE_DRAG_AND_DROP + #include "wx/dataobj.h" +#endif + +// ---------------------------------------------------------------------------- +// Metafile and metafile device context classes +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxMetafile; + +class WXDLLEXPORT wxMetafileRefData: public wxGDIRefData +{ + friend class WXDLLEXPORT wxMetafile; +public: + wxMetafileRefData(); + ~wxMetafileRefData(); + +public: + WXHANDLE m_metafile; + int m_windowsMappingMode; + int m_width, m_height; +}; + +#define M_METAFILEDATA ((wxMetafileRefData *)m_refData) + +class WXDLLEXPORT wxMetafile: public wxGDIObject +{ +public: + wxMetafile(const wxString& file = wxEmptyString); + wxMetafile(const wxMetafile& metafile) { Ref(metafile); } + virtual ~wxMetafile(); + + // 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); + bool Ok() const { return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != 0)); }; + + // set/get the size of metafile for clipboard operations + wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); } + int GetWidth() const { return M_METAFILEDATA->m_width; } + int GetHeight() const { return M_METAFILEDATA->m_height; } + + void SetWidth(int width) { M_METAFILEDATA->m_width = width; } + void SetHeight(int height) { M_METAFILEDATA->m_height = height; } + + // Implementation + WXHANDLE GetHMETAFILE() const { return M_METAFILEDATA->m_metafile; } + void SetHMETAFILE(WXHANDLE mf) ; + int GetWindowsMappingMode() const { return M_METAFILEDATA->m_windowsMappingMode; } + void SetWindowsMappingMode(int mm); + + // Operators + wxMetafile& operator=(const wxMetafile& metafile) + { if (*this != metafile) Ref(metafile); return *this; } + bool operator==(const wxMetafile& metafile) const + { return m_refData == metafile.m_refData; } + bool operator!=(const wxMetafile& metafile) const + { return m_refData != metafile.m_refData; } + +private: + DECLARE_DYNAMIC_CLASS(wxMetafile) +}; + +class WXDLLEXPORT wxMetafileDC: public wxDC +{ +public: + // Don't supply origin and extent + // Supply them to wxMakeMetaFilePlaceable instead. + wxMetafileDC(const wxString& file = wxEmptyString); + + // Supply origin and extent (recommended). + // Then don't need to supply them to wxMakeMetaFilePlaceable. + wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg); + + virtual ~wxMetafileDC(); + + // Should be called at end of drawing + virtual wxMetafile *Close(); + virtual void SetMapMode(int mode); + virtual void GetTextExtent(const wxString& string, long *x, long *y, + long *descent = NULL, long *externalLeading = NULL, + wxFont *theFont = NULL, bool use16bit = FALSE) const; + + // Implementation + wxMetafile *GetMetaFile() const { return m_metaFile; } + void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; } + int GetWindowsMappingMode() const { return m_windowsMappingMode; } + void SetWindowsMappingMode(int mm) { m_windowsMappingMode = mm; } + +protected: + int m_windowsMappingMode; + wxMetafile* m_metaFile; + +private: + DECLARE_DYNAMIC_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 +bool WXDLLEXPORT wxMakeMetafilePlaceable(const wxString& filename, float scale = 1.0); + +// Optional origin and extent +bool WXDLLEXPORT wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale = 1.0, bool useOriginAndExtent = TRUE); + +// ---------------------------------------------------------------------------- +// wxMetafileDataObject is a specialization of wxDataObject for metafile data +// ---------------------------------------------------------------------------- + +#if wxUSE_DRAG_AND_DROP + +class WXDLLEXPORT wxMetafileDataObject : public wxDataObjectSimple +{ +public: + // ctors + wxMetafileDataObject() : wxDataObjectSimple(wxDF_METAFILE) + { } + wxMetafileDataObject(const wxMetafile& metafile) + : wxDataObjectSimple(wxDF_METAFILE), m_metafile(metafile) { } + + // virtual functions which you may override if you want to provide data on + // demand only - otherwise, the trivial default versions will be used + virtual void SetMetafile(const wxMetafile& metafile) + { m_metafile = metafile; } + virtual wxMetafile GetMetafile() const + { return m_metafile; } + + // implement base class pure virtuals + virtual size_t GetDataSize() const; + virtual bool GetDataHere(void *buf) const; + virtual bool SetData(size_t len, const void *buf); + +protected: + wxMetafile m_metafile; +}; + +#endif // wxUSE_DRAG_AND_DROP + +#endif // wxUSE_METAFILE +#endif + // _WX_METAFIILE_H_ + diff --git a/include/wx/palmos/mimetype.h b/include/wx/palmos/mimetype.h new file mode 100644 index 0000000000..c6fdd88ded --- /dev/null +++ b/include/wx/palmos/mimetype.h @@ -0,0 +1,126 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/mimetype.h +// Purpose: classes and functions to manage MIME types +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _MIMETYPE_IMPL_H +#define _MIMETYPE_IMPL_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "mimetype.h" +#endif + +#include "wx/defs.h" + +#if wxUSE_MIMETYPE + +#include "wx/mimetype.h" + +// ---------------------------------------------------------------------------- +// wxFileTypeImpl is the MSW version of wxFileType, this is a private class +// and is never used directly by the application +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxFileTypeImpl +{ +public: + // ctor + wxFileTypeImpl() { } + + // one of these Init() function must be called (ctor can't take any + // arguments because it's common) + + // initialize us with our file type name and extension - in this case + // we will read all other data from the registry + void Init(const wxString& strFileType, const wxString& ext); + + // implement accessor functions + bool GetExtensions(wxArrayString& extensions); + bool GetMimeType(wxString *mimeType) const; + bool GetMimeTypes(wxArrayString& mimeTypes) const; + bool GetIcon(wxIconLocation *iconLoc) const; + bool GetDescription(wxString *desc) const; + bool GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters& params) const; + bool GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters& params) const; + + size_t GetAllCommands(wxArrayString * verbs, wxArrayString * commands, + const wxFileType::MessageParameters& params) const; + + bool Unassociate(); + + // 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& cmd = wxEmptyString, int index = 0); + + // this is called by Associate + bool SetDescription (const wxString& desc); + +private: + // helper function: reads the command corresponding to the specified verb + // from the registry (returns an empty string if not found) + wxString GetCommand(const wxChar *verb) const; + + // get the registry path for the given verb + wxString GetVerbPath(const wxString& verb) const; + + // check that the registry key for our extension exists, create it if it + // doesn't, return FALSE if this failed + bool EnsureExtKeyExists(); + + wxString m_strFileType, // may be empty + m_ext; + + // these methods are not publicly accessible (as wxMimeTypesManager + // doesn't know about them), and should only be called by Unassociate + + bool RemoveOpenCommand(); + bool RemoveCommand(const wxString& verb); + bool RemoveMimeType(); + bool RemoveDefaultIcon(); + bool RemoveDescription(); +}; + +class WXDLLIMPEXP_BASE wxMimeTypesManagerImpl +{ +public: + // nothing to do here, we don't load any data but just go and fetch it from + // the registry when asked for + wxMimeTypesManagerImpl() { } + + // 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 Windows + bool ReadMailcap(const wxString& WXUNUSED(filename), bool WXUNUSED(fallback) = TRUE) + { return TRUE; } + bool ReadMimeTypes(const wxString& WXUNUSED(filename)) + { return TRUE; } + + // create a new filetype association + wxFileType *Associate(const wxFileTypeInfo& ftInfo); + + // create a new filetype with the given name and extension + wxFileType *CreateFileType(const wxString& filetype, const wxString& ext); +}; + +#endif // wxUSE_MIMETYPE + +#endif + //_MIMETYPE_IMPL_H + diff --git a/include/wx/palmos/minifram.h b/include/wx/palmos/minifram.h new file mode 100644 index 0000000000..473f581f1f --- /dev/null +++ b/include/wx/palmos/minifram.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/minifram.h +// Purpose: wxMiniFrame class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MINIFRAM_H_ +#define _WX_MINIFRAM_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "minifram.h" +#endif + +#include "wx/frame.h" + +class WXDLLEXPORT wxMiniFrame : public wxFrame +{ +public: + wxMiniFrame() { } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxFrameNameStr) + { + return wxFrame::Create(parent, id, title, pos, size, + style | + wxFRAME_TOOL_WINDOW | + (parent ? wxFRAME_FLOAT_ON_PARENT : 0), name); + } + + wxMiniFrame(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER, + const wxString& name = wxFrameNameStr) + { + Create(parent, id, title, pos, size, style, name); + } + +protected: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame) +}; + +#endif + // _WX_MINIFRAM_H_ diff --git a/include/wx/palmos/msgdlg.h b/include/wx/palmos/msgdlg.h new file mode 100644 index 0000000000..97cd171243 --- /dev/null +++ b/include/wx/palmos/msgdlg.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: msgdlg.h +// Purpose: wxMessageDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSGBOXDLG_H_ +#define _WX_MSGBOXDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "msgdlg.h" +#endif + +#include "wx/setup.h" +#include "wx/dialog.h" + +/* + * Message box dialog + */ + +WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr; + +class WXDLLEXPORT wxMessageDialog: public wxDialog +{ +DECLARE_DYNAMIC_CLASS(wxMessageDialog) +protected: + wxString m_caption; + wxString m_message; + long m_dialogStyle; + wxWindow * m_parent; +public: + wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption = wxMessageBoxCaptionStr, + long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition); + + int ShowModal(void); + + DECLARE_NO_COPY_CLASS(wxMessageDialog) +}; + + +#endif + // _WX_MSGBOXDLG_H_ diff --git a/include/wx/palmos/mslu.h b/include/wx/palmos/mslu.h new file mode 100644 index 0000000000..176a3d5120 --- /dev/null +++ b/include/wx/palmos/mslu.h @@ -0,0 +1,72 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/mslu.h +// Purpose: Fixes for bugs in MSLU +// Author: Vaclav Slavik +// Modified by: +// Created: 2002/02/17 +// RCS-ID: $Id$ +// Copyright: (c) 2002 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSLU_H_ +#define _WX_MSLU_H_ + +#include "wx/defs.h" +#include "wx/utils.h" +#include "wx/wxchar.h" + +#if !wxUSE_UNICODE_MSLU +inline bool wxUsingUnicowsDll() { return FALSE; } +#else + +// Returns true if we are running under Unicode emulation in Win9x environment. +// Workaround hacks take effect only if this condition is met +inline bool wxUsingUnicowsDll() +{ + return (wxGetOsVersion() == wxWIN95); +} + +//------------------------------------------------------------------------ +// Wrongly implemented functions from unicows.dll +//------------------------------------------------------------------------ + +#if wxUSE_GUI + +WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, + WXLPARAM lData, WXWPARAM wData, + int x, int y, int cx, int cy, + unsigned int flags); +#define DrawStateW(dc, br, func, ld, wd, x, y, cx, cy, flags) \ + wxMSLU_DrawStateW((WXHDC)dc,(WXHBRUSH)br,(WXFARPROC)func, \ + ld, wd, x, y, cx, cy, flags) + +WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn); +#define GetOpenFileNameW(ofn) wxMSLU_GetOpenFileNameW((void*)ofn) + +WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn); +#define GetSaveFileNameW(ofn) wxMSLU_GetSaveFileNameW((void*)ofn) + +#endif + +//------------------------------------------------------------------------ +// Missing libc file manipulation functions in Win9x +//------------------------------------------------------------------------ + +WXDLLEXPORT int wxMSLU__trename(const wxChar *oldname, const wxChar *newname); +WXDLLEXPORT int wxMSLU__tremove(const wxChar *name); + +#if defined( __VISUALC__ ) \ + || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ + || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ + || ( defined(__BORLANDC__) && (__BORLANDC__ > 0x460) ) +WXDLLEXPORT int wxMSLU__wopen(const wxChar *name, int flags, int mode); +WXDLLEXPORT int wxMSLU__waccess(const wxChar *name, int mode); +WXDLLEXPORT int wxMSLU__wmkdir(const wxChar *name); +WXDLLEXPORT int wxMSLU__wrmdir(const wxChar *name); +WXDLLEXPORT int wxMSLU__wstat(const wxChar *name, struct _stat *buffer); +#endif + +#endif // wxUSE_UNICODE_MSLU + +#endif // _WX_MSLU_H_ diff --git a/include/wx/palmos/msvcrt.h b/include/wx/palmos/msvcrt.h new file mode 100644 index 0000000000..4a891c86ca --- /dev/null +++ b/include/wx/palmos/msvcrt.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/msvcrt.h +// Purpose: macros to use some non-standard features of MS Visual C++ +// C run-time library +// Author: Vadim Zeitlin +// Modified by: +// Created: 31.01.1999 +// RCS-ID: $Id$ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// the goal of this file is to define wxCrtSetDbgFlag() macro which may be +// used like this: +// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF); +// to turn on memory leak checks for programs compiled with Microsoft Visual +// C++ (5.0+). The macro will expand to nothing under other compilers. + +#ifndef _PALMOS_MSVCRT_H_ +#define _PALMOS_MSVCRT_H_ + +// use debug CRT functions for memory leak detections in VC++ 5.0+ in debug +// builds +#undef wxUSE_VC_CRTDBG +#if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ >= 1000) \ + && !defined(UNDER_CE) + // it doesn't combine well with wxWin own memory debugging methods + #if !wxUSE_GLOBAL_MEMORY_OPERATORS && !wxUSE_MEMORY_TRACING && !defined(__NO_VC_CRTDBG__) + #define wxUSE_VC_CRTDBG + #endif +#endif + +#ifdef wxUSE_VC_CRTDBG + // VC++ uses this macro as debug/release mode indicator + #ifndef _DEBUG + #define _DEBUG + #endif + + // Need to undef new if including crtdbg.h which redefines new itself + #ifdef new + #undef new + #endif + + // we need this to show file & line number of the allocation that caused + // the leak + #define _CRTDBG_MAP_ALLOC + #include + #ifndef _CRTBLD + // Need when builded with pure MS SDK + #define _CRTBLD + #endif + + #include + + // this define works around a bug with inline declarations of new, see + // + // http://support.microsoft.com/support/kb/articles/Q140/8/58.asp + // + // for the details + #define new new( _NORMAL_BLOCK, __FILE__, __LINE__) + + #define wxCrtSetDbgFlag(flag) \ + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | (flag)) +#else // !using VC CRT + #define wxCrtSetDbgFlag(flag) +#endif // wxUSE_VC_CRTDBG + +#endif // _PALMOS_MSVCRT_H_ + diff --git a/include/wx/palmos/notebook.h b/include/wx/palmos/notebook.h new file mode 100644 index 0000000000..ccdc06f094 --- /dev/null +++ b/include/wx/palmos/notebook.h @@ -0,0 +1,196 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/notebook.h +// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _NOTEBOOK_H +#define _NOTEBOOK_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "notebook.h" +#endif + +#if wxUSE_NOTEBOOK + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxNotebook +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxNotebookPageInfo : public wxObject +{ +public : + wxNotebookPageInfo() { m_page = NULL ; m_imageId = -1 ; m_selected = false ; } + virtual ~wxNotebookPageInfo() { } + + void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId ) + { m_page = page ; m_text = text ; m_selected = selected ; m_imageId = imageId ; } + wxNotebookPage* GetPage() const { return m_page ; } + wxString GetText() const { return m_text ; } + bool GetSelected() const { return m_selected ; } + int GetImageId() const { return m_imageId; } +private : + wxNotebookPage *m_page ; + wxString m_text ; + bool m_selected ; + int m_imageId ; + + DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) ; +} ; + + +WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList ); + +class WXDLLEXPORT 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 = wxNOTEBOOK_NAME); + // Create() function + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxNOTEBOOK_NAME); + + // accessors + // --------- + // get number of pages in the dialog + virtual size_t GetPageCount() const; + + // set the currently selected page, return the index of the previously + // selected one (or -1 on error) + // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events + int SetSelection(size_t nPage); + // get the currently selected page + int GetSelection() const { return m_nSelection; } + + // set/get the title of a page + bool SetPageText(size_t nPage, const wxString& strText); + wxString GetPageText(size_t nPage) const; + + // image list stuff: each page may have an image associated with it. All + // the images belong to an image list, so you have to + // 1) create an image list + // 2) associate it with the notebook + // 3) set for each page it's image + // associate image list with a control + void SetImageList(wxImageList* imageList); + + // sets/returns item's image index in the current image list + int GetPageImage(size_t nPage) const; + bool SetPageImage(size_t nPage, int nImage); + + // currently it's always 1 because wxGTK doesn't support multi-row + // tab controls + int GetRowCount() const; + + // control the appearance of the notebook pages + // set the size (the same for all pages) + void SetPageSize(const wxSize& size); + // set the padding between tabs (in pixels) + void SetPadding(const wxSize& padding); + + // Windows only: attempts to get colour for UX theme page background + wxColour GetThemeBackgroundColour(); + + // operations + // ---------- + // remove all pages + bool DeleteAllPages(); + + // inserts a new page to the notebook (it will be deleted ny the notebook, + // don't delete it yourself). If bSelect, this page becomes active. + bool InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect = FALSE, + int imageId = -1); + + void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; } + const wxNotebookPageInfoList& GetPageInfos() const ; + + // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH + // style. + void SetTabSize(const wxSize& sz); + + // Windows only: attempts to apply the UX theme page background to this page + void ApplyThemeBackground(wxWindow* window, const wxColour& colour); + + // hit test + virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; + + // calculate the size of the notebook from the size of its page + virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; + + // callbacks + // --------- + void OnSize(wxSizeEvent& event); + void OnSelChange(wxNotebookEvent& event); + void OnNavigationKey(wxNavigationKeyEvent& event); + + // base class virtuals + // ------------------- + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control); + virtual bool MSWTranslateMessage(WXMSG *wxmsg); + +#if wxUSE_CONSTRAINTS + virtual void SetConstraintSizes(bool recurse = TRUE); + virtual bool DoPhase(int nPhase); +#endif // wxUSE_CONSTRAINTS + +protected: + // common part of all ctors + void Init(); + + // translate wxWin styles to the Windows ones + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + + // remove one page from the notebook, without deleting + virtual wxNotebookPage *DoRemovePage(size_t nPage); + + // set the size of the given page to fit in the notebook + void AdjustPageSize(wxNotebookPage *page); + + // override WndProc. +#if wxUSE_UXTHEME + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); +#endif + + // the current selection (-1 if none) + int m_nSelection; + + wxNotebookPageInfoList m_pageInfos ; + + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook) + DECLARE_EVENT_TABLE() +}; + +#endif // wxUSE_NOTEBOOK + +#endif // _NOTEBOOK_H diff --git a/include/wx/palmos/palette.h b/include/wx/palmos/palette.h new file mode 100644 index 0000000000..b0753763e2 --- /dev/null +++ b/include/wx/palmos/palette.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palette.h +// Purpose: wxPalette class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALETTE_H_ +#define _WX_PALETTE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "palette.h" +#endif + +#include "wx/gdiobj.h" + +class WXDLLEXPORT wxPalette; + +class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData +{ + friend class WXDLLEXPORT wxPalette; +public: + wxPaletteRefData(void); + ~wxPaletteRefData(void); +protected: + WXHPALETTE m_hPalette; +}; + +#define M_PALETTEDATA ((wxPaletteRefData *)m_refData) + +class WXDLLEXPORT wxPalette: public wxGDIObject +{ + DECLARE_DYNAMIC_CLASS(wxPalette) + +public: + wxPalette(void); + inline wxPalette(const wxPalette& palette) { Ref(palette); } + + wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + ~wxPalette(void); + bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); + int GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const; + bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const; + + virtual bool Ok(void) const { return (m_refData != NULL) ; } + + inline wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; } + inline bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; } + inline bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; } + + virtual bool FreeResource(bool force = FALSE); + + inline WXHPALETTE GetHPALETTE(void) const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); } + void SetHPALETTE(WXHPALETTE pal); +}; + +#define wxColorMap wxPalette +#define wxColourMap wxPalette + +#endif + // _WX_PALETTE_H_ diff --git a/include/wx/palmos/pen.h b/include/wx/palmos/pen.h new file mode 100644 index 0000000000..26b86cf569 --- /dev/null +++ b/include/wx/palmos/pen.h @@ -0,0 +1,145 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/pen.h +// Purpose: wxPen class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PEN_H_ +#define _WX_PEN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "pen.h" +#endif + +#include "wx/gdiobj.h" +#include "wx/bitmap.h" +#include "wx/colour.h" + +typedef WXDWORD wxMSWDash; + +class WXDLLEXPORT wxPen; + +// VZ: this class should be made private +class WXDLLEXPORT wxPenRefData : public wxGDIRefData +{ +public: + wxPenRefData(); + wxPenRefData(const wxPenRefData& data); + virtual ~wxPenRefData(); + + bool operator==(const wxPenRefData& data) const + { + // we intentionally don't compare m_hPen fields here + return m_style == data.m_style && + m_width == data.m_width && + m_join == data.m_join && + m_cap == data.m_cap && + m_colour == data.m_colour && + (m_style != wxSTIPPLE || m_stipple == data.m_stipple) && + (m_style != wxUSER_DASH || + (m_nbDash == data.m_nbDash && + memcmp(m_dash, data.m_dash, m_nbDash*sizeof(wxDash)) == 0)); + } + +protected: + int m_width; + int m_style; + int m_join; + int m_cap; + wxBitmap m_stipple; + int m_nbDash; + wxDash * m_dash; + wxColour m_colour; + WXHPEN m_hPen; + +private: + friend class WXDLLEXPORT wxPen; + + // Cannot use + // DECLARE_NO_COPY_CLASS(wxPenRefData) + // because copy constructor is explicitly declared above; + // but no copy assignment operator is defined, so declare + // it private to prevent the compiler from defining it: + wxPenRefData& operator=(const wxPenRefData&); +}; + +#define M_PENDATA ((wxPenRefData *)m_refData) +#define wxPENDATA(x) ((wxPenRefData *)(x).m_refData) + +// ---------------------------------------------------------------------------- +// Pen +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPen : public wxGDIObject +{ +public: + wxPen(); + wxPen(const wxColour& col, int width = 1, int style = wxSOLID); + wxPen(const wxBitmap& stipple, int width); + wxPen(const wxPen& pen) { Ref(pen); } + virtual ~wxPen(); + + wxPen& operator=(const wxPen& pen) + { + if ( this != &pen ) + Ref(pen); + + return *this; + } + + bool operator==(const wxPen& pen) const + { + const wxPenRefData *penData = (wxPenRefData *)pen.m_refData; + + // an invalid pen is only equal to another invalid pen + return m_refData ? penData && *M_PENDATA == *penData : !penData; + } + + bool operator!=(const wxPen& pen) const { return !(*this == pen); } + + virtual bool Ok() const { return (m_refData != NULL); } + + // Override in order to recreate the pen + void SetColour(const wxColour& col); + void SetColour(unsigned char r, unsigned char g, unsigned char b); + + void SetWidth(int width); + void SetStyle(int style); + void SetStipple(const wxBitmap& stipple); + void SetDashes(int nb_dashes, const wxDash *dash); + void SetJoin(int join); + void SetCap(int cap); + + wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); }; + int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); }; + int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); }; + int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); }; + int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); }; + int GetDashes(wxDash **ptr) const + { + *ptr = (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*) NULL); + return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + } + wxDash* GetDash() const { return (M_PENDATA ? (wxDash*)M_PENDATA->m_dash : (wxDash*)NULL); }; + inline int GetDashCount() const { return (M_PENDATA ? M_PENDATA->m_nbDash : 0); }; + + inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); }; + + // Internal + bool RealizeResource(); + bool FreeResource(bool force = FALSE); + WXHANDLE GetResourceHandle() const; + bool IsFree() const; + void Unshare(); + +private: + DECLARE_DYNAMIC_CLASS(wxPen) +}; + +#endif // _WX_PEN_H_ + diff --git a/include/wx/palmos/popupwin.h b/include/wx/palmos/popupwin.h new file mode 100644 index 0000000000..beaced311e --- /dev/null +++ b/include/wx/palmos/popupwin.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/popupwin.h +// Purpose: wxPopupWindow class for wxMSW +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_POPUPWIN_H_ +#define _WX_MSW_POPUPWIN_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "popup.h" +#endif + +// ---------------------------------------------------------------------------- +// wxPopupWindow +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase +{ +public: + wxPopupWindow() { } + + wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) + { (void)Create(parent, flags); } + + bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + + virtual bool Show(bool show = TRUE); + +protected: + // popups handle the position like wxTopLevelWindow, not wxWindow + virtual void DoGetPosition(int *x, int *y) const; + + // return the style to be used for the popup windows + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle) const; + + // get the HWND to be used as parent of this window with CreateWindow() + virtual WXHWND MSWGetParent() const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPopupWindow) +}; + +#endif // _WX_MSW_POPUPWIN_H_ + diff --git a/include/wx/palmos/printdlg.h b/include/wx/palmos/printdlg.h new file mode 100644 index 0000000000..2bb9a51257 --- /dev/null +++ b/include/wx/palmos/printdlg.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: printdlg.h +// Purpose: wxPrintDialog, wxPageSetupDialog classes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTDLG_H_ +#define _WX_PRINTDLG_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "printdlg.h" +#endif + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/dialog.h" +#include "wx/cmndata.h" + +class WXDLLEXPORT wxDC; + +// --------------------------------------------------------------------------- +// wxPrinterDialog: the common dialog for printing. +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPrintDialog : public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxPrintDialog) + +public: + wxPrintDialog(); + wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL); + wxPrintDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxPrintDialog(); + + bool Create(wxWindow *parent, wxPrintDialogData* data = NULL); + virtual int ShowModal(); + + wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); } + virtual wxDC *GetPrintDC(); + +private: + wxPrintDialogData m_printDialogData; + wxDC* m_printerDC; + bool m_destroyDC; + wxWindow* m_dialogParent; + + DECLARE_NO_COPY_CLASS(wxPrintDialog) +}; + +class WXDLLEXPORT wxPageSetupDialog: public wxDialog +{ + DECLARE_DYNAMIC_CLASS(wxPageSetupDialog) + +public: + wxPageSetupDialog(); + wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL); + virtual ~wxPageSetupDialog(); + + bool Create(wxWindow *parent, wxPageSetupData *data = NULL); + virtual int ShowModal(); + + wxPageSetupData& GetPageSetupData() { return m_pageSetupData; } + +private: + wxPageSetupData m_pageSetupData; + wxWindow* m_dialogParent; + + DECLARE_NO_COPY_CLASS(wxPageSetupDialog) +}; + +#endif // wxUSE_PRINTING_ARCHITECTURE + +#endif + // _WX_PRINTDLG_H_ diff --git a/include/wx/palmos/printpalm.h b/include/wx/palmos/printpalm.h new file mode 100644 index 0000000000..55d6549e24 --- /dev/null +++ b/include/wx/palmos/printpalm.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: printpalm.h +// Purpose: wxPalmPrinter, wxPalmPrintPreview classes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PRINTPALM_H_ +#define _WX_PRINTPALM_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "printpalm.h" +#endif + +#include "wx/prntbase.h" + +// --------------------------------------------------------------------------- +// Represents the printer: manages printing a wxPrintout object +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPalmPrinter : public wxPrinterBase +{ + DECLARE_DYNAMIC_CLASS(wxPalmPrinter) + +public: + wxPalmPrinter(wxPrintDialogData *data = NULL); + virtual ~wxPalmPrinter(); + + virtual bool Print(wxWindow *parent, + wxPrintout *printout, + bool prompt = TRUE); + virtual wxDC* PrintDialog(wxWindow *parent); + virtual bool Setup(wxWindow *parent); + +private: + WXFARPROC m_lpAbortProc; + + DECLARE_NO_COPY_CLASS(wxPalmPrinter) +}; + +// --------------------------------------------------------------------------- +// wxPrintPreview: programmer creates an object of this class to preview a +// wxPrintout. +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxPalmPrintPreview : public wxPrintPreviewBase +{ +public: + wxPalmPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting = NULL, + wxPrintDialogData *data = NULL); + wxPalmPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data); + virtual ~wxPalmPrintPreview(); + + virtual bool Print(bool interactive); + virtual void DetermineScaling(); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxPalmPrintPreview) +}; + +#endif +// _WX_PRINTPALM_H_ diff --git a/include/wx/palmos/radiobox.h b/include/wx/palmos/radiobox.h new file mode 100644 index 0000000000..fbb7560f32 --- /dev/null +++ b/include/wx/palmos/radiobox.h @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/radiobox.h +// Purpose: wxRadioBox class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBOX_H_ +#define _WX_RADIOBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "radiobox.h" +#endif + +class WXDLLEXPORT wxBitmap; + +// ---------------------------------------------------------------------------- +// wxRadioBox +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase +{ +public: + wxRadioBox(); + + 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) + { + (void)Create(parent, id, title, pos, size, n, choices, majorDim, + style, val, name); + } + 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) + { + (void)Create(parent, id, title, pos, size, choices, majorDim, + style, val, name); + } + + ~wxRadioBox(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + int n = 0, const wxString choices[] = NULL, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + + // implement the radiobox interface + virtual void SetSelection(int n); + virtual int GetSelection() const; + virtual int GetCount() const; + virtual wxString GetString(int n) const; + virtual void SetString(int n, const wxString& label); + virtual void Enable(int n, bool enable = TRUE); + virtual void Show(int n, bool show = TRUE); + virtual int GetColumnCount() const; + virtual int GetRowCount() const; + + virtual bool Show(bool show = TRUE); + void SetFocus(); + virtual bool Enable(bool enable = TRUE); + void SetLabelFont(const wxFont& WXUNUSED(font)) {}; + void SetButtonFont(const wxFont& font) { SetFont(font); } + + void Command(wxCommandEvent& event); + + int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } + void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } + + // implementation only from now on + // ------------------------------- + + virtual bool MSWCommand(WXUINT param, WXWORD id); + + // FIXME: are they used? missing "Do" prefix? + void GetSize(int *x, int *y) const; + void GetPosition(int *x, int *y) const; + + virtual bool SetFont(const wxFont& font); + + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, WXLPARAM lParam); + WXHWND *GetRadioButtons() const { return m_radioButtons; } + bool ContainsHWND(WXHWND hWnd) const; + void SendNotificationEvent(); + + // get the number of buttons per column/row + int GetNumVer() const; + int GetNumHor() const; + + virtual void ApplyParentThemeBackground(const wxColour& bg) + { SetBackgroundColour(bg); } + +protected: + // we can't compute our best size before the items are added to the control + virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { } + + // subclass one radio button + void SubclassRadioButton(WXHWND hWndBtn); + + // get the max size of radio buttons + wxSize GetMaxButtonSize() const; + + // get the total size occupied by the radio box buttons + wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; + + WXHWND * m_radioButtons; + int m_majorDim; + int * m_radioWidth; // for bitmaps + int * m_radioHeight; + + int m_noItems; + int m_noRowsOrCols; + int m_selectedButton; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS(wxRadioBox) + DECLARE_NO_COPY_CLASS(wxRadioBox) +}; + +#endif + // _WX_RADIOBOX_H_ diff --git a/include/wx/palmos/radiobut.h b/include/wx/palmos/radiobut.h new file mode 100644 index 0000000000..87e1d25d00 --- /dev/null +++ b/include/wx/palmos/radiobut.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: radiobut.h +// Purpose: wxRadioButton class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_RADIOBUT_H_ +#define _WX_RADIOBUT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "radiobut.h" +#endif + +class WXDLLEXPORT wxRadioButton: public wxControl +{ +public: + // ctors and creation functions + wxRadioButton() { Init(); } + + 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) + { + Init(); + + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioButtonNameStr); + + // implement the radio button interface + virtual void SetValue(bool value); + virtual bool GetValue() const; + + // implementation only from now on + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void Command(wxCommandEvent& event); + virtual void ApplyParentThemeBackground(const wxColour& bg) + { SetBackgroundColour(bg); } + + +protected: + virtual wxSize DoGetBestSize() const; + +private: + // common part of all ctors + void Init(); + + // we need to store the state internally as the result of GetValue() + // sometimes gets out of sync in WM_COMMAND handler + bool m_isChecked; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton) +}; + +#endif + // _WX_RADIOBUT_H_ diff --git a/include/wx/palmos/regconf.h b/include/wx/palmos/regconf.h new file mode 100644 index 0000000000..4088af5aa8 --- /dev/null +++ b/include/wx/palmos/regconf.h @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/regconf.h +// Purpose: Registry based implementation of wxConfigBase +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _REGCONF_H +#define _REGCONF_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "regconf.h" +#endif + +#ifndef _REGISTRY_H + #include "wx/palmos/registry.h" +#endif +#include "wx/object.h" + +// ---------------------------------------------------------------------------- +// wxRegConfig +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxRegConfig : public wxConfigBase +{ +public: + // ctor & dtor + // will store data in HKLM\appName and HKCU\appName + wxRegConfig(const wxString& appName = wxEmptyString, + const wxString& vendorName = wxEmptyString, + const wxString& localFilename = wxEmptyString, + const wxString& globalFilename = wxEmptyString, + long style = wxCONFIG_USE_GLOBAL_FILE); + + // dtor will save unsaved data + virtual ~wxRegConfig(); + + // implement inherited pure virtual functions + // ------------------------------------------ + + // path management + virtual void SetPath(const wxString& strPath); + virtual const wxString& GetPath() const { return m_strPath; } + + // entry/subgroup info + // enumerate all of them + virtual bool GetFirstGroup(wxString& str, long& lIndex) const; + virtual bool GetNextGroup (wxString& str, long& lIndex) const; + virtual bool GetFirstEntry(wxString& str, long& lIndex) const; + virtual bool GetNextEntry (wxString& str, long& lIndex) const; + + // tests for existence + virtual bool HasGroup(const wxString& strName) const; + virtual bool HasEntry(const wxString& strName) const; + virtual EntryType GetEntryType(const wxString& name) const; + + // get number of entries/subgroups in the current group, with or without + // it's subgroups + virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const; + virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const; + + virtual bool Flush(bool WXUNUSED(bCurrentOnly) = FALSE) { return TRUE; } + + // rename + virtual bool RenameEntry(const wxString& oldName, const wxString& newName); + virtual bool RenameGroup(const wxString& oldName, const wxString& newName); + + // delete + virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso = TRUE); + virtual bool DeleteGroup(const wxString& key); + virtual bool DeleteAll(); + +protected: + // opens the local key creating it if necessary and returns it + wxRegKey& LocalKey() const // must be const to be callable from const funcs + { + wxRegConfig* self = wxConstCast(this, wxRegConfig); + + if ( !m_keyLocal.IsOpened() ) + { + // create on demand + self->m_keyLocal.Create(); + } + + return self->m_keyLocal; + } + + // implement read/write methods + virtual bool DoReadString(const wxString& key, wxString *pStr) const; + virtual bool DoReadLong(const wxString& key, long *plResult) const; + + virtual bool DoWriteString(const wxString& key, const wxString& szValue); + virtual bool DoWriteLong(const wxString& key, long lValue); + +private: + // no copy ctor/assignment operator + wxRegConfig(const wxRegConfig&); + wxRegConfig& operator=(const wxRegConfig&); + + // these keys are opened during all lifetime of wxRegConfig object + wxRegKey m_keyLocalRoot, m_keyLocal, + m_keyGlobalRoot, m_keyGlobal; + + // current path (not '/' terminated) + wxString m_strPath; +}; + +#endif //_REGCONF_H diff --git a/include/wx/palmos/region.h b/include/wx/palmos/region.h new file mode 100644 index 0000000000..b44b8f08fc --- /dev/null +++ b/include/wx/palmos/region.h @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/region.h +// Purpose: wxRegion class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) 1997-2002 wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_REGION_H_ +#define _WX_REGION_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "region.h" +#endif + +#include "wx/gdiobj.h" +#include "wx/gdicmn.h" + +class WXDLLEXPORT wxRect; +class WXDLLEXPORT wxPoint; + +enum wxRegionContain +{ + wxOutRegion = 0, + wxPartRegion = 1, + wxInRegion = 2 +}; + +// So far, for internal use only +enum wxRegionOp +{ + wxRGN_AND, // Creates the intersection of the two combined regions. + wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1. + wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2. + wxRGN_OR, // Creates the union of two combined regions. + wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas. +}; + +class WXDLLEXPORT wxRegion : public wxGDIObject +{ +public: + wxRegion(); + wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); + wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); + wxRegion(const wxRect& rect); + wxRegion(WXHRGN hRegion); // Hangs on to this region + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); + wxRegion( const wxBitmap& bmp) + { + Union(bmp); + } + wxRegion( const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) + { + Union(bmp, transColour, tolerance); + } + + virtual ~wxRegion(); + + // Copying + wxRegion(const wxRegion& r) : wxGDIObject(r) + { Ref(r); } + wxRegion& operator = (const wxRegion& r) + { Ref(r); return (*this); } + + // Modify region + // ------------- + + // Clear current region + void Clear(); + + // Move the region + bool Offset(wxCoord x, wxCoord y); + + // Union rectangle or region with this. + bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_OR); } + bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); } + bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); } + + // Intersect rectangle or region with this. + bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_AND); } + bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); } + bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); } + + // Subtract rectangle or region from this: + // Combines the parts of 'this' that are not part of the second region. + bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_DIFF); } + bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); } + bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); } + + // XOR: the union of two combined regions except for any overlapping areas. + bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_XOR); } + bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); } + bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); } + + // Information on region + // --------------------- + + // Outer bounds of region + void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const; + wxRect GetBox() const ; + + // Is region empty? + bool Empty() const; + inline bool IsEmpty() const { return Empty(); } + + // Tests + // Does the region contain the point (x,y)? + wxRegionContain Contains(wxCoord x, wxCoord y) const; + // Does the region contain the point pt? + wxRegionContain Contains(const wxPoint& pt) const; + // Does the region contain the rectangle (x, y, w, h)? + wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const; + // Does the region contain the rectangle rect? + wxRegionContain Contains(const wxRect& rect) const; + + // Convert the region to a B&W bitmap with the white pixels being inside + // the region. + wxBitmap ConvertToBitmap() const; + + // Use the non-transparent pixels of a wxBitmap for the region to combine + // with this region. First version takes transparency from bitmap's mask, + // second lets the user specify the colour to be treated as transparent + // along with an optional tolerance value. + // NOTE: implemented in common/rgncmn.cpp + bool Union(const wxBitmap& bmp); + bool Union(const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0); + +// Internal + bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op); + bool Combine(const wxRegion& region, wxRegionOp op); + bool Combine(const wxRect& rect, wxRegionOp op); + + // Get internal region handle + WXHRGN GetHRGN() const; + +protected: + virtual wxObjectRefData *CreateRefData() const; + virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; + + friend class WXDLLEXPORT wxRegionIterator; + + DECLARE_DYNAMIC_CLASS(wxRegion) +}; + +class WXDLLEXPORT wxRegionIterator : public wxObject +{ +public: + wxRegionIterator() { Init(); } + wxRegionIterator(const wxRegion& region); + wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; } + + wxRegionIterator& operator=(const wxRegionIterator& ri); + + virtual ~wxRegionIterator(); + + void Reset() { m_current = 0; } + void Reset(const wxRegion& region); + + bool HaveRects() const { return (m_current < m_numRects); } + +#ifndef __SALFORDC__ + operator bool () const { return HaveRects(); } +#endif + + wxRegionIterator& operator++(); + wxRegionIterator operator++(int); + + wxCoord GetX() const; + wxCoord GetY() const; + wxCoord GetW() const; + wxCoord GetWidth() const { return GetW(); } + wxCoord GetH() const; + wxCoord GetHeight() const { return GetH(); } + + wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); } + +private: + // common part of all ctors + void Init(); + + long m_current; + long m_numRects; + wxRegion m_region; + wxRect* m_rects; + + DECLARE_DYNAMIC_CLASS(wxRegionIterator) +}; + +#endif + // _WX_REGION_H_ diff --git a/include/wx/palmos/registry.h b/include/wx/palmos/registry.h new file mode 100644 index 0000000000..8bd2165fee --- /dev/null +++ b/include/wx/palmos/registry.h @@ -0,0 +1,244 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/registry.h +// Purpose: Registry classes and functions +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _REGISTRY_H +#define _REGISTRY_H + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "registry.h" +#endif + +// ---------------------------------------------------------------------------- +// types used in this module +// ---------------------------------------------------------------------------- + +/* +#ifndef HKEY_DEFINED + #define HKEY_DEFINED + #define HKEY unsigned long +#endif +*/ + +typedef unsigned long ulong; + +// ---------------------------------------------------------------------------- +// class wxRegKey encapsulates window HKEY handle +// ---------------------------------------------------------------------------- +class WXDLLIMPEXP_BASE wxRegKey +{ +public: + // NB: do _not_ change the values of elements in these enumerations! + + // registry value types (with comments from winnt.h) + enum ValueType + { + Type_None, // No value type + Type_String, // Unicode nul terminated string +#ifdef __WIN32__ + Type_Expand_String, // Unicode nul terminated string + // (with environment variable references) + Type_Binary, // Free form binary + Type_Dword, // 32-bit number + Type_Dword_little_endian // 32-bit number + = Type_Dword, // (same as Type_DWORD) + Type_Dword_big_endian, // 32-bit number + Type_Link, // Symbolic Link (unicode) + Type_Multi_String, // Multiple Unicode strings + Type_Resource_list, // Resource list in the resource map + Type_Full_resource_descriptor, // Resource list in the hardware description + Type_Resource_requirements_list // ??? +#endif //WIN32 + }; + + // predefined registry keys + enum StdKey + { + HKCR // classes root +#ifdef __WIN32__ + , + HKCU, // current user + HKLM, // local machine + HKUSR, // users + HKPD // performance data (WinNT/2K only) +#if WINVER >= 0x0400 + , + HKCC, // current config (starting from Win95/NT 4.0) + HKDD // dynamic data (Win95/98 only) +#endif // Winver +#endif // Win32/16 + }; + + // access mode for the key + enum AccessMode + { + Read, // read-only + Write // read and write + }; + + // information about standard (predefined) registry keys + // number of standard keys + static const size_t nStdKeys; + // get the name of a standard key + static const wxChar *GetStdKeyName(size_t key); + // get the short name of a standard key + static const wxChar *GetStdKeyShortName(size_t key); + // get StdKey from root HKEY + static StdKey GetStdKeyFromHkey(WXHKEY hkey); + + // extacts the std key prefix from the string (return value) and + // leaves only the part after it (i.e. modifies the string passed!) + static StdKey ExtractKeyName(wxString& str); + + // ctors + // root key is set to HKCR (the only root key under Win16) + wxRegKey(); + // strKey is the full name of the key (i.e. starting with HKEY_xxx...) + wxRegKey(const wxString& strKey); + // strKey is the name of key under (standard key) keyParent + wxRegKey(StdKey keyParent, const wxString& strKey); + // strKey is the name of key under (previously created) keyParent + wxRegKey(const wxRegKey& keyParent, const wxString& strKey); + // dtor closes the key + ~wxRegKey(); + + // change key (closes the previously opened key if any) + // the name is absolute, i.e. should start with HKEY_xxx + void SetName(const wxString& strKey); + // the name is relative to the parent key + void SetName(StdKey keyParent, const wxString& strKey); + // the name is relative to the parent key + void SetName(const wxRegKey& keyParent, const wxString& strKey); + // hKey should be opened and will be closed in wxRegKey dtor + void SetHkey(WXHKEY hKey); + + // get infomation about the key + // get the (full) key name. Abbreviate std root keys if bShortPrefix. + wxString GetName(bool bShortPrefix = TRUE) const; + // return true if the key exists + bool Exists() const; + // get the info about key (any number of these pointers may be NULL) + bool GetKeyInfo(size_t *pnSubKeys, // number of subkeys + size_t *pnMaxKeyLen, // max len of subkey name + size_t *pnValues, // number of values + size_t *pnMaxValueLen) const; + // return true if the key is opened + bool IsOpened() const { return m_hKey != 0; } + // for "if ( !key ) wxLogError(...)" kind of expressions + operator bool() const { return m_dwLastError == 0; } + + // operations on the key itself + // explicitly open the key (will be automatically done by all functions + // which need the key to be opened if the key is not opened yet) + bool Open(AccessMode mode = Write); + // create the key: will fail if the key already exists and !bOkIfExists + bool Create(bool bOkIfExists = TRUE); + // rename a value from old name to new one + bool RenameValue(const wxChar *szValueOld, const wxChar *szValueNew); + // rename the key + bool Rename(const wxChar *szNewName); + // copy value to another key possibly changing its name (by default it will + // remain the same) + bool CopyValue(const wxChar *szValue, wxRegKey& keyDst, + const wxChar *szNewName = NULL); + // copy the entire contents of the key recursively to another location + bool Copy(const wxChar *szNewName); + // same as Copy() but using a key and not the name + bool Copy(wxRegKey& keyDst); + // close the key (will be automatically done in dtor) + bool Close(); + + // deleting keys/values + // deletes this key and all of it's subkeys/values + bool DeleteSelf(); + // deletes the subkey with all of it's subkeys/values recursively + bool DeleteKey(const wxChar *szKey); + // deletes the named value (may be NULL to remove the default value) + bool DeleteValue(const wxChar *szValue); + + // access to values and subkeys + // get value type + ValueType GetValueType(const wxChar *szValue) const; + // returns TRUE if the value contains a number (else it's some string) + bool IsNumericValue(const wxChar *szValue) const; + + // assignment operators set the default value of the key + wxRegKey& operator=(const wxString& strValue) + { SetValue(NULL, strValue); return *this; } + wxRegKey& operator=(long lValue) + { SetValue(NULL, lValue); return *this; } + + // query the default value of the key: implicitly or explicitly + wxString QueryDefaultValue() const; + operator wxString() const { return QueryDefaultValue(); } + + // named values + + // set the string value + bool SetValue(const wxChar *szValue, const wxString& strValue); + // retrieve the string value + bool QueryValue(const wxChar *szValue, wxString& strValue) const + { return QueryValue(szValue, strValue, FALSE); } + // retrieve raw string value + bool QueryRawValue(const wxChar *szValue, wxString& strValue) const + { return QueryValue(szValue, strValue, TRUE); } + // retrieve either raw or expanded string value + bool QueryValue(const wxChar *szValue, wxString& strValue, bool raw) const; + +#ifdef __WIN32__ + // set the numeric value + bool SetValue(const wxChar *szValue, long lValue); + // return the numeric value + bool QueryValue(const wxChar *szValue, long *plValue) const; +#endif //Win32 + + // query existence of a key/value + // return true if value exists + bool HasValue(const wxChar *szKey) const; + // return true if given subkey exists + bool HasSubKey(const wxChar *szKey) const; + // return true if any subkeys exist + bool HasSubkeys() const; + // return true if any values exist + bool HasValues() const; + // return true if the key is empty (nothing under this key) + bool IsEmpty() const { return !HasSubkeys() && !HasValues(); } + + // enumerate values and subkeys + bool GetFirstValue(wxString& strValueName, long& lIndex); + bool GetNextValue (wxString& strValueName, long& lIndex) const; + + bool GetFirstKey (wxString& strKeyName , long& lIndex); + bool GetNextKey (wxString& strKeyName , long& lIndex) const; + + // for wxRegConfig usage only: preallocate some memory for the name + void ReserveMemoryForName(size_t bytes) { m_strKey.reserve(bytes); } + +private: + // common part of all ctors + void Init() + { + m_hKey = (WXHKEY) NULL; + m_dwLastError = 0; + } + + // no copy ctor/assignment operator + wxRegKey(const wxRegKey& key); // not implemented + wxRegKey& operator=(const wxRegKey& key); // not implemented + + WXHKEY m_hKey, // our handle + m_hRootKey; // handle of the top key (i.e. StdKey) + wxString m_strKey; // key name (relative to m_hRootKey) + + long m_dwLastError; // last error (0 if none) +}; + +#endif //_REGISTRY_H + diff --git a/include/wx/palmos/scrolbar.h b/include/wx/palmos/scrolbar.h new file mode 100644 index 0000000000..6ade82a3ab --- /dev/null +++ b/include/wx/palmos/scrolbar.h @@ -0,0 +1,74 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: scrollbar.h +// Purpose: wxScrollBar class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SCROLBAR_H_ +#define _WX_SCROLBAR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "scrolbar.h" +#endif + +// Scrollbar item +class WXDLLEXPORT wxScrollBar: public wxScrollBarBase +{ +public: + wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; } + ~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); + + int GetThumbPosition() const ; + int GetThumbSize() const { return m_pageSize; } + int GetPageSize() const { return m_viewSize; } + 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); + + // needed for RTTI + void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; } + void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; } + void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; } + + void Command(wxCommandEvent& event); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + +protected: + + wxSize DoGetBestSize() const; + + int m_pageSize; + int m_viewSize; + int m_objectSize; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar) +}; + +#endif + // _WX_SCROLBAR_H_ diff --git a/include/wx/palmos/setup.h b/include/wx/palmos/setup.h new file mode 100644 index 0000000000..684ba18aa3 --- /dev/null +++ b/include/wx/palmos/setup.h @@ -0,0 +1,1107 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.2 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_2 0 + +// This setting determines the compatibility with 2.4 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 1 + +// Define as 1 for font size to be backward compatible to 1.63 and earlier. +// 1.64 and later define point sizes to be compatible with Windows. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxFONT_SIZE_COMPATIBILITY 0 + +// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. +// If migrating between versions, your dialogs may seem to shrink. +// +// Default is 1 +// +// Recommended setting: 0 (the new calculations are more correct!) +#define wxDIALOG_UNIT_COMPATIBILITY 1 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as 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. +#if defined(_MSC_VER) || \ + (defined(__BORLANDC__) && __BORLANDC__ >= 0x0550) + #define wxUSE_ON_FATAL_EXCEPTION 0 +#else +#define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Set wxUSE_UNICODE_MSLU to 1 if you want to compile wxWidgets in Unicode mode +// and be able to run compiled apps under Windows 9x as well as NT/2000/XP. +// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note +// that you will have to modify the makefiles to include unicows.lib import +// library as the first library (see installation instructions in install.txt +// to learn how to do it when building the library or samples). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) +#define wxUSE_UNICODE_MSLU 0 + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 0 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_EXTENDED_RTTI 0 + +#if defined(__BORLANDC__) +#undef wxUSE_EXTENDED_RTTI +#define wxUSE_EXTENDED_RTTI 1 +#endif + +// 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 0 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 0 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 0 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 0 + +// 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 0 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// This is ignored under Win16, threads are only supported under Win32. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 0 + +// If enabled (1), compiles wxWidgets streams classes +#define wxUSE_STREAMS 0 + +// Use standard C++ streams if 1. If 0, use wxWin streams implementation. +#define wxUSE_STD_IOSTREAM 0 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 0 +#define wxUSE_FFILE 0 + +// 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 0 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 0 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 0 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 0 + +// 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 0 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 0 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 0 + +// 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 0 + +// 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 0 + +// 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 0 + +// 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 0 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 0 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 0 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 0 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 0 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 0 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 0 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 0 + +// 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 0 + +// Joystick support class +#define wxUSE_JOYSTICK 0 + +// wxFontMapper class +#define wxUSE_FONTMAP 0 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 0 + +// 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 0 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 0 +#define wxUSE_PROTOCOL_FTP 0 +#define wxUSE_PROTOCOL_HTTP 0 + +// Define this to use wxURL class. +#define wxUSE_URL 0 + +// 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 regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 0 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 0 + +// wxSound class +#define wxUSE_SOUND 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 0 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#if wxUSE_XRC +# define wxUSE_XML 1 +#else +# define wxUSE_XML 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 0 + +// 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 0 + +// 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_BUTTON 0 // wxButton +#define wxUSE_BMPBUTTON 0 // wxBitmapButton +#define wxUSE_CALENDARCTRL 0 // wxCalendarCtrl +#define wxUSE_CHECKBOX 0 // wxCheckBox +#define wxUSE_CHECKLISTBOX 0 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 0 // wxChoice +#define wxUSE_COMBOBOX 0 // wxComboBox +#define wxUSE_GAUGE 0 // wxGauge +#define wxUSE_LISTBOX 0 // wxListBox +#define wxUSE_LISTCTRL 0 // wxListCtrl +#define wxUSE_RADIOBOX 0 // wxRadioBox +#define wxUSE_RADIOBTN 0 // wxRadioButton +#define wxUSE_SCROLLBAR 0 // wxScrollBar +#define wxUSE_SLIDER 0 // wxSlider +#define wxUSE_SPINBTN 0 // wxSpinButton +#define wxUSE_SPINCTRL 0 // wxSpinCtrl +#define wxUSE_STATBOX 0 // wxStaticBox +#define wxUSE_STATLINE 0 // wxStaticLine +#define wxUSE_STATTEXT 0 // wxStaticText +#define wxUSE_STATBMP 0 // wxStaticBitmap +#define wxUSE_TEXTCTRL 0 // wxTextCtrl +#define wxUSE_TOGGLEBTN 0 // requires wxButton +#define wxUSE_TREECTRL 0 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 0 +#define wxUSE_TOOLBAR_NATIVE 0 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 0 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 0 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 0 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1 for both options. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 0 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 0 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 0 + +// 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 0 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// working with them. +// +// Default is 0 because it isn't yet implemented on all platforms +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 0 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 0 + +// 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 0 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 0 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 0 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 0 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 0 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 0 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// Set this to 1 to enable wxDIB +#define wxUSE_WXDIB 0 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 0 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 0 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 0 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 0 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 0 + +// 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 0 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 0 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 0 + +// 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 0 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 0 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 0 + +// number entry dialog +#define wxUSE_NUMBERDLG 0 + +// splash screen class +#define wxUSE_SPLASH 0 + +// wizards +#define wxUSE_WIZARDDLG 0 + +// ---------------------------------------------------------------------------- +// 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 0 +#define wxUSE_ENH_METAFILE 0 +#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 0 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 0 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 0 + +// 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 0 + +// 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 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 0 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 0 + +// 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 0 + +// 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 (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 0 + +#define wxUSE_DRAGIMAGE 0 + +#define wxUSE_IPC 0 + // 0 for no interprocess comms +#define wxUSE_HELP 0 + // 0 for no help facility +#define wxUSE_MS_HTML_HELP 0 + // 0 for no MS HTML Help + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 0 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 0 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 0 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 0 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 0 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 0 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatability with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for . Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// 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 0 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 0 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 0 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 0 + +// Set to 1 for GIF format support +#define wxUSE_GIF 0 + +// Set to 1 for PNM format support +#define wxUSE_PNM 0 + +// Set to 1 for PCX format support +#define wxUSE_PCX 0 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 0 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 0 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 0 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 0 + +// Set this to 1 to use Microsoft CTL3D library for "3D-look" under Win16 or NT +// 3.x. This setting is ignored under Win9x and NT 4.0+. +// +// Default is 0 for (most) Win32 (systems), 1 for Win16 +// +// Recommended setting: same as default +#if defined(__WIN95__) +#define wxUSE_CTL3D 0 +#else +#define wxUSE_CTL3D 0 +#endif + +// Define as 1 to use Microsoft's ItsyBitsy small title bar library, for +// wxMiniFrame. This setting is only used for Win3.1; Win9x and NT use native +// miniframes support instead. +// +// Default is 0 for (most) Win32 (systems), 1 for Win16 +// +#define wxUSE_ITSY_BITSY 0 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#if defined(__WIN95__) && !defined(__WINE__) && !defined(__GNUWIN32_OLD__) +#define wxUSE_RICHEDIT 0 + +// TODO: This should be ifdef'ed for any compilers that don't support +// RichEdit 2.0 but do have RichEdit 1.0... +#define wxUSE_RICHEDIT2 0 + +#else +#define wxUSE_RICHEDIT 0 +#define wxUSE_RICHEDIT2 0 +#endif + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 0 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 0 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 0 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Set to 1 to use PenWindows +#define wxUSE_PENWINDOWS 0 + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 0 + +// If 1, enables provision of run-time type information. +// NOW MANDATORY: don't change. +#define wxUSE_DYNAMIC_CLASSES 1 + +#endif + // _WX_SETUP_H_ diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h new file mode 100644 index 0000000000..684ba18aa3 --- /dev/null +++ b/include/wx/palmos/setup0.h @@ -0,0 +1,1107 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/setup.h +// Purpose: Configuration for the library +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SETUP_H_ +#define _WX_SETUP_H_ + +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- + +// define this to 0 when building wxBase library - this can also be done from +// makefile/project file overriding the value here +#ifndef wxUSE_GUI + #define wxUSE_GUI 1 +#endif // wxUSE_GUI + +// ---------------------------------------------------------------------------- +// compatibility settings +// ---------------------------------------------------------------------------- + +// This setting determines the compatibility with 2.2 API: set it to 1 to +// enable it but please consider updating your code instead. +// +// Default is 0 +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_2 0 + +// This setting determines the compatibility with 2.4 API: set it to 0 to +// flag all cases of using deprecated functions. +// +// Default is 1 but please try building your code with 0 as the default will +// change to 0 in the next version and the deprecated functions will disappear +// in the version after it completely. +// +// Recommended setting: 0 (please update your code) +#define WXWIN_COMPATIBILITY_2_4 1 + +// Define as 1 for font size to be backward compatible to 1.63 and earlier. +// 1.64 and later define point sizes to be compatible with Windows. +// +// Default is 0 +// +// Recommended setting: 0 +#define wxFONT_SIZE_COMPATIBILITY 0 + +// Set to 0 for accurate dialog units, else 1 to be as per 2.1.16 and before. +// If migrating between versions, your dialogs may seem to shrink. +// +// Default is 1 +// +// Recommended setting: 0 (the new calculations are more correct!) +#define wxDIALOG_UNIT_COMPATIBILITY 1 + +// ---------------------------------------------------------------------------- +// debugging settings +// ---------------------------------------------------------------------------- + +// Generic comment about debugging settings: they are very useful if you don't +// use any other memory leak detection tools such as Purify/BoundsChecker, but +// are probably redundant otherwise. Also, Visual C++ CRT has the same features +// as 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. +#if defined(_MSC_VER) || \ + (defined(__BORLANDC__) && __BORLANDC__ >= 0x0550) + #define wxUSE_ON_FATAL_EXCEPTION 0 +#else +#define wxUSE_ON_FATAL_EXCEPTION 0 +#endif + +// ---------------------------------------------------------------------------- +// Unicode support +// ---------------------------------------------------------------------------- + +// Set wxUSE_UNICODE to 1 to compile wxWidgets in Unicode mode: wxChar will be +// defined as wchar_t, wxString will use Unicode internally. If you set this +// to 1, you must use wxT() macro for all literal strings in the program. +// +// Unicode is currently only fully supported under Windows NT/2000/XP +// (Windows 9x doesn't support it and the programs compiled in Unicode mode +// will not run under 9x -- but see wxUSE_UNICODE_MSLU below). +// +// Default is 0 +// +// Recommended setting: 0 (unless you only plan to use Windows NT/2000/XP) +#ifndef wxUSE_UNICODE + #define wxUSE_UNICODE 0 +#endif + +// Set wxUSE_UNICODE_MSLU to 1 if you want to compile wxWidgets in Unicode mode +// and be able to run compiled apps under Windows 9x as well as NT/2000/XP. +// This setting enables use of unicows.dll from MSLU (MS Layer for Unicode, see +// http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx). Note +// that you will have to modify the makefiles to include unicows.lib import +// library as the first library (see installation instructions in install.txt +// to learn how to do it when building the library or samples). +// +// If your compiler doesn't have unicows.lib, you can get a version of it at +// http://libunicows.sourceforge.net +// +// Default is 0 +// +// Recommended setting: 0 (1 if you want to deploy Unicode apps on 9x systems) +#define wxUSE_UNICODE_MSLU 0 + +// Setting wxUSE_WCHAR_T to 1 gives you some degree of Unicode support without +// compiling the program in Unicode mode. More precisely, it will be possible +// to construct wxString from a wide (Unicode) string and convert any wxString +// to Unicode. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_WCHAR_T 0 + +// ---------------------------------------------------------------------------- +// global features +// ---------------------------------------------------------------------------- + +// Compile library in exception-safe mode? If set to 1, the library will try to +// behave correctly in presence of exceptions (even though it still will not +// use the exceptions itself) and notify the user code about any unhandled +// exceptions. If set to 0, propagation of the exceptions through the library +// code will lead to undefined behaviour -- but the code itself will be +// slightly smaller and faster. +// +// Default is 1 +// +// Recommended setting: depends on whether you intend to use C++ exceptions +// in your own code (1 if you do, 0 if you don't) +#define wxUSE_EXCEPTIONS 1 + +// Set wxUSE_EXTENDED_RTTI to 1 to use extended RTTI +// +// Default is 0 +// +// Recommended setting: 0 +#define wxUSE_EXTENDED_RTTI 0 + +#if defined(__BORLANDC__) +#undef wxUSE_EXTENDED_RTTI +#define wxUSE_EXTENDED_RTTI 1 +#endif + +// 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 0 + +// Recommended setting: 1 +#define wxUSE_LOGWINDOW 0 + +// Recommended setting: 1 +#define wxUSE_LOGGUI 0 + +// Recommended setting: 1 +#define wxUSE_LOG_DIALOG 0 + +// 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 0 + +// Support for multithreaded applications: if 1, compile in thread classes +// (thread.h) and make the library a bit more thread safe. Although thread +// support is quite stable by now, you may still consider recompiling the +// library without it if you have no use for it - this will result in a +// somewhat smaller and faster operation. +// +// This is ignored under Win16, threads are only supported under Win32. +// +// Default is 1 +// +// Recommended setting: 0 unless you do plan to develop MT applications +#define wxUSE_THREADS 0 + +// If enabled (1), compiles wxWidgets streams classes +#define wxUSE_STREAMS 0 + +// Use standard C++ streams if 1. If 0, use wxWin streams implementation. +#define wxUSE_STD_IOSTREAM 0 + +// ---------------------------------------------------------------------------- +// non GUI features selection +// ---------------------------------------------------------------------------- + +// Set wxUSE_LONGLONG to 1 to compile the wxLongLong class. This is a 64 bit +// integer which is implemented in terms of native 64 bit integers if any or +// uses emulation otherwise. +// +// This class is required by wxDateTime and so you should enable it if you want +// to use wxDateTime. For most modern platforms, it will use the native 64 bit +// integers in which case (almost) all of its functions are inline and it +// almost does not take any space, so there should be no reason to switch it +// off. +// +// Recommended setting: 1 +#define wxUSE_LONGLONG 1 + +// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level +// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions. +// +// Default is 1 +// +// Recommended setting: 1 (wxFile is highly recommended as it is required by +// i18n code, wxFileConfig and others) +#define wxUSE_FILE 0 +#define wxUSE_FFILE 0 + +// 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 0 + +// use wxTextBuffer class: required by wxTextFile +#define wxUSE_TEXTBUFFER 0 + +// use wxTextFile class: requires wxFile and wxTextBuffer, required by +// wxFileConfig +#define wxUSE_TEXTFILE 0 + +// i18n support: _() macro, wxLocale class. Requires wxTextFile. +#define wxUSE_INTL 0 + +// 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 0 + +// Set wxUSE_TIMER to 1 to compile wxTimer class +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_TIMER 0 + +// Use wxStopWatch clas. +// +// Default is 1 +// +// Recommended setting: 1 (needed by wxSocket) +#define wxUSE_STOPWATCH 0 + +// 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 0 + +// 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 0 + +// 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 0 + +// 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 0 + +// experimental, don't use for now +#define wxUSE_DYNAMIC_LOADER 0 + +// Set to 1 to use socket classes +#define wxUSE_SOCKETS 0 + +// Set to 1 to enable virtual file systems (required by wxHTML) +#define wxUSE_FILESYSTEM 0 + +// Set to 1 to enable virtual ZIP filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_ZIP 0 + +// Set to 1 to enable virtual Internet filesystem (requires wxUSE_FILESYSTEM) +#define wxUSE_FS_INET 0 + +// Set to 1 to compile wxZipInput/OutputStream classes. +#define wxUSE_ZIPSTREAM 0 + +// Set to 1 to compile wxZlibInput/OutputStream classes. Also required by +// wxUSE_LIBPNG +#define wxUSE_ZLIB 0 + +// 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 0 + +// Joystick support class +#define wxUSE_JOYSTICK 0 + +// wxFontMapper class +#define wxUSE_FONTMAP 0 + +// wxMimeTypesManager class +#define wxUSE_MIMETYPE 0 + +// 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 0 + +// The settings for the individual URL schemes +#define wxUSE_PROTOCOL_FILE 0 +#define wxUSE_PROTOCOL_FTP 0 +#define wxUSE_PROTOCOL_HTTP 0 + +// Define this to use wxURL class. +#define wxUSE_URL 0 + +// 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 regular expression matching via wxRegEx class: enable this to +// use POSIX regular expressions in your code. You need to compile regex +// library from src/regex to use it under Windows. +// +// Default is 0 +// +// Recommended setting: 1 if your compiler supports it, if it doesn't please +// contribute us a makefile for src/regex for it +#define wxUSE_REGEX 0 + +// wxSystemOptions class +#define wxUSE_SYSTEM_OPTIONS 0 + +// wxSound class +#define wxUSE_SOUND 0 + +// Use wxWidget's XRC XML-based resource system. Recommended. +// +// Default is 1 +// +// Recommended setting: 1 (requires wxUSE_XML) +#define wxUSE_XRC 0 + +// XML parsing classes. Note that their API will change in the future, so +// using wxXmlDocument and wxXmlNode in your app is not recommended. +// +// Default is 1 +// +// Recommended setting: 1 (required by XRC) +#if wxUSE_XRC +# define wxUSE_XML 1 +#else +# define wxUSE_XML 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 0 + +// 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 0 + +// 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_BUTTON 0 // wxButton +#define wxUSE_BMPBUTTON 0 // wxBitmapButton +#define wxUSE_CALENDARCTRL 0 // wxCalendarCtrl +#define wxUSE_CHECKBOX 0 // wxCheckBox +#define wxUSE_CHECKLISTBOX 0 // wxCheckListBox (requires wxUSE_OWNER_DRAWN) +#define wxUSE_CHOICE 0 // wxChoice +#define wxUSE_COMBOBOX 0 // wxComboBox +#define wxUSE_GAUGE 0 // wxGauge +#define wxUSE_LISTBOX 0 // wxListBox +#define wxUSE_LISTCTRL 0 // wxListCtrl +#define wxUSE_RADIOBOX 0 // wxRadioBox +#define wxUSE_RADIOBTN 0 // wxRadioButton +#define wxUSE_SCROLLBAR 0 // wxScrollBar +#define wxUSE_SLIDER 0 // wxSlider +#define wxUSE_SPINBTN 0 // wxSpinButton +#define wxUSE_SPINCTRL 0 // wxSpinCtrl +#define wxUSE_STATBOX 0 // wxStaticBox +#define wxUSE_STATLINE 0 // wxStaticLine +#define wxUSE_STATTEXT 0 // wxStaticText +#define wxUSE_STATBMP 0 // wxStaticBitmap +#define wxUSE_TEXTCTRL 0 // wxTextCtrl +#define wxUSE_TOGGLEBTN 0 // requires wxButton +#define wxUSE_TREECTRL 0 // wxTreeCtrl + +// Use a status bar class? Depending on the value of wxUSE_NATIVE_STATUSBAR +// below either wxStatusBar95 or a generic wxStatusBar will be used. +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_STATUSBAR 1 + +// Two status bar implementations are available under Win32: the generic one +// or the wrapper around native control. For native look and feel the native +// version should be used. +// +// Default is 1. +// +// Recommended setting: 1 (there is no advantage in using the generic one) +#define wxUSE_NATIVE_STATUSBAR 1 + +// wxToolBar related settings: if wxUSE_TOOLBAR is 0, don't compile any toolbar +// classes at all. Otherwise, use the native toolbar class unless +// wxUSE_TOOLBAR_NATIVE is 0. +// +// Default is 1 for all settings. +// +// Recommended setting: 1 for wxUSE_TOOLBAR and wxUSE_TOOLBAR_NATIVE. +#define wxUSE_TOOLBAR 0 +#define wxUSE_TOOLBAR_NATIVE 0 + +// wxNotebook is a control with several "tabs" located on one of its sides. It +// may be used ot logically organise the data presented to the user instead of +// putting everything in one huge dialog. It replaces wxTabControl and related +// classes of wxWin 1.6x. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_NOTEBOOK 0 + +// wxListbook control is similar to wxNotebook but uses wxListCtrl instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_LISTBOOK 0 + +// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of +// the tabs +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CHOICEBOOK 0 + +// wxTabDialog is a generic version of wxNotebook but it is incompatible with +// the new class. It shouldn't be used in new code. +// +// Default is 0. +// +// Recommended setting: 0 (use wxNotebook) +#define wxUSE_TAB_DIALOG 0 + +// wxGrid class +// +// Default is 1 for both options. +// +// Recommended setting: 1 +// +#define wxUSE_GRID 0 + +// ---------------------------------------------------------------------------- +// Miscellaneous GUI stuff +// ---------------------------------------------------------------------------- + +// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar) +#define wxUSE_ACCEL 0 + +// Hotkey support (currently Windows only) +#define wxUSE_HOTKEY 0 + +// 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 0 + +// Use wxDisplay class: it allows enumerating all displays on a system and +// working with them. +// +// Default is 0 because it isn't yet implemented on all platforms +// +// Recommended setting: 1 if you need it, can be safely set to 0 otherwise +#define wxUSE_DISPLAY 0 + +// Miscellaneous geometry code: needed for Canvas library +#define wxUSE_GEOMETRY 0 + +// 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 0 + +// Use wxMenu, wxMenuBar, wxMenuItem. +// +// Default is 1. +// +// Recommended setting: 1 (can't be disabled under MSW) +#define wxUSE_MENUS 1 + +// Use wxSashWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SASH 0 + +// Use wxSplitterWindow class. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_SPLITTER 0 + +// Use wxToolTip and wxWindow::Set/GetToolTip() methods. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_TOOLTIPS 0 + +// wxValidator class and related methods +#define wxUSE_VALIDATORS 0 + +// wxDC cacheing implementation +#define wxUSE_DC_CACHEING 0 + +// Set this to 1 to enable the use of DIB's for wxBitmap to support +// bitmaps > 16MB on Win95/98/Me. Set to 0 to use DDB's only. +#define wxUSE_DIB_FOR_BITMAP 0 + +// Set this to 1 to enable wxDIB +#define wxUSE_WXDIB 0 + +// ---------------------------------------------------------------------------- +// common dialogs +// ---------------------------------------------------------------------------- + +// On rare occasions (e.g. using DJGPP) may want to omit common dialogs (e.g. +// file selector, printer dialog). Switching this off also switches off the +// printing architecture and interactive wxPrinterDC. +// +// Default is 1 +// +// Recommended setting: 1 (unless it really doesn't work) +#define wxUSE_COMMON_DIALOGS 0 + +// wxBusyInfo displays window with message when app is busy. Works in same way +// as wxBusyCursor +#define wxUSE_BUSYINFO 0 + +// Use single/multiple choice dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_CHOICEDLG 0 + +// Use colour picker dialog +// +// Default is 1 +// +// Recommended setting: 1 +#define wxUSE_COLOURDLG 0 + +// wxDirDlg class for getting a directory name from user +#define wxUSE_DIRDLG 0 + +// 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 0 + +// Use find/replace dialogs. +// +// Default is 1 +// +// Recommended setting: 1 (but may be safely set to 0) +#define wxUSE_FINDREPLDLG 0 + +// Use font picker dialog +// +// Default is 1 +// +// Recommended setting: 1 (used in the library itself) +#define wxUSE_FONTDLG 0 + +// 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 0 + +// support for startup tips (wxShowTip &c) +#define wxUSE_STARTUP_TIPS 0 + +// text entry dialog and wxGetTextFromUser function +#define wxUSE_TEXTDLG 0 + +// number entry dialog +#define wxUSE_NUMBERDLG 0 + +// splash screen class +#define wxUSE_SPLASH 0 + +// wizards +#define wxUSE_WIZARDDLG 0 + +// ---------------------------------------------------------------------------- +// 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 0 +#define wxUSE_ENH_METAFILE 0 +#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 0 + +// Set to 0 to disable document/view architecture +#define wxUSE_DOC_VIEW_ARCHITECTURE 0 + +// Set to 0 to disable MDI document/view architecture +// +// Requires wxUSE_MDI && wxUSE_DOC_VIEW_ARCHITECTURE +#define wxUSE_MDI_ARCHITECTURE 0 + +// Set to 0 to disable print/preview architecture code +#define wxUSE_PRINTING_ARCHITECTURE 0 + +// 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 0 + +// 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 + +// ---------------------------------------------------------------------------- +// Data transfer +// ---------------------------------------------------------------------------- + +// Use wxClipboard class for clipboard copy/paste. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_CLIPBOARD 0 + +// Use wxDataObject and related classes. Needed for clipboard and OLE drag and +// drop +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_DATAOBJ 0 + +// 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 0 + +// 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 (it is only available under Win32) +// +// Default is 1 +// +// Recommended setting: 1 (the class is tiny, disabling it won't save much +// space) +#define wxUSE_SNGLINST_CHECKER 0 + +#define wxUSE_DRAGIMAGE 0 + +#define wxUSE_IPC 0 + // 0 for no interprocess comms +#define wxUSE_HELP 0 + // 0 for no help facility +#define wxUSE_MS_HTML_HELP 0 + // 0 for no MS HTML Help + +// Use wxHTML-based help controller? +#define wxUSE_WXHTML_HELP 0 + +#define wxUSE_RESOURCES 0 + // 0 for no wxGetResource/wxWriteResource +#define wxUSE_CONSTRAINTS 0 + // 0 for no window layout constraint system + +#define wxUSE_SPLINES 0 + // 0 for no splines + +#define wxUSE_MOUSEWHEEL 0 + // Include mouse wheel support + +// ---------------------------------------------------------------------------- +// postscript support settings +// ---------------------------------------------------------------------------- + +// Set to 1 for PostScript device context. +#define wxUSE_POSTSCRIPT 0 + +// Set to 1 to use font metric files in GetTextExtent +#define wxUSE_AFM_FOR_POSTSCRIPT 0 + +// Set to 0 to disable PostScript print/preview architecture code under Windows +// (just use Windows printing). +#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0 + +// ---------------------------------------------------------------------------- +// database classes +// ---------------------------------------------------------------------------- + +// Define 1 to use ODBC classes +#define wxUSE_ODBC 0 + +// For backward compatibility reasons, this parameter now only controls the +// default scrolling method used by cursors. This default behavior can be +// overriden by setting the second param of wxDB::wxDbGetConnection() or +// wxDb() constructor to indicate whether the connection (and any wxDbTable()s +// that use the connection) should support forward only scrolling of cursors, +// or both forward and backward support for backward scrolling cursors is +// dependent on the data source as well as the ODBC driver being used. +#define wxODBC_FWD_ONLY_CURSORS 0 + +// Default is 0. Set to 1 to use the deprecated classes, enum types, function, +// member variables. With a setting of 1, full backward compatability with the +// 2.0.x release is possible. It is STRONGLY recommended that this be set to 0, +// as future development will be done only on the non-deprecated +// functions/classes/member variables/etc. +#define wxODBC_BACKWARD_COMPATABILITY 0 + +// ---------------------------------------------------------------------------- +// other compiler (mis)features +// ---------------------------------------------------------------------------- + +// Set this to 0 if your compiler can't cope with omission of prototype +// parameters. +// +// Default is 1. +// +// Recommended setting: 1 (should never need to set this to 0) +#define REMOVE_UNUSED_ARG 1 + +// VC++ 4.2 and above allows and but you can't mix +// them. Set to 1 for , 0 for . Note that VC++ 7.1 +// and later doesn't support wxUSE_IOSTREAMH == 1 and so will be +// used anyhow. +// +// Default is 1. +// +// Recommended setting: whatever your compiler likes more +#define wxUSE_IOSTREAMH 1 + +// ---------------------------------------------------------------------------- +// 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 0 + +// Set to 1 for PNG format support (requires libpng). Also requires wxUSE_ZLIB. +#define wxUSE_LIBPNG 0 + +// Set to 1 for JPEG format support (requires libjpeg) +#define wxUSE_LIBJPEG 0 + +// Set to 1 for TIFF format support (requires libtiff) +#define wxUSE_LIBTIFF 0 + +// Set to 1 for GIF format support +#define wxUSE_GIF 0 + +// Set to 1 for PNM format support +#define wxUSE_PNM 0 + +// Set to 1 for PCX format support +#define wxUSE_PCX 0 + +// Set to 1 for IFF format support (Amiga format) +#define wxUSE_IFF 0 + +// Set to 1 for XPM format support +#define wxUSE_XPM 0 + +// Set to 1 for MS Icons and Cursors format support +#define wxUSE_ICO_CUR 0 + +// Set to 1 to compile in wxPalette class +#define wxUSE_PALETTE 0 + +// ---------------------------------------------------------------------------- +// Windows-only settings +// ---------------------------------------------------------------------------- + +// Set this to 1 if you want to use wxWidgets and MFC in the same program. This +// will override some other settings (see below) +// +// Default is 0. +// +// Recommended setting: 0 unless you really have to use MFC +#define wxUSE_MFC 0 + +// Set this to 1 for generic OLE support: this is required for drag-and-drop, +// clipboard, OLE Automation. Only set it to 0 if your compiler is very old and +// can't compile/doesn't have the OLE headers. +// +// Default is 1. +// +// Recommended setting: 1 +#define wxUSE_OLE 0 + +// Set this to 1 to use Microsoft CTL3D library for "3D-look" under Win16 or NT +// 3.x. This setting is ignored under Win9x and NT 4.0+. +// +// Default is 0 for (most) Win32 (systems), 1 for Win16 +// +// Recommended setting: same as default +#if defined(__WIN95__) +#define wxUSE_CTL3D 0 +#else +#define wxUSE_CTL3D 0 +#endif + +// Define as 1 to use Microsoft's ItsyBitsy small title bar library, for +// wxMiniFrame. This setting is only used for Win3.1; Win9x and NT use native +// miniframes support instead. +// +// Default is 0 for (most) Win32 (systems), 1 for Win16 +// +#define wxUSE_ITSY_BITSY 0 + +// Set this to 1 to use RICHEDIT controls for wxTextCtrl with style wxTE_RICH +// which allows to put more than ~32Kb of text in it even under Win9x (NT +// doesn't have such limitation). +// +// Default is 1 for compilers which support it +// +// Recommended setting: 1, only set it to 0 if your compiler doesn't have +// or can't compile +#if defined(__WIN95__) && !defined(__WINE__) && !defined(__GNUWIN32_OLD__) +#define wxUSE_RICHEDIT 0 + +// TODO: This should be ifdef'ed for any compilers that don't support +// RichEdit 2.0 but do have RichEdit 1.0... +#define wxUSE_RICHEDIT2 0 + +#else +#define wxUSE_RICHEDIT 0 +#define wxUSE_RICHEDIT2 0 +#endif + +// Set this to 1 to enable support for the owner-drawn menu and listboxes. This +// is required by wxUSE_CHECKLISTBOX. +// +// Default is 1. +// +// Recommended setting: 1, set to 0 for a small library size reduction +#define wxUSE_OWNER_DRAWN 0 + +// Set to 1 to compile MS Windows XP theme engine support +#define wxUSE_UXTHEME 0 + +// Set to 1 to auto-adapt to MS Windows XP themes where possible +// (notably, wxNotebook pages) +#define wxUSE_UXTHEME_AUTO 0 + +// ---------------------------------------------------------------------------- +// obsolete settings +// ---------------------------------------------------------------------------- + +// NB: all settings in this section are obsolete and should not be used/changed +// at all, they will disappear + +// Set to 1 to use PenWindows +#define wxUSE_PENWINDOWS 0 + +// Define 1 to use bitmap messages. +#define wxUSE_BITMAP_MESSAGE 0 + +// If 1, enables provision of run-time type information. +// NOW MANDATORY: don't change. +#define wxUSE_DYNAMIC_CLASSES 1 + +#endif + // _WX_SETUP_H_ diff --git a/include/wx/palmos/slider.h b/include/wx/palmos/slider.h new file mode 100644 index 0000000000..698e532c95 --- /dev/null +++ b/include/wx/palmos/slider.h @@ -0,0 +1,108 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/slider95.h +// Purpose: wxSlider class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _SLIDER95_H_ +#define _SLIDER95_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "slider95.h" +#endif + +// Slider +class WXDLLEXPORT wxSlider : public wxSliderBase +{ +public: + wxSlider(); + + wxSlider(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr) + { + Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); + } + + ~wxSlider(); + + bool Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSL_HORIZONTAL, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSliderNameStr); + + virtual int GetValue() const; + virtual void SetValue(int); + + void GetPosition(int *x, int *y) const; + + bool Show(bool show = TRUE); + + void SetRange(int minValue, int maxValue); + + int GetMin() const { return m_rangeMin; } + int GetMax() const { return m_rangeMax; } + + // For trackbars only + void SetTickFreq(int n, int pos); + 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); + + // IMPLEMENTATION + WXHWND GetStaticMin() const { return m_staticMin; } + WXHWND GetStaticMax() const { return m_staticMax; } + WXHWND GetEditValue() const { return m_staticValue; } + virtual bool ContainsHWND(WXHWND hWnd) const; + + void Command(wxCommandEvent& event); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + +protected: + WXHWND m_staticMin; + WXHWND m_staticMax; + WXHWND m_staticValue; + int m_rangeMin; + int m_rangeMax; + int m_pageSize; + int m_lineSize; + int m_tickFreq; + + virtual void DoGetSize(int *width, int *height) const; + + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + + virtual wxSize DoGetBestSize() const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) +}; + +#endif + // _SLIDER95_H_ diff --git a/include/wx/palmos/sound.h b/include/wx/palmos/sound.h new file mode 100644 index 0000000000..d77ffa6f76 --- /dev/null +++ b/include/wx/palmos/sound.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: sound.h +// Purpose: wxSound class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SOUND_H_ +#define _WX_SOUND_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "sound.h" +#endif + +#if wxUSE_SOUND + +#include "wx/object.h" + +class WXDLLIMPEXP_ADV wxSound : public wxSoundBase +{ +public: + wxSound(); + wxSound(const wxString& fileName, bool isResource = false); + wxSound(int size, const wxByte* data); + ~wxSound(); + +public: + // Create from resource or file + bool Create(const wxString& fileName, bool isResource = false); + // Create from data + bool Create(int size, const wxByte* data); + + bool IsOk() const { return (m_waveData ? true : false); }; + + static void Stop(); + +protected: + bool Free(); + + bool DoPlay(unsigned flags) const; + +private: + wxByte* m_waveData; + int m_waveLength; + bool m_isResource; + + DECLARE_NO_COPY_CLASS(wxSound) +}; +#endif +#endif + diff --git a/include/wx/palmos/spinbutt.h b/include/wx/palmos/spinbutt.h new file mode 100644 index 0000000000..6e1931bfa3 --- /dev/null +++ b/include/wx/palmos/spinbutt.h @@ -0,0 +1,70 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/spinbutt.h +// Purpose: wxSpinButton class +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_SPINBUTT_H_ +#define _WX_SPINBUTT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "spinbutt.h" +#endif + +#include "wx/control.h" +#include "wx/event.h" + +class WXDLLEXPORT wxSpinButton : public wxSpinButtonBase +{ +public: + // construction + wxSpinButton() { } + + wxSpinButton(wxWindow *parent, + wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxSP_VERTICAL | wxSP_ARROW_KEYS, + const wxString& name = wxSPIN_BUTTON_NAME) + { + 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 = wxSPIN_BUTTON_NAME); + + + // accessors + virtual int GetValue() const; + virtual void SetValue(int val); + virtual void SetRange(int minVal, int maxVal); + + // implementation + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + virtual bool MSWOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control); + + // a wxSpinButton can't do anything useful with focus, only wxSpinCtrl can + virtual bool AcceptsFocus() const { return FALSE; } + +protected: + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxSpinButton) +}; + +#endif + // _WX_SPINBUTT_H_ diff --git a/include/wx/palmos/spinctrl.h b/include/wx/palmos/spinctrl.h new file mode 100644 index 0000000000..dfb88a09fd --- /dev/null +++ b/include/wx/palmos/spinctrl.h @@ -0,0 +1,121 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: palmos/spinctrl.h +// Purpose: wxSpinCtrl class declaration for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_SPINCTRL_H_ +#define _WX_PALMOS_SPINCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "spinctrl.h" +#endif + +#include "wx/spinbutt.h" // the base class + +#include "wx/dynarray.h" + +class WXDLLEXPORT wxSpinCtrl; +WX_DEFINE_EXPORTED_ARRAY_PTR(wxSpinCtrl *, wxArraySpins); + +// ---------------------------------------------------------------------------- +// Under Win32, wxSpinCtrl is a wxSpinButton with a buddy (as MSDN docs call +// it) text window whose contents is automatically updated when the spin +// control is clicked. +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSpinCtrl : public wxSpinButton +{ +public: + wxSpinCtrl() { } + + 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")); + + // a wxTextCtrl-like method (but we can't have GetValue returning wxString + // because the base class already has one returning int!) + void SetValue(const wxString& text); + + // another wxTextCtrl-like method + void SetSelection(long from, long to); + + // implementation only from now on + // ------------------------------- + + virtual ~wxSpinCtrl(); + + virtual void SetValue(int val) { wxSpinButton::SetValue(val); } + virtual int GetValue() const; + virtual bool SetFont(const wxFont &font); + virtual void SetFocus(); + + virtual bool Enable(bool enable = TRUE); + virtual bool Show(bool show = TRUE); + + // wxSpinButton doesn't accept focus, but we do + virtual bool AcceptsFocus() const { return wxWindow::AcceptsFocus(); } + + // for internal use only + + // get the subclassed window proc of the buddy text + WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } + + // return the spinctrl object whose buddy is the given window or NULL + static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); + + // process a WM_COMMAND generated by the buddy text control + bool ProcessTextCommand(WXWORD cmd, WXWORD id); + +protected: + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoMoveWindow(int x, int y, int width, int height); + virtual wxSize DoGetBestSize() const; + virtual void DoGetSize(int *width, int *height) const; + + // the handler for wxSpinButton events + void OnSpinChange(wxSpinEvent& event); + + // Handle processing of special keys + void OnChar(wxKeyEvent& event); + void OnSetFocus(wxFocusEvent& event); + + // the data for the "buddy" text ctrl + WXHWND m_hwndBuddy; + WXFARPROC m_wndProcBuddy; + + // all existing wxSpinCtrls - this allows to find the one corresponding to + // the given buddy window in GetSpinForTextCtrl() + static wxArraySpins ms_allSpins; + +private: + DECLARE_DYNAMIC_CLASS(wxSpinCtrl) + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxSpinCtrl) +}; + +#endif // _WX_PALMOS_SPINCTRL_H_ + + diff --git a/include/wx/palmos/statbmp.h b/include/wx/palmos/statbmp.h new file mode 100644 index 0000000000..93b4dc2cb2 --- /dev/null +++ b/include/wx/palmos/statbmp.h @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/statbmp.h +// Purpose: wxStaticBitmap class for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBMP_H_ +#define _WX_STATBMP_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "statbmp.h" +#endif + +#include "wx/control.h" +#include "wx/icon.h" +#include "wx/bitmap.h" + +WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr; + +// a control showing an icon or a bitmap +class WXDLLEXPORT wxStaticBitmap : public wxStaticBitmapBase +{ +public: + wxStaticBitmap() { Init(); } + + wxStaticBitmap(wxWindow *parent, + wxWindowID id, + const wxGDIImage& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr) + { + Init(); + + Create(parent, id, label, pos, size, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxGDIImage& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxStaticBitmapNameStr); + + virtual ~wxStaticBitmap() { Free(); } + + virtual void SetIcon(const wxIcon& icon) { SetImage(&icon); } + virtual void SetBitmap(const wxBitmap& bitmap) { SetImage(&bitmap); } + + // assert failure is provoked by an attempt to get an icon from bitmap or + // vice versa + wxIcon GetIcon() const + { + wxASSERT_MSG( m_isIcon, _T("no icon in this wxStaticBitmap") ); + + return *(wxIcon *)m_image; + } + + wxBitmap GetBitmap() const + { + wxASSERT_MSG( !m_isIcon, _T("no bitmap in this wxStaticBitmap") ); + + return *(wxBitmap *)m_image; + } + + // implementation only from now on + // ------------------------------- + + // implement base class virtuals + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + +protected: + virtual wxBorder GetDefaultBorder() const; + virtual wxSize DoGetBestSize() const; + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + // ctor/dtor helpers + void Init() { m_isIcon = TRUE; m_image = NULL; } + void Free(); + + // TRUE if icon/bitmap is valid + bool ImageIsOk() const; + + void SetImage(const wxGDIImage* image); + void SetImageNoCopy( wxGDIImage* image ); + + // we can have either an icon or a bitmap + bool m_isIcon; + wxGDIImage *m_image; + +private: + DECLARE_DYNAMIC_CLASS(wxStaticBitmap) + DECLARE_NO_COPY_CLASS(wxStaticBitmap) +}; + +#endif + // _WX_STATBMP_H_ diff --git a/include/wx/palmos/statbox.h b/include/wx/palmos/statbox.h new file mode 100644 index 0000000000..d6d82e0501 --- /dev/null +++ b/include/wx/palmos/statbox.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbox.h +// Purpose: wxStaticBox class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATBOX_H_ +#define _WX_STATBOX_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "statbox.h" +#endif + +// Group box +class WXDLLEXPORT wxStaticBox : public wxStaticBoxBase +{ +public: + wxStaticBox() { } + + 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); + + // implementation from now on + // -------------------------- + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return FALSE; } + +protected: + virtual wxSize DoGetBestSize() const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticBox) +}; + +#endif + // _WX_STATBOX_H_ diff --git a/include/wx/palmos/statline.h b/include/wx/palmos/statline.h new file mode 100644 index 0000000000..bccb0e8595 --- /dev/null +++ b/include/wx/palmos/statline.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/statline.h +// Purpose: Palm OS version of wxStaticLine class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_STATLINE_H_ +#define _WX_MSW_STATLINE_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface +#endif + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxStaticLine : public wxStaticLineBase +{ +public: + // constructors and pseudo-constructors + wxStaticLine() { } + + wxStaticLine( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ) + { + Create(parent, id, pos, size, style, name); + } + + bool Create( wxWindow *parent, + wxWindowID id, + const wxPoint &pos = wxDefaultPosition, + const wxSize &size = wxDefaultSize, + long style = wxLI_HORIZONTAL, + const wxString &name = wxStaticTextNameStr ); + + // overriden base class virtuals + virtual bool AcceptsFocus() const { return FALSE; } + +protected: + // usually overridden base class virtuals + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticLine) +}; + +#endif // _WX_MSW_STATLINE_H_ + + diff --git a/include/wx/palmos/stattext.h b/include/wx/palmos/stattext.h new file mode 100644 index 0000000000..8b8534bb81 --- /dev/null +++ b/include/wx/palmos/stattext.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/stattext.h +// Purpose: wxStaticText class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATTEXT_H_ +#define _WX_STATTEXT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "stattext.h" +#endif + +class WXDLLEXPORT wxStaticText : public wxStaticTextBase +{ +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); + + // override some methods to resize the window properly + virtual void SetLabel(const wxString& label); + virtual bool SetFont( const wxFont &font ); + +protected: + // implement/override some base class virtuals + virtual wxBorder GetDefaultBorder() const; + virtual void DoSetSize(int x, int y, int w, int h, + int sizeFlags = wxSIZE_AUTO); + virtual wxSize DoGetBestSize() const; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText) +}; + +#endif + // _WX_STATTEXT_H_ diff --git a/include/wx/palmos/statusbr.h b/include/wx/palmos/statusbr.h new file mode 100644 index 0000000000..485e9a1b7b --- /dev/null +++ b/include/wx/palmos/statusbr.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/statusbr.h +// Purpose: Palm OS implementation of wxStatusBar +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_STATUSBR_H_ +#define _WX_STATUSBR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "statusbr.h" +#endif + +#if wxUSE_NATIVE_STATUSBAR + +class WXDLLEXPORT wxStatusBarPalm : public wxStatusBarBase +{ +public: + // ctors and such + wxStatusBarPalm(); + wxStatusBarPalm(wxWindow *parent, + wxWindowID id = -1, + long style = wxST_SIZEGRIP, + const wxString& name = wxEmptyString) + { + (void)Create(parent, id, style, name); + } + + bool Create(wxWindow *parent, + wxWindowID id = -1, + long style = wxST_SIZEGRIP, + const wxString& name = wxEmptyString); + + virtual ~wxStatusBarPalm(); + + // a status line can have several (<256) fields numbered from 0 + virtual void SetFieldsCount(int number = 1, const int *widths = NULL); + + // each field of status line has it's own text + virtual void SetStatusText(const wxString& text, int number = 0); + virtual wxString GetStatusText(int number = 0) const; + + // set status line fields' widths + virtual void SetStatusWidths(int n, const int widths_field[]); + + // sets the minimal vertical size of the status bar + virtual void SetMinHeight(int height); + + // get the position and size of the field's internal bounding rectangle + virtual bool GetFieldRect(int i, wxRect& rect) const; + + // get the border size + virtual int GetBorderX() const; + virtual int GetBorderY() const; + + void DrawStatusBar(); + +protected: + void CopyFieldsWidth(const int widths[]); + void SetFieldsWidth(); + + // store the text in the status bar + wxListString **StatusTextBuffer; + void SetStatusBufferText(const wxString& text, int number); + wxString GetStatusBufferText(int number); + wxListString *GetOrCreateStatusBuffer(int i); + wxListString *GetStatusBufferStack(int i) const; + void DeleteStatusBuffer(); + + // override base class virtual + void DoMoveWindow(int x, int y, int width, int height); + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarPalm) +}; + +#endif // wxUSE_NATIVE_STATUSBAR + +#endif diff --git a/include/wx/palmos/tabctrl.h b/include/wx/palmos/tabctrl.h new file mode 100644 index 0000000000..53095f163b --- /dev/null +++ b/include/wx/palmos/tabctrl.h @@ -0,0 +1,164 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tabctrl.h +// Purpose: wxTabCtrl class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TABCTRL_H_ +#define _WX_TABCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "tabctrl.h" +#endif + +class wxImageList; + +// WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr; + +/* + * Flags returned by HitTest + */ + +#define wxTAB_HITTEST_NOWHERE 1 +#define wxTAB_HITTEST_ONICON 2 +#define wxTAB_HITTEST_ONLABEL 4 +#define wxTAB_HITTEST_ONITEM 6 + +class WXDLLEXPORT wxTabCtrl: public wxControl +{ + DECLARE_DYNAMIC_CLASS(wxTabCtrl) + public: + /* + * Public interface + */ + + wxTabCtrl(); + + inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")) + { + Create(parent, id, pos, size, style, name); + } + ~wxTabCtrl(); + +// Accessors + + // Get the selection + int GetSelection() const; + + // Get the tab with the current keyboard focus + int GetCurFocus() const; + + // Get the associated image list + wxImageList* GetImageList() const; + + // Get the number of items + int GetItemCount() const; + + // Get the rect corresponding to the tab + bool GetItemRect(int item, wxRect& rect) const; + + // Get the number of rows + int GetRowCount() const; + + // Get the item text + wxString GetItemText(int item) const ; + + // Get the item image + int GetItemImage(int item) const; + + // Get the item data + void* GetItemData(int item) const; + + // Set the selection + int SetSelection(int item); + + // Set the image list + void SetImageList(wxImageList* imageList); + + // Set the text for an item + bool SetItemText(int item, const wxString& text); + + // Set the image for an item + bool SetItemImage(int item, int image); + + // Set the data for an item + bool SetItemData(int item, void* data); + + // Set the size for a fixed-width tab control + void SetItemSize(const wxSize& size); + + // Set the padding between tabs + void SetPadding(const wxSize& padding); + +// Operations + + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = wxT("tabCtrl")); + + // Delete all items + bool DeleteAllItems(); + + // Delete an item + bool DeleteItem(int item); + + // Hit test + int HitTest(const wxPoint& pt, long& flags); + + // Insert an item + bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL); + + // Implementation + + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); + +protected: + wxImageList* m_imageList; + +DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxTabCtrl) +}; + +class WXDLLEXPORT 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/palmos/taskbar.h b/include/wx/palmos/taskbar.h new file mode 100644 index 0000000000..e6063d182f --- /dev/null +++ b/include/wx/palmos/taskbar.h @@ -0,0 +1,86 @@ +///////////////////////////////////////////////////////////////////////// +// File: wx/palmos/taskbar.h +// Purpose: Defines wxTaskBarIcon class for manipulating icons on the +// task bar. +// Author: Julian Smart +// Modified by: Vaclav Slavik +// Created: 24/3/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifndef _TASKBAR_H_ +#define _TASKBAR_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "taskbar.h" +#endif + +#include "wx/icon.h" + +// private helper class: +class WXDLLIMPEXP_ADV wxTaskBarIconWindow; + +class WXDLLIMPEXP_ADV wxTaskBarIcon: public wxTaskBarIconBase +{ + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon) +public: + wxTaskBarIcon(); + virtual ~wxTaskBarIcon(); + +// Accessors + inline bool IsOk() const { return true; } + inline bool IsIconInstalled() const { return m_iconAdded; } + +// Operations + bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString); + bool RemoveIcon(void); + bool PopupMenu(wxMenu *menu); //, int x, int y); + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool IsOK() const ); + +// Overridables + virtual void OnMouseMove(wxEvent&); + virtual void OnLButtonDown(wxEvent&); + virtual void OnLButtonUp(wxEvent&); + virtual void OnRButtonDown(wxEvent&); + virtual void OnRButtonUp(wxEvent&); + virtual void OnLButtonDClick(wxEvent&); + virtual void OnRButtonDClick(wxEvent&); +#endif + +// Implementation +protected: + friend class wxTaskBarIconWindow; + long WindowProc(unsigned int msg, unsigned int wParam, long lParam); + void RegisterWindowMessages(); + +// Data members +protected: + wxTaskBarIconWindow *m_win; + bool m_iconAdded; + wxIcon m_icon; + wxString m_strTooltip; + +#if WXWIN_COMPATIBILITY_2_4 + // non-virtual default event handlers to forward events to the virtuals + void _OnMouseMove(wxTaskBarIconEvent&); + void _OnLButtonDown(wxTaskBarIconEvent&); + void _OnLButtonUp(wxTaskBarIconEvent&); + void _OnRButtonDown(wxTaskBarIconEvent&); + void _OnRButtonUp(wxTaskBarIconEvent&); + void _OnLButtonDClick(wxTaskBarIconEvent&); + void _OnRButtonDClick(wxTaskBarIconEvent&); + + DECLARE_EVENT_TABLE() +#endif +}; + +#if WXWIN_COMPATIBILITY_2_4 +inline bool wxTaskBarIcon::IsOK() const { return IsOk(); } +#endif + +#endif + // _TASKBAR_H_ diff --git a/include/wx/palmos/textctrl.h b/include/wx/palmos/textctrl.h new file mode 100644 index 0000000000..e12608bc79 --- /dev/null +++ b/include/wx/palmos/textctrl.h @@ -0,0 +1,261 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/textctrl.h +// Purpose: wxTextCtrl class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TEXTCTRL_H_ +#define _WX_TEXTCTRL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "textctrl.h" +#endif + +class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase +{ +public: + // creation + // -------- + + 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); + } + ~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); + + // implement base class pure virtuals + // ---------------------------------- + + virtual wxString GetValue() const; + virtual void SetValue(const wxString& value); + + virtual wxString GetRange(long from, long to) 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; + + virtual void GetSelection(long* from, long* to) const; + + // operations + // ---------- + + // editing + virtual void Clear(); + virtual void Replace(long from, long to, const wxString& value); + virtual void Remove(long from, long to); + + // load the controls contents from the file + virtual bool LoadFile(const wxString& file); + + // clears the dirty flag + virtual void MarkDirty(); + virtual void DiscardEdits(); + + virtual void SetMaxLength(unsigned long len); + + // 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); + +#ifdef __WIN32__ + virtual bool EmulateKeyPress(const wxKeyEvent& event); +#endif // __WIN32__ + +#if wxUSE_RICHEDIT + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style); + virtual bool SetDefaultStyle(const wxTextAttr& style); + virtual bool GetStyle(long position, wxTextAttr& style); +#endif // wxUSE_RICHEDIT + + // translate between the position (which is just an index in the text ctrl + // considering all its contents as a single strings) and (x, y) coordinates + // which represent column and line. + virtual long XYToPosition(long x, long y) const; + virtual bool PositionToXY(long pos, long *x, long *y) const; + + virtual void ShowPosition(long pos); + virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, + wxTextCoord *col, + wxTextCoord *row) const; + + // Clipboard operations + virtual void Copy(); + virtual void Cut(); + virtual void Paste(); + + virtual bool CanCopy() const; + virtual bool CanCut() const; + virtual bool CanPaste() const; + + // Undo/redo + virtual void Undo(); + virtual void Redo(); + + virtual bool CanUndo() const; + virtual bool CanRedo() const; + + // Insertion point + virtual void SetInsertionPoint(long pos); + virtual void SetInsertionPointEnd(); + virtual long GetInsertionPoint() const; + virtual long GetLastPosition() const; + + virtual void SetSelection(long from, long to); + virtual void SetEditable(bool editable); + + // Caret handling (Windows only) + + bool ShowNativeCaret(bool show = true); + bool HideNativeCaret() { return ShowNativeCaret(false); } + + // Implementation from now on + // -------------------------- + + virtual void SetWindowStyleFlag(long style); + + virtual void Command(wxCommandEvent& event); + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + +#if wxUSE_RICHEDIT + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + int GetRichVersion() const { return m_verRichEdit; } + bool IsRich() const { return m_verRichEdit != 0; } + + // rich edit controls are not compatible with normal ones and wem ust set + // the colours for them otherwise + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); +#endif // wxUSE_RICHEDIT + + virtual void AdoptAttributesFromHWND(); + + 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); + + // Show a context menu for Rich Edit controls (the standard + // EDIT control has one already) + void OnRightClick(wxMouseEvent& event); + + // be sure the caret remains invisible if the user + // called HideNativeCaret() before + void OnSetFocus(wxFocusEvent& event); + +protected: + // common part of all ctors + void Init(); + + // intercept WM_GETDLGCODE + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // call this to increase the size limit (will do nothing if the current + // limit is big enough) + // + // returns true if we increased the limit to allow entering more text, + // false if we hit the limit set by SetMaxLength() and so didn't change it + bool AdjustSpaceLimit(); + +#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) + // replace the selection or the entire control contents with the given text + // in the specified encoding + bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly); + + // get the contents of the control out as text in the given encoding + wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const; +#endif // wxUSE_RICHEDIT + + // replace the contents of the selection or of the entire control with the + // given text + void DoWriteText(const wxString& text, bool selectionOnly = TRUE); + + // set the selection possibly without scrolling the caret into view + void DoSetSelection(long from, long to, bool scrollCaret = TRUE); + + // return true if there is a non empty selection in the control + bool HasSelection() const; + + // get the length of the line containing the character at the given + // position + long GetLengthOfLineContainingPos(long pos) const; + + // send TEXT_UPDATED event, return TRUE if it was handled, FALSE otherwise + bool SendUpdateEvent(); + + // override some base class virtuals + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); + virtual wxSize DoGetBestSize() const; + + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + +#if wxUSE_RICHEDIT + // we're using RICHEDIT (and not simple EDIT) control if this field is not + // 0, it also gives the version of the RICHEDIT control being used (1, 2 or + // 3 so far) + int m_verRichEdit; +#endif // wxUSE_RICHEDIT + + // if TRUE, SendUpdateEvent() will eat the next event (see comments in the + // code as to why this is needed) + bool m_suppressNextUpdate; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl) + + wxMenu* m_privateContextMenu; + + bool m_isNativeCaretShown; +}; + +#endif + // _WX_TEXTCTRL_H_ diff --git a/include/wx/palmos/tglbtn.h b/include/wx/palmos/tglbtn.h new file mode 100644 index 0000000000..d28f4a7327 --- /dev/null +++ b/include/wx/palmos/tglbtn.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/tglbtn.h +// Purpose: Declaration of the wxToggleButton class, which implements a +// toggle button under Palm OS. +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TOGGLEBUTTON_H_ +#define _WX_TOGGLEBUTTON_H_ + +WXDLLEXPORT_DATA(extern const wxChar*) wxCheckBoxNameStr; + +// Checkbox item (single checkbox) +class WXDLLEXPORT wxToggleButton : public wxControl +{ +public: + wxToggleButton() {} + wxToggleButton(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr) + { + Create(parent, id, label, pos, size, style, validator, name); + } + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxCheckBoxNameStr); + + virtual void SetValue(bool value); + virtual bool GetValue() const ; + + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual void SetLabel(const wxString& label); + virtual void Command(wxCommandEvent& event); + +protected: + virtual wxSize DoGetBestSize() const; + virtual wxBorder GetDefaultBorder() const; + virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) +}; + +#endif // _WX_TOGGLEBUTTON_H_ + diff --git a/include/wx/palmos/timer.h b/include/wx/palmos/timer.h new file mode 100644 index 0000000000..dc2b749db7 --- /dev/null +++ b/include/wx/palmos/timer.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: timer.h +// Purpose: wxTimer class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TIMER_H_ +#define _WX_TIMER_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "timer.h" +#endif + +class WXDLLEXPORT wxTimer : public wxTimerBase +{ +friend void wxProcessTimer(wxTimer& timer); + +public: + wxTimer() { Init(); } + wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) + { Init(); } + ~wxTimer(); + + virtual bool Start(int milliseconds = -1, bool oneShot = FALSE); + virtual void Stop(); + + virtual bool IsRunning() const { return m_id != 0; } + +protected: + void Init(); + + unsigned long m_id; + +private: + DECLARE_DYNAMIC_CLASS_NO_COPY(wxTimer) +}; + +#endif + // _WX_TIMERH_ diff --git a/include/wx/palmos/toolbar.h b/include/wx/palmos/toolbar.h new file mode 100644 index 0000000000..f6e689a8ba --- /dev/null +++ b/include/wx/palmos/toolbar.h @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/toolbar.h +// Purpose: wxToolBar class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TBAR95_H_ +#define _WX_TBAR95_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "toolbar.h" +#endif + +#if wxUSE_TOOLBAR + +#include "wx/dynarray.h" + +class WXDLLEXPORT wxToolBar : public wxToolBarBase +{ +public: + // ctors and dtor + wxToolBar() { Init(); } + + 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); + } + + 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 ~wxToolBar(); + + // override/implement base class virtuals + virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const; + + virtual bool Realize(); + + virtual void SetToolBitmapSize(const wxSize& size); + virtual wxSize GetToolSize() const; + + virtual void SetRows(int nRows); + + // implementation only from now on + // ------------------------------- + + virtual void SetWindowStyleFlag(long style); + + void OnMouseEvent(wxMouseEvent& event); + void OnSysColourChanged(wxSysColourChangedEvent& event); + + void SetFocus() {} + +protected: + // common part of all ctors + void Init(); + + // recreate the control completely + void Recreate(); + + // implement base class pure virtuals + virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool); + virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool); + + virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable); + virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle); + virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle); + + virtual wxToolBarToolBase *CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp); + virtual wxToolBarToolBase *CreateTool(wxControl *control); + + // return the appropriate size and flags for the toolbar control + virtual wxSize DoGetBestSize() const; + + // should be called whenever the toolbar size changes + void UpdateSize(); + + // the big bitmap containing all bitmaps of the toolbar buttons + WXHBITMAP m_hBitmap; + + // the total number of toolbar elements + size_t m_nButtons; + + // the tool the cursor is in + wxToolBarToolBase *m_pInTool; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxToolBar) + DECLARE_NO_COPY_CLASS(wxToolBar) +}; + +#endif // wxUSE_TOOLBAR + +#endif + // _WX_TBAR95_H_ diff --git a/include/wx/palmos/tooltip.h b/include/wx/palmos/tooltip.h new file mode 100644 index 0000000000..229c645b29 --- /dev/null +++ b/include/wx/palmos/tooltip.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/tooltip.h +// Purpose: wxToolTip class - tooltip control +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +class WXDLLEXPORT 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); + + // implementation only from now on + // ------------------------------- + + // should be called in responde to WM_MOUSEMOVE + void RelayEvent(WXMSG *msg); + +private: + // the one and only one tooltip control we use - never access it directly + // but use GetToolTipCtrl() which will create it when needed + static WXHWND ms_hwndTT; + + // create the tooltip ctrl if it doesn't exist yet and return its HWND + static WXHWND GetToolTipCtrl(); + + // remove this tooltip from the tooltip control + void Remove(); + + // add a window to the tooltip control + void Add(WXHWND hwnd); + + wxString m_text; // tooltip text + wxWindow *m_window; // window we're associated with + + DECLARE_ABSTRACT_CLASS(wxToolTip) + DECLARE_NO_COPY_CLASS(wxToolTip) +}; + diff --git a/include/wx/palmos/toplevel.h b/include/wx/palmos/toplevel.h new file mode 100644 index 0000000000..64577fa230 --- /dev/null +++ b/include/wx/palmos/toplevel.h @@ -0,0 +1,146 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/toplevel.h +// Purpose: wxTopLevelWindow +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_PALMOS_TOPLEVEL_H_ +#define _WX_PALMOS_TOPLEVEL_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "toplevel.h" +#endif + +#ifdef __PALMOS__ + #include +#endif + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowPalm +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTopLevelWindowPalm : public wxTopLevelWindowBase +{ +public: + // constructors and such + wxTopLevelWindowPalm() { Init(); } + + wxTopLevelWindowPalm(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); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + wxFrame* PFrame); + + virtual ~wxTopLevelWindowPalm(); + + // implement base class pure virtuals + virtual void Maximize(bool maximize = TRUE); + virtual bool IsMaximized() const; + virtual void Iconize(bool iconize = TRUE); + virtual bool IsIconized() const; + virtual void SetIcon(const wxIcon& icon); + virtual void SetIcons(const wxIconBundle& icons ); + virtual void Restore(); + +#ifndef __WXWINCE__ + virtual bool SetShape(const wxRegion& region); +#endif // __WXWINCE__ + + virtual bool Show(bool show = TRUE); + + virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); + virtual bool IsFullScreen() const { return m_fsIsShowing; } + + // wxPalm only: EnableCloseButton(FALSE) may be used to remove the "Close" + // button from the title bar + bool EnableCloseButton(bool enable = TRUE); + + // implementation from now on + // -------------------------- + + // event handlers + void OnActivate(wxActivateEvent& event); + + // called by wxWindow whenever it gets focus + void SetLastFocus(wxWindow *win) { m_winLastFocused = win; } + wxWindow *GetLastFocus() const { return m_winLastFocused; } + +protected: + // common part of all ctors + void Init(); + + // create a new frame, return FALSE if it couldn't be created + bool CreateFrame(const wxString& title, + const wxPoint& pos, + const wxSize& size); + + // create a new dialog using the given dialog template from resources, + // return FALSE if it couldn't be created + bool CreateDialog(const void *dlgTemplate, + const wxString& title, + const wxPoint& pos, + const wxSize& size); + + // common part of Iconize(), Maximize() and Restore() + void DoShowWindow(int nShowCmd); + + // translate wxWidgets flags to Windows ones + virtual WXDWORD PalmGetStyle(long flags, WXDWORD *exstyle) const; + + // choose the right parent to use with CreateWindow() + virtual WXHWND PalmGetParent() const; + + // is the window 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; + + // Data to save/restore when calling ShowFullScreen + long m_fsStyle; // Passed to ShowFullScreen + wxRect m_fsOldSize; + long m_fsOldWindowStyle; + bool m_fsIsMaximized; + bool m_fsIsShowing; + + // the last focused child: we restore focus to it on activation + wxWindow *m_winLastFocused; + + DECLARE_EVENT_TABLE() + DECLARE_NO_COPY_CLASS(wxTopLevelWindowPalm) +}; + +static Boolean FrameFormHandleEvent(EventType* pEvent); + +#endif // _WX_PALMOS_TOPLEVEL_H_ + diff --git a/include/wx/palmos/treectrl.h b/include/wx/palmos/treectrl.h new file mode 100644 index 0000000000..09811d6c0c --- /dev/null +++ b/include/wx/palmos/treectrl.h @@ -0,0 +1,512 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/treectrl.h +// Purpose: wxTreeCtrl class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREECTRL_H_ +#define _WX_TREECTRL_H_ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "treectrl.h" +#endif + +#if wxUSE_TREECTRL + +#include "wx/textctrl.h" +#include "wx/dynarray.h" +#include "wx/treebase.h" +#include "wx/hashmap.h" + +#ifdef __GNUWIN32__ + // Cygwin windows.h defines these identifiers + #undef GetFirstChild + #undef GetNextSibling +#endif // Cygwin + +// fwd decl +class WXDLLEXPORT wxImageList; +class WXDLLEXPORT wxDragImage; +struct WXDLLEXPORT wxTreeViewItem; + +// NB: all the following flags are for compatbility only and will be removed in the +// next versions + +// flags for deprecated `Expand(int action)' +enum +{ + wxTREE_EXPAND_EXPAND, + wxTREE_EXPAND_COLLAPSE, + wxTREE_EXPAND_COLLAPSE_RESET, + wxTREE_EXPAND_TOGGLE +}; + +// flags for deprecated InsertItem() variant (their values are the same as of +// TVI_FIRST and TVI_LAST) +#define wxTREE_INSERT_FIRST 0xFFFF0001 +#define wxTREE_INSERT_LAST 0xFFFF0002 + +// hash storing attributes for our items +WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); + +// ---------------------------------------------------------------------------- +// wxTreeCtrl +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxTreeCtrl : public wxControl +{ +public: + // creation + // -------- + wxTreeCtrl() { Init(); } + + wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr) + { + Create(parent, id, pos, size, style, validator, name); + } + + virtual ~wxTreeCtrl(); + + bool Create(wxWindow *parent, wxWindowID id = -1, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxTreeCtrlNameStr); + + // accessors + // --------- + + // get the total number of items in the control + size_t GetCount() const; + + // indent is the number of pixels the children are indented relative to + // the parents position. SetIndent() also redraws the control + // immediately. + unsigned int GetIndent() const; + void SetIndent(unsigned int indent); + + // spacing is the number of pixels between the start and the Text + // not implemented under wxMSW + unsigned int GetSpacing() const { return 18; } // return wxGTK default + void SetSpacing(unsigned int WXUNUSED(spacing)) { } + + // image list: these functions allow to associate an image list with + // the control and retrieve it. Note that the control does _not_ delete + // the associated image list when it's deleted in order to allow image + // lists to be shared between different controls. + // + // The normal image list is for the icons which correspond to the + // normal tree item state (whether it is selected or not). + // Additionally, the application might choose to show a state icon + // which corresponds to an app-defined item state (for example, + // checked/unchecked) which are taken from the state image list. + wxImageList *GetImageList() const; + wxImageList *GetStateImageList() const; + + void SetImageList(wxImageList *imageList); + void SetStateImageList(wxImageList *imageList); + void AssignImageList(wxImageList *imageList); + void AssignStateImageList(wxImageList *imageList); + + // Functions to work with tree ctrl items. Unfortunately, they can _not_ be + // member functions of wxTreeItem because they must know the tree the item + // belongs to for Windows implementation and storing the pointer to + // wxTreeCtrl in each wxTreeItem is just too much waste. + + // accessors + // --------- + + // retrieve items label + wxString GetItemText(const wxTreeItemId& item) const; + // get one of the images associated with the item (normal by default) + int GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which = wxTreeItemIcon_Normal) const; + // get the data associated with the item + wxTreeItemData *GetItemData(const wxTreeItemId& item) const; + + // get the item's text colour + wxColour GetItemTextColour(const wxTreeItemId& item) const; + + // get the item's background colour + wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; + + // get the item's font + wxFont GetItemFont(const wxTreeItemId& item) const; + + // modifiers + // --------- + + // set items label + void SetItemText(const wxTreeItemId& item, const wxString& text); + // get one of the images associated with the item (normal by default) + void SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which = wxTreeItemIcon_Normal); + // associate some data with the item + void SetItemData(const wxTreeItemId& item, wxTreeItemData *data); + + // force appearance of [+] button near the item. This is useful to + // allow the user to expand the items which don't have any children now + // - but instead add them only when needed, thus minimizing memory + // usage and loading time. + void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE); + + // the item will be shown in bold + void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + + // the item will be shown with a drop highlight + void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE); + + // set the items text colour + void SetItemTextColour(const wxTreeItemId& item, const wxColour& col); + + // set the items background colour + void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col); + + // set the items font (should be of the same height for all items) + void SetItemFont(const wxTreeItemId& item, const wxFont& font); + + // item status inquiries + // --------------------- + + // is the item visible (it might be outside the view or not expanded)? + bool IsVisible(const wxTreeItemId& item) const; + // does the item has any children? + bool ItemHasChildren(const wxTreeItemId& item) const; + // is the item expanded (only makes sense if HasChildren())? + bool IsExpanded(const wxTreeItemId& item) const; + // is this item currently selected (the same as has focus)? + bool IsSelected(const wxTreeItemId& item) const; + // is item text in bold font? + bool IsBold(const wxTreeItemId& item) const; + + // number of children + // ------------------ + + // if 'recursively' is FALSE, only immediate children count, otherwise + // the returned number is the number of all items in this branch + size_t GetChildrenCount(const wxTreeItemId& item, + bool recursively = TRUE) const; + + // navigation + // ---------- + + // wxTreeItemId.IsOk() will return FALSE if there is no such item + + // get the root tree item + wxTreeItemId GetRootItem() const; + + // get the item currently selected (may return NULL if no selection) + wxTreeItemId GetSelection() const; + + // get the items currently selected, return the number of such item + // + // NB: this operation is expensive and can take a long time for a + // control with a lot of items (~ O(number of items)). + size_t GetSelections(wxArrayTreeItemIds& selections) const; + + // get the parent of this item (may return NULL if root) + wxTreeItemId GetItemParent(const wxTreeItemId& item) const; + +#if WXWIN_COMPATIBILITY_2_2 + // deprecated: Use GetItemParent instead. + wxTreeItemId GetParent(const wxTreeItemId& item) const + { return GetItemParent( item ); } + + // Expose the base class method hidden by the one above. + wxWindow *GetParent() const { return wxControl::GetParent(); } +#endif // WXWIN_COMPATIBILITY_2_2 + + // for this enumeration function you must pass in a "cookie" parameter + // which is opaque for the application but is necessary for the library + // to make these functions reentrant (i.e. allow more than one + // enumeration on one and the same object simultaneously). Of course, + // the "cookie" passed to GetFirstChild() and GetNextChild() should be + // the same! + + // get the first child of this item + wxTreeItemId GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const; + // get the next child + wxTreeItemId GetNextChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const; + // get the last child of this item - this method doesn't use cookies + wxTreeItemId GetLastChild(const wxTreeItemId& item) const; + + // get the next sibling of this item + wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; + // get the previous sibling + wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; + + // get first visible item + wxTreeItemId GetFirstVisibleItem() const; + // get the next visible item: item must be visible itself! + // see IsVisible() and wxTreeCtrl::GetFirstVisibleItem() + wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; + // get the previous visible item: item must be visible itself! + wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; + + // operations + // ---------- + + // add the root node to the tree + wxTreeItemId AddRoot(const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the first child of the parent + wxTreeItemId PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item after a given one + wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item before the one with the given index + wxTreeItemId InsertItem(const wxTreeItemId& parent, + size_t index, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // insert a new item in as the last child of the parent + wxTreeItemId AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selectedImage = -1, + wxTreeItemData *data = NULL); + + // delete this item and associated data if any + void Delete(const wxTreeItemId& item); + // delete all children (but don't delete the item itself) + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteChildren(const wxTreeItemId& item); + // delete all items from the tree + // NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events + void DeleteAllItems(); + + // expand this item + void Expand(const wxTreeItemId& item); + // collapse the item without removing its children + void Collapse(const wxTreeItemId& item); + // collapse the item and remove all children + void CollapseAndReset(const wxTreeItemId& item); + // toggles the current state + void Toggle(const wxTreeItemId& item); + + // remove the selection from currently selected item (if any) + void Unselect(); + // unselect all items (only makes sense for multiple selection control) + void UnselectAll(); + // select this item + void SelectItem(const wxTreeItemId& item, bool select = true); + // unselect this item + void UnselectItem(const wxTreeItemId& item); + // toggle item selection + void ToggleItemSelection(const wxTreeItemId& item); + + // make sure this item is visible (expanding the parent item and/or + // scrolling to this item if necessary) + void EnsureVisible(const wxTreeItemId& item); + // scroll to this item (but don't expand its parent) + void ScrollTo(const wxTreeItemId& item); + + // start editing the item label: this (temporarily) replaces the item + // with a one line edit control. The item will be selected if it hadn't + // been before. textCtrlClass parameter allows you to create an edit + // control of arbitrary user-defined class deriving from wxTextCtrl. + wxTextCtrl* EditLabel(const wxTreeItemId& item, + wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)); + // returns the same pointer as StartEdit() if the item is being edited, + // NULL otherwise (it's assumed that no more than one item may be + // edited simultaneously) + wxTextCtrl* GetEditControl() const; + // end editing and accept or discard the changes to item label + void EndEditLabel(const wxTreeItemId& item, bool discardChanges = FALSE); + + // sorting + // this function is called to compare 2 items and should return -1, 0 + // or +1 if the first item is less than, equal to or greater than the + // second one. The base class version performs alphabetic comparaison + // of item labels (GetText) + virtual int OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2); + // sort the children of this item using OnCompareItems + // + // NB: this function is not reentrant and not MT-safe (FIXME)! + void SortChildren(const wxTreeItemId& item); + + // helpers + // ------- + + // determine to which item (if any) belongs the given point (the + // coordinates specified are relative to the client area of tree ctrl) + // and fill the flags parameter with a bitmask of wxTREE_HITTEST_xxx + // constants. + // + // The first function is more portable (because easier to implement + // on other platforms), but the second one returns some extra info. + wxTreeItemId HitTest(const wxPoint& point) + { int dummy; return HitTest(point, dummy); } + wxTreeItemId HitTest(const wxPoint& point, int& flags); + + // get the bounding rectangle of the item (or of its label only) + bool GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly = FALSE) const; + + // deprecated + // ---------- + +#if WXWIN_COMPATIBILITY_2_4 + // these methods are deprecated and will be removed in future versions of + // wxWidgets, they're here for compatibility only, don't use them in new + // code (the comments indicate why these methods are now useless and how to + // replace them) + + // use Expand, Collapse, CollapseAndReset or Toggle + wxDEPRECATED( void ExpandItem(const wxTreeItemId& item, int action) ); + + // use AddRoot, PrependItem or AppendItem + wxDEPRECATED( wxTreeItemId InsertItem(const wxTreeItemId& parent, + const wxString& text, + int image = -1, int selImage = -1, + long insertAfter = wxTREE_INSERT_LAST) ); + + // use Set/GetImageList and Set/GetStateImageList + wxImageList *GetImageList(int) const { return GetImageList(); } + void SetImageList(wxImageList *imageList, int) { SetImageList(imageList); } + + // use Set/GetItemImage directly + int GetItemSelectedImage(const wxTreeItemId& item) const + { return GetItemImage(item, wxTreeItemIcon_Selected); } + void SetItemSelectedImage(const wxTreeItemId& item, int image) + { SetItemImage(item, image, wxTreeItemIcon_Selected); } + + // use the versions taking wxTreeItemIdValue cookies + wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item, + long& cookie) const ); + wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item, + long& cookie) const ); +#endif // WXWIN_COMPATIBILITY_2_4 + + + // implementation + // -------------- + + virtual bool ShouldInheritColours() const { return false; } + + virtual wxVisualAttributes GetDefaultAttributes() const + { + return GetClassDefaultAttributes(GetWindowVariant()); + } + + static wxVisualAttributes + GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); + + + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + + // override some base class virtuals + virtual bool SetBackgroundColour(const wxColour &colour); + virtual bool SetForegroundColour(const wxColour &colour); + + // get/set the check state for the item (only for wxTR_MULTIPLE) + bool IsItemChecked(const wxTreeItemId& item) const; + void SetItemCheck(const wxTreeItemId& item, bool check = TRUE); + + // set/get the item state.image (state == -1 means cycle to the next one) + void SetState(const wxTreeItemId& node, int state); + int GetState(const wxTreeItemId& node); + +protected: + // SetImageList helper + void SetAnyImageList(wxImageList *imageList, int which); + + // refresh a single item + void RefreshItem(const wxTreeItemId& item); + + wxTextCtrl *m_textCtrl; // used while editing the item label + wxImageList *m_imageListNormal, // images for tree elements + *m_imageListState; // special images for app defined states + bool m_ownsImageListNormal, m_ownsImageListState; + +private: + // the common part of all ctors + void Init(); + + // helper functions + inline bool DoGetItem(wxTreeViewItem *tvItem) const; + inline void DoSetItem(wxTreeViewItem *tvItem); + + inline void DoExpand(const wxTreeItemId& item, int flag); + + wxTreeItemId DoInsertItem(const wxTreeItemId& parent, + wxTreeItemId hInsertAfter, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data); + + int DoGetItemImageFromData(const wxTreeItemId& item, + wxTreeItemIcon which) const; + void DoSetItemImageFromData(const wxTreeItemId& item, + int image, + wxTreeItemIcon which) const; + void DoSetItemImages(const wxTreeItemId& item, int image, int imageSel); + + void DeleteTextCtrl(); + + // support for additional item images which we implement using + // wxTreeItemIndirectData technique - see the comments in msw/treectrl.cpp + void SetIndirectItemData(const wxTreeItemId& item, + class wxTreeItemIndirectData *data); + bool HasIndirectData(const wxTreeItemId& item) const; + bool IsDataIndirect(wxTreeItemData *data) const + { return data && data->GetId().m_pItem == 0; } + + // the hash storing the items attributes (indexed by item ids) + wxMapTreeAttr m_attrs; + + // TRUE if the hash above is not empty + bool m_hasAnyAttr; + + // used for dragging + wxDragImage *m_dragImage; + + // Virtual root item, if wxTR_HIDE_ROOT is set. + void* m_pVirtualRoot; + + // the starting item for selection with Shift + wxTreeItemId m_htSelStart; + + friend class wxTreeItemIndirectData; + friend class wxTreeSortHelper; + + DECLARE_DYNAMIC_CLASS(wxTreeCtrl) + DECLARE_NO_COPY_CLASS(wxTreeCtrl) +}; + +#endif // wxUSE_TREECTRL + +#endif + // _WX_TREECTRL_H_ diff --git a/include/wx/palmos/window.h b/include/wx/palmos/window.h new file mode 100644 index 0000000000..b19904f5f0 --- /dev/null +++ b/include/wx/palmos/window.h @@ -0,0 +1,522 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/palmos/window.h +// Purpose: wxWindow class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_WINDOW_H_ +#define _WX_WINDOW_H_ + +#ifdef __PALMOS__ + #include +#endif + + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma interface "window.h" +#endif + +// [at least] some version of Windows send extra mouse move messages after +// a mouse click or a key press - to temporarily fix this problem, set the +// define below to 1 +// +// a better solution should be found later... +#define wxUSE_MOUSEEVENT_HACK 0 + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +// FIXME does anybody use those? they're unused by wxWidgets... +enum +{ + wxKEY_SHIFT = 1, + wxKEY_CTRL = 2 +}; + +// --------------------------------------------------------------------------- +// wxWindow declaration for Palm +// --------------------------------------------------------------------------- + +class WXDLLEXPORT wxWindowPalm : public wxWindowBase +{ +public: + wxWindowPalm() { Init(); } + + wxWindowPalm(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr) + { + Init(); + Create(parent, id, pos, size, style, name); + } + + virtual ~wxWindowPalm(); + + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxPanelNameStr); + + // implement base class pure virtuals + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; + + virtual void Raise(); + virtual void Lower(); + + virtual bool Show( bool show = TRUE ); + virtual bool Enable( bool enable = TRUE ); + + virtual void SetFocus(); + virtual void SetFocusFromKbd(); + + virtual bool Reparent(wxWindowBase *newParent); + + virtual void WarpPointer(int x, int y); + + virtual void Refresh( bool eraseBackground = TRUE, + const wxRect *rect = (const wxRect *) NULL ); + virtual void Update(); + virtual void Freeze(); + virtual void Thaw(); + + virtual void SetWindowStyleFlag( long style ); + virtual bool SetCursor( const wxCursor &cursor ); + virtual bool SetFont( const wxFont &font ); + + virtual int GetCharHeight() const; + virtual int GetCharWidth() const; + virtual void GetTextExtent(const wxString& string, + int *x, int *y, + int *descent = (int *) NULL, + int *externalLeading = (int *) NULL, + const wxFont *theFont = (const wxFont *) NULL) + const; + +#if wxUSE_MENUS_NATIVE + virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); +#endif // wxUSE_MENUS_NATIVE + + 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 bool ScrollLines(int lines); + virtual bool ScrollPages(int pages); + +#if wxUSE_DRAG_AND_DROP + virtual void SetDropTarget( wxDropTarget *dropTarget ); +#endif // wxUSE_DRAG_AND_DROP + + // Accept files for dragging + virtual void DragAcceptFiles(bool accept); + +#if WXWIN_COMPATIBILITY_2_4 + wxDEPRECATED( bool GetUseCtl3D() const ); + wxDEPRECATED( bool GetTransparentBackground() const ); + wxDEPRECATED( void SetTransparent(bool t = TRUE) ); +#endif // WXWIN_COMPATIBILITY_2_4 + +#ifndef __WXUNIVERSAL__ + // Native resource loading (implemented in src/Palm/nativdlg.cpp) + // FIXME: should they really be all virtual? + virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id); + virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name); + wxWindow* GetWindowChild1(wxWindowID id); + wxWindow* GetWindowChild(wxWindowID id); +#endif // __WXUNIVERSAL__ + +#if wxUSE_HOTKEY + // install and deinstall a system wide hotkey + virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode); + virtual bool UnregisterHotKey(int hotkeyId); +#endif // wxUSE_HOTKEY + + // implementation from now on + // -------------------------- + + // simple accessors + // ---------------- + + WXHWND GetHWND() const { return m_hWnd; } + void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; } + virtual WXWidget GetHandle() const { return GetHWND(); } + + // event handlers + // -------------- + + void OnEraseBackground(wxEraseEvent& event); + void OnPaint(wxPaintEvent& event); + +public: + // For implementation purposes - sometimes decorations make the client area + // smaller + virtual wxPoint GetClientAreaOrigin() const; + + // Windows subclassing + void SubclassWin(WXHWND hWnd); + void UnsubclassWin(); + + WXFARPROC PalmGetOldWndProc() const { return m_oldWndProc; } + void PalmSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } + + // return TRUE if the window is of a standard (i.e. not wxWidgets') class + // + // to understand why does it work, look at SubclassWin() code and comments + bool IsOfStandardClass() const { return m_oldWndProc != NULL; } + + wxWindow *FindItem(long id) const; + wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const; + + // Palm only: TRUE if this control is part of the main control + virtual bool ContainsHWND(WXHWND WXUNUSED(hWnd)) const { return FALSE; }; + + // translate wxWidgets style flags for this control into the Windows style + // and optional extended style for the corresponding native control + // + // this is the function that should be overridden in the derived classes, + // but you will mostly use PalmGetCreateWindowFlags() below + virtual WXDWORD PalmGetStyle(long flags, WXDWORD *exstyle = NULL) const ; + + // get the Palm window flags corresponding to wxWidgets ones + // + // the functions returns the flags (WS_XXX) directly and puts the ext + // (WS_EX_XXX) flags into the provided pointer if not NULL + WXDWORD PalmGetCreateWindowFlags(WXDWORD *exflags = NULL) const + { return PalmGetStyle(GetWindowStyle(), exflags); } + + // translate wxWidgets coords into Windows ones suitable to be passed to + // ::CreateWindow() + // + // returns TRUE if non default coords are returned, FALSE otherwise + bool PalmGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const; + + // get the HWND to be used as parent of this window with CreateWindow() + virtual WXHWND PalmGetParent() const; + + // creates the window of specified Windows class with given style, extended + // style, title and geometry (default values + // + // returns TRUE if the window has been created, FALSE if creation failed + bool PalmCreate(const wxChar *wclass, + const wxChar *title = NULL, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + WXDWORD style = 0, + WXDWORD exendedStyle = 0); + + virtual bool PalmCommand(WXUINT param, WXWORD id); + +#ifndef __WXUNIVERSAL__ + // Create an appropriate wxWindow from a HWND + virtual wxWindow* CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd); + + // Make sure the window style reflects the HWND style (roughly) + virtual void AdoptAttributesFromHWND(); +#endif // __WXUNIVERSAL__ + + // Setup background and foreground colours correctly + virtual void SetupColours(); + + // ------------------------------------------------------------------------ + // helpers for message handlers: these perform the same function as the + // message crackers from - they unpack WPARAM and LPARAM into + // the correct parameters + // ------------------------------------------------------------------------ + + void UnpackCommand(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *id, WXHWND *hwnd, WXWORD *cmd); + void UnpackActivate(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *state, WXWORD *minimized, WXHWND *hwnd); + void UnpackScroll(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *code, WXWORD *pos, WXHWND *hwnd); + void UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd); + void UnpackMenuSelect(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *item, WXWORD *flags, WXHMENU *hmenu); + + // ------------------------------------------------------------------------ + // internal handlers for Palm messages: all handlers return a boolean value: + // TRUE means that the handler processed the event and FALSE that it didn't + // ------------------------------------------------------------------------ + + // there are several cases where we have virtual functions for Windows + // message processing: this is because these messages often require to be + // processed in a different manner in the derived classes. For all other + // messages, however, we do *not* have corresponding PalmOnXXX() function + // and if the derived class wants to process them, it should override + // PalmWindowProc() directly. + + // scroll event (both horizontal and vertical) + virtual bool PalmOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control); + + // child control notifications +#ifdef __WIN95__ + virtual bool PalmOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); +#endif // __WIN95__ + + // owner-drawn controls need to process these messages + virtual bool PalmOnDrawItem(int id, WXDRAWITEMSTRUCT *item); + virtual bool PalmOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item); + + // the rest are not virtual + bool HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate); + bool HandleInitDialog(WXHWND hWndFocus); + bool HandleDestroy(); + + bool HandlePaint(); + bool HandleEraseBkgnd(WXHDC pDC); + + bool HandleMinimize(); + bool HandleMaximize(); + bool HandleSize(int x, int y, WXUINT flag); + bool HandleSizing(wxRect& rect); + bool HandleGetMinMaxInfo(void *mmInfo); + + bool HandleShow(bool show, int status); + bool HandleActivate(int flag, bool minimized, WXHWND activate); + + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + bool HandleCtlColor(WXHBRUSH *hBrush, + WXHDC hdc, + WXHWND hWnd, + WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); + + bool HandlePaletteChanged(WXHWND hWndPalChange); + bool HandleQueryNewPalette(); + bool HandleSysColorChange(); + bool HandleDisplayChange(); + bool HandleCaptureChanged(WXHWND gainedCapture); + + bool HandleQueryEndSession(long logOff, bool *mayEnd); + bool HandleEndSession(bool endSession, long logOff); + + bool HandleSetFocus(WXHWND wnd); + bool HandleKillFocus(WXHWND wnd); + + bool HandleDropFiles(WXWPARAM wParam); + + bool HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags); + bool HandleMouseMove(int x, int y, WXUINT flags); + bool HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam); + + bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = FALSE); + bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam); + bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam); +#if wxUSE_ACCEL + bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam); +#endif +#ifdef __WIN32__ + int HandleMenuChar(int chAccel, WXLPARAM lParam); +#endif + + bool HandleQueryDragIcon(WXHICON *hIcon); + + bool HandleSetCursor(WXHWND hWnd, short nHitTest, int mouseMsg); + + // Window procedure + virtual WXLRESULT PalmWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // Calls an appropriate default window procedure + virtual WXLRESULT PalmDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + // message processing helpers + + // return FALSE if the message shouldn't be translated/preprocessed but + // dispatched normally + virtual bool PalmShouldPreProcessMessage(WXMSG* pMsg); + + // return TRUE if the message was preprocessed and shouldn't be dispatched + virtual bool PalmProcessMessage(WXMSG* pMsg); + + // return TRUE if the message was translated and shouldn't be dispatched + virtual bool PalmTranslateMessage(WXMSG* pMsg); + + // called when the window is about to be destroyed + virtual void PalmDestroyWindow(); + + // this function should return the brush to paint the window background + // with or 0 for the default brush + virtual WXHBRUSH OnCtlColor(WXHDC hDC, + WXHWND hWnd, + WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam); + + // Responds to colour changes: passes event on to children. + void OnSysColourChanged(wxSysColourChangedEvent& event); + + // initialize various fields of wxMouseEvent (common part of PalmOnMouseXXX) + void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags); + + // check if mouse is in the window + bool IsMouseInWindow() const; + + // virtual function for implementing internal idle + // behaviour + virtual void OnInternalIdle() ; + +protected: + // the window handle + WXHWND m_hWnd; + FormType *FrameForm; + + FormType *GetFormPtr(); + void SetFormPtr(FormType *FormPtr); + + // the old window proc (we subclass all windows) + WXFARPROC m_oldWndProc; + + // additional (Palm specific) flags + bool m_mouseInWindow:1; + bool m_lastKeydownProcessed:1; + + // the size of one page for scrolling + int m_xThumbSize; + int m_yThumbSize; + +#if wxUSE_MOUSEEVENT_HACK + // the coordinates of the last mouse event and the type of it + long m_lastMouseX, + m_lastMouseY; + int m_lastMouseEvent; +#endif // wxUSE_MOUSEEVENT_HACK + + WXHMENU m_hMenu; // Menu, if any + + // implement the base class pure virtuals + virtual void DoClientToScreen( int *x, int *y ) const; + virtual void DoScreenToClient( int *x, int *y ) const; + virtual void DoGetPosition( int *x, int *y ) const; + virtual void DoGetSize( int *width, int *height ) const; + virtual void DoGetClientSize( int *width, int *height ) const; + virtual void DoSetSize(int x, int y, + int width, int height, + int sizeFlags = wxSIZE_AUTO); + virtual void DoSetClientSize(int width, int height); + + virtual void DoCaptureMouse(); + virtual void DoReleaseMouse(); + + // move the window to the specified location and resize it: this is called + // from both DoSetSize() and DoSetClientSize() and would usually just call + // ::MoveWindow() except for composite controls which will want to arrange + // themselves inside the given rectangle + virtual void DoMoveWindow(int x, int y, int width, int height); + +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); + + // process TTN_NEEDTEXT message properly (i.e. fixing the bugs in + // comctl32.dll in our code -- see the function body for more info) + bool HandleTooltipNotify(WXUINT code, + WXLPARAM lParam, + const wxString& ttip); +#endif // wxUSE_TOOLTIPS + + // the helper functions used by HandleChar/KeyXXX methods + wxKeyEvent CreateKeyEvent(wxEventType evType, int id, + WXLPARAM lParam = 0, WXWPARAM wParam = 0) const; + +private: + // common part of all ctors + void Init(); + + // the (non-virtual) handlers for the events + bool HandleMove(int x, int y); + bool HandleMoving(wxRect& rect); + bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags); + +#ifdef __WIN95__ + bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); +#endif // __WIN95__ + + // list of disabled children before last call to our Disable() + wxWindowList *m_childrenDisabled; + + // number of calls to Freeze() minus number of calls to Thaw() + unsigned int m_frozenness; + + DECLARE_DYNAMIC_CLASS(wxWindowPalm) + DECLARE_NO_COPY_CLASS(wxWindowPalm) + DECLARE_EVENT_TABLE() +}; + +// ---------------------------------------------------------------------------- +// inline functions +// ---------------------------------------------------------------------------- + +#if WXWIN_COMPATIBILITY_2_4 + +inline bool wxWindowPalm::GetUseCtl3D() const { return false; } +inline bool wxWindowPalm::GetTransparentBackground() const { return false; } +inline void wxWindowPalm::SetTransparent(bool WXUNUSED(t)) { } + +#endif // WXWIN_COMPATIBILITY_2_4 + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// kbd code translation +WXDLLEXPORT int wxCharCodePalmToWX(int keySym, WXLPARAM lParam = 0); +WXDLLEXPORT int wxCharCodeWXToPalm(int id, bool *IsVirtual); + +// window creation helper class: before creating a new HWND, instantiate an +// object of this class on stack - this allows to process the messages sent to +// the window even before CreateWindow() returns +class wxWindowCreationHook +{ +public: + wxWindowCreationHook(wxWindowPalm *winBeingCreated); + ~wxWindowCreationHook(); +}; + +// ---------------------------------------------------------------------------- +// global objects +// ---------------------------------------------------------------------------- + +// notice that this hash must be defined after wxWindow declaration as it +// needs to "see" its dtor and not just forward declaration +#include "wx/hash.h" + +// pseudo-template HWND <-> wxWindow hash table +#if WXWIN_COMPATIBILITY_2_4 +WX_DECLARE_HASH(wxWindow, wxWindowList, wxWinHashTable); +#else +WX_DECLARE_HASH(wxWindowPalm, wxWindowList, wxWinHashTable); +#endif + +extern wxWinHashTable *wxWinHandleHash; + +#endif + // _WX_WINDOW_H_ diff --git a/include/wx/palmos/wxWidgets.def b/include/wx/palmos/wxWidgets.def new file mode 100644 index 0000000000..82e6cbd461 --- /dev/null +++ b/include/wx/palmos/wxWidgets.def @@ -0,0 +1,7 @@ +EXPORTS +_PalmUIAppStartup @1 +SysGetRefNum @2 +__ExportDispatchTable @3 +__GetRefNum @4 +__SetPreloadedDispatchTable @5 +__SetRefNum @6 \ No newline at end of file diff --git a/include/wx/palmos/wxWidgets.sld b/include/wx/palmos/wxWidgets.sld new file mode 100644 index 0000000000..40e4a0beb8 --- /dev/null +++ b/include/wx/palmos/wxWidgets.sld @@ -0,0 +1,9 @@ +; +; BasicApp Library Definition File +; + +REVISION 1 +RESOURCEID 0 + +; Always use this default main entry point for UI applications +ENTRY _PalmUIAppStartup diff --git a/include/wx/palmos/wxWidgets.xrd b/include/wx/palmos/wxWidgets.xrd new file mode 100644 index 0000000000..bbeb61b40d --- /dev/null +++ b/include/wx/palmos/wxWidgets.xrd @@ -0,0 +1,501 @@ + + + + + + WARNING_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + + + + + ERROR_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + + + + + INFORMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + + + + + CONFIRMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + + + + + WARNING_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + "Cancel" + + + + + ERROR_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + "Cancel" + + + + + INFORMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + "Cancel" + + + + + CONFIRMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "OK" + "Cancel" + + + + + WARNING_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + + + + + ERROR_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + + + + + INFORMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + + + + + CONFIRMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + + + + + WARNING_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + "Cancel" + + + + + ERROR_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + "Cancel" + + + + + INFORMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + "Cancel" + + + + + CONFIRMATION_ALERT + 0 + 0 + "AAAAAAAAAABBBBBBBBBBCCCCC" + "^1" + + "Yes" + "No" + "Cancel" + + + + + + + 144 + 50 + 44 + 8 + BEST + TRUE + + 0xC0 + + FALSE + "./Icons/AppIcon_Large-X2-8.bmp" + + + + + + + + 144 + 30 + 18 + 8 + BEST + TRUE + + 0xC0 + + FALSE + "./Icons/AppIcon_Small-X2-8.bmp" + + + + + + "Minimal App" + + + + TRUE + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9000 + "A" + "" + FALSE + + + + + + + + TRUE + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9000 + "A" + "" + FALSE + + + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9001 + "B" + "" + FALSE + + + + + + + + TRUE + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9000 + "A" + "" + FALSE + + + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9001 + "B" + "" + FALSE + + + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9002 + "C" + "" + FALSE + + + + + + + + TRUE + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9000 + "A" + "" + FALSE + + + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9001 + "B" + "" + FALSE + + + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9002 + "C" + "" + FALSE + + + + + "AAA " + FALSE + + 0 + 0 + 0 + 0 + + + 0 + 0 + 0 + 0 + + + + 9003 + "D" + "" + FALSE + + + + + + + diff --git a/include/wx/pen.h b/include/wx/pen.h index f1202f58fb..f700e98879 100644 --- a/include/wx/pen.h +++ b/include/wx/pen.h @@ -1,7 +1,9 @@ #ifndef _WX_PEN_H_BASE_ #define _WX_PEN_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/pen.h" +#elif defined(__WXMSW__) #include "wx/msw/pen.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/pen.h" diff --git a/include/wx/platform.h b/include/wx/platform.h index 0d61836746..aa05fa683d 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -465,7 +465,9 @@ This macro can be used to check that the version of mingw32 compiler is at least maj.min */ -#if ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ +#if defined(__PALMOS__) +# include "wx/palmos/gccpriv.h" +#elif ( defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \ defined( __CYGWIN__ ) || \ (defined(__WATCOMC__) && __WATCOMC__ >= 1200) ) && \ !defined(__DOS__) && !defined(__WXMOTIF__) && !defined(__WXGTK__) && !defined(__WXX11__) diff --git a/include/wx/printdlg.h b/include/wx/printdlg.h index 8f54d9afa1..4cf036b94f 100644 --- a/include/wx/printdlg.h +++ b/include/wx/printdlg.h @@ -68,6 +68,8 @@ private: #if defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) #include "wx/generic/prntdlgg.h" +#elif defined(__PALMOS__) +#include "wx/palmos/printdlg.h" #elif defined(__WXMSW__) #include "wx/msw/printdlg.h" #elif defined(__WXMOTIF__) diff --git a/include/wx/region.h b/include/wx/region.h index 5bb9cd1118..2cde039eb6 100644 --- a/include/wx/region.h +++ b/include/wx/region.h @@ -1,7 +1,9 @@ #ifndef _WX_REGION_H_BASE_ #define _WX_REGION_H_BASE_ -#if defined(__WXMSW__) +#if defined(__PALMOS__) +#include "wx/palmos/region.h" +#elif defined(__WXMSW__) #include "wx/msw/region.h" #elif defined(__WXMOTIF__) #include "wx/x11/region.h" diff --git a/include/wx/renderer.h b/include/wx/renderer.h index 453baf801a..1a14e5fb4b 100644 --- a/include/wx/renderer.h +++ b/include/wx/renderer.h @@ -31,7 +31,7 @@ class WXDLLEXPORT wxWindow; #include "wx/gdicmn.h" // for wxPoint // some platforms have their own renderers, others use the generic one -#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__) +#if (defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__)) && !defined(__PALMOS__) #define wxHAS_NATIVE_RENDERER #else #undef wxHAS_NATIVE_RENDERER diff --git a/include/wx/statusbr.h b/include/wx/statusbr.h index d91defc1b3..ea67d427bc 100644 --- a/include/wx/statusbr.h +++ b/include/wx/statusbr.h @@ -150,6 +150,10 @@ protected: #define wxStatusBarUniv wxStatusBar #include "wx/univ/statusbr.h" +#elif defined(__PALMOS__) && wxUSE_NATIVE_STATUSBAR + #define wxStatusBarPalm wxStatusBar + + #include "wx/palmos/statbrpalm.h" #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR #define wxStatusBar95 wxStatusBar diff --git a/include/wx/string.h b/include/wx/string.h index 30b903e322..6804f6792d 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -51,6 +51,10 @@ #include // for strcasecmp() #endif // HAVE_STRCASECMP_IN_STRINGS_H +#ifdef __PALMOS__ + #include +#endif + #include "wx/wxchar.h" // for wxChar #include "wx/buffer.h" // for wxCharBuffer #include "wx/strconv.h" // for wxConvertXXX() macros and wxMBConv classes diff --git a/include/wx/taskbar.h b/include/wx/taskbar.h index bc8371c18d..a97354fe78 100644 --- a/include/wx/taskbar.h +++ b/include/wx/taskbar.h @@ -41,7 +41,9 @@ private: // now include the actual class declaration // ---------------------------------------------------------------------------- -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/taskbar.h" +#elif defined(__WXMSW__) #include "wx/msw/taskbar.h" #elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) #include "wx/unix/taskbarx11.h" diff --git a/include/wx/toolbar.h b/include/wx/toolbar.h index 744a17705f..a830694c78 100644 --- a/include/wx/toolbar.h +++ b/include/wx/toolbar.h @@ -123,6 +123,8 @@ enum #else // wxUSE_TOOLBAR_NATIVE #if defined(__WXUNIVERSAL__) #include "wx/univ/toolbar.h" + #elif defined(__PALMOS__) + #include "wx/palmos/toolbar.h" #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) #include "wx/msw/tbar95.h" #elif defined(__WXWINCE__) diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index a3b3afcce1..e2201ae8fd 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -241,7 +241,10 @@ protected: // include the real class declaration -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #include "wx/palmos/toplevel.h" + #define wxTopLevelWindowNative wxTopLevelWindowPalm +#elif defined(__WXMSW__) #include "wx/msw/toplevel.h" #define wxTopLevelWindowNative wxTopLevelWindowMSW #elif defined(__WXGTK__) diff --git a/include/wx/treectrl.h b/include/wx/treectrl.h index 080de6b24d..5d3c03aa8b 100644 --- a/include/wx/treectrl.h +++ b/include/wx/treectrl.h @@ -9,6 +9,8 @@ #if defined(__WXUNIVERSAL__) #include "wx/generic/treectlg.h" +#elif defined(__PALMOS__) + #include "wx/palmos/treectrl.h" #elif defined(__WXMSW__) #include "wx/msw/treectrl.h" #elif defined(__WXMOTIF__) diff --git a/include/wx/window.h b/include/wx/window.h index f641fc3dca..db5205b6a7 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -1310,7 +1310,14 @@ private: // ---------------------------------------------------------------------------- // include the declaration of the platform-specific class -#if defined(__WXMSW__) +#if defined(__PALMOS__) + #ifdef __WXUNIVERSAL__ + #define wxWindowNative wxWindowPalm + #else // !wxUniv + #define wxWindowPalm wxWindow + #endif // wxUniv/!wxUniv + #include "wx/palmos/window.h" +#elif defined(__WXMSW__) #ifdef __WXUNIVERSAL__ #define wxWindowNative wxWindowMSW #else // !wxUniv diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index f25233ad87..0d2fc9ad70 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -118,7 +118,7 @@ #define wxHAVE_TCHAR_SUPPORT #elif defined(__DMC__) #define wxHAVE_TCHAR_SUPPORT -#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) +#elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 ) && !defined(__PALMOS__) #define wxHAVE_TCHAR_SUPPORT #include #include @@ -693,6 +693,12 @@ defined(__EMX__) || defined(__DJGPP__) #define wxStricmp stricmp #define wxStrnicmp strnicmp + #elif defined(__PALMOS__) + /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This + * quick hack should do until one can be written. + */ + #define wxStricmp StrCaselessCompare + #define wxStrnicmp strnicmp #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ (defined(__MWERKS__) && defined(__INTEL__)) #define wxStricmp _stricmp @@ -1072,7 +1078,8 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #define wxWX2WC wxMB2WC #endif #else /* !wxUSE_UNICODE */ -#error ha +/* Why is this here? +#error ha */ /* No wxUSE_WCHAR_T: we have to do something (JACS) */ #define wxMB2WC wxStrncpy #define wxWC2MB wxStrncpy diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 404eb2dd6f..1a13c3f339 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -43,7 +43,7 @@ #include // for SIGTRAP used by wxTrap() #endif //Win/Unix -#if defined(__WXMSW__) +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox() #endif @@ -140,11 +140,13 @@ bool wxAppConsole::Initialize(int& argc, wxChar **argv) this->argc = argc; this->argv = argv; +#ifndef __PALMOS__ if ( m_appName.empty() && argv ) { // the application name is, by default, the name of its executable file wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); } +#endif return true; } diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 146378d59f..43bd65360c 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -47,7 +47,7 @@ #include "wx/utils.h" #include "wx/ptr_scpd.h" -#if defined(__WXMSW__) +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/private.h" // includes windows.h for LOGFONT #endif diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 9779d87fdb..2a5523a1c4 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -49,7 +49,7 @@ #include "wx/paper.h" #endif // wxUSE_PRINTING_ARCHITECTURE -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !defined(__PALMOS__) #include #include "wx/msw/private.h" diff --git a/src/common/containr.cpp b/src/common/containr.cpp index 84ca21a7cc..5bfc812f78 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -291,7 +291,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) wxWindow *child = node->GetData(); -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !defined(__PALMOS__) bool is_not_msw_rb = !m_winLastFocused || !wxIsKindOf(m_winLastFocused,wxRadioButton); #else @@ -306,7 +306,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) // direction we're coming event.SetEventObject(m_winParent); -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !defined(__PALMOS__) // we need to hop to the next activated // radio button, not just the next radio // button under MSW diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index c4416f5bec..dcb846f6f5 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -36,7 +36,7 @@ #include "wx/gdicmn.h" -#if defined(__WXMSW__) +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/private.h" // includes windows.h for LOGFONT #include "wx/msw/winundef.h" #endif diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 19223f77f7..8edaa3ecf2 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -42,7 +42,7 @@ #include "wx/log.h" #include -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/wrapwin.h" #endif diff --git a/src/common/init.cpp b/src/common/init.cpp index aaa186cc16..459d37a7cc 100644 --- a/src/common/init.cpp +++ b/src/common/init.cpp @@ -433,6 +433,8 @@ int wxEntry(int& argc, wxChar **argv) { #ifdef __WXWINCE__ ::ExitThread(3); // the same exit code as abort() +#elif __PALMOS__ + return -1; #else ::ExitProcess(3); // the same exit code as abort() #endif diff --git a/src/common/msgout.cpp b/src/common/msgout.cpp index f588f326df..348f6ae1dd 100755 --- a/src/common/msgout.cpp +++ b/src/common/msgout.cpp @@ -52,7 +52,7 @@ #include #include -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/private.h" #endif #ifdef __WXMAC__ @@ -118,7 +118,7 @@ void wxMessageOutputDebug::Printf(const wxChar* format, ...) out.PrintfV(format, args); va_end(args); -#if defined(__WXMSW__) && !defined(__WXMICROWIN__) +#if defined(__WXMSW__) && !defined(__WXMICROWIN__) && !defined(__PALMOS__) out.Replace(wxT("\t"), wxT(" ")); out.Replace(wxT("\n"), wxT("\r\n")); ::OutputDebugString(out); diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 4e4d3a9280..9cf7ef1ff6 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -95,7 +95,7 @@ #include #endif -#ifdef __WXMSW__ +#if defined(__WXMSW__) && !defined(__PALMOS__) #include "wx/msw/private.h" #endif diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 8402f89718..8c7f6898d3 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -7,6 +7,8 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +#ifndef __PALMOS__ + #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "imaglist.h" #endif @@ -190,4 +192,4 @@ bool wxGenericImageList::Draw( int index, wxDC &dc, int x, int y, return true; } - +#endif // __PALMOS__ diff --git a/src/generic/notebook.cpp b/src/generic/notebook.cpp index e4cbc77c80..19b7b08a51 100644 --- a/src/generic/notebook.cpp +++ b/src/generic/notebook.cpp @@ -16,6 +16,9 @@ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- + +#ifndef __PALMOS__ + #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "notebook.h" #endif @@ -705,3 +708,4 @@ bool wxNotebookTabView::OnTabPreActivate(int activateId, int deactivateId) return retval; } +#endif // __PALMOS__ diff --git a/src/palmos/accel.cpp b/src/palmos/accel.cpp new file mode 100644 index 0000000000..7864af70c1 --- /dev/null +++ b/src/palmos/accel.cpp @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: accel.cpp +// Purpose: wxAcceleratorTable +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "accel.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" +#endif + +#include "wx/accel.h" + +#if wxUSE_ACCEL + +#include "wx/palmos/private.h" + +IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) + +class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData +{ + friend class WXDLLEXPORT wxAcceleratorTable; +public: + wxAcceleratorRefData(); + ~wxAcceleratorRefData(); + + inline HACCEL GetHACCEL() const { return m_hAccel; } +protected: + HACCEL m_hAccel; + bool m_ok; + + DECLARE_NO_COPY_CLASS(wxAcceleratorRefData) +}; + +#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData) + +wxAcceleratorRefData::wxAcceleratorRefData() +{ +} + +wxAcceleratorRefData::~wxAcceleratorRefData() +{ +} + +wxAcceleratorTable::wxAcceleratorTable() +{ +} + +wxAcceleratorTable::~wxAcceleratorTable() +{ +} + +wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) +{ +} + +extern int wxCharCodeWXToMSW(int id, bool *isVirtual); + +wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) +{ +} + +bool wxAcceleratorTable::Ok() const +{ + return false; +} + +void wxAcceleratorTable::SetHACCEL(WXHACCEL hAccel) +{ +} + +WXHACCEL wxAcceleratorTable::GetHACCEL() const +{ + return 0; +} + +bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const +{ + return false; +} + +#endif diff --git a/src/palmos/app.cpp b/src/palmos/app.cpp new file mode 100644 index 0000000000..c66d9f24e5 --- /dev/null +++ b/src/palmos/app.cpp @@ -0,0 +1,313 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: app.cpp +// Purpose: wxApp +// Author: William Osborne +// Modified by: +// Created: 10/08/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "app.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/gdicmn.h" + #include "wx/pen.h" + #include "wx/brush.h" + #include "wx/cursor.h" + #include "wx/icon.h" + #include "wx/palette.h" + #include "wx/dc.h" + #include "wx/dialog.h" + #include "wx/msgdlg.h" + #include "wx/intl.h" + #include "wx/dynarray.h" + #include "wx/wxchar.h" + #include "wx/icon.h" + #include "wx/log.h" +#endif + +#include "wx/apptrait.h" +#include "wx/filename.h" +#include "wx/module.h" +#include "wx/dynlib.h" + +#if wxUSE_TOOLTIPS + #include "wx/tooltip.h" +#endif // wxUSE_TOOLTIPS + +// We don't support OLE +#undef wxUSE_OLE +#define wxUSE_OLE 0 + +#include +#include + +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- + +extern wxList WXDLLEXPORT wxPendingDelete; + +// NB: all "NoRedraw" classes must have the same names as the "normal" classes +// with NR suffix - wxWindow::MSWCreate() supposes this +const wxChar *wxCanvasClassName = wxT("wxWindowClass"); +const wxChar *wxCanvasClassNameNR = wxT("wxWindowClassNR"); +const wxChar *wxMDIFrameClassName = wxT("wxMDIFrameClass"); +const wxChar *wxMDIFrameClassNameNoRedraw = wxT("wxMDIFrameClassNR"); +const wxChar *wxMDIChildFrameClassName = wxT("wxMDIChildFrameClass"); +const wxChar *wxMDIChildFrameClassNameNoRedraw = wxT("wxMDIChildFrameClassNR"); + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// =========================================================================== +// wxGUIAppTraits implementation +// =========================================================================== + +// private class which we use to pass parameters from BeforeChildWaitLoop() to +// AfterChildWaitLoop() +struct ChildWaitLoopData +{ + ChildWaitLoopData(wxWindowDisabler *wd_, wxWindow *winActive_) + { + wd = wd_; + winActive = winActive_; + } + + wxWindowDisabler *wd; + wxWindow *winActive; +}; + +void *wxGUIAppTraits::BeforeChildWaitLoop() +{ + return NULL; +} + +void wxGUIAppTraits::AlwaysYield() +{ + wxYield(); +} + +void wxGUIAppTraits::AfterChildWaitLoop(void *dataOrig) +{ +} + +bool wxGUIAppTraits::DoMessageFromThreadWait() +{ + return false; +} + +wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() +{ + static wxToolkitInfo info; + wxToolkitInfo& baseInfo = wxAppTraits::GetToolkitInfo(); + info.versionMajor = baseInfo.versionMajor; + info.versionMinor = baseInfo.versionMinor; + info.os = baseInfo.os; + info.shortName = _T("msw"); + info.name = _T("wxMSW"); +#ifdef __WXUNIVERSAL__ + info.shortName << _T("univ"); + info.name << _T("/wxUniversal"); +#endif + return info; +} + +// =========================================================================== +// wxApp implementation +// =========================================================================== + +int wxApp::m_nCmdShow = 0; + +// --------------------------------------------------------------------------- +// wxWin macros +// --------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) + +BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) + EVT_IDLE(wxApp::OnIdle) + EVT_END_SESSION(wxApp::OnEndSession) + EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession) +END_EVENT_TABLE() + +// class to ensure that wxAppBase::CleanUp() is called if our Initialize() +// fails +class wxCallBaseCleanup +{ +public: + wxCallBaseCleanup(wxApp *app) : m_app(app) { } + ~wxCallBaseCleanup() { if ( m_app ) m_app->wxAppBase::CleanUp(); } + + void Dismiss() { m_app = NULL; } + +private: + wxApp *m_app; +}; + +//// Initialize +bool wxApp::Initialize(int& argc, wxChar **argv) +{ + if ( !wxAppBase::Initialize(argc, argv) ) + return false; + + // ensure that base cleanup is done if we return too early + wxCallBaseCleanup callBaseCleanup(this); + + wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100); + + callBaseCleanup.Dismiss(); + + return true; +} + +// --------------------------------------------------------------------------- +// RegisterWindowClasses +// --------------------------------------------------------------------------- + +// TODO we should only register classes really used by the app. For this it +// would be enough to just delay the class registration until an attempt +// to create a window of this class is made. +bool wxApp::RegisterWindowClasses() +{ + return TRUE; +} + +// --------------------------------------------------------------------------- +// UnregisterWindowClasses +// --------------------------------------------------------------------------- + +bool wxApp::UnregisterWindowClasses() +{ + bool retval = TRUE; + return retval; +} + +void wxApp::CleanUp() +{ + // all objects pending for deletion must be deleted first, otherwise we + // would crash when they use wxWinHandleHash (and UnregisterWindowClasses() + // call wouldn't succeed as long as any windows still exist), so call the + // base class method first and only then do our clean up + wxAppBase::CleanUp(); + + // for an EXE the classes are unregistered when it terminates but DLL may + // be loaded several times (load/unload/load) into the same process in + // which case the registration will fail after the first time if we don't + // unregister the classes now + UnregisterWindowClasses(); + + delete wxWinHandleHash; + wxWinHandleHash = NULL; +} + +// ---------------------------------------------------------------------------- +// wxApp ctor/dtor +// ---------------------------------------------------------------------------- + +wxApp::wxApp() +{ + m_printMode = wxPRINT_WINDOWS; +} + +wxApp::~wxApp() +{ + // our cmd line arguments are allocated inside wxEntry(HINSTANCE), they + // don't come from main(), so we have to free them + + while ( argc ) + { + // m_argv elements were allocated by wxStrdup() + free(argv[--argc]); + } + + // but m_argv itself -- using new[] + delete [] argv; +} + +// ---------------------------------------------------------------------------- +// wxApp idle handling +// ---------------------------------------------------------------------------- + +void wxApp::OnIdle(wxIdleEvent& event) +{ + wxAppBase::OnIdle(event); +} + +void wxApp::WakeUpIdle() +{ +} + +// ---------------------------------------------------------------------------- +// other wxApp event hanlders +// ---------------------------------------------------------------------------- + +void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) +{ + if (GetTopWindow()) + GetTopWindow()->Close(TRUE); +} + +// Default behaviour: close the application with prompts. The +// user can veto the close, and therefore the end session. +void wxApp::OnQueryEndSession(wxCloseEvent& event) +{ + if (GetTopWindow()) + { + if (!GetTopWindow()->Close(!event.CanVeto())) + event.Veto(TRUE); + } +} + +// ---------------------------------------------------------------------------- +// miscellaneous +// ---------------------------------------------------------------------------- + +/* static */ +int wxApp::GetComCtl32Version() +{ + return 0; +} + +// Yield to incoming messages + +bool wxApp::Yield(bool onlyIfNeeded) +{ + return true; +} + +#if wxUSE_EXCEPTIONS + +// ---------------------------------------------------------------------------- +// exception handling +// ---------------------------------------------------------------------------- + +bool wxApp::OnExceptionInMainLoop() +{ + return true; +} + +#endif // wxUSE_EXCEPTIONS diff --git a/src/palmos/base.cpp b/src/palmos/base.cpp new file mode 100644 index 0000000000..6d83ddb485 --- /dev/null +++ b/src/palmos/base.cpp @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/basemsw.cpp +// Purpose: misc stuff only used in applications under PalmOS +// Author: William Osborne +// Modified by: +// Created: 10.13.2004 +// RCS-ID: $Id: +// Copyright: (c) 2004 William Osborne +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif //WX_PRECOMP + +#include "wx/apptrait.h" + +#include "wx/recguard.h" + +// ============================================================================ +// wxConsoleAppTraits implementation +// ============================================================================ + +void wxConsoleAppTraits::AlwaysYield() +{ +} + +void *wxConsoleAppTraits::BeforeChildWaitLoop() +{ + return NULL; +} + +void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data)) +{ +} + +bool wxConsoleAppTraits::DoMessageFromThreadWait() +{ + return true; +} + diff --git a/src/palmos/bitmap.cpp b/src/palmos/bitmap.cpp new file mode 100644 index 0000000000..06dff74aa2 --- /dev/null +++ b/src/palmos/bitmap.cpp @@ -0,0 +1,525 @@ +//////////////////////////////////////////////////////////////////////////// +// Name: bitmap.cpp +// Purpose: wxBitmap +// Author: William Osborne +// Modified by: +// Created: 10/08/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "bitmap.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include + + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/palette.h" + #include "wx/dcmemory.h" + #include "wx/bitmap.h" + #include "wx/icon.h" +#endif + +#include "wx/log.h" + +#if wxUSE_WXDIB +#include "wx/palmos/dib.h" +#endif + +#include "wx/image.h" +#include "wx/xpmdecod.h" + +#ifdef wxHAVE_RAW_BITMAP +#include "wx/rawbmp.h" +#endif + +// missing from mingw32 header +#ifndef CLR_INVALID + #define CLR_INVALID ((COLORREF)-1) +#endif // no CLR_INVALID + +// ---------------------------------------------------------------------------- +// Bitmap data +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxBitmapRefData : public wxGDIImageRefData +{ +public: + wxBitmapRefData(); + virtual ~wxBitmapRefData() { Free(); } + + virtual void Free(); + + // set the mask object to use as the mask, we take ownership of it + void SetMask(wxMask *mask) + { + delete m_bitmapMask; + m_bitmapMask = mask; + } + + // return the mask + wxMask *GetMask() const { return m_bitmapMask; } + +public: +#if wxUSE_PALETTE + wxPalette m_bitmapPalette; +#endif // wxUSE_PALETTE + +#ifdef __WXDEBUG__ + wxDC *m_selectedInto; +#endif // __WXDEBUG__ + +#if wxUSE_WXDIB + wxDIB *m_dib; +#endif + + bool m_hasAlpha; + + bool m_isDIB; + +private: + wxMask *m_bitmapMask; + + DECLARE_NO_COPY_CLASS(wxBitmapRefData) +}; + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) + +IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// helper functions +// ---------------------------------------------------------------------------- + +#if !wxUSE_WXDIB + #define NEVER_USE_DIB +#else + static inline bool wxShouldCreateDIB(int w, int h, int d, WXHDC hdc) + { + // here is the logic: + // + // (a) if hdc is specified, the caller explicitly wants DDB + // (b) otherwise, create a DIB if depth >= 24 (we don't support 16bpp + // or less DIBs anyhow) + // (c) finally, create DIBs under Win9x even if the depth hasn't been + // explicitly specified but the current display depth is 24 or + // more and the image is "big", i.e. > 16Mb which is the + // theoretical limit for DDBs under Win9x + // + // consequences (all of which seem to make sense): + // + // (i) by default, DDBs are created (depth == -1 usually) + // (ii) DIBs can be created by explicitly specifying the depth + // (iii) using a DC always forces creating a DDB + return !hdc && + (d >= 24 || + (d == -1 && + wxDIB::GetLineSize(w, wxDisplayDepth())*h > 16*1024*1024)); + } + + #define SOMETIMES_USE_DIB +#endif // different DIB usage scenarious + +// ---------------------------------------------------------------------------- +// wxBitmapRefData +// ---------------------------------------------------------------------------- + +wxBitmapRefData::wxBitmapRefData() +{ +#ifdef __WXDEBUG__ + m_selectedInto = NULL; +#endif + m_bitmapMask = NULL; + + m_hBitmap = (WXHBITMAP) NULL; +#if wxUSE_WXDIB + m_dib = NULL; +#endif + + m_isDIB = + m_hasAlpha = FALSE; +} + +void wxBitmapRefData::Free() +{ +} + +// ---------------------------------------------------------------------------- +// wxBitmap creation +// ---------------------------------------------------------------------------- + +// this function should be called from all wxBitmap ctors +void wxBitmap::Init() +{ +} + +wxGDIImageRefData *wxBitmap::CreateData() const +{ + return NULL; +} + +#ifdef __WIN32__ + +bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon) +{ + return FALSE; +} + +#endif // Win32 + +bool wxBitmap::CopyFromCursor(const wxCursor& cursor) +{ + return FALSE; +} + +bool wxBitmap::CopyFromIcon(const wxIcon& icon) +{ + return FALSE; +} + +#ifndef NEVER_USE_DIB + +bool wxBitmap::CopyFromDIB(const wxDIB& dib) +{ + return FALSE: +} + +#endif // NEVER_USE_DIB + +wxBitmap::~wxBitmap() +{ +} + +wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) +{ + Init(); +} + +// Create from XPM data +#if wxUSE_IMAGE && wxUSE_XPM +bool wxBitmap::CreateFromXpm(const char **data) +#else +bool wxBitmap::CreateFromXpm(const char **WXUNUSED(data)) +#endif +{ + return FALSE; +} + +wxBitmap::wxBitmap(int w, int h, int d) +{ +} + +wxBitmap::wxBitmap(int w, int h, const wxDC& dc) +{ +} + +wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth) +{ +} + +wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) +{ +} + +bool wxBitmap::Create(int width, int height, int depth) +{ + return FALSE; +} + +bool wxBitmap::Create(int width, int height, const wxDC& dc) +{ + return FALSE; +} + +bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc) +{ + return FALSE; +} + +#if wxUSE_IMAGE + +// ---------------------------------------------------------------------------- +// wxImage to/from conversions +// ---------------------------------------------------------------------------- + +#if wxUSE_WXDIB + +bool wxBitmap::CreateFromImage(const wxImage& image, int depth) +{ + return FALSE; +} + +bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) +{ + return FALSE; +} + +bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) +{ + return FALSE; +} + +wxImage wxBitmap::ConvertToImage() const +{ + wxImage image; + return image; +} + +#endif // wxUSE_WXDIB + +#endif // wxUSE_IMAGE + +// ---------------------------------------------------------------------------- +// loading and saving bitmaps +// ---------------------------------------------------------------------------- + +bool wxBitmap::LoadFile(const wxString& filename, long type) +{ + return FALSE; +} + +bool wxBitmap::Create(void *data, long type, int width, int height, int depth) +{ + return FALSE; +} + +bool wxBitmap::SaveFile(const wxString& filename, + int type, + const wxPalette *palette) +{ + return FALSE; +} + +// ---------------------------------------------------------------------------- +// sub bitmap extraction +// ---------------------------------------------------------------------------- + +wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const +{ + wxBitmap ret( 0, 0 ); + return ret; +} + +// ---------------------------------------------------------------------------- +// wxBitmap accessors +// ---------------------------------------------------------------------------- + +#if wxUSE_PALETTE +wxPalette* wxBitmap::GetPalette() const +{ + return (wxPalette *) NULL; +} +#endif + +wxMask *wxBitmap::GetMask() const +{ + return (wxMask *) NULL; +} + +#ifdef __WXDEBUG__ + +wxDC *wxBitmap::GetSelectedInto() const +{ + return (wxDC *) NULL; +} + +#endif + +#if WXWIN_COMPATIBILITY_2_4 + +int wxBitmap::GetQuality() const +{ + return 0; +} + +#endif // WXWIN_COMPATIBILITY_2_4 + +void wxBitmap::UseAlpha() +{ +} + +bool wxBitmap::HasAlpha() const +{ + return FALSE; +} + +// ---------------------------------------------------------------------------- +// wxBitmap setters +// ---------------------------------------------------------------------------- + +#ifdef __WXDEBUG__ + +void wxBitmap::SetSelectedInto(wxDC *dc) +{ +} + +#endif + +#if wxUSE_PALETTE + +void wxBitmap::SetPalette(const wxPalette& palette) +{ +} + +#endif // wxUSE_PALETTE + +void wxBitmap::SetMask(wxMask *mask) +{ +} + +#if WXWIN_COMPATIBILITY_2_4 + +void wxBitmap::SetQuality(int WXUNUSED(quality)) +{ +} + +#endif // WXWIN_COMPATIBILITY_2_4 + +// ---------------------------------------------------------------------------- +// raw bitmap access support +// ---------------------------------------------------------------------------- + +#ifdef wxHAVE_RAW_BITMAP +void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) +{ + return NULL; +} + +void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) +{ + return; +} +#endif // #ifdef wxHAVE_RAW_BITMAP + +// ---------------------------------------------------------------------------- +// wxMask +// ---------------------------------------------------------------------------- + +wxMask::wxMask() +{ + m_maskBitmap = 0; +} + +// Construct a mask from a bitmap and a colour indicating +// the transparent area +wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour) +{ +} + +// Construct a mask from a bitmap and a palette index indicating +// the transparent area +wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex) +{ +} + +// Construct a mask from a mono bitmap (copies the bitmap). +wxMask::wxMask(const wxBitmap& bitmap) +{ +} + +wxMask::~wxMask() +{ +} + +// Create a mask from a mono bitmap (copies the bitmap). +bool wxMask::Create(const wxBitmap& bitmap) +{ + return FALSE; +} + +// Create a mask from a bitmap and a palette index indicating +// the transparent area +bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex) +{ + return FALSE; +} + +// Create a mask from a bitmap and a colour indicating +// the transparent area +bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) +{ + return FALSE; +} + +// ---------------------------------------------------------------------------- +// wxBitmapHandler +// ---------------------------------------------------------------------------- + +bool wxBitmapHandler::Create(wxGDIImage *image, + void *data, + long flags, + int width, int height, int depth) +{ + return FALSE; +} + +bool wxBitmapHandler::Load(wxGDIImage *image, + const wxString& name, + long flags, + int width, int height) +{ + return FALSE; +} + +bool wxBitmapHandler::Save(wxGDIImage *image, + const wxString& name, + int type) +{ + return FALSE; +} + +bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), + void *WXUNUSED(data), + long WXUNUSED(type), + int WXUNUSED(width), + int WXUNUSED(height), + int WXUNUSED(depth)) +{ + return FALSE; +} + +bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), + const wxString& WXUNUSED(name), + long WXUNUSED(type), + int WXUNUSED(desiredWidth), + int WXUNUSED(desiredHeight)) +{ + return FALSE; +} + +bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), + const wxString& WXUNUSED(name), + int WXUNUSED(type), + const wxPalette *WXUNUSED(palette)) +{ + return FALSE; +} diff --git a/src/palmos/bmpbuttn.cpp b/src/palmos/bmpbuttn.cpp new file mode 100644 index 0000000000..8290018f66 --- /dev/null +++ b/src/palmos/bmpbuttn.cpp @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/bmpbuttn.cpp +// Purpose: wxBitmapButton +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "bmpbuttn.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_BMPBUTTON + +#ifndef WX_PRECOMP + #include "wx/bmpbuttn.h" + #include "wx/log.h" + #include "wx/dcmemory.h" +#endif + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI + +WX_DEFINE_FLAGS( wxBitmapButtonStyle ) + +wxBEGIN_FLAGS( wxBitmapButtonStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxBU_AUTODRAW) + wxFLAGS_MEMBER(wxBU_LEFT) + wxFLAGS_MEMBER(wxBU_RIGHT) + wxFLAGS_MEMBER(wxBU_TOP) + wxFLAGS_MEMBER(wxBU_BOTTOM) +wxEND_FLAGS( wxBitmapButtonStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxBitmapButton, wxButton,"wx/bmpbuttn.h") + +wxBEGIN_PROPERTIES_TABLE(wxBitmapButton) + wxPROPERTY_FLAGS( WindowStyle , wxBitmapButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxBitmapButton) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxBitmapButton , wxWindow* , Parent , wxWindowID , Id , wxBitmap , Bitmap , wxPoint , Position , wxSize , Size ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) +#endif + +#define BUTTON_HEIGHT_FACTOR (EDIT_CONTROL_FACTOR * 1.1) + +bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, + const wxBitmap& bitmap, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& wxVALIDATOR_PARAM(validator), + const wxString& name) +{ + return false; +} + +#define FOCUS_MARGIN 3 + +bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) +{ + return true; +} + +void wxBitmapButton::DrawFace( WXHDC dc, int left, int top, + int right, int bottom, bool sel ) +{ +} + +void wxBitmapButton::DrawButtonFocus( WXHDC dc, int left, int top, int right, + int bottom, bool WXUNUSED(sel) ) +{ +} + +void wxBitmapButton::DrawButtonDisable( WXHDC dc, int left, int top, int right, + int bottom, bool with_marg ) +{ +} + +void wxBitmapButton::SetDefault() +{ +} + +wxSize wxBitmapButton::DoGetBestSize() const +{ + wxSize best; + best.x = 0; + best.y = 0; + + return best; +} + +#endif // wxUSE_BMPBUTTON + diff --git a/src/palmos/brush.cpp b/src/palmos/brush.cpp new file mode 100644 index 0000000000..2719da4954 --- /dev/null +++ b/src/palmos/brush.cpp @@ -0,0 +1,136 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/brush.cpp +// Purpose: wxBrush +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "brush.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/brush.h" +#endif // WX_PRECOMP + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// ============================================================================ +// wxBrush implementation +// ============================================================================ + +IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) + +// ---------------------------------------------------------------------------- +// wxBrush ctors/dtor +// ---------------------------------------------------------------------------- + +wxBrush::wxBrush() +{ +} + +wxBrush::wxBrush(const wxColour& col, int style) +{ +} + +wxBrush::wxBrush(const wxBitmap& stipple) +{ +} + +wxBrush::~wxBrush() +{ +} + +// ---------------------------------------------------------------------------- +// wxBrush house keeping stuff +// ---------------------------------------------------------------------------- + +wxBrush& wxBrush::operator=(const wxBrush& brush) +{ + return *this; +} + +bool wxBrush::operator==(const wxBrush& brush) const +{ + return FALSE; +} + +wxObjectRefData *wxBrush::CreateRefData() const +{ + return NULL; +} + +wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const +{ + return NULL; +} + +// ---------------------------------------------------------------------------- +// wxBrush accessors +// ---------------------------------------------------------------------------- + +wxColour wxBrush::GetColour() const +{ + return wxNullColour; +} + +int wxBrush::GetStyle() const +{ + return -1; +} + +wxBitmap *wxBrush::GetStipple() const +{ + return NULL; +} + +WXHANDLE wxBrush::GetResourceHandle() const +{ + return (WXHANDLE)0; +} + +// ---------------------------------------------------------------------------- +// wxBrush setters +// ---------------------------------------------------------------------------- + +void wxBrush::SetColour(const wxColour& col) +{ +} + +void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b) +{ +} + +void wxBrush::SetStyle(int style) +{ +} + +void wxBrush::SetStipple(const wxBitmap& stipple) +{ +} + + diff --git a/src/palmos/button.cpp b/src/palmos/button.cpp new file mode 100644 index 0000000000..fdaf6f2570 --- /dev/null +++ b/src/palmos/button.cpp @@ -0,0 +1,248 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/button.cpp +// Purpose: wxButton +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "button.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_BUTTON + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/button.h" + #include "wx/brush.h" + #include "wx/panel.h" + #include "wx/bmpbuttn.h" + #include "wx/settings.h" + #include "wx/dcscreen.h" +#endif + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI + +WX_DEFINE_FLAGS( wxButtonStyle ) + +wxBEGIN_FLAGS( wxButtonStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxBU_LEFT) + wxFLAGS_MEMBER(wxBU_RIGHT) + wxFLAGS_MEMBER(wxBU_TOP) + wxFLAGS_MEMBER(wxBU_BOTTOM) + wxFLAGS_MEMBER(wxBU_EXACTFIT) +wxEND_FLAGS( wxButtonStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h") + +wxBEGIN_PROPERTIES_TABLE(wxButton) + wxEVENT_PROPERTY( Click , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + + wxPROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxButton) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) + + +#else +IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) +#endif + +// this macro tries to adjust the default button height to a reasonable value +// using the char height as the base +#define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// creation/destruction +// ---------------------------------------------------------------------------- + +bool wxButton::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +wxButton::~wxButton() +{ +} + +// ---------------------------------------------------------------------------- +// flags +// ---------------------------------------------------------------------------- + +WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// size management including autosizing +// ---------------------------------------------------------------------------- + +wxSize wxButton::DoGetBestSize() const +{ + return wxSize(0,0); +} + +/* static */ +wxSize wxButtonBase::GetDefaultSize() +{ + return wxSize(0,0); +} + +void wxButton::SetDefault() +{ +} + +void wxButton::SetTmpDefault() +{ +} + +void wxButton::UnsetTmpDefault() +{ +} + +/* static */ +void +wxButton::SetDefaultStyle(wxButton *btn, bool on) +{ +} + +// ---------------------------------------------------------------------------- +// helpers +// ---------------------------------------------------------------------------- + +bool wxButton::SendClickEvent() +{ + return false; +} + +void wxButton::Command(wxCommandEvent & event) +{ +} + +// ---------------------------------------------------------------------------- +// event/message handlers +// ---------------------------------------------------------------------------- + +bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// owner-drawn buttons support +// ---------------------------------------------------------------------------- + +#ifdef __WIN32__ + +// drawing helpers + +static void DrawButtonText(HDC hdc, + RECT *pRect, + const wxString& text, + COLORREF col) +{ +} + +static void DrawRect(HDC hdc, const RECT& r) +{ +} + +void wxButton::MakeOwnerDrawn() +{ +} + +bool wxButton::SetBackgroundColour(const wxColour &colour) +{ + return false; +} + +bool wxButton::SetForegroundColour(const wxColour &colour) +{ + return false; +} + +static void DrawButtonFrame(HDC hdc, const RECT& rectBtn, + bool selected, bool pushed) +{ +} + +bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis) +{ + return true; +} + +#endif // __WIN32__ + +#endif // wxUSE_BUTTON + diff --git a/src/palmos/caret.cpp b/src/palmos/caret.cpp new file mode 100644 index 0000000000..cdf3b896b2 --- /dev/null +++ b/src/palmos/caret.cpp @@ -0,0 +1,115 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/caret.cpp +// Purpose: Palm OS implementation of wxCaret +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "caret.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/log.h" +#endif // WX_PRECOMP + +#include "wx/caret.h" + +#if wxUSE_CARET + +#include "wx/palmos/private.h" + +// --------------------------------------------------------------------------- +// macros +// --------------------------------------------------------------------------- + +#define CALL_CARET_API(api, args) \ + if ( !api args ) \ + wxLogLastError(_T(#api)) + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// blink time +// --------------------------------------------------------------------------- + +//static +int wxCaretBase::GetBlinkTime() +{ + return 0; +} + +//static +void wxCaretBase::SetBlinkTime(int milliseconds) +{ +} + +// --------------------------------------------------------------------------- +// creating/destroying the caret +// --------------------------------------------------------------------------- + +bool wxCaret::PalmOSCreateCaret() +{ + return false; +} + +void wxCaret::OnSetFocus() +{ +} + +void wxCaret::OnKillFocus() +{ +} + +// --------------------------------------------------------------------------- +// showing/hiding the caret +// --------------------------------------------------------------------------- + +void wxCaret::DoShow() +{ +} + +void wxCaret::DoHide() +{ +} + +// --------------------------------------------------------------------------- +// moving the caret +// --------------------------------------------------------------------------- + +void wxCaret::DoMove() +{ +} + + +// --------------------------------------------------------------------------- +// resizing the caret +// --------------------------------------------------------------------------- + +void wxCaret::DoSize() +{ +} + +#endif diff --git a/src/palmos/checkbox.cpp b/src/palmos/checkbox.cpp new file mode 100644 index 0000000000..527868a833 --- /dev/null +++ b/src/palmos/checkbox.cpp @@ -0,0 +1,166 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/checkbox.cpp +// Purpose: wxCheckBox +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "checkbox.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_CHECKBOX + +#ifndef WX_PRECOMP + #include "wx/checkbox.h" + #include "wx/brush.h" + #include "wx/dcscreen.h" + #include "wx/settings.h" +#endif + +#include "wx/palmos/private.h" + +#ifndef BST_UNCHECKED + #define BST_UNCHECKED 0x0000 +#endif + +#ifndef BST_CHECKED + #define BST_CHECKED 0x0001 +#endif + +#ifndef BST_INDETERMINATE + #define BST_INDETERMINATE 0x0002 +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxCheckBoxStyle ) + +wxBEGIN_FLAGS( wxCheckBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxNO_BORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxNO_FULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxCheckBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckBox, wxControl,"wx/checkbox.h") + +wxBEGIN_PROPERTIES_TABLE(wxCheckBox) + wxEVENT_PROPERTY( Click , wxEVT_COMMAND_CHECKBOX_CLICKED , wxCommandEvent ) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxCheckBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxCheckBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxCheckBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) +#endif + + +// ---------------------------------------------------------------------------- +// wxCheckBox +// ---------------------------------------------------------------------------- + +bool wxCheckBox::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) +{ + return true; +} + +bool wxCheckBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +void wxCheckBox::SetLabel(const wxString& label) +{ +} + +wxSize wxCheckBox::DoGetBestSize() const +{ + return wxSize(0,0); +} + +void wxCheckBox::SetValue(bool val) +{ +} + +bool wxCheckBox::GetValue() const +{ + return false; +} + +void wxCheckBox::Command(wxCommandEvent& event) +{ +} + +wxCOMPILE_TIME_ASSERT(wxCHK_UNCHECKED == BST_UNCHECKED + && wxCHK_CHECKED == BST_CHECKED + && wxCHK_UNDETERMINED == BST_INDETERMINATE, EnumValuesIncorrect); + +void wxCheckBox::DoSet3StateValue(wxCheckBoxState state) +{ +} + +wxCheckBoxState wxCheckBox::DoGet3StateValue() const +{ + return (wxCheckBoxState) 0; +} + +#endif // wxUSE_CHECKBOX diff --git a/src/palmos/checklst.cpp b/src/palmos/checklst.cpp new file mode 100644 index 0000000000..08efd5f0ef --- /dev/null +++ b/src/palmos/checklst.cpp @@ -0,0 +1,291 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/checklst.cpp +// Purpose: implementation of wxCheckListBox class +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "checklst.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_OWNER_DRAWN + +#ifndef WX_PRECOMP + #include "wx/object.h" + #include "wx/colour.h" + #include "wx/font.h" + #include "wx/bitmap.h" + #include "wx/window.h" + #include "wx/listbox.h" + #include "wx/dcmemory.h" + + #include "wx/settings.h" + + #include "wx/log.h" +#endif + +#include "wx/ownerdrw.h" +#include "wx/checklst.h" + +#include "wx/palmos/wrapwin.h" + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// get item (converted to right type) +#define GetItem(n) ((wxCheckListBoxItem *)(GetItem(n))) + +// ============================================================================ +// implementation +// ============================================================================ + + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxCheckListBoxStyle ) + +wxBEGIN_FLAGS( wxCheckListBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxLB_SINGLE) + wxFLAGS_MEMBER(wxLB_MULTIPLE) + wxFLAGS_MEMBER(wxLB_EXTENDED) + wxFLAGS_MEMBER(wxLB_HSCROLL) + wxFLAGS_MEMBER(wxLB_ALWAYS_SB) + wxFLAGS_MEMBER(wxLB_NEEDED_SB) + wxFLAGS_MEMBER(wxLB_SORT) + wxFLAGS_MEMBER(wxLB_OWNERDRAW) + +wxEND_FLAGS( wxCheckListBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox,"wx/checklst.h") + +wxBEGIN_PROPERTIES_TABLE(wxCheckListBox) + wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent ) + wxPROPERTY_FLAGS( WindowStyle , wxCheckListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , wxLB_OWNERDRAW /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxCheckListBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_4( wxCheckListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) +#endif + +// ---------------------------------------------------------------------------- +// declaration and implementation of wxCheckListBoxItem class +// ---------------------------------------------------------------------------- + +class wxCheckListBoxItem : public wxOwnerDrawn +{ +friend class WXDLLEXPORT wxCheckListBox; +public: + // ctor + wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex); + + // drawing functions + virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat); + + // simple accessors and operations + bool IsChecked() const { return m_bChecked; } + + void Check(bool bCheck); + void Toggle() { Check(!IsChecked()); } + + void SendEvent(); + +private: + + DECLARE_NO_COPY_CLASS(wxCheckListBoxItem) + bool m_bChecked; + wxCheckListBox *m_pParent; + size_t m_nIndex; +}; + +wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex) + : wxOwnerDrawn(wxEmptyString, TRUE) // checkable +{ +} + +bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc, + wxODAction act, wxODStatus stat) +{ + return FALSE; +} + +// change the state of the item and redraw it +void wxCheckListBoxItem::Check(bool check) +{ +} + +// send an "item checked" event +void wxCheckListBoxItem::SendEvent() +{ +} + +// ---------------------------------------------------------------------------- +// implementation of wxCheckListBox class +// ---------------------------------------------------------------------------- + +// define event table +// ------------------ +BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox) + EVT_KEY_DOWN(wxCheckListBox::OnKeyDown) + EVT_LEFT_DOWN(wxCheckListBox::OnLeftClick) +END_EVENT_TABLE() + +// control creation +// ---------------- + +// def ctor: use Create() to really create the control +wxCheckListBox::wxCheckListBox() +{ +} + +// ctor which creates the associated control +wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + int nStrings, const wxString choices[], + long style, const wxValidator& val, + const wxString& name) +{ + Create(parent, id, pos, size, nStrings, choices, style, val, name); +} + +wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, const wxValidator& val, + const wxString& name) +{ + Create(parent, id, pos, size, choices, style, val, name); +} + +bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, const wxString& name) +{ + return wxListBox::Create(parent, id, pos, size, n, choices, + style | wxLB_OWNERDRAW, validator, name); +} + +bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, const wxString& name) +{ + return wxListBox::Create(parent, id, pos, size, choices, + style | wxLB_OWNERDRAW, validator, name); +} + +// misc overloaded methods +// ----------------------- + +void wxCheckListBox::Delete(int N) +{ +} + +bool wxCheckListBox::SetFont( const wxFont &font ) +{ + return false; +} + +// create/retrieve item +// -------------------- + +// create a check list box item +wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t nIndex) +{ + wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex); + return pItem; +} + +// return item size +// ---------------- +bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) +{ + return false; +} + +// check items +// ----------- + +bool wxCheckListBox::IsChecked(size_t uiIndex) const +{ + return false; +} + +void wxCheckListBox::Check(size_t uiIndex, bool bCheck) +{ +} + +// process events +// -------------- + +void wxCheckListBox::OnKeyDown(wxKeyEvent& event) +{ +} + +void wxCheckListBox::OnLeftClick(wxMouseEvent& event) +{ +} + +int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const +{ + return wxNOT_FOUND; +} + +#endif + diff --git a/src/palmos/choice.cpp b/src/palmos/choice.cpp new file mode 100644 index 0000000000..2abc6a9d89 --- /dev/null +++ b/src/palmos/choice.cpp @@ -0,0 +1,284 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: choice.cpp +// Purpose: wxChoice +// Author: William Osborne +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "choice.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_CHOICE + +#ifndef WX_PRECOMP + #include "wx/choice.h" + #include "wx/utils.h" + #include "wx/log.h" + #include "wx/brush.h" + #include "wx/settings.h" +#endif + +#include "wx/palmos/private.h" + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxChoiceStyle ) + +wxBEGIN_FLAGS( wxChoiceStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxChoiceStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl,"wx/choice.h") + +wxBEGIN_PROPERTIES_TABLE(wxChoice) + wxEVENT_PROPERTY( Select , wxEVT_COMMAND_CHOICE_SELECTED , wxCommandEvent ) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxChoiceStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxChoice) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// creation +// ---------------------------------------------------------------------------- + +bool wxChoice::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +bool wxChoice::CreateAndInit(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + return FALSE; +} + +bool wxChoice::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +bool wxChoice::MSWShouldPreProcessMessage(WXMSG *pMsg) +{ + return false; +} + +WXDWORD wxChoice::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +wxChoice::~wxChoice() +{ +} + +// ---------------------------------------------------------------------------- +// adding/deleting items to/from the list +// ---------------------------------------------------------------------------- + +int wxChoice::DoAppend(const wxString& item) +{ + return 0; +} + +int wxChoice::DoInsert(const wxString& item, int pos) +{ + return 0; +} + +void wxChoice::Delete(int n) +{ +} + +void wxChoice::Clear() +{ +} + +void wxChoice::Free() +{ +} + +// ---------------------------------------------------------------------------- +// selection +// ---------------------------------------------------------------------------- + +int wxChoice::GetSelection() const +{ + return 0; +} + +void wxChoice::SetSelection(int n) +{ +} + +// ---------------------------------------------------------------------------- +// string list functions +// ---------------------------------------------------------------------------- + +int wxChoice::GetCount() const +{ + return 0; +} + +int wxChoice::FindString(const wxString& s) const +{ + return 0; +} + +void wxChoice::SetString(int n, const wxString& s) +{ +} + +wxString wxChoice::GetString(int n) const +{ + wxString str; + + return str; +} + +// ---------------------------------------------------------------------------- +// client data +// ---------------------------------------------------------------------------- + +void wxChoice::DoSetItemClientData( int n, void* clientData ) +{ +} + +void* wxChoice::DoGetItemClientData( int n ) const +{ + return (void *)NULL; +} + +void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData ) +{ +} + +wxClientData* wxChoice::DoGetItemClientObject( int n ) const +{ + return (wxClientData *)DoGetItemClientData(n); +} + +// ---------------------------------------------------------------------------- +// wxMSW specific helpers +// ---------------------------------------------------------------------------- + +void wxChoice::UpdateVisibleHeight() +{ +} + +void wxChoice::DoMoveWindow(int x, int y, int width, int height) +{ +} + +void wxChoice::DoGetSize(int *w, int *h) const +{ +} + +void wxChoice::DoSetSize(int x, int y, + int width, int height, + int sizeFlags) +{ +} + +wxSize wxChoice::DoGetBestSize() const +{ + return wxSize(0,0); +} + +WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +bool wxChoice::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +{ + return false; +} + +WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) + ) +{ + return (WXHBRUSH) 0; +} + +#endif // wxUSE_CHOICE diff --git a/src/palmos/clipbrd.cpp b/src/palmos/clipbrd.cpp new file mode 100644 index 0000000000..93b63f584e --- /dev/null +++ b/src/palmos/clipbrd.cpp @@ -0,0 +1,210 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: clipbrd.cpp +// Purpose: Clipboard functionality +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "clipbrd.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/setup.h" +#endif + +#if wxUSE_CLIPBOARD + +#ifndef WX_PRECOMP + #include "wx/object.h" + #include "wx/event.h" + #include "wx/app.h" + #include "wx/frame.h" + #include "wx/bitmap.h" + #include "wx/utils.h" + #include "wx/intl.h" +#endif + +#if wxUSE_METAFILE + #include "wx/metafile.h" +#endif + +#include "wx/log.h" +#include "wx/clipbrd.h" + +#include + +#include "wx/palmos/private.h" + +#if wxUSE_WXDIB +#include "wx/palmos/dib.h" +#endif + +#if wxUSE_DATAOBJ + #include "wx/dataobj.h" +#endif + +#if wxUSE_OLE && !defined(__WXWINCE__) + // use OLE clipboard + #define wxUSE_OLE_CLIPBOARD 1 +#else // !wxUSE_DATAOBJ + // use Win clipboard API + #define wxUSE_OLE_CLIPBOARD 0 +#endif + +#if wxUSE_OLE_CLIPBOARD + #include +#endif // wxUSE_OLE_CLIPBOARD + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// old-style clipboard functions +// --------------------------------------------------------------------------- + +static bool gs_wxClipboardIsOpen = FALSE; + +bool wxOpenClipboard() +{ + return false; +} + +bool wxCloseClipboard() +{ + return false; +} + +bool wxEmptyClipboard() +{ + return false; +} + +bool wxIsClipboardOpened() +{ + return false; +} + +bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) +{ + return false; +} + + +bool wxSetClipboardData(wxDataFormat dataFormat, + const void *data, + int width, int height) +{ + return false; +} + +void *wxGetClipboardData(wxDataFormat dataFormat, long *len) +{ + void *retval = NULL; + + return retval; +} + +wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) +{ + return (wxDataFormat::NativeFormat)::EnumClipboardFormats(dataFormat); +} + +int wxRegisterClipboardFormat(wxChar *formatName) +{ + return ::RegisterClipboardFormat(formatName); +} + +bool wxGetClipboardFormatName(wxDataFormat dataFormat, + wxChar *formatName, + int maxCount) +{ + return false; +} + +// --------------------------------------------------------------------------- +// wxClipboard +// --------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) + +wxClipboard::wxClipboard() +{ + m_clearOnExit = FALSE; + m_isOpened = FALSE; +} + +wxClipboard::~wxClipboard() +{ + if ( m_clearOnExit ) + { + Clear(); + } +} + +void wxClipboard::Clear() +{ +} + +bool wxClipboard::Flush() +{ + return false; +} + +bool wxClipboard::Open() +{ + return wxOpenClipboard(); +} + +bool wxClipboard::IsOpened() const +{ + return wxIsClipboardOpened(); +} + +bool wxClipboard::SetData( wxDataObject *data ) +{ + return false; +} + +bool wxClipboard::AddData( wxDataObject *data ) +{ + return false; +} + +void wxClipboard::Close() +{ + wxCloseClipboard(); +} + +bool wxClipboard::IsSupported( wxDataFormat format ) +{ + return wxIsClipboardFormatAvailable(format); +} + +bool wxClipboard::GetData( wxDataObject& data ) +{ + return false; +} + +#endif // wxUSE_CLIPBOARD + diff --git a/src/palmos/colordlg.cpp b/src/palmos/colordlg.cpp new file mode 100644 index 0000000000..9720f46368 --- /dev/null +++ b/src/palmos/colordlg.cpp @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/colordlg.cpp +// Purpose: wxColourDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "colordlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include + #include "wx/defs.h" + #include "wx/bitmap.h" + #include "wx/pen.h" + #include "wx/brush.h" + #include "wx/colour.h" + #include "wx/gdicmn.h" + #include "wx/utils.h" + #include "wx/frame.h" + #include "wx/dialog.h" + #include "wx/msgdlg.h" +#endif + +#if wxUSE_COLOURDLG && !defined(__SMARTPHONE__) + +#include "wx/palmos/private.h" +#include "wx/colordlg.h" +#include "wx/cmndata.h" + +#include +#include +#include + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxColourDialog +// ---------------------------------------------------------------------------- + +wxColourDialog::wxColourDialog() +{ +} + +wxColourDialog::wxColourDialog(wxWindow *parent, wxColourData *data) +{ +} + +bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) +{ + return false; +} + +int wxColourDialog::ShowModal() +{ + return wxID_CANCEL; +} + +// ---------------------------------------------------------------------------- +// title +// ---------------------------------------------------------------------------- + +void wxColourDialog::SetTitle(const wxString& title) +{ + m_title = title; +} + +wxString wxColourDialog::GetTitle() const +{ + return m_title; +} + +// ---------------------------------------------------------------------------- +// position/size +// ---------------------------------------------------------------------------- + +void wxColourDialog::DoGetPosition(int *x, int *y) const +{ + if ( x ) + *x = m_pos.x; + if ( y ) + *y = m_pos.y; +} + +void wxColourDialog::DoSetSize(int x, int y, + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags)) +{ + if ( x != -1 ) + m_pos.x = x; + + if ( y != -1 ) + m_pos.y = y; + + // ignore the size params - we can't change the size of a standard dialog + return; +} + +// NB: of course, both of these functions are completely bogus, but it's better +// than nothing +void wxColourDialog::DoGetSize(int *width, int *height) const +{ + // the standard dialog size + if ( width ) + *width = 225; + if ( height ) + *height = 324; +} + +void wxColourDialog::DoGetClientSize(int *width, int *height) const +{ + // the standard dialog size + if ( width ) + *width = 219; + if ( height ) + *height = 299; +} + +#endif diff --git a/src/palmos/colour.cpp b/src/palmos/colour.cpp new file mode 100644 index 0000000000..fc292a2b99 --- /dev/null +++ b/src/palmos/colour.cpp @@ -0,0 +1,114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: colour.cpp +// Purpose: wxColour class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "colour.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" +#include "wx/colour.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "wx/gdicmn.h" + +#include + +#if wxUSE_EXTENDED_RTTI + +template<> void wxStringReadValue(const wxString &s , wxColour &data ) +{ + // copied from VS xrc + unsigned long tmp = 0; + + if (s.Length() != 7 || s[0u] != wxT('#') + || wxSscanf(s.c_str(), wxT("#%lX"), &tmp) != 1) + { + wxLogError(_("String To Colour : Incorrect colour specification : %s"), + s.c_str() ); + data = wxNullColour; + } + else + { + data = wxColour((unsigned char) ((tmp & 0xFF0000) >> 16) , + (unsigned char) ((tmp & 0x00FF00) >> 8), + (unsigned char) ((tmp & 0x0000FF))); + } +} + +template<> void wxStringWriteValue(wxString &s , const wxColour &data ) +{ + s = wxString::Format(wxT("#%02X%02X%02X"), + data.Red(), data.Green(), data.Blue() ); +} + +wxTO_STRING_IMP( wxColour ) +wxFROM_STRING_IMP( wxColour ) + +IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour , wxObject , "wx/colour.h" , &wxTO_STRING( wxColour ) , &wxFROM_STRING( wxColour )) + +wxBEGIN_PROPERTIES_TABLE(wxColour) + wxREADONLY_PROPERTY( Red, unsigned char, Red, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group")) + wxREADONLY_PROPERTY( Green, unsigned char, Green, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group")) + wxREADONLY_PROPERTY( Blue, unsigned char, Blue, EMPTY_MACROVALUE , 0 /*flags*/, wxT("Helpstring"), wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxCONSTRUCTOR_3( wxColour, unsigned char, Red, unsigned char, Green, unsigned char, Blue ) + +wxBEGIN_HANDLERS_TABLE(wxColour) +wxEND_HANDLERS_TABLE() +#else +IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) +#endif + +// Colour + +void wxColour::Init() +{ + m_isInit = false; + m_pixel = 0; + m_red = + m_blue = + m_green = 0; +} + +wxColour::wxColour(const wxColour& col) +{ + *this = col; +} + +wxColour& wxColour::operator=(const wxColour& col) +{ + m_red = col.m_red; + m_green = col.m_green; + m_blue = col.m_blue; + m_isInit = col.m_isInit; + m_pixel = col.m_pixel; + return *this; +} + +void wxColour::InitFromName(const wxString& name) +{ + // leave invalid + Init(); +} + +wxColour::~wxColour() +{ +} + +void wxColour::Set(unsigned char r, unsigned char g, unsigned char b) +{ +} + diff --git a/src/palmos/combobox.cpp b/src/palmos/combobox.cpp new file mode 100644 index 0000000000..9f11f13fd2 --- /dev/null +++ b/src/palmos/combobox.cpp @@ -0,0 +1,265 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/combobox.cpp +// Purpose: wxComboBox class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "combobox.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_COMBOBOX + +#ifndef WX_PRECOMP + #include "wx/settings.h" + #include "wx/log.h" + // for wxEVT_COMMAND_TEXT_ENTER + #include "wx/textctrl.h" +#endif + +#include "wx/combobox.h" +#include "wx/brush.h" +#include "wx/clipbrd.h" +#include "wx/palmos/private.h" + +#if wxUSE_TOOLTIPS + #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) + #include + #endif + #include "wx/tooltip.h" +#endif // wxUSE_TOOLTIPS + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxComboBoxStyle ) + +wxBEGIN_FLAGS( wxComboBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxCB_SIMPLE) + wxFLAGS_MEMBER(wxCB_SORT) + wxFLAGS_MEMBER(wxCB_READONLY) + wxFLAGS_MEMBER(wxCB_DROPDOWN) + +wxEND_FLAGS( wxComboBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl,"wx/combobox.h") + +wxBEGIN_PROPERTIES_TABLE(wxComboBox) + wxEVENT_PROPERTY( Select , wxEVT_COMMAND_COMBOBOX_SELECTED , wxCommandEvent ) + wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent ) + + // TODO DELEGATES + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Value ,wxString, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxComboBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxComboBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxComboBox , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) +#endif + +// ---------------------------------------------------------------------------- +// function prototypes +// ---------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// global vars +// --------------------------------------------------------------------------- + +// the pointer to standard radio button wnd proc +static WNDPROC gs_wndprocEdit = (WNDPROC)NULL; + +// ============================================================================ +// implementation +// ============================================================================ + +WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC, + WXHWND WXUNUSED(pWnd), + WXUINT WXUNUSED(nCtlColor), + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam)) +{ + HDC hdc = (HDC)pDC; + wxColour colBack = GetBackgroundColour(); + + if (!IsEnabled()) + colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); + + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); + + return (WXHBRUSH)brush->GetResourceHandle(); +} + +// ---------------------------------------------------------------------------- +// wxComboBox callbacks +// ---------------------------------------------------------------------------- + +WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +{ + return false; +} + +WXHWND wxComboBox::GetEditHWND() const +{ + return (WXHWND)0; +} + +// ---------------------------------------------------------------------------- +// wxComboBox creation +// ---------------------------------------------------------------------------- + +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +WXDWORD wxComboBox::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// wxComboBox text control-like methods +// ---------------------------------------------------------------------------- + +void wxComboBox::SetValue(const wxString& value) +{ +} + +// Clipboard operations +void wxComboBox::Copy() +{ +} + +void wxComboBox::Cut() +{ +} + +void wxComboBox::Paste() +{ +} + +void wxComboBox::SetEditable(bool WXUNUSED(editable)) +{ +} + +void wxComboBox::SetInsertionPoint(long pos) +{ +} + +void wxComboBox::SetInsertionPointEnd() +{ +} + +long wxComboBox::GetInsertionPoint() const +{ + return 0; +} + +long wxComboBox::GetLastPosition() const +{ + return 0; +} + +void wxComboBox::Replace(long from, long to, const wxString& value) +{ +} + +void wxComboBox::Remove(long from, long to) +{ +} + +void wxComboBox::SetSelection(long from, long to) +{ +} + +#endif // wxUSE_COMBOBOX + diff --git a/src/palmos/control.cpp b/src/palmos/control.cpp new file mode 100644 index 0000000000..aad3ffef11 --- /dev/null +++ b/src/palmos/control.cpp @@ -0,0 +1,201 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/control.cpp +// Purpose: wxControl class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "control.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_CONTROLS + +#ifndef WX_PRECOMP + #include "wx/event.h" + #include "wx/app.h" + #include "wx/dcclient.h" + #include "wx/log.h" + #include "wx/settings.h" +#endif + +#include "wx/control.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) + +BEGIN_EVENT_TABLE(wxControl, wxWindow) + EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground) +END_EVENT_TABLE() + +// ============================================================================ +// wxControl implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxControl ctor/dtor +// ---------------------------------------------------------------------------- + +wxControl::~wxControl() +{ + m_isBeingDeleted = TRUE; +} + +// ---------------------------------------------------------------------------- +// control window creation +// ---------------------------------------------------------------------------- + +bool wxControl::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& wxVALIDATOR_PARAM(validator), + const wxString& name) +{ + if ( !wxWindow::Create(parent, id, pos, size, style, name) ) + return FALSE; + +#if wxUSE_VALIDATORS + SetValidator(validator); +#endif + + return TRUE; +} + +bool wxControl::MSWCreateControl(const wxChar *classname, + const wxString& label, + const wxPoint& pos, + const wxSize& size) +{ + WXDWORD exstyle; + WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), &exstyle); + + return MSWCreateControl(classname, msStyle, pos, size, label, exstyle); +} + +bool wxControl::MSWCreateControl(const wxChar *classname, + WXDWORD style, + const wxPoint& pos, + const wxSize& size, + const wxString& label, + WXDWORD exstyle) +{ + return TRUE; +} + +// ---------------------------------------------------------------------------- +// various accessors +// ---------------------------------------------------------------------------- + +wxBorder wxControl::GetDefaultBorder() const +{ + // we want to automatically give controls a sunken style (confusingly, + // it may not really mean sunken at all as we map it to WS_EX_CLIENTEDGE + // which is not sunken at all under Windows XP -- rather, just the default) + return wxBORDER_SUNKEN; +} + +WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +wxSize wxControl::DoGetBestSize() const +{ + return wxSize(16, 16); +} + +/* static */ wxVisualAttributes +wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + wxVisualAttributes attrs; + + // old school (i.e. not "common") controls use the standard dialog font + // by default + attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + + // most, or at least many, of the controls use the same colours as the + // buttons -- others will have to override this (and possibly simply call + // GetCompositeControlsDefaultAttributes() from their versions) + attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT); + attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); + + return attrs; +} + +// another version for the "composite", i.e. non simple controls +/* static */ wxVisualAttributes +wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + wxVisualAttributes attrs; + attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + + return attrs; +} + +// ---------------------------------------------------------------------------- +// message handling +// ---------------------------------------------------------------------------- + +bool wxControl::ProcessCommand(wxCommandEvent& event) +{ + return GetEventHandler()->ProcessEvent(event); +} + +#ifdef __WIN95__ +bool wxControl::MSWOnNotify(int idCtrl, + WXLPARAM lParam, + WXLPARAM* result) +{ +} +#endif // Win95 + +void wxControl::OnEraseBackground(wxEraseEvent& event) +{ +} + +WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), +#if wxUSE_CTL3D + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam +#else + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) +#endif + ) +{ + return (WXHBRUSH)0; +} + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +#endif // wxUSE_CONTROLS diff --git a/src/palmos/crashrpt.cpp b/src/palmos/crashrpt.cpp new file mode 100644 index 0000000000..e3c322d64c --- /dev/null +++ b/src/palmos/crashrpt.cpp @@ -0,0 +1,537 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/crashrpt.cpp +// Purpose: helpers for structured exception handling (SEH) +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +/* + The code generating the crash reports in this file is heavily based on + Matt Pietrek's column from the March 2002 issue of MSDN Magazine. Note + that this code is not currently used by default, however. In any case, + all bugs are my alone. + */ + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_ON_FATAL_EXCEPTION + +#ifndef WX_PRECOMP +#endif //WX_PRECOMP + +/* + We have two possibilities here: one, a priori more interesting, is to + generate the crash report ourselves and include the values of all the + variables in the dump. Unfortunately my code to do it doesn't work in + "real life" situations i.e. it works in small examples but invariably + gets confused by something in big programs which makes quite useless. + + The other possibility is to let dbghelp.dll to do the work for us and + analyze its results later using a debugger with knowledge about crash + dumps, such as (free!) WinDbg. This also has another advantage of not + needing to ship the .pdb file (containing debug info) to the user. So + this is the default now, but I keep the old code just in case, and if + you really want you can still use it. + */ +#define wxUSE_MINIDUMP 1 + +#if !wxUSE_MINIDUMP + #include "wx/longlong.h" +#endif // wxUSE_MINIDUMP + +#include "wx/datetime.h" + +#include "wx/dynload.h" + +#include "wx/palmos/crashrpt.h" + +#include "wx/palmos/wrapwin.h" +#include "wx/palmos/private.h" + +#ifndef wxUSE_DBGHELP + #define wxUSE_DBGHELP 0 +#endif + +#if wxUSE_DBGHELP + +// ---------------------------------------------------------------------------- +// types of imagehlp.h functions +// ---------------------------------------------------------------------------- + +#if wxUSE_MINIDUMP + +typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE, + MINIDUMP_TYPE, + CONST PMINIDUMP_EXCEPTION_INFORMATION, + CONST PMINIDUMP_USER_STREAM_INFORMATION, + CONST PMINIDUMP_CALLBACK_INFORMATION); +#else // !wxUSE_MINIDUMP +typedef DWORD (WINAPI *SymSetOptions_t)(DWORD); +typedef BOOL (WINAPI *SymInitialize_t)(HANDLE, LPSTR, BOOL); +typedef BOOL (WINAPI *StackWalk_t)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, + LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, + PFUNCTION_TABLE_ACCESS_ROUTINE, + PGET_MODULE_BASE_ROUTINE, + PTRANSLATE_ADDRESS_ROUTINE); +typedef BOOL (WINAPI *SymFromAddr_t)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); +typedef LPVOID (WINAPI *SymFunctionTableAccess_t)(HANDLE, DWORD); +typedef DWORD (WINAPI *SymGetModuleBase_t)(HANDLE, DWORD); +typedef BOOL (WINAPI *SymGetLineFromAddr_t)(HANDLE, DWORD, + PDWORD, PIMAGEHLP_LINE); +typedef BOOL (WINAPI *SymSetContext_t)(HANDLE, PIMAGEHLP_STACK_FRAME, + PIMAGEHLP_CONTEXT); +typedef BOOL (WINAPI *SymEnumSymbols_t)(HANDLE, ULONG64, PCSTR, + PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID); +typedef BOOL (WINAPI *SymGetTypeInfo_t)(HANDLE, DWORD64, ULONG, + IMAGEHLP_SYMBOL_TYPE_INFO, PVOID); +#endif // wxUSE_MINIDUMP + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#if !wxUSE_MINIDUMP + +// Stolen from CVCONST.H in the DIA 2.0 SDK +enum BasicType +{ + BASICTYPE_NOTYPE = 0, + BASICTYPE_VOID = 1, + BASICTYPE_CHAR = 2, + BASICTYPE_WCHAR = 3, + BASICTYPE_INT = 6, + BASICTYPE_UINT = 7, + BASICTYPE_FLOAT = 8, + BASICTYPE_BCD = 9, + BASICTYPE_BOOL = 10, + BASICTYPE_LONG = 13, + BASICTYPE_ULONG = 14, + BASICTYPE_CURRENCY = 25, + BASICTYPE_DATE = 26, + BASICTYPE_VARIANT = 27, + BASICTYPE_COMPLEX = 28, + BASICTYPE_BIT = 29, + BASICTYPE_BSTR = 30, + BASICTYPE_HRESULT = 31 +}; + +// Same as above +enum SymbolTag +{ + SYMBOL_TAG_NULL, + SYMBOL_TAG_FUNCTION = 5, + SYMBOL_TAG_DATA = 7, + SYMBOL_TAG_PUBLIC = 10, // appears in .DBGs + SYMBOL_TAG_UDT, + SYMBOL_TAG_ENUM, + SYMBOL_TAG_FUNCTION_TYPE, + SYMBOL_TAG_POINTER_TYPE, + SYMBOL_TAG_ARRAY_TYPE, + SYMBOL_TAG_BASE_TYPE, + SYMBOL_TAG_TYPEDEF, + SYMBOL_TAG_BASECLASS +}; + +#endif // wxUSE_MINIDUMP + +#endif // wxUSE_DBGHELP + +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + +// low level wxBusyCursor replacement: we use Win32 API directly here instead +// of going through wxWidgets calls as this could be dangerous +class BusyCursor +{ +public: + BusyCursor() + { + } + + ~BusyCursor() + { + } + +private: +}; + +// the real crash report generator +class wxCrashReportImpl +{ +public: + wxCrashReportImpl(const wxChar *filename); + + bool Generate(int flags); + + ~wxCrashReportImpl() + { + if ( m_hFile != INVALID_HANDLE_VALUE ) + { + ::CloseHandle(m_hFile); + } + } + +private: + + // formatted output to m_hFile + void Output(const wxChar *format, ...); + + // output end of line + void OutputEndl() { Output(_T("\r\n")); } + +#if wxUSE_DBGHELP + +#if !wxUSE_MINIDUMP + // translate exception code to its symbolic name + static wxString GetExceptionString(DWORD dwCode); + + // return the type from "type index" + static BasicType GetBasicType(DWORD64 modBase, DWORD typeIndex); + + // return the name for the type index + static wxString GetSymbolName(DWORD64 modBase, DWORD dwTypeIndex); + + // return the string representation of the variable value + static wxString FormatSimpleValue(BasicType bt, + DWORD64 length, + PVOID pAddress); + + // return string representation of a struct field (which may itself be a + // struct, of course) + static wxString FormatField(DWORD64 modBase, + DWORD dwTypeIndex, + void *pVariable, + unsigned level); + + // show the name and value of the given symbol + static wxString FormatSymbol(PSYMBOL_INFO pSym, STACKFRAME *sf); + + // show value described by SYMBOL_INFO located at pVariable + static wxString FormatAnyValue(PSYMBOL_INFO pSym, void *pVariable); + + // show value of possibly complex (user-defined) type + static wxString FormatUDT(DWORD64 modBase, + DWORD dwTypeIndex, + void *pVariable, + unsigned level = 0); + + // outputs information about the given symbol + void OutputSymbol(PSYMBOL_INFO pSymInfo, STACKFRAME *sf); + + // map address to module (and also section:offset), retunr true if ok + static bool GetLogicalAddress(PVOID addr, + PTSTR szModule, + DWORD len, + DWORD& section, + DWORD& offset); + + // callback used with SymEnumSymbols() to process all variables + static BOOL CALLBACK EnumerateSymbolsCallback(PSYMBOL_INFO pSymInfo, + ULONG SymbolSize, + PVOID UserContext); + + + // show the general information about exception which should be always + // available + // + // returns the module of the handle where the crash occured + HANDLE OutputBasicContext(EXCEPTION_RECORD *pExceptionRecord, CONTEXT *pCtx); + + // output the call stack and local variables values + void OutputStack(const CONTEXT *pCtx, int flags); + + // output the global variables values + void OutputGlobals(HANDLE hModuleCrash); + + + // the current stack frame (may be NULL) + STACKFRAME *m_sfCurrent; +#endif // !wxUSE_MINIDUMP + + // load all the functions we need from dbghelp.dll, return true if all ok + bool BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp); + + + // dynamically loaded dbghelp.dll functions + #define DECLARE_SYM_FUNCTION(func) static func ## _t func + +#if wxUSE_MINIDUMP + DECLARE_SYM_FUNCTION(MiniDumpWriteDump); +#else // !wxUSE_MINIDUMP + DECLARE_SYM_FUNCTION(SymSetOptions); + DECLARE_SYM_FUNCTION(SymInitialize); + DECLARE_SYM_FUNCTION(StackWalk); + DECLARE_SYM_FUNCTION(SymFromAddr); + DECLARE_SYM_FUNCTION(SymFunctionTableAccess); + DECLARE_SYM_FUNCTION(SymGetModuleBase); + DECLARE_SYM_FUNCTION(SymGetLineFromAddr); + DECLARE_SYM_FUNCTION(SymSetContext); + DECLARE_SYM_FUNCTION(SymEnumSymbols); + DECLARE_SYM_FUNCTION(SymGetTypeInfo); +#endif // wxUSE_MINIDUMP/!wxUSE_MINIDUMP + + #undef DECLARE_SYM_FUNCTION +#endif // wxUSE_DBGHELP + + // the handle of the report file + HANDLE m_hFile; +}; + +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- + +// global pointer to exception information, only valid inside OnFatalException +extern WXDLLIMPEXP_BASE EXCEPTION_POINTERS *wxGlobalSEInformation = NULL; + + +// flag telling us whether the application wants to handle exceptions at all +static bool gs_handleExceptions = false; + +// the file name where the report about exception is written +static wxChar gs_reportFilename[MAX_PATH]; + +// ============================================================================ +// implementation +// ============================================================================ + +#if wxUSE_DBGHELP + +#define DEFINE_SYM_FUNCTION(func) func ## _t wxCrashReportImpl::func = 0 + +#if wxUSE_MINIDUMP +DEFINE_SYM_FUNCTION(MiniDumpWriteDump); +#else // !wxUSE_MINIDUMP +DEFINE_SYM_FUNCTION(SymSetOptions); +DEFINE_SYM_FUNCTION(SymInitialize); +DEFINE_SYM_FUNCTION(StackWalk); +DEFINE_SYM_FUNCTION(SymFromAddr); +DEFINE_SYM_FUNCTION(SymFunctionTableAccess); +DEFINE_SYM_FUNCTION(SymGetModuleBase); +DEFINE_SYM_FUNCTION(SymGetLineFromAddr); +DEFINE_SYM_FUNCTION(SymSetContext); +DEFINE_SYM_FUNCTION(SymEnumSymbols); +DEFINE_SYM_FUNCTION(SymGetTypeInfo); +#endif // wxUSE_MINIDUMP/!wxUSE_MINIDUMP + +#undef DEFINE_SYM_FUNCTION + +#endif // wxUSE_DBGHELP + +// ---------------------------------------------------------------------------- +// wxCrashReportImpl +// ---------------------------------------------------------------------------- + +wxCrashReportImpl::wxCrashReportImpl(const wxChar *filename) +{ +} + +void wxCrashReportImpl::Output(const wxChar *format, ...) +{ +} + +#if wxUSE_DBGHELP + +#if !wxUSE_MINIDUMP + +bool +wxCrashReportImpl::GetLogicalAddress(PVOID addr, + PTSTR szModule, + DWORD len, + DWORD& section, + DWORD& offset) +{ + return false; +} + +/* static */ BasicType +wxCrashReportImpl::GetBasicType(DWORD64 modBase, DWORD typeIndex) +{ + return BASICTYPE_NOTYPE; +} + +/* static */ wxString +wxCrashReportImpl::FormatSimpleValue(BasicType bt, + DWORD64 length, + PVOID pAddress) +{ + wxString s; + + return s; +} + +/* static */ +wxString wxCrashReportImpl::GetSymbolName(DWORD64 modBase, DWORD dwTypeIndex) +{ + wxString s; + + return s; +} + +// this is called for the struct members/base classes +wxString +wxCrashReportImpl::FormatField(DWORD64 modBase, + DWORD dwTypeIndex, + void *pVariable, + unsigned level) +{ + wxString s; + + return s; +} + +// If it's a user defined type (UDT), recurse through its members until we're +// at fundamental types. +wxString +wxCrashReportImpl::FormatUDT(DWORD64 modBase, + DWORD dwTypeIndex, + void *pVariable, + unsigned level) +{ + wxString s; + + return s; +} + +// return the string containing the symbol of the given symbol +/* static */ wxString +wxCrashReportImpl::FormatAnyValue(PSYMBOL_INFO pSym, void *pVariable) +{ + wxString s; + + return s; +} + +// display contents and type of the given variable +/* static */ wxString +wxCrashReportImpl::FormatSymbol(PSYMBOL_INFO pSym, STACKFRAME *sf) +{ + wxString s; + + return s; +} + +void +wxCrashReportImpl::OutputSymbol(PSYMBOL_INFO pSymInfo, STACKFRAME *sf) +{ +} + +// callback for SymEnumSymbols() +/* static */ +BOOL CALLBACK +wxCrashReportImpl::EnumerateSymbolsCallback(PSYMBOL_INFO pSymInfo, + ULONG WXUNUSED(SymbolSize), + PVOID UserContext) +{ + return false; +} + +HANDLE +wxCrashReportImpl::OutputBasicContext(EXCEPTION_RECORD *pExceptionRecord, + CONTEXT *pCtx) +{ + return ::GetModuleHandle(szFaultingModule); +} + +void wxCrashReportImpl::OutputStack(const CONTEXT *pCtx, int flags) +{ +} + +void wxCrashReportImpl::OutputGlobals(HANDLE hModule) +{ +} + +#endif // wxUSE_MINIDUMP + +bool wxCrashReportImpl::BindDbgHelpFunctions(const wxDynamicLibrary& dllDbgHelp) +{ + return false; +} + +#if !wxUSE_MINIDUMP + +/* static */ +wxString wxCrashReportImpl::GetExceptionString(DWORD dwCode) +{ + wxString s; + + return s; +} + +#endif // !wxUSE_MINIDUMP + +#endif // wxUSE_DBGHELP + +bool wxCrashReportImpl::Generate( +#if wxUSE_DBGHELP + int flags +#else + int WXUNUSED(flags) +#endif +) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxCrashReport +// ---------------------------------------------------------------------------- + +/* static */ +void wxCrashReport::SetFileName(const wxChar *filename) +{ +} + +/* static */ +const wxChar *wxCrashReport::GetFileName() +{ + return NULL; +} + +/* static */ +bool wxCrashReport::Generate(int flags) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxApp::OnFatalException() support +// ---------------------------------------------------------------------------- + +bool wxHandleFatalExceptions(bool doit) +{ + return true; +} + +extern unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs) +{ + return EXCEPTION_EXECUTE_HANDLER; +} + +#else // !wxUSE_ON_FATAL_EXCEPTION + +bool wxHandleFatalExceptions(bool WXUNUSED(doit)) +{ + return false; +} + +#endif // wxUSE_ON_FATAL_EXCEPTION/!wxUSE_ON_FATAL_EXCEPTION + diff --git a/src/palmos/cursor.cpp b/src/palmos/cursor.cpp new file mode 100644 index 0000000000..d93a8b1a23 --- /dev/null +++ b/src/palmos/cursor.cpp @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/cursor.cpp +// Purpose: wxCursor class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "cursor.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/bitmap.h" + #include "wx/icon.h" + #include "wx/cursor.h" + #include "wx/settings.h" + #include "wx/intl.h" +#endif + +#include "wx/module.h" +#include "wx/image.h" + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject) + +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- + +// Current cursor, in order to hang on to cursor handle when setting the cursor +// globally +static wxCursor *gs_globalCursor = NULL; + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + + +// ============================================================================ +// implementation +// ============================================================================ + + +// ---------------------------------------------------------------------------- +// Cursors +// ---------------------------------------------------------------------------- + +wxCursor::wxCursor() +{ +} + +#if wxUSE_IMAGE +wxCursor::wxCursor(const wxImage& image) +{ +} +#endif + +wxCursor::wxCursor(const char WXUNUSED(bits)[], + int WXUNUSED(width), + int WXUNUSED(height), + int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), + const char WXUNUSED(maskBits)[]) +{ +} + +wxCursor::wxCursor(const wxString& filename, + long kind, + int hotSpotX, + int hotSpotY) +{ +} + +// Cursors by stock number +wxCursor::wxCursor(int idCursor) +{ +} + +wxCursor::~wxCursor() +{ +} + +// ---------------------------------------------------------------------------- +// other wxCursor functions +// ---------------------------------------------------------------------------- + +bool wxCursor::operator==(const wxCursor& cursor) const +{ + return FALSE; +} + +wxGDIImageRefData *wxCursor::CreateData() const +{ + return NULL; +} + +// ---------------------------------------------------------------------------- +// Global cursor setting +// ---------------------------------------------------------------------------- + +const wxCursor *wxGetGlobalCursor() +{ + return NULL; +} + +void wxSetCursor(const wxCursor& cursor) +{ +} + + diff --git a/src/palmos/data.cpp b/src/palmos/data.cpp new file mode 100644 index 0000000000..04abb7f531 --- /dev/null +++ b/src/palmos/data.cpp @@ -0,0 +1,22 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: data.cpp +// Purpose: Various data +// Author: Julian Smart +// Modified by: +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "data.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + diff --git a/src/palmos/dc.cpp b/src/palmos/dc.cpp new file mode 100644 index 0000000000..46471e3ee6 --- /dev/null +++ b/src/palmos/dc.cpp @@ -0,0 +1,510 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dc.cpp +// Purpose: wxDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dc.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/dc.h" + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/app.h" + #include "wx/bitmap.h" + #include "wx/dcmemory.h" + #include "wx/log.h" + #include "wx/icon.h" +#endif + +#include "wx/sysopt.h" +#include "wx/dcprint.h" +#include "wx/module.h" +#include "wx/dynload.h" + +#ifdef wxHAVE_RAW_BITMAP +#include "wx/rawbmp.h" +#endif + +#include +#include + +#ifndef AC_SRC_ALPHA +#define AC_SRC_ALPHA 1 +#endif + +/* Quaternary raster codes */ +#ifndef MAKEROP4 +#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) +#endif + +IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase) + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +static const int VIEWPORT_EXTENT = 1000; + +static const int MM_POINTS = 9; +static const int MM_METRIC = 10; + +// usually this is defined in math.h +#ifndef M_PI + static const double M_PI = 3.14159265358979323846; +#endif // M_PI + +#define DSTCOPY 0x00AA0029 + +// --------------------------------------------------------------------------- +// private functions +// --------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxDC +// --------------------------------------------------------------------------- + +// Default constructor +wxDC::wxDC() +{ +} + +wxDC::~wxDC() +{ +} + +// This will select current objects out of the DC, +// which is what you have to do before deleting the +// DC. +void wxDC::SelectOldObjects(WXHDC dc) +{ +} + +// --------------------------------------------------------------------------- +// clipping +// --------------------------------------------------------------------------- + +void wxDC::UpdateClipBox() +{ +} + +void +wxDC::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const +{ +} + +// common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion() +void wxDC::SetClippingHrgn(WXHRGN hrgn) +{ +} + +void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ +} + +void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) +{ +} + +void wxDC::DestroyClippingRegion() +{ +} + +// --------------------------------------------------------------------------- +// query capabilities +// --------------------------------------------------------------------------- + +bool wxDC::CanDrawBitmap() const +{ + return false; +} + +bool wxDC::CanGetTextExtent() const +{ + return false; +} + +int wxDC::GetDepth() const +{ + return 0; +} + +// --------------------------------------------------------------------------- +// drawing +// --------------------------------------------------------------------------- + +void wxDC::Clear() +{ +} + +bool wxDC::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) +{ + return false; +} + +bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const +{ + return false; +} + +void wxDC::DoCrossHair(wxCoord x, wxCoord y) +{ +} + +void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) +{ +} + +// Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1) +// and ending at (x2, y2) +void wxDC::DoDrawArc(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord xc, wxCoord yc) +{ +} + +void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, + wxCoord width, wxCoord height) +{ +} + +void wxDC::DoDrawPoint(wxCoord x, wxCoord y) +{ +} + +void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle) +{ +} + +void +wxDC::DoDrawPolyPolygon(int n, + int count[], + wxPoint points[], + wxCoord xoffset, + wxCoord yoffset, + int fillStyle) +{ +} + +void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset) +{ +} + +void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +{ +} + +void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius) +{ +} + +void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +{ +} + +void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) +{ +} + +void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) +{ +} + +void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask ) +{ +} + +void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) +{ +} + +void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) +{ +} + +void wxDC::DoDrawRotatedText(const wxString& text, + wxCoord x, wxCoord y, + double angle) +{ +} + +// --------------------------------------------------------------------------- +// set GDI objects +// --------------------------------------------------------------------------- + +#if wxUSE_PALETTE + +void wxDC::DoSelectPalette(bool realize) +{ +} + +void wxDC::SetPalette(const wxPalette& palette) +{ +} + +void wxDC::InitializePalette() +{ +} + +#endif // wxUSE_PALETTE + +void wxDC::SetFont(const wxFont& font) +{ +} + +void wxDC::SetPen(const wxPen& pen) +{ +} + +void wxDC::SetBrush(const wxBrush& brush) +{ +} + +void wxDC::SetBackground(const wxBrush& brush) +{ +} + +void wxDC::SetBackgroundMode(int mode) +{ +} + +void wxDC::SetLogicalFunction(int function) +{ +} + +void wxDC::SetRop(WXHDC dc) +{ +} + +bool wxDC::StartDoc(const wxString& WXUNUSED(message)) +{ + return true; +} + +void wxDC::EndDoc() +{ +} + +void wxDC::StartPage() +{ +} + +void wxDC::EndPage() +{ +} + +// --------------------------------------------------------------------------- +// text metrics +// --------------------------------------------------------------------------- + +wxCoord wxDC::GetCharHeight() const +{ + return 0; +} + +wxCoord wxDC::GetCharWidth() const +{ + return 0; +} + +void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, + wxCoord *descent, wxCoord *externalLeading, + wxFont *font) const +{ +} + + +bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const +{ + return false; +} + + + + +void wxDC::SetMapMode(int mode) +{ +} + +void wxDC::SetUserScale(double x, double y) +{ +} + +void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp) +{ +} + +void wxDC::SetSystemScale(double x, double y) +{ +} + +void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y) +{ +} + +void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y) +{ +} + +// --------------------------------------------------------------------------- +// coordinates transformations +// --------------------------------------------------------------------------- + +wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const +{ + return 0; +} + +wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const +{ + return 0; +} + +wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const +{ + return 0; +} + +wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const +{ + return 0; +} + +wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const +{ + return 0; +} + +wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const +{ + return 0; +} + +wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const +{ + return 0; +} + +wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const +{ + return 0; +} + +// --------------------------------------------------------------------------- +// bit blit +// --------------------------------------------------------------------------- + +bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, wxCoord xsrc, wxCoord ysrc, + int rop, bool useMask, + wxCoord xsrcMask, wxCoord ysrcMask) +{ + return false; +} + +void wxDC::DoGetSize(int *w, int *h) const +{ +} + +void wxDC::DoGetSizeMM(int *w, int *h) const +{ +} + +wxSize wxDC::GetPPI() const +{ + return wxSize(0, 0); +} + +void wxDC::SetLogicalScale(double x, double y) +{ +} + +// ---------------------------------------------------------------------------- +// DC caching +// ---------------------------------------------------------------------------- + +#if wxUSE_DC_CACHEING + +wxList wxDC::sm_bitmapCache; +wxList wxDC::sm_dcCache; + +wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth) +{ +} + +wxDCCacheEntry::wxDCCacheEntry(WXHDC hDC, int depth) +{ +} + +wxDCCacheEntry::~wxDCCacheEntry() +{ +} + +wxDCCacheEntry* wxDC::FindBitmapInCache(WXHDC dc, int w, int h) +{ + return NULL; +} + +wxDCCacheEntry* wxDC::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc) +{ + return NULL; +} + +void wxDC::AddToBitmapCache(wxDCCacheEntry* entry) +{ +} + +void wxDC::AddToDCCache(wxDCCacheEntry* entry) +{ +} + +void wxDC::ClearCache() +{ +} + +class wxDCModule : public wxModule +{ +public: + virtual bool OnInit() { return true; } + virtual void OnExit() { wxDC::ClearCache(); } + +private: + DECLARE_DYNAMIC_CLASS(wxDCModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule) + +#endif // wxUSE_DC_CACHEING + diff --git a/src/palmos/dcclient.cpp b/src/palmos/dcclient.cpp new file mode 100644 index 0000000000..8dc1a37498 --- /dev/null +++ b/src/palmos/dcclient.cpp @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcclient.cpp +// Purpose: wxClientDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dcclient.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/string.h" +#include "wx/log.h" +#include "wx/window.h" + +#include "wx/dcclient.h" + +// ---------------------------------------------------------------------------- +// array/list types +// ---------------------------------------------------------------------------- + +struct WXDLLEXPORT wxPaintDCInfo +{ + wxPaintDCInfo(wxWindow *win, wxDC *dc) + { + hwnd = win->GetHWND(); + hdc = dc->GetHDC(); + count = 1; + } + + WXHWND hwnd; // window for this DC + WXHDC hdc; // the DC handle + size_t count; // usage count +}; + +#include "wx/arrimpl.cpp" + +WX_DEFINE_OBJARRAY(wxArrayDCInfo); + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) +IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC) +IMPLEMENT_CLASS(wxPaintDCEx, wxPaintDC) + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +#ifdef __WXDEBUG__ + int g_isPainting = 0; +#endif // __WXDEBUG__ + +// =========================================================================== +// implementation +// =========================================================================== + +// ---------------------------------------------------------------------------- +// wxWindowDC +// ---------------------------------------------------------------------------- + +wxWindowDC::wxWindowDC() +{ +} + +wxWindowDC::wxWindowDC(wxWindow *canvas) +{ +} + +void wxWindowDC::InitDC() +{ +} + +void wxWindowDC::DoGetSize(int *width, int *height) const +{ +} + +// ---------------------------------------------------------------------------- +// wxClientDC +// ---------------------------------------------------------------------------- + +wxClientDC::wxClientDC() +{ +} + +wxClientDC::wxClientDC(wxWindow *canvas) +{ +} + +void wxClientDC::InitDC() +{ +} + +wxClientDC::~wxClientDC() +{ +} + +void wxClientDC::DoGetSize(int *width, int *height) const +{ +} + +// ---------------------------------------------------------------------------- +// wxPaintDC +// ---------------------------------------------------------------------------- + +wxArrayDCInfo wxPaintDC::ms_cache; + +wxPaintDC::wxPaintDC() +{ +} + +wxPaintDC::wxPaintDC(wxWindow *canvas) +{ +} + +wxPaintDC::~wxPaintDC() +{ +} + +wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const +{ + return NULL; +} + +WXHDC wxPaintDC::FindDCInCache(wxWindow* win) +{ + return 0; +} + +/* + * wxPaintDCEx + */ + +wxPaintDCEx::wxPaintDCEx(wxWindow *canvas, WXHDC dc) : saveState(0) +{ +} + +wxPaintDCEx::~wxPaintDCEx() +{ +} + diff --git a/src/palmos/dcmemory.cpp b/src/palmos/dcmemory.cpp new file mode 100644 index 0000000000..4a4523f3f1 --- /dev/null +++ b/src/palmos/dcmemory.cpp @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dcmemory.cpp +// Purpose: wxMemoryDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dcmemory.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/log.h" +#endif + +#include "wx/dcmemory.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxMemoryDC +// ---------------------------------------------------------------------------- + +wxMemoryDC::wxMemoryDC() +{ +} + +wxMemoryDC::wxMemoryDC(wxDC *dc) +{ +} + +void wxMemoryDC::Init() +{ +} + +bool wxMemoryDC::CreateCompatible(wxDC *dc) +{ + return false; +} + +void wxMemoryDC::SelectObject(const wxBitmap& bitmap) +{ +} + +void wxMemoryDC::DoGetSize(int *width, int *height) const +{ +} + +// the rest of this file deals with drawing rectangles workaround, disabled by +// default + +#define wxUSE_MEMORY_DC_DRAW_RECTANGLE 0 + +#if wxUSE_MEMORY_DC_DRAW_RECTANGLE + +// For some reason, drawing a rectangle on a memory DC has problems. +// Use this substitute if we can. +static void wxDrawRectangle(wxDC& dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height) +{ +} + +#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE + +void wxMemoryDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) +{ +} + diff --git a/src/palmos/dcprint.cpp b/src/palmos/dcprint.cpp new file mode 100644 index 0000000000..6462bbeef5 --- /dev/null +++ b/src/palmos/dcprint.cpp @@ -0,0 +1,148 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/dcprint.cpp +// Purpose: wxPrinterDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dcprint.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/log.h" + #include "wx/window.h" + #include "wx/dcmemory.h" +#endif + +#if wxUSE_PRINTING_ARCHITECTURE + +#include "wx/palmos/private.h" + +#if wxUSE_WXDIB +#include "wx/palmos/dib.h" +#endif + +#include "wx/dcprint.h" +#include "math.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_CLASS(wxPrinterDC, wxDC) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxPrinterDC construction +// ---------------------------------------------------------------------------- + +// This form is deprecated +wxPrinterDC::wxPrinterDC(const wxString& driver_name, + const wxString& device_name, + const wxString& file, + bool interactive, + int orientation) +{ +} + +wxPrinterDC::wxPrinterDC(const wxPrintData& printData) +{ +} + + +wxPrinterDC::wxPrinterDC(WXHDC dc) +{ +} + +void wxPrinterDC::Init() +{ +} + +// ---------------------------------------------------------------------------- +// wxPrinterDC {Start/End}{Page/Doc} methods +// ---------------------------------------------------------------------------- + +bool wxPrinterDC::StartDoc(const wxString& message) +{ + return false; +} + +void wxPrinterDC::EndDoc() +{ +} + +void wxPrinterDC::StartPage() +{ +} + +void wxPrinterDC::EndPage() +{ +} + +// Returns default device and port names +static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) +{ + return false; +} + +// Gets an HDC for the specified printer configuration +WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst) +{ + return (WXHDC) 0; +} + +// ---------------------------------------------------------------------------- +// wxPrinterDC bit blitting/bitmap drawing +// ---------------------------------------------------------------------------- + +// helper of DoDrawBitmap() and DoBlit() +static +bool DrawBitmapUsingStretchDIBits(HDC hdc, + const wxBitmap& bmp, + wxCoord x, wxCoord y) +{ + return false; +} + +void wxPrinterDC::DoDrawBitmap(const wxBitmap& bmp, + wxCoord x, wxCoord y, + bool useMask) +{ +} + +bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, + wxCoord WXUNUSED(xsrc), wxCoord WXUNUSED(ysrc), + int WXUNUSED(rop), bool useMask, + wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask)) +{ + return false; +} + +#endif + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/palmos/dcscreen.cpp b/src/palmos/dcscreen.cpp new file mode 100644 index 0000000000..c6051d18a5 --- /dev/null +++ b/src/palmos/dcscreen.cpp @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/dcscreen.cpp +// Purpose: wxScreenDC class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "dcscreen.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/window.h" +#endif + +#include "wx/dcscreen.h" + +IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) + +// Create a DC representing the whole screen +wxScreenDC::wxScreenDC() +{ +} + +void wxScreenDC::DoGetSize(int *width, int *height) const +{ +} + diff --git a/src/palmos/dialog.cpp b/src/palmos/dialog.cpp new file mode 100644 index 0000000000..0c869da0c6 --- /dev/null +++ b/src/palmos/dialog.cpp @@ -0,0 +1,265 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/dialog.cpp +// Purpose: wxDialog class +// Author: William Osborne +// Modified by: +// Created: 10/12/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dialog.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/dialog.h" + #include "wx/utils.h" + #include "wx/frame.h" + #include "wx/app.h" + #include "wx/settings.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#include "wx/log.h" +#include "wx/evtloop.h" +#include "wx/ptr_scpd.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxDialogStyle ) + +wxBEGIN_FLAGS( wxDialogStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxNO_BORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + + // dialog styles + wxFLAGS_MEMBER(wxWS_EX_VALIDATE_RECURSIVELY) + wxFLAGS_MEMBER(wxSTAY_ON_TOP) + wxFLAGS_MEMBER(wxCAPTION) + wxFLAGS_MEMBER(wxTHICK_FRAME) + wxFLAGS_MEMBER(wxSYSTEM_MENU) + wxFLAGS_MEMBER(wxRESIZE_BORDER) + wxFLAGS_MEMBER(wxRESIZE_BOX) + wxFLAGS_MEMBER(wxCLOSE_BOX) + wxFLAGS_MEMBER(wxMAXIMIZE_BOX) + wxFLAGS_MEMBER(wxMINIMIZE_BOX) +wxEND_FLAGS( wxDialogStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxDialog, wxTopLevelWindow,"wx/dialog.h") + +wxBEGIN_PROPERTIES_TABLE(wxDialog) + wxPROPERTY( Title, wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxDialogStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxDialog) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxDialog , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow) +#endif + +BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) + EVT_BUTTON(wxID_OK, wxDialog::OnOK) + EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) + EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) + + EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) + + EVT_CLOSE(wxDialog::OnCloseWindow) +END_EVENT_TABLE() + +// ---------------------------------------------------------------------------- +// wxDialogModalData +// ---------------------------------------------------------------------------- + +// this is simply a container for any data we need to implement modality which +// allows us to avoid changing wxDialog each time the implementation changes +class wxDialogModalData +{ +public: + wxDialogModalData(wxDialog *dialog) : m_evtLoop(dialog) { } + + void RunLoop() + { + m_evtLoop.Run(); + } + + void ExitLoop() + { + m_evtLoop.Exit(); + } + +private: + wxModalEventLoop m_evtLoop; +}; + +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData); + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDialog construction +// ---------------------------------------------------------------------------- + +void wxDialog::Init() +{ +} + +bool wxDialog::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +// deprecated ctor +wxDialog::wxDialog(wxWindow *parent, + const wxString& title, + bool WXUNUSED(modal), + int x, + int y, + int w, + int h, + long style, + const wxString& name) +{ +} + +void wxDialog::SetModal(bool WXUNUSED(flag)) +{ +} + +wxDialog::~wxDialog() +{ +} + +// ---------------------------------------------------------------------------- +// showing the dialogs +// ---------------------------------------------------------------------------- + +bool wxDialog::IsModalShowing() const +{ + return false; +} + +wxWindow *wxDialog::FindSuitableParent() const +{ + return NULL; +} + +bool wxDialog::Show(bool show) +{ + return false; +} + +void wxDialog::Raise() +{ +} + +// show dialog modally +int wxDialog::ShowModal() +{ + return -1; +} + +void wxDialog::EndModal(int retCode) +{ +} + +// ---------------------------------------------------------------------------- +// wxWin event handlers +// ---------------------------------------------------------------------------- + +// Standard buttons +void wxDialog::OnOK(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxDialog::OnApply(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) +{ +} + +void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) +{ +} + +// --------------------------------------------------------------------------- +// dialog window proc +// --------------------------------------------------------------------------- + +WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +#if wxUSE_CTL3D + +// Define for each class of dialog and control +WXHBRUSH wxDialog::OnCtlColor(WXHDC WXUNUSED(pDC), + WXHWND WXUNUSED(pWnd), + WXUINT WXUNUSED(nCtlColor), + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ + return (WXHBRUSH)Ctl3dCtlColorEx(message, wParam, lParam); +} + +#endif // wxUSE_CTL3D + diff --git a/src/palmos/dialup.cpp b/src/palmos/dialup.cpp new file mode 100644 index 0000000000..c78dc6b4b3 --- /dev/null +++ b/src/palmos/dialup.cpp @@ -0,0 +1,1290 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/dialup.cpp +// Purpose: Palm OS implementation of network/dialup classes and functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 07.07.99 +// RCS-ID: $Id$ +// Copyright: (c) Vadim Zeitlin +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_DIALUP_MANAGER + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/intl.h" + #include "wx/event.h" +#endif + +#include "wx/timer.h" +#include "wx/app.h" +#include "wx/generic/choicdgg.h" + +#include "wx/dynlib.h" +#include "wx/dialup.h" + +DEFINE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED) +DEFINE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED) + +// This needs to be written using Palm OS Network API calls, but for now this +// will do. +#if (!defined(__PALMOS__) + +#include +#include + +#include + +// Not in VC++ 5 +#ifndef INTERNET_CONNECTION_LAN +#define INTERNET_CONNECTION_LAN 2 +#endif +#ifndef INTERNET_CONNECTION_PROXY +#define INTERNET_CONNECTION_PROXY 4 +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// this message is sent by the secondary thread when RAS status changes +#define wxWM_RAS_STATUS_CHANGED (WM_USER + 10010) +#define wxWM_RAS_DIALING_PROGRESS (WM_USER + 10011) + +// ---------------------------------------------------------------------------- +// types +// ---------------------------------------------------------------------------- + +// the signatures of RAS functions: all this is quite heavy, but we must do it +// to allow running wxWin programs on machine which don't have RAS installed +// (this does exist) - if we link with rasapi32.lib, the program will fail on +// startup because of the missing DLL... + +#ifndef UNICODE + typedef DWORD (APIENTRY * RASDIAL)( LPRASDIALEXTENSIONS, LPCSTR, LPRASDIALPARAMSA, DWORD, LPVOID, LPHRASCONN ); + typedef DWORD (APIENTRY * RASENUMCONNECTIONS)( LPRASCONNA, LPDWORD, LPDWORD ); + typedef DWORD (APIENTRY * RASENUMENTRIES)( LPCSTR, LPCSTR, LPRASENTRYNAMEA, LPDWORD, LPDWORD ); + typedef DWORD (APIENTRY * RASGETCONNECTSTATUS)( HRASCONN, LPRASCONNSTATUSA ); + typedef DWORD (APIENTRY * RASGETERRORSTRING)( UINT, LPSTR, DWORD ); + typedef DWORD (APIENTRY * RASHANGUP)( HRASCONN ); + typedef DWORD (APIENTRY * RASGETPROJECTIONINFO)( HRASCONN, RASPROJECTION, LPVOID, LPDWORD ); + typedef DWORD (APIENTRY * RASCREATEPHONEBOOKENTRY)( HWND, LPCSTR ); + typedef DWORD (APIENTRY * RASEDITPHONEBOOKENTRY)( HWND, LPCSTR, LPCSTR ); + typedef DWORD (APIENTRY * RASSETENTRYDIALPARAMS)( LPCSTR, LPRASDIALPARAMSA, BOOL ); + typedef DWORD (APIENTRY * RASGETENTRYDIALPARAMS)( LPCSTR, LPRASDIALPARAMSA, LPBOOL ); + typedef DWORD (APIENTRY * RASENUMDEVICES)( LPRASDEVINFOA, LPDWORD, LPDWORD ); + typedef DWORD (APIENTRY * RASGETCOUNTRYINFO)( LPRASCTRYINFOA, LPDWORD ); + typedef DWORD (APIENTRY * RASGETENTRYPROPERTIES)( LPCSTR, LPCSTR, LPRASENTRYA, LPDWORD, LPBYTE, LPDWORD ); + typedef DWORD (APIENTRY * RASSETENTRYPROPERTIES)( LPCSTR, LPCSTR, LPRASENTRYA, DWORD, LPBYTE, DWORD ); + typedef DWORD (APIENTRY * RASRENAMEENTRY)( LPCSTR, LPCSTR, LPCSTR ); + typedef DWORD (APIENTRY * RASDELETEENTRY)( LPCSTR, LPCSTR ); + typedef DWORD (APIENTRY * RASVALIDATEENTRYNAME)( LPCSTR, LPCSTR ); + typedef DWORD (APIENTRY * RASCONNECTIONNOTIFICATION)( HRASCONN, HANDLE, DWORD ); + + static const wxChar gs_funcSuffix = _T('A'); +#else // Unicode + typedef DWORD (APIENTRY * RASDIAL)( LPRASDIALEXTENSIONS, LPCWSTR, LPRASDIALPARAMSW, DWORD, LPVOID, LPHRASCONN ); + typedef DWORD (APIENTRY * RASENUMCONNECTIONS)( LPRASCONNW, LPDWORD, LPDWORD ); + typedef DWORD (APIENTRY * RASENUMENTRIES)( LPCWSTR, LPCWSTR, LPRASENTRYNAMEW, LPDWORD, LPDWORD ); + typedef DWORD (APIENTRY * RASGETCONNECTSTATUS)( HRASCONN, LPRASCONNSTATUSW ); + typedef DWORD (APIENTRY * RASGETERRORSTRING)( UINT, LPWSTR, DWORD ); + typedef DWORD (APIENTRY * RASHANGUP)( HRASCONN ); + typedef DWORD (APIENTRY * RASGETPROJECTIONINFO)( HRASCONN, RASPROJECTION, LPVOID, LPDWORD ); + typedef DWORD (APIENTRY * RASCREATEPHONEBOOKENTRY)( HWND, LPCWSTR ); + typedef DWORD (APIENTRY * RASEDITPHONEBOOKENTRY)( HWND, LPCWSTR, LPCWSTR ); + typedef DWORD (APIENTRY * RASSETENTRYDIALPARAMS)( LPCWSTR, LPRASDIALPARAMSW, BOOL ); + typedef DWORD (APIENTRY * RASGETENTRYDIALPARAMS)( LPCWSTR, LPRASDIALPARAMSW, LPBOOL ); + typedef DWORD (APIENTRY * RASENUMDEVICES)( LPRASDEVINFOW, LPDWORD, LPDWORD ); + typedef DWORD (APIENTRY * RASGETCOUNTRYINFO)( LPRASCTRYINFOW, LPDWORD ); + typedef DWORD (APIENTRY * RASGETENTRYPROPERTIES)( LPCWSTR, LPCWSTR, LPRASENTRYW, LPDWORD, LPBYTE, LPDWORD ); + typedef DWORD (APIENTRY * RASSETENTRYPROPERTIES)( LPCWSTR, LPCWSTR, LPRASENTRYW, DWORD, LPBYTE, DWORD ); + typedef DWORD (APIENTRY * RASRENAMEENTRY)( LPCWSTR, LPCWSTR, LPCWSTR ); + typedef DWORD (APIENTRY * RASDELETEENTRY)( LPCWSTR, LPCWSTR ); + typedef DWORD (APIENTRY * RASVALIDATEENTRYNAME)( LPCWSTR, LPCWSTR ); + typedef DWORD (APIENTRY * RASCONNECTIONNOTIFICATION)( HRASCONN, HANDLE, DWORD ); + + static const wxChar gs_funcSuffix = _T('W'); +#endif // ASCII/Unicode + +// structure passed to the secondary thread +struct WXDLLEXPORT wxRasThreadData +{ + wxRasThreadData() + { + hWnd = 0; + hEventRas = + hEventQuit = 0; + dialUpManager = NULL; + } + + ~wxRasThreadData() + { + if ( hWnd ) + DestroyWindow(hWnd); + + if ( hEventQuit ) + CloseHandle(hEventQuit); + + if ( hEventRas ) + CloseHandle(hEventRas); + } + + HWND hWnd; // window to send notifications to + HANDLE hEventRas, // automatic event which RAS signals when status changes + hEventQuit; // manual event which we signal when we terminate + + class WXDLLEXPORT wxDialUpManagerMSW *dialUpManager; // the owner +}; + +// ---------------------------------------------------------------------------- +// wxDialUpManager class for MSW +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDialUpManagerMSW : public wxDialUpManager +{ +public: + // ctor & dtor + wxDialUpManagerMSW(); + virtual ~wxDialUpManagerMSW(); + + // implement base class pure virtuals + virtual bool IsOk() const; + virtual size_t GetISPNames(wxArrayString& names) const; + virtual bool Dial(const wxString& nameOfISP, + const wxString& username, + const wxString& password, + bool async); + virtual bool IsDialing() const; + virtual bool CancelDialing(); + virtual bool HangUp(); + virtual bool IsAlwaysOnline() const; + virtual bool IsOnline() const; + virtual void SetOnlineStatus(bool isOnline = TRUE); + virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds); + virtual void DisableAutoCheckOnlineStatus(); + virtual void SetWellKnownHost(const wxString& hostname, int port); + virtual void SetConnectCommand(const wxString& commandDial, + const wxString& commandHangup); + + // for RasTimer + void CheckRasStatus(); + + // for wxRasStatusWindowProc + void OnConnectStatusChange(); + void OnDialProgress(RASCONNSTATE rasconnstate, DWORD dwError); + + // for wxRasDialFunc + static HWND GetRasWindow() { return ms_hwndRas; } + static wxDialUpManagerMSW *GetDialer() { return ms_dialer; } + +private: + // return the error string for the given RAS error code + static wxString GetErrorString(DWORD error); + + // find the (first) handle of the active connection + static HRASCONN FindActiveConnection(); + + // notify the application about status change + void NotifyApp(bool connected, bool fromOurselves = FALSE) const; + + // destroy the thread data and the thread itself + void CleanUpThreadData(); + + // number of times EnableAutoCheckOnlineStatus() had been called minus the + // number of times DisableAutoCheckOnlineStatus() had been called + int m_autoCheckLevel; + + // timer used for polling RAS status + class WXDLLEXPORT RasTimer : public wxTimer + { + public: + RasTimer(wxDialUpManagerMSW *dialUpManager) + { m_dialUpManager = dialUpManager; } + + virtual void Notify() { m_dialUpManager->CheckRasStatus(); } + + private: + wxDialUpManagerMSW *m_dialUpManager; + + DECLARE_NO_COPY_CLASS(RasTimer) + } m_timerStatusPolling; + + // thread handle for the thread sitting on connection change event + HANDLE m_hThread; + + // data used by this thread and our hidden window to send messages between + // each other + wxRasThreadData *m_data; + + // the handle of rasapi32.dll when it's loaded + wxDynamicLibrary m_dllRas; + + // the hidden window we use for passing messages between threads + static HWND ms_hwndRas; + + // the handle of the connection we initiated or 0 if none + static HRASCONN ms_hRasConnection; + + // the pointers to RAS functions + static RASDIAL ms_pfnRasDial; + static RASENUMCONNECTIONS ms_pfnRasEnumConnections; + static RASENUMENTRIES ms_pfnRasEnumEntries; + static RASGETCONNECTSTATUS ms_pfnRasGetConnectStatus; + static RASGETERRORSTRING ms_pfnRasGetErrorString; + static RASHANGUP ms_pfnRasHangUp; + static RASGETPROJECTIONINFO ms_pfnRasGetProjectionInfo; + static RASCREATEPHONEBOOKENTRY ms_pfnRasCreatePhonebookEntry; + static RASEDITPHONEBOOKENTRY ms_pfnRasEditPhonebookEntry; + static RASSETENTRYDIALPARAMS ms_pfnRasSetEntryDialParams; + static RASGETENTRYDIALPARAMS ms_pfnRasGetEntryDialParams; + static RASENUMDEVICES ms_pfnRasEnumDevices; + static RASGETCOUNTRYINFO ms_pfnRasGetCountryInfo; + static RASGETENTRYPROPERTIES ms_pfnRasGetEntryProperties; + static RASSETENTRYPROPERTIES ms_pfnRasSetEntryProperties; + static RASRENAMEENTRY ms_pfnRasRenameEntry; + static RASDELETEENTRY ms_pfnRasDeleteEntry; + static RASVALIDATEENTRYNAME ms_pfnRasValidateEntryName; + + // this function is not supported by Win95 + static RASCONNECTIONNOTIFICATION ms_pfnRasConnectionNotification; + + // if this flag is different from -1, it overrides IsOnline() + static int ms_userSpecifiedOnlineStatus; + + // this flag tells us if we're online + static int ms_isConnected; + + // this flag tells us whether a call to RasDial() is in progress + static wxDialUpManagerMSW *ms_dialer; + + DECLARE_NO_COPY_CLASS(wxDialUpManagerMSW) +}; + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +static LRESULT WINAPI wxRasStatusWindowProc(HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam); + +static DWORD wxRasMonitorThread(wxRasThreadData *data); + +static void WINAPI wxRasDialFunc(UINT unMsg, + RASCONNSTATE rasconnstate, + DWORD dwError); + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// init the static variables +// ---------------------------------------------------------------------------- + +HRASCONN wxDialUpManagerMSW::ms_hRasConnection = 0; + +HWND wxDialUpManagerMSW::ms_hwndRas = 0; + +RASDIAL wxDialUpManagerMSW::ms_pfnRasDial = 0; +RASENUMCONNECTIONS wxDialUpManagerMSW::ms_pfnRasEnumConnections = 0; +RASENUMENTRIES wxDialUpManagerMSW::ms_pfnRasEnumEntries = 0; +RASGETCONNECTSTATUS wxDialUpManagerMSW::ms_pfnRasGetConnectStatus = 0; +RASGETERRORSTRING wxDialUpManagerMSW::ms_pfnRasGetErrorString = 0; +RASHANGUP wxDialUpManagerMSW::ms_pfnRasHangUp = 0; +RASGETPROJECTIONINFO wxDialUpManagerMSW::ms_pfnRasGetProjectionInfo = 0; +RASCREATEPHONEBOOKENTRY wxDialUpManagerMSW::ms_pfnRasCreatePhonebookEntry = 0; +RASEDITPHONEBOOKENTRY wxDialUpManagerMSW::ms_pfnRasEditPhonebookEntry = 0; +RASSETENTRYDIALPARAMS wxDialUpManagerMSW::ms_pfnRasSetEntryDialParams = 0; +RASGETENTRYDIALPARAMS wxDialUpManagerMSW::ms_pfnRasGetEntryDialParams = 0; +RASENUMDEVICES wxDialUpManagerMSW::ms_pfnRasEnumDevices = 0; +RASGETCOUNTRYINFO wxDialUpManagerMSW::ms_pfnRasGetCountryInfo = 0; +RASGETENTRYPROPERTIES wxDialUpManagerMSW::ms_pfnRasGetEntryProperties = 0; +RASSETENTRYPROPERTIES wxDialUpManagerMSW::ms_pfnRasSetEntryProperties = 0; +RASRENAMEENTRY wxDialUpManagerMSW::ms_pfnRasRenameEntry = 0; +RASDELETEENTRY wxDialUpManagerMSW::ms_pfnRasDeleteEntry = 0; +RASVALIDATEENTRYNAME wxDialUpManagerMSW::ms_pfnRasValidateEntryName = 0; +RASCONNECTIONNOTIFICATION wxDialUpManagerMSW::ms_pfnRasConnectionNotification = 0; + +int wxDialUpManagerMSW::ms_userSpecifiedOnlineStatus = -1; +int wxDialUpManagerMSW::ms_isConnected = -1; +wxDialUpManagerMSW *wxDialUpManagerMSW::ms_dialer = NULL; + +// ---------------------------------------------------------------------------- +// ctor and dtor: the dynamic linking happens here +// ---------------------------------------------------------------------------- + +// the static creator function is implemented here +wxDialUpManager *wxDialUpManager::Create() +{ + return new wxDialUpManagerMSW; +} + +#ifdef __VISUALC__ + // warning about "'this' : used in base member initializer list" - so what? + #pragma warning(disable:4355) +#endif // VC++ + +wxDialUpManagerMSW::wxDialUpManagerMSW() + : m_timerStatusPolling(this), + m_dllRas(_T("RASAPI32")) +{ + // initialize our data + m_autoCheckLevel = 0; + m_hThread = 0; + m_data = new wxRasThreadData; + + if ( !m_dllRas.IsLoaded() ) + { + wxLogError(_("Dial up functions are unavailable because the remote access service (RAS) is not installed on this machine. Please install it.")); + } + else if ( !ms_pfnRasDial ) + { + // resolve the functions we need + + // this will contain the name of the function we failed to resolve + // if any at the end + const char *funcName = NULL; + + // get the function from rasapi32.dll and abort if it's not found + #define RESOLVE_RAS_FUNCTION(type, name) \ + ms_pfn##name = (type)m_dllRas.GetSymbol( wxString(_T(#name)) \ + + gs_funcSuffix); \ + if ( !ms_pfn##name ) \ + { \ + funcName = #name; \ + goto exit; \ + } + + // a variant of above macro which doesn't abort if the function is + // not found in the DLL + #define RESOLVE_OPTIONAL_RAS_FUNCTION(type, name) \ + ms_pfn##name = (type)m_dllRas.GetSymbol( wxString(_T(#name)) \ + + gs_funcSuffix); + + RESOLVE_RAS_FUNCTION(RASDIAL, RasDial); + RESOLVE_RAS_FUNCTION(RASENUMCONNECTIONS, RasEnumConnections); + RESOLVE_RAS_FUNCTION(RASENUMENTRIES, RasEnumEntries); + RESOLVE_RAS_FUNCTION(RASGETCONNECTSTATUS, RasGetConnectStatus); + RESOLVE_RAS_FUNCTION(RASGETERRORSTRING, RasGetErrorString); + RESOLVE_RAS_FUNCTION(RASHANGUP, RasHangUp); + RESOLVE_RAS_FUNCTION(RASGETENTRYDIALPARAMS, RasGetEntryDialParams); + + // suppress error messages about missing (non essential) functions + { + wxLogNull noLog; + + RESOLVE_OPTIONAL_RAS_FUNCTION(RASGETPROJECTIONINFO, RasGetProjectionInfo); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASCREATEPHONEBOOKENTRY, RasCreatePhonebookEntry); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASEDITPHONEBOOKENTRY, RasEditPhonebookEntry); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASSETENTRYDIALPARAMS, RasSetEntryDialParams); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASGETENTRYPROPERTIES, RasGetEntryProperties); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASSETENTRYPROPERTIES, RasSetEntryProperties); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASRENAMEENTRY, RasRenameEntry); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASDELETEENTRY, RasDeleteEntry); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASVALIDATEENTRYNAME, RasValidateEntryName); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASGETCOUNTRYINFO, RasGetCountryInfo); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASENUMDEVICES, RasEnumDevices); + RESOLVE_OPTIONAL_RAS_FUNCTION(RASCONNECTIONNOTIFICATION, RasConnectionNotification); + } + + // keep your preprocessor name space clean + #undef RESOLVE_RAS_FUNCTION + #undef RESOLVE_OPTIONAL_RAS_FUNCTION + +exit: + if ( funcName ) + { + static const wxChar *msg = wxTRANSLATE( +"The version of remote access service (RAS) installed on this machine is too\ +old, please upgrade (the following required function is missing: %s)." + ); + + wxLogError(wxGetTranslation(msg), funcName); + m_dllRas.Unload(); + return; + } + } + + // enable auto check by default + EnableAutoCheckOnlineStatus(0); +} + +wxDialUpManagerMSW::~wxDialUpManagerMSW() +{ + CleanUpThreadData(); +} + +// ---------------------------------------------------------------------------- +// helper functions +// ---------------------------------------------------------------------------- + +wxString wxDialUpManagerMSW::GetErrorString(DWORD error) +{ + wxChar buffer[512]; // this should be more than enough according to MS docs + DWORD dwRet = ms_pfnRasGetErrorString(error, buffer, WXSIZEOF(buffer)); + switch ( dwRet ) + { + case ERROR_INVALID_PARAMETER: + // this was a standard Win32 error probably + return wxString(wxSysErrorMsg(error)); + + default: + { + wxLogSysError(dwRet, + _("Failed to retrieve text of RAS error message")); + + wxString msg; + msg.Printf(_("unknown error (error code %08x)."), error); + return msg; + } + + case 0: + // we want the error message to start from a lower case letter + buffer[0] = wxTolower(buffer[0]); + + return wxString(buffer); + } +} + +HRASCONN wxDialUpManagerMSW::FindActiveConnection() +{ + // enumerate connections + DWORD cbBuf = sizeof(RASCONN); + LPRASCONN lpRasConn = (LPRASCONN)malloc(cbBuf); + if ( !lpRasConn ) + { + // out of memory + return 0; + } + + lpRasConn->dwSize = sizeof(RASCONN); + + DWORD nConnections = 0; + DWORD dwRet = ERROR_BUFFER_TOO_SMALL; + + while ( dwRet == ERROR_BUFFER_TOO_SMALL ) + { + dwRet = ms_pfnRasEnumConnections(lpRasConn, &cbBuf, &nConnections); + + if ( dwRet == ERROR_BUFFER_TOO_SMALL ) + { + LPRASCONN lpRasConnOld = lpRasConn; + lpRasConn = (LPRASCONN)realloc(lpRasConn, cbBuf); + if ( !lpRasConn ) + { + // out of memory + free(lpRasConnOld); + + return 0; + } + } + else if ( dwRet == 0 ) + { + // ok, success + break; + } + else + { + // an error occured + wxLogError(_("Cannot find active dialup connection: %s"), + GetErrorString(dwRet).c_str()); + return 0; + } + } + + HRASCONN hrasconn; + + switch ( nConnections ) + { + case 0: + // no connections + hrasconn = 0; + break; + + default: + // more than 1 connection - we don't know what to do with this + // case, so give a warning but continue (taking the first + // connection) - the warning is really needed because this function + // is used, for example, to select the connection to hang up and so + // we may hang up the wrong connection here... + wxLogWarning(_("Several active dialup connections found, choosing one randomly.")); + // fall through + + case 1: + // exactly 1 connection, great + hrasconn = lpRasConn->hrasconn; + } + + free(lpRasConn); + + return hrasconn; +} + +void wxDialUpManagerMSW::CleanUpThreadData() +{ + if ( m_hThread ) + { + if ( !SetEvent(m_data->hEventQuit) ) + { + wxLogLastError(_T("SetEvent(RasThreadQuit)")); + } + else // sent quit request to the background thread + { + // the thread still needs m_data so we can't free it here, rather + // let the thread do it itself + m_data = NULL; + } + + CloseHandle(m_hThread); + + m_hThread = 0; + } + + if ( m_data ) + { + delete m_data; + m_data = NULL; + } +} + +// ---------------------------------------------------------------------------- +// connection status +// ---------------------------------------------------------------------------- + +void wxDialUpManagerMSW::CheckRasStatus() +{ + // use int, not bool to compare with -1 + int isConnected = FindActiveConnection() != 0; + if ( isConnected != ms_isConnected ) + { + if ( ms_isConnected != -1 ) + { + // notify the program + NotifyApp(isConnected != 0); + } + // else: it's the first time we're called, just update the flag + + ms_isConnected = isConnected; + } +} + +void wxDialUpManagerMSW::NotifyApp(bool connected, bool fromOurselves) const +{ + wxDialUpEvent event(connected, fromOurselves); + (void)wxTheApp->ProcessEvent(event); +} + +// this function is called whenever the status of any RAS connection on this +// machine changes by RAS itself +void wxDialUpManagerMSW::OnConnectStatusChange() +{ + // we know that status changed, but we don't know whether we're connected + // or not - so find it out + CheckRasStatus(); +} + +// this function is called by our callback which we give to RasDial() when +// calling it asynchronously +void wxDialUpManagerMSW::OnDialProgress(RASCONNSTATE rasconnstate, + DWORD dwError) +{ + if ( !GetDialer() ) + { + // this probably means that CancelDialing() was called and we get + // "disconnected" notification + return; + } + + // we're only interested in 2 events: connected and disconnected + if ( dwError ) + { + wxLogError(_("Failed to establish dialup connection: %s"), + GetErrorString(dwError).c_str()); + + // we should still call RasHangUp() if we got a non 0 connection + if ( ms_hRasConnection ) + { + ms_pfnRasHangUp(ms_hRasConnection); + ms_hRasConnection = 0; + } + + ms_dialer = NULL; + + NotifyApp(FALSE /* !connected */, TRUE /* we dialed ourselves */); + } + else if ( rasconnstate == RASCS_Connected ) + { + ms_isConnected = TRUE; + ms_dialer = NULL; + + NotifyApp(TRUE /* connected */, TRUE /* we dialed ourselves */); + } +} + +// ---------------------------------------------------------------------------- +// implementation of wxDialUpManager functions +// ---------------------------------------------------------------------------- + +bool wxDialUpManagerMSW::IsOk() const +{ + return m_dllRas.IsLoaded(); +} + +size_t wxDialUpManagerMSW::GetISPNames(wxArrayString& names) const +{ + // fetch the entries + DWORD size = sizeof(RASENTRYNAME); + RASENTRYNAME *rasEntries = (RASENTRYNAME *)malloc(size); + rasEntries->dwSize = sizeof(RASENTRYNAME); + + DWORD nEntries; + DWORD dwRet; + do + { + dwRet = ms_pfnRasEnumEntries + ( + NULL, // reserved + NULL, // default phone book (or all) + rasEntries, // [out] buffer for the entries + &size, // [in/out] size of the buffer + &nEntries // [out] number of entries fetched + ); + + if ( dwRet == ERROR_BUFFER_TOO_SMALL ) + { + // reallocate the buffer + rasEntries = (RASENTRYNAME *)realloc(rasEntries, size); + } + else if ( dwRet != 0 ) + { + // some other error - abort + wxLogError(_("Failed to get ISP names: %s"), + GetErrorString(dwRet).c_str()); + + free(rasEntries); + + return 0u; + } + } + while ( dwRet != 0 ); + + // process them + names.Empty(); + for ( size_t n = 0; n < (size_t)nEntries; n++ ) + { + names.Add(rasEntries[n].szEntryName); + } + + free(rasEntries); + + // return the number of entries + return names.GetCount(); +} + +bool wxDialUpManagerMSW::Dial(const wxString& nameOfISP, + const wxString& username, + const wxString& password, + bool async) +{ + // check preconditions + wxCHECK_MSG( IsOk(), FALSE, wxT("using uninitialized wxDialUpManager") ); + + if ( ms_hRasConnection ) + { + wxFAIL_MSG(wxT("there is already an active connection")); + + return TRUE; + } + + // get the default ISP if none given + wxString entryName(nameOfISP); + if ( !entryName ) + { + wxArrayString names; + size_t count = GetISPNames(names); + switch ( count ) + { + case 0: + // no known ISPs, abort + wxLogError(_("Failed to connect: no ISP to dial.")); + + return FALSE; + + case 1: + // only one ISP, choose it + entryName = names[0u]; + break; + + default: + // several ISPs, let the user choose + { + wxString *strings = new wxString[count]; + for ( size_t i = 0; i < count; i++ ) + { + strings[i] = names[i]; + } + + entryName = wxGetSingleChoice + ( + _("Choose ISP to dial"), + _("Please choose which ISP do you want to connect to"), + count, + strings + ); + + delete [] strings; + + if ( !entryName ) + { + // cancelled by user + return FALSE; + } + } + } + } + + RASDIALPARAMS rasDialParams; + rasDialParams.dwSize = sizeof(rasDialParams); + wxStrncpy(rasDialParams.szEntryName, entryName, RAS_MaxEntryName); + + // do we have the username and password? + if ( !username || !password ) + { + BOOL gotPassword; + DWORD dwRet = ms_pfnRasGetEntryDialParams + ( + NULL, // default phonebook + &rasDialParams, // [in/out] the params of this entry + &gotPassword // [out] did we get password? + ); + + if ( dwRet != 0 ) + { + wxLogError(_("Failed to connect: missing username/password.")); + + return FALSE; + } + } + else + { + wxStrncpy(rasDialParams.szUserName, username, UNLEN); + wxStrncpy(rasDialParams.szPassword, password, PWLEN); + } + + // default values for other fields + rasDialParams.szPhoneNumber[0] = '\0'; + rasDialParams.szCallbackNumber[0] = '\0'; + rasDialParams.szCallbackNumber[0] = '\0'; + + rasDialParams.szDomain[0] = '*'; + rasDialParams.szDomain[1] = '\0'; + + // apparently, this is not really necessary - passing NULL instead of the + // phone book has the same effect +#if 0 + wxString phoneBook; + if ( wxGetOsVersion() == wxWINDOWS_NT ) + { + // first get the length + UINT nLen = ::GetSystemDirectory(NULL, 0); + nLen++; + + if ( !::GetSystemDirectory(phoneBook.GetWriteBuf(nLen), nLen) ) + { + wxLogSysError(_("Cannot find the location of address book file")); + } + + phoneBook.UngetWriteBuf(); + + // this is the default phone book + phoneBook << "\\ras\\rasphone.pbk"; + } +#endif // 0 + + // TODO may be we should disable auto check while async dialing is in + // progress? + + ms_dialer = this; + + DWORD dwRet = ms_pfnRasDial + ( + NULL, // no extended features + NULL, // default phone book file (NT only) + &rasDialParams, + 0, // use callback for notifications + async ? (void *)wxRasDialFunc // cast needed for gcc 3.1 + : 0, // no notifications, sync operation + &ms_hRasConnection + ); + + if ( dwRet != 0 ) + { + // can't pass a wxWCharBuffer through ( ... ) + wxLogError(_("Failed to %s dialup connection: %s"), + wxString(async ? _("initiate") : _("establish")).c_str(), + GetErrorString(dwRet).c_str()); + + // we should still call RasHangUp() if we got a non 0 connection + if ( ms_hRasConnection ) + { + ms_pfnRasHangUp(ms_hRasConnection); + ms_hRasConnection = 0; + } + + ms_dialer = NULL; + + return FALSE; + } + + // for async dialing, we're not yet connected + if ( !async ) + { + ms_isConnected = TRUE; + } + + return TRUE; +} + +bool wxDialUpManagerMSW::IsDialing() const +{ + return GetDialer() != NULL; +} + +bool wxDialUpManagerMSW::CancelDialing() +{ + if ( !GetDialer() ) + { + // silently ignore + return FALSE; + } + + wxASSERT_MSG( ms_hRasConnection, wxT("dialing but no connection?") ); + + ms_dialer = NULL; + + return HangUp(); +} + +bool wxDialUpManagerMSW::HangUp() +{ + wxCHECK_MSG( IsOk(), FALSE, wxT("using uninitialized wxDialUpManager") ); + + // we may terminate either the connection we initiated or another one which + // is active now + HRASCONN hRasConn; + if ( ms_hRasConnection ) + { + hRasConn = ms_hRasConnection; + + ms_hRasConnection = 0; + } + else + { + hRasConn = FindActiveConnection(); + } + + if ( !hRasConn ) + { + wxLogError(_("Cannot hang up - no active dialup connection.")); + + return FALSE; + } + + DWORD dwRet = ms_pfnRasHangUp(hRasConn); + if ( dwRet != 0 ) + { + wxLogError(_("Failed to terminate the dialup connection: %s"), + GetErrorString(dwRet).c_str()); + } + + ms_isConnected = FALSE; + + return TRUE; +} + +bool wxDialUpManagerMSW::IsAlwaysOnline() const +{ + // assume no permanent connection by default + bool isAlwaysOnline = FALSE; + + // try to use WinInet functions + + // NB: we could probably use wxDynamicLibrary here just as well, + // but we allow multiple instances of wxDialUpManagerMSW so + // we might as well use the ref counted version here too. + + wxDynamicLibrary hDll(_T("WININET")); + if ( hDll.IsLoaded() ) + { + typedef BOOL (WINAPI *INTERNETGETCONNECTEDSTATE)(LPDWORD, DWORD); + INTERNETGETCONNECTEDSTATE pfnInternetGetConnectedState; + + #define RESOLVE_FUNCTION(type, name) \ + pfn##name = (type)hDll.GetSymbol(_T(#name)) + + RESOLVE_FUNCTION(INTERNETGETCONNECTEDSTATE, InternetGetConnectedState); + + if ( pfnInternetGetConnectedState ) + { + DWORD flags = 0; + if ( pfnInternetGetConnectedState(&flags, 0 /* reserved */) ) + { + // there is some connection to the net, see of which type + isAlwaysOnline = (flags & (INTERNET_CONNECTION_LAN | + INTERNET_CONNECTION_PROXY)) != 0; + } + //else: no Internet connection at all + } + } + + return isAlwaysOnline; +} + +bool wxDialUpManagerMSW::IsOnline() const +{ + wxCHECK_MSG( IsOk(), FALSE, wxT("using uninitialized wxDialUpManager") ); + + if ( IsAlwaysOnline() ) + { + // always => now + return true; + } + + if ( ms_userSpecifiedOnlineStatus != -1 ) + { + // user specified flag overrides our logic + return ms_userSpecifiedOnlineStatus != 0; + } + else + { + // return TRUE if there is at least one active connection + return FindActiveConnection() != 0; + } +} + +void wxDialUpManagerMSW::SetOnlineStatus(bool isOnline) +{ + wxCHECK_RET( IsOk(), wxT("using uninitialized wxDialUpManager") ); + + ms_userSpecifiedOnlineStatus = isOnline; +} + +bool wxDialUpManagerMSW::EnableAutoCheckOnlineStatus(size_t nSeconds) +{ + wxCHECK_MSG( IsOk(), FALSE, wxT("using uninitialized wxDialUpManager") ); + + if ( m_autoCheckLevel++ ) + { + // already checking + return TRUE; + } + + bool ok = ms_pfnRasConnectionNotification != 0; + + if ( ok ) + { + // we're running under NT 4.0, Windows 98 or later and can use + // RasConnectionNotification() to be notified by a secondary thread + + // first, see if we don't have this thread already running + if ( m_hThread != 0 ) + { + if ( ::ResumeThread(m_hThread) != (DWORD)-1 ) + return TRUE; + + // we're leaving a zombie thread... but what else can we do? + wxLogLastError(wxT("ResumeThread(RasThread)")); + + ok = FALSE; + } + } + + // create all the stuff we need to be notified about RAS connection + // status change + + if ( ok ) + { + // first create an event to wait on + m_data->hEventRas = CreateEvent + ( + NULL, // security attribute (default) + FALSE, // manual reset (no, it is automatic) + FALSE, // initial state (not signaled) + NULL // name (no) + ); + if ( !m_data->hEventRas ) + { + wxLogLastError(wxT("CreateEvent(RasStatus)")); + + ok = FALSE; + } + } + + if ( ok ) + { + // create the event we use to quit the thread: using a manual event + // here avoids problems with missing the event if wxDialUpManagerMSW + // is created and destroyed immediately, before wxRasStatusWindowProc + // starts waiting on the event + m_data->hEventQuit = CreateEvent + ( + NULL, // default security + TRUE, // manual event + FALSE, // initially non signalled + NULL // nameless + ); + if ( !m_data->hEventQuit ) + { + wxLogLastError(wxT("CreateEvent(RasThreadQuit)")); + + CleanUpThreadData(); + + ok = FALSE; + } + } + + if ( ok && !ms_hwndRas ) + { + // create a hidden window to receive notification about connections + // status change + extern const wxChar *wxCanvasClassName; + ms_hwndRas = ::CreateWindow(wxCanvasClassName, NULL, + 0, 0, 0, 0, + 0, NULL, + (HMENU)NULL, wxGetInstance(), 0); + if ( !ms_hwndRas ) + { + wxLogLastError(wxT("CreateWindow(RasHiddenWindow)")); + + CleanUpThreadData(); + + ok = FALSE; + } + + // and subclass it + wxSetWindowProc(ms_hwndRas, wxRasStatusWindowProc); + } + + m_data->hWnd = ms_hwndRas; + + if ( ok ) + { + // start the secondary thread + m_data->dialUpManager = this; + + DWORD tid; + m_hThread = CreateThread + ( + NULL, + 0, + (LPTHREAD_START_ROUTINE)wxRasMonitorThread, + (void *)m_data, + 0, + &tid + ); + + if ( !m_hThread ) + { + wxLogLastError(wxT("CreateThread(RasStatusThread)")); + + CleanUpThreadData(); + } + } + + if ( ok ) + { + // start receiving RAS notifications + DWORD dwRet = ms_pfnRasConnectionNotification + ( + (HRASCONN)INVALID_HANDLE_VALUE, + m_data->hEventRas, + 3 /* RASCN_Connection | RASCN_Disconnection */ + ); + + if ( dwRet != 0 ) + { + wxLogDebug(wxT("RasConnectionNotification() failed: %s"), + GetErrorString(dwRet).c_str()); + + CleanUpThreadData(); + } + else + { + return TRUE; + } + } + + // we're running under Windows 95 and have to poll ourselves + // (or, alternatively, the code above for NT/98 failed) + m_timerStatusPolling.Stop(); + if ( nSeconds == 0 ) + { + // default value + nSeconds = 60; + } + m_timerStatusPolling.Start(nSeconds * 1000); + + return TRUE; +} + +void wxDialUpManagerMSW::DisableAutoCheckOnlineStatus() +{ + wxCHECK_RET( IsOk(), wxT("using uninitialized wxDialUpManager") ); + + if ( --m_autoCheckLevel ) + { + // still checking + return; + } + + if ( m_hThread ) + { + // we have running secondary thread, it's just enough to suspend it + if ( SuspendThread(m_hThread) == (DWORD)-1 ) + { + wxLogLastError(wxT("SuspendThread(RasThread)")); + } + } + else + { + // even simpler - just stop the timer + m_timerStatusPolling.Stop(); + } +} + +// ---------------------------------------------------------------------------- +// stubs which don't do anything in MSW version +// ---------------------------------------------------------------------------- + +void wxDialUpManagerMSW::SetWellKnownHost(const wxString& WXUNUSED(hostname), + int WXUNUSED(port)) +{ + wxCHECK_RET( IsOk(), wxT("using uninitialized wxDialUpManager") ); + + // nothing to do - we don't use this +} + +void wxDialUpManagerMSW::SetConnectCommand(const wxString& WXUNUSED(dial), + const wxString& WXUNUSED(hangup)) +{ + wxCHECK_RET( IsOk(), wxT("using uninitialized wxDialUpManager") ); + + // nothing to do - we don't use this +} + +// ---------------------------------------------------------------------------- +// callbacks +// ---------------------------------------------------------------------------- + +static DWORD wxRasMonitorThread(wxRasThreadData *data) +{ + HANDLE handles[2]; + handles[0] = data->hEventRas; + handles[1] = data->hEventQuit; + + bool cont = TRUE; + while ( cont ) + { + DWORD dwRet = WaitForMultipleObjects(2, handles, FALSE, INFINITE); + + switch ( dwRet ) + { + case WAIT_OBJECT_0: + // RAS connection status changed + SendMessage(data->hWnd, wxWM_RAS_STATUS_CHANGED, + 0, (LPARAM)data); + break; + + case WAIT_OBJECT_0 + 1: + cont = FALSE; + break; + + default: + wxFAIL_MSG( _T("unexpected return of WaitForMultipleObjects()") ); + // fall through + + case WAIT_FAILED: +#ifdef __WXDEBUG__ + // using wxLogLastError() from here is dangerous: we risk to + // deadlock the main thread if wxLog sends output to GUI + DWORD err = GetLastError(); + wxMessageOutputDebug().Printf + ( + wxT("WaitForMultipleObjects(RasMonitor) failed: 0x%08lx (%s)"), + err, + wxSysErrorMsg(err) + ); +#endif // __WXDEBUG__ + + // no sense in continuing, who knows if the handles we're + // waiting for even exist yet... + return (DWORD)-1; + } + } + + // we don't need it any more now and if this thread ran, it is our + // responsability to free the data + delete data; + + return 0; +} + +static LRESULT APIENTRY wxRasStatusWindowProc(HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + switch ( message ) + { + case wxWM_RAS_STATUS_CHANGED: + { + wxRasThreadData *data = (wxRasThreadData *)lParam; + data->dialUpManager->OnConnectStatusChange(); + } + break; + + case wxWM_RAS_DIALING_PROGRESS: + { + wxDialUpManagerMSW *dialMan = wxDialUpManagerMSW::GetDialer(); + + dialMan->OnDialProgress((RASCONNSTATE)wParam, lParam); + } + break; + + default: + return ::DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; +} + +static void WINAPI wxRasDialFunc(UINT WXUNUSED(unMsg), + RASCONNSTATE rasconnstate, + DWORD dwError) +{ + wxDialUpManagerMSW *dialUpManager = wxDialUpManagerMSW::GetDialer(); + + wxCHECK_RET( dialUpManager, wxT("who started to dial then?") ); + + SendMessage(dialUpManager->GetRasWindow(), wxWM_RAS_DIALING_PROGRESS, + rasconnstate, dwError); +} + +#endif // __PALMOS__ + +#endif // wxUSE_DIALUP_MANAGER + diff --git a/src/palmos/dib.cpp b/src/palmos/dib.cpp new file mode 100644 index 0000000000..ee9ae2df71 --- /dev/null +++ b/src/palmos/dib.cpp @@ -0,0 +1,170 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/dib.cpp +// Purpose: implements wxDIB class +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/log.h" +#endif //WX_PRECOMP + +#if wxUSE_WXDIB + +#include "wx/bitmap.h" +#include "wx/intl.h" +#include "wx/file.h" + +#include "wx/image.h" +#include "wx/palmos/dib.h" + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// calculate the number of palette entries needed for the bitmap with this +// number of bits per pixel +static inline WORD GetNumberOfColours(WORD bitsPerPixel) +{ + // only 1, 4 and 8bpp bitmaps use palettes (well, they could be used with + // 24bpp ones too but we don't support this as I think it's quite uncommon) + return bitsPerPixel <= 8 ? 1 << bitsPerPixel : 0; +} + +// wrapper around ::GetObject() for DIB sections +static inline bool GetDIBSection(HBITMAP hbmp, DIBSECTION *ds) +{ + // note that at least under Win9x (this doesn't seem to happen under Win2K + // but this doesn't mean anything, of course), GetObject() may return + // sizeof(DIBSECTION) for a bitmap which is *not* a DIB section and the way + // to check for it is by looking at the bits pointer + return ::GetObject(hbmp, sizeof(DIBSECTION), ds) == sizeof(DIBSECTION) && + ds->dsBm.bmBits; +} + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDIB creation +// ---------------------------------------------------------------------------- + +bool wxDIB::Create(int width, int height, int depth) +{ + return false; +} + +bool wxDIB::Create(const wxBitmap& bmp) +{ + return false; +} + +bool wxDIB::CopyFromDDB(HBITMAP hbmp) +{ + return false; +} + + +// ---------------------------------------------------------------------------- +// Loading/saving the DIBs +// ---------------------------------------------------------------------------- + +bool wxDIB::Load(const wxString& filename) +{ + return false; +} + +bool wxDIB::Save(const wxString& filename) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxDIB accessors +// ---------------------------------------------------------------------------- + +void wxDIB::DoGetObject() const +{ +} + +// ---------------------------------------------------------------------------- +// DDB <-> DIB conversions +// ---------------------------------------------------------------------------- + +HBITMAP wxDIB::CreateDDB(HDC hdc) const +{ + return 0; +} + +/* static */ +HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, void *bits) +{ + return 0; +} + +/* static */ +size_t wxDIB::ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp) +{ + return 0; +} + +/* static */ +HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp) +{ + return NULL; +} + +// ---------------------------------------------------------------------------- +// palette support +// ---------------------------------------------------------------------------- + +#if wxUSE_PALETTE + +wxPalette *wxDIB::CreatePalette() const +{ + return NULL; +} + +#endif // wxUSE_PALETTE + +// ---------------------------------------------------------------------------- +// wxImage support +// ---------------------------------------------------------------------------- + +#if wxUSE_IMAGE + +bool wxDIB::Create(const wxImage& image) +{ + return false; +} + +wxImage wxDIB::ConvertToImage() const +{ + return wxNullImage; +} + +#endif // wxUSE_IMAGE + +#endif // wxUSE_WXDIB + diff --git a/src/palmos/dir.cpp b/src/palmos/dir.cpp new file mode 100644 index 0000000000..5bde0b1d19 --- /dev/null +++ b/src/palmos/dir.cpp @@ -0,0 +1,119 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/dir.cpp +// Purpose: wxDir implementation for Win32 +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dir.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" +#endif // PCH + +#include "wx/dir.h" +#include "wx/filefn.h" // for wxPathExists() + +// ---------------------------------------------------------------------------- +// define the types and functions used for file searching +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#ifndef MAX_PATH + #define MAX_PATH 260 // from VC++ headers +#endif + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#define M_DIR ((wxDirData *)m_data) + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDir helpers +// ---------------------------------------------------------------------------- + +/* static */ +bool wxDir::Exists(const wxString& dir) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxDir construction/destruction +// ---------------------------------------------------------------------------- + +wxDir::wxDir(const wxString& dirname) +{ +} + +bool wxDir::Open(const wxString& dirname) +{ + return false; +} + +bool wxDir::IsOpened() const +{ + return false; +} + +wxString wxDir::GetName() const +{ + wxString name; + + return name; +} + +wxDir::~wxDir() +{ +} + +// ---------------------------------------------------------------------------- +// wxDir enumerating +// ---------------------------------------------------------------------------- + +bool wxDir::GetFirst(wxString *filename, + const wxString& filespec, + int flags) const +{ + return false; +} + +bool wxDir::GetNext(wxString *filename) const +{ + return false; +} + diff --git a/src/palmos/dirdlg.cpp b/src/palmos/dirdlg.cpp new file mode 100644 index 0000000000..58825213ac --- /dev/null +++ b/src/palmos/dirdlg.cpp @@ -0,0 +1,143 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dirdlg.cpp +// Purpose: wxDirDialog +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "dirdlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_DIRDLG + +#if defined(__WIN95__) && !defined(__GNUWIN32_OLD__) && wxUSE_OLE + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/dirdlg.h" + #include "wx/log.h" + #include "wx/app.h" // for GetComCtl32Version() +#endif + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#ifndef MAX_PATH + #define MAX_PATH 4096 // be generous +#endif + +#ifndef BIF_NEWDIALOGSTYLE + #define BIF_NEWDIALOGSTYLE 0x0040 +#endif + +#ifndef BIF_NONEWFOLDERBUTTON + #define BIF_NONEWFOLDERBUTTON 0x0200 +#endif + +#ifndef BIF_EDITBOX + #define BIF_EDITBOX 16 +#endif + +// ---------------------------------------------------------------------------- +// wxWidgets macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_CLASS(wxDirDialog, wxDialog) + +// ---------------------------------------------------------------------------- +// private functions prototypes +// ---------------------------------------------------------------------------- + +// free the parameter +static void ItemListFree(LPITEMIDLIST pidl); + +// the callback proc for the dir dlg +static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, + LPARAM pData); + + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDirDialog +// ---------------------------------------------------------------------------- + +wxDirDialog::wxDirDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultPath, + long style, + const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size), + const wxString& WXUNUSED(name)) +{ +} + +void wxDirDialog::SetPath(const wxString& path) +{ +} + +int wxDirDialog::ShowModal() +{ + return wxID_OK; +} + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +static int CALLBACK +BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) +{ + return 0; +} + + +static void ItemListFree(LPITEMIDLIST pidl) +{ + if ( pidl ) + { + LPMALLOC pMalloc; + SHGetMalloc(&pMalloc); + if ( pMalloc ) + { + pMalloc->Free(pidl); + pMalloc->Release(); + } + else + { + wxLogLastError(wxT("SHGetMalloc")); + } + } +} + +#else + #include "../generic/dirdlgg.cpp" +#endif // compiler/platform on which the code here compiles + +#endif // wxUSE_DIRDLG diff --git a/src/palmos/display.cpp b/src/palmos/display.cpp new file mode 100644 index 0000000000..eb64582534 --- /dev/null +++ b/src/palmos/display.cpp @@ -0,0 +1,276 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: display.cpp +// Purpose: Palm OS Implementation of wxDisplay class +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "display.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_DISPLAY + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/dynarray.h" + #include "wx/frame.h" +#endif + +#include "wx/dynload.h" + +#include "wx/display.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#ifdef _UNICODE + #define WINFUNC(x) _T(#x) L"W" +#else + #define WINFUNC(x) #x "A" +#endif + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +class wxDisplayInfo +{ +public: + // handle of this monitor used by MonitorXXX() functions, never NULL + HMONITOR m_hmon; + + // IDirectDraw object used to control this display, may be NULL + IDirectDraw2 *m_pDD2; + + // DirectDraw GUID for this display, only valid when using DirectDraw + GUID m_guid; + + // the entire area of this monitor in virtual screen coordinates + wxRect m_rect; + + // the display device name for this monitor, empty initially and retrieved + // on demand by DoGetName() + wxString m_devName; + + wxDisplayInfo() { m_hmon = NULL; m_pDD2 = NULL; } + ~wxDisplayInfo() { if ( m_pDD2 ) m_pDD2->Release(); } +}; + +WX_DECLARE_OBJARRAY(wxDisplayInfo, wxDisplayInfoArray); +#include "wx/arrimpl.cpp" +WX_DEFINE_OBJARRAY(wxDisplayInfoArray); + +// this module is used to cleanup gs_displays array +class wxDisplayModule : public wxModule +{ +public: + virtual bool OnInit() { return true; } + virtual void OnExit(); + + DECLARE_DYNAMIC_CLASS(wxDisplayModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxDisplayModule, wxModule) + +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- + +// this is not really MT-unsafe as wxDisplay is only going to be used from the +// main thread, i.e. we consider that it's a GUI class and so don't protect it +static wxDisplayInfoArray *gs_displays = NULL; + +// =========================================================================== +// implementation +// =========================================================================== + +// ---------------------------------------------------------------------------- +// local functions +// ---------------------------------------------------------------------------- + +// initialize gs_displays using DirectX functions +static bool DoInitDirectX() +{ + return false; +} + +// initialize gs_displays using the standard Windows functions +static void DoInitStdWindows() +{ +} + +// this function must be called before accessing gs_displays array as it +// creates and initializes it +static void InitDisplays() +{ +} + +// convert a DEVMODE to our wxVideoMode +wxVideoMode ConvertToVideoMode(const DEVMODE& dm) +{ + return wxVideoMode(160, + 160, + 16, + 0); +} + +// ---------------------------------------------------------------------------- +// wxDisplayModule +// ---------------------------------------------------------------------------- + +void wxDisplayModule::OnExit() +{ +} + +// --------------------------------------------------------------------------- +// wxDisplay +// --------------------------------------------------------------------------- + +/* static */ +void wxDisplay::UseDirectX(bool useDX) +{ +} + +// helper of GetFromPoint() and GetFromWindow() +static int DisplayFromHMONITOR(HMONITOR hmon) +{ + return wxNOT_FOUND; +} + +/* static */ +size_t wxDisplayBase::GetCount() +{ + return 0; +} + +/* static */ +int wxDisplayBase::GetFromPoint ( const wxPoint& pt ) +{ + return 0; +} + +/* static */ +int wxDisplayBase::GetFromWindow(wxWindow *window) +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// wxDisplay ctor/dtor +// ---------------------------------------------------------------------------- + +wxDisplay::wxDisplay ( size_t n ) + : wxDisplayBase ( n ) +{ +} + +wxDisplay::~wxDisplay() +{ +} + +// ---------------------------------------------------------------------------- +// wxDisplay simple accessors +// ---------------------------------------------------------------------------- + +bool wxDisplay::IsOk() const +{ + return false; +} + +wxRect wxDisplay::GetGeometry() const +{ + wxRect rect; + + return rect; +} + +wxString wxDisplay::GetName() const +{ + wxString ret; + + return ret; +} + +wxString wxDisplay::GetNameForEnumSettings() const +{ + wxString ret; + + return ret; +} + +// ---------------------------------------------------------------------------- +// video modes enumeration +// ---------------------------------------------------------------------------- + +wxArrayVideoModes +wxDisplay::DoGetModesDirectX(const wxVideoMode& WXUNUSED(modeMatch)) const +{ + wxArrayVideoModes modes; + + return modes; +} + +wxArrayVideoModes +wxDisplay::DoGetModesWindows(const wxVideoMode& modeMatch) const +{ + wxArrayVideoModes modes; + + return modes; +} + +wxArrayVideoModes wxDisplay::GetModes(const wxVideoMode& modeMatch) const +{ + return gs_useDirectX ? DoGetModesDirectX(modeMatch) + : DoGetModesWindows(modeMatch); +} + +wxVideoMode wxDisplay::GetCurrentMode() const +{ + wxVideoMode mode; + + return mode; +} + +// ---------------------------------------------------------------------------- +// video mode switching +// ---------------------------------------------------------------------------- + +bool wxDisplay::DoChangeModeDirectX(const wxVideoMode& mode) +{ + return false; +} + +bool wxDisplay::DoChangeModeWindows(const wxVideoMode& mode) +{ + return false; +} + +bool wxDisplay::ChangeMode(const wxVideoMode& mode) +{ + return gs_useDirectX ? DoChangeModeDirectX(mode) + : DoChangeModeWindows(mode); +} + +#endif // wxUSE_DISPLAY + diff --git a/src/palmos/dragimag.cpp b/src/palmos/dragimag.cpp new file mode 100644 index 0000000000..7ae1e34e74 --- /dev/null +++ b/src/palmos/dragimag.cpp @@ -0,0 +1,159 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dragimag.cpp +// Purpose: wxDragImage +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "dragimag.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_DRAGIMAGE + +#ifndef WX_PRECOMP +#include +#include "wx/setup.h" +#include "wx/window.h" +#include "wx/dcclient.h" +#include "wx/dcscreen.h" +#include "wx/dcmemory.h" +#include "wx/settings.h" +#endif + +#include "wx/msw/private.h" +#include "wx/log.h" +#include "wx/intl.h" +#include "wx/frame.h" +#include "wx/image.h" + +#include "wx/palmos/dragimag.h" +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxDragImage, wxObject) + +#define GetHimageList() ((HIMAGELIST) m_hImageList) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxDragImage ctors/dtor +// ---------------------------------------------------------------------------- + +wxDragImage::wxDragImage() +{ +} + +wxDragImage::~wxDragImage() +{ +} + +void wxDragImage::Init() +{ +} + +// Attributes +//////////////////////////////////////////////////////////////////////////// + + +// Operations +//////////////////////////////////////////////////////////////////////////// + +// Create a drag image from a bitmap and optional cursor +bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) +{ + return false; +} + +// Create a drag image from an icon and optional cursor +bool wxDragImage::Create(const wxIcon& image, const wxCursor& cursor) +{ + return false; +} + +// Create a drag image from a string and optional cursor +bool wxDragImage::Create(const wxString& str, const wxCursor& cursor) +{ + return false; +} + +#if wxUSE_TREECTRL +// Create a drag image for the given tree control item +bool wxDragImage::Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) +{ + return false; +} +#endif + +#if wxUSE_LISTCTRL +// Create a drag image for the given list control item +bool wxDragImage::Create(const wxListCtrl& listCtrl, long id) +{ + return false; +} +#endif + +// Begin drag +bool wxDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen, wxRect* rect) +{ + return false; +} + +// Begin drag. hotspot is the location of the drag position relative to the upper-left +// corner of the image. This is full screen only. fullScreenRect gives the +// position of the window on the screen, to restrict the drag to. +bool wxDragImage::BeginDrag(const wxPoint& hotspot, wxWindow* window, wxWindow* fullScreenRect) +{ + return false; +} + +// End drag +bool wxDragImage::EndDrag() +{ + return false; +} + +// Move the image: call from OnMouseMove. Pt is in window client coordinates if window +// is non-NULL, or in screen coordinates if NULL. +bool wxDragImage::Move(const wxPoint& pt) +{ + return false; +} + +bool wxDragImage::Show() +{ + return false; +} + +bool wxDragImage::Hide() +{ + return false; +} + + +#endif // wxUSE_DRAGIMAGE diff --git a/src/palmos/dummy.cpp b/src/palmos/dummy.cpp new file mode 100644 index 0000000000..968f2b0851 --- /dev/null +++ b/src/palmos/dummy.cpp @@ -0,0 +1,30 @@ +/* + * File: dummy.cc + * Purpose: See below + * Author: Julian Smart + * Created: 1993 + * Updated: + * Copyright: (c) 1993, AIAI, University of Edinburgh + */ + +/* A dummy file to include wx.h. If precompiling wx.h, I + * always start by compiling this and producing the PCH file. + * Then subsequent source files use the PCH file. + * + * If precompiling wx.h for wxWidgets and derived apps, + * link dummy.obj with your program (the MSC 7 linker complains otherwise). + * + * This is the only convenient way I found to use precompiled headers + * under MSC 7. + * + * This will produce a big PCH file. + */ + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/palmos/msvcrt.h" + diff --git a/src/palmos/dummydll.cpp b/src/palmos/dummydll.cpp new file mode 100644 index 0000000000..f1a29bcf1e --- /dev/null +++ b/src/palmos/dummydll.cpp @@ -0,0 +1,25 @@ +/* + * File: dummydll.cc + * Purpose: + * Author: Julian Smart + * Created: 1993 + * Updated: + * Copyright: (c) 1993, AIAI, University of Edinburgh + */ + +/* static const char sccsid[] = "@(#)dummydll.cc 1.2 5/9/94"; */ + +/* + * A dummy file to include wx.h. If precompiling wx.h, I + * always start by compiling this and producing the PCH file. + * Then subsequent source files use the PCH file. + */ + +#include "wx/wxprec.h" + +// Foils optimizations in Visual C++ (see also app.cpp). Without it, +// dummy.obj isn't linked and we get a linker error. +#if defined(__VISUALC__) + char wxDummyChar=0; +#endif + diff --git a/src/palmos/enhmeta.cpp b/src/palmos/enhmeta.cpp new file mode 100644 index 0000000000..483095f1f2 --- /dev/null +++ b/src/palmos/enhmeta.cpp @@ -0,0 +1,180 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/enhmeta.cpp +// Purpose: implementation of wxEnhMetaFileXXX classes +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "enhmeta.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_ENH_METAFILE + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/log.h" +#endif //WX_PRECOMP + +#include "wx/metafile.h" +#include "wx/clipbrd.h" + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC) + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#define GetEMF() ((HENHMETAFILE)m_hMF) +#define GetEMFOf(mf) ((HENHMETAFILE)((mf).m_hMF)) + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// we must pass NULL if the string is empty to metafile functions +static inline const wxChar *GetMetaFileName(const wxString& fn) + { return !fn ? (wxChar *)NULL : fn.c_str(); } + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxEnhMetaFile +// ---------------------------------------------------------------------------- + +void wxEnhMetaFile::Assign(const wxEnhMetaFile& mf) +{ +} + +void wxEnhMetaFile::Free() +{ +} + +bool wxEnhMetaFile::Play(wxDC *dc, wxRect *rectBound) +{ + return false; +} + +wxSize wxEnhMetaFile::GetSize() const +{ + wxSize size = wxDefaultSize; + + return size; +} + +bool wxEnhMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height)) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDC +// ---------------------------------------------------------------------------- + +wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename, + int width, int height, + const wxString& description) +{ +} + +wxEnhMetaFile *wxEnhMetaFileDC::Close() +{ + return NULL; +} + +wxEnhMetaFileDC::~wxEnhMetaFileDC() +{ +} + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileDataObject +// ---------------------------------------------------------------------------- + +wxDataFormat +wxEnhMetaFileDataObject::GetPreferredFormat(Direction WXUNUSED(dir)) const +{ + return wxDF_ENHMETAFILE; +} + +size_t wxEnhMetaFileDataObject::GetFormatCount(Direction WXUNUSED(dir)) const +{ + // wxDF_ENHMETAFILE and wxDF_METAFILE + return 2; +} + +void wxEnhMetaFileDataObject::GetAllFormats(wxDataFormat *formats, + Direction WXUNUSED(dir)) const +{ +} + +size_t wxEnhMetaFileDataObject::GetDataSize(const wxDataFormat& format) const +{ + return 0u; +} + +bool wxEnhMetaFileDataObject::GetDataHere(const wxDataFormat& format, void *buf) const +{ + return false; +} + +bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format, + size_t WXUNUSED(len), + const void *buf) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxEnhMetaFileSimpleDataObject +// ---------------------------------------------------------------------------- + +size_t wxEnhMetaFileSimpleDataObject::GetDataSize() const +{ + return 0u; +} + +bool wxEnhMetaFileSimpleDataObject::GetDataHere(void *buf) const +{ + return false; +} + +bool wxEnhMetaFileSimpleDataObject::SetData(size_t WXUNUSED(len), + const void *buf) +{ + return false; +} + + +#endif // wxUSE_DRAG_AND_DROP + +#endif // wxUSE_ENH_METAFILE diff --git a/src/palmos/evtloop.cpp b/src/palmos/evtloop.cpp new file mode 100644 index 0000000000..36b0cf43db --- /dev/null +++ b/src/palmos/evtloop.cpp @@ -0,0 +1,164 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/evtloop.cpp +// Purpose: implements wxEventLoop for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10.14.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "evtloop.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/app.h" +#endif //WX_PRECOMP + +#include "wx/evtloop.h" + +#include "wx/tooltip.h" +#include "wx/except.h" +#include "wx/ptr_scpd.h" + +#if wxUSE_THREADS + #include "wx/thread.h" + + // define the array of MSG strutures + WX_DECLARE_OBJARRAY(MSG, wxMsgArray); + + #include "wx/arrimpl.cpp" + + WX_DEFINE_OBJARRAY(wxMsgArray); +#endif // wxUSE_THREADS + +// ---------------------------------------------------------------------------- +// helper class +// ---------------------------------------------------------------------------- + +// this object sets the wxEventLoop given to the ctor as the currently active +// one and unsets it in its dtor +class wxEventLoopActivator +{ +public: + wxEventLoopActivator(wxEventLoop **pActive, + wxEventLoop *evtLoop) + { + m_pActive = pActive; + m_evtLoopOld = *pActive; + *pActive = evtLoop; + } + + ~wxEventLoopActivator() + { + // restore the previously active event loop + *m_pActive = m_evtLoopOld; + } + +private: + wxEventLoop *m_evtLoopOld; + wxEventLoop **m_pActive; +}; + +// ============================================================================ +// wxEventLoop implementation +// ============================================================================ + +wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL; + +// ---------------------------------------------------------------------------- +// ctor/dtor +// ---------------------------------------------------------------------------- + +wxEventLoop::wxEventLoop() +{ + m_shouldExit = false; + m_exitcode = 0; +} + +// ---------------------------------------------------------------------------- +// wxEventLoop message processing +// ---------------------------------------------------------------------------- + +void wxEventLoop::ProcessMessage(WXMSG *msg) +{ +} + +bool wxEventLoop::PreProcessMessage(WXMSG *msg) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxEventLoop running and exiting +// ---------------------------------------------------------------------------- + +bool wxEventLoop::IsRunning() const +{ + return true; +} + +int wxEventLoop::Run() +{ + status_t error; + EventType event; + + do { + wxTheApp && wxTheApp->ProcessIdle(); + + EvtGetEvent(&event, evtWaitForever); + + if (SysHandleEvent(&event)) + continue; + + if (MenuHandleEvent(0, &event, &error)) + continue; + + FrmDispatchEvent(&event); + + } while (event.eType != appStopEvent); + + return 0; +} + +void wxEventLoop::Exit(int rc) +{ + FrmCloseAllForms(); + + EventType AppStop; + AppStop.eType=appStopEvent; + EvtAddEventToQueue(&AppStop); +} + +// ---------------------------------------------------------------------------- +// wxEventLoop message processing dispatching +// ---------------------------------------------------------------------------- + +bool wxEventLoop::Pending() const +{ + return false; +} + +bool wxEventLoop::Dispatch() +{ + return false; +} + diff --git a/src/palmos/fdrepdlg.cpp b/src/palmos/fdrepdlg.cpp new file mode 100644 index 0000000000..5e2f46d037 --- /dev/null +++ b/src/palmos/fdrepdlg.cpp @@ -0,0 +1,210 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/fdrepdlg.cpp +// Purpose: wxFindReplaceDialog class +// Author: William Osborne +// Modified by: +// Created: 10.13.04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "mswfdrepdlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_FINDREPLDLG + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#include "wx/palmos/private.h" + +#include "wx/fdrepdlg.h" + +// ---------------------------------------------------------------------------- +// functions prototypes +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxFindReplaceDialog, wxDialog) + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialogImpl: the internals of wxFindReplaceDialog +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFindReplaceDialogImpl +{ +public: + wxFindReplaceDialogImpl(wxFindReplaceDialog *dialog, int flagsWX); + ~wxFindReplaceDialogImpl(); + + void InitFindWhat(const wxString& str); + void InitReplaceWith(const wxString& str); + + void SubclassDialog(HWND hwnd); + + static UINT GetFindDialogMessage() { return ms_msgFindDialog; } + + // only for passing to ::FindText or ::ReplaceText + FINDREPLACE *GetPtrFindReplace() { return &m_findReplace; } + + // set/query the "closed by user" flag + void SetClosedByUser() { m_wasClosedByUser = TRUE; } + bool WasClosedByUser() const { return m_wasClosedByUser; } + +private: + void InitString(const wxString& str, LPTSTR *ppStr, WORD *pLen); + + // the owner of the dialog + HWND m_hwndOwner; + + // the previous window proc of our owner + WNDPROC m_oldParentWndProc; + + // the find replace data used by the dialog + FINDREPLACE m_findReplace; + + // TRUE if the user closed us, FALSE otherwise + bool m_wasClosedByUser; + + // registered Message for Dialog + static UINT ms_msgFindDialog; + + DECLARE_NO_COPY_CLASS(wxFindReplaceDialogImpl) +}; + +UINT wxFindReplaceDialogImpl::ms_msgFindDialog = 0; + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialogImpl +// ---------------------------------------------------------------------------- + +wxFindReplaceDialogImpl::wxFindReplaceDialogImpl(wxFindReplaceDialog *dialog, + int flagsWX) +{ +} + +void wxFindReplaceDialogImpl::InitString(const wxString& str, + LPTSTR *ppStr, WORD *pLen) +{ +} + +void wxFindReplaceDialogImpl::InitFindWhat(const wxString& str) +{ +} + +void wxFindReplaceDialogImpl::InitReplaceWith(const wxString& str) +{ +} + +void wxFindReplaceDialogImpl::SubclassDialog(HWND hwnd) +{ +} + +wxFindReplaceDialogImpl::~wxFindReplaceDialogImpl() +{ +} + +// ============================================================================ +// wxFindReplaceDialog implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog ctors/dtor +// ---------------------------------------------------------------------------- + +void wxFindReplaceDialog::Init() +{ +} + +wxFindReplaceDialog::wxFindReplaceDialog(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int flags) + : wxFindReplaceDialogBase(parent, data, title, flags) +{ +} + +wxFindReplaceDialog::~wxFindReplaceDialog() +{ +} + +bool wxFindReplaceDialog::Create(wxWindow *parent, + wxFindReplaceData *data, + const wxString &title, + int flags) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxFindReplaceData show/hide +// ---------------------------------------------------------------------------- + +bool wxFindReplaceDialog::Show(bool show) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog title handling +// ---------------------------------------------------------------------------- + +void wxFindReplaceDialog::SetTitle( const wxString& title) +{ +} + +wxString wxFindReplaceDialog::GetTitle() const +{ + return wxString; +} + +// ---------------------------------------------------------------------------- +// wxFindReplaceDialog position/size +// ---------------------------------------------------------------------------- + +void wxFindReplaceDialog::DoSetSize(int WXUNUSED(x), int WXUNUSED(y), + int WXUNUSED(width), int WXUNUSED(height), + int WXUNUSED(sizeFlags)) +{ + // ignore - we can't change the size of this standard dialog + return; +} + +// NB: of course, both of these functions are completely bogus, but it's better +// than nothing +void wxFindReplaceDialog::DoGetSize(int *width, int *height) const +{ +} + +void wxFindReplaceDialog::DoGetClientSize(int *width, int *height) const +{ +} + +#endif // wxUSE_FINDREPLDLG + diff --git a/src/palmos/filedlg.cpp b/src/palmos/filedlg.cpp new file mode 100644 index 0000000000..747b6377de --- /dev/null +++ b/src/palmos/filedlg.cpp @@ -0,0 +1,106 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/filedlg.cpp +// Purpose: wxFileDialog +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "filedlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_FILEDLG && !defined(__SMARTPHONE__) + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/msgdlg.h" + #include "wx/filedlg.h" + #include "wx/filefn.h" + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/app.h" +#endif + +#include "wx/palmos/private.h" + +#include +#include +#include + +#include "wx/filename.h" +#include "wx/tokenzr.h" + +#ifndef OFN_EXPLORER + #define OFN_EXPLORER 0x00080000 +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#define wxMAXPATH 1024 + +# define wxMAXFILE 1024 + +# define wxMAXEXT 5 + +// ============================================================================ +// implementation +// ============================================================================ + +IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) + +// ---------------------------------------------------------------------------- +// wxFileDialog +// ---------------------------------------------------------------------------- + +wxFileDialog::wxFileDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultDir, + const wxString& defaultFileName, + const wxString& wildCard, + long style, + const wxPoint& pos) + :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos) + +{ +} + +void wxFileDialog::GetPaths(wxArrayString& paths) const +{ +} + +void wxFileDialog::GetFilenames(wxArrayString& files) const +{ +} + +void wxFileDialog::SetPath(const wxString& path) +{ +} + +int wxFileDialog::ShowModal() +{ + return wxID_CANCEL; +} + +#endif // wxUSE_FILEDLG + diff --git a/src/palmos/font.cpp b/src/palmos/font.cpp new file mode 100644 index 0000000000..ad4f75ec74 --- /dev/null +++ b/src/palmos/font.cpp @@ -0,0 +1,535 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/font.cpp +// Purpose: wxFont class +// Author: William Osborne +// Modified by: +// Created: 10/14/04 +// RCS-ID: $Id: +// Copyright: (c) wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "font.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/setup.h" + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/font.h" + #include "wx/log.h" + #include "wx/encinfo.h" +#endif // WX_PRECOMP + +#include "wx/fontutil.h" +#include "wx/fontmap.h" + +#include "wx/tokenzr.h" + +#if wxUSE_EXTENDED_RTTI + +wxBEGIN_ENUM( wxFontFamily ) + wxENUM_MEMBER( wxDEFAULT ) + wxENUM_MEMBER( wxDECORATIVE ) + wxENUM_MEMBER( wxROMAN ) + wxENUM_MEMBER( wxSCRIPT ) + wxENUM_MEMBER( wxSWISS ) + wxENUM_MEMBER( wxMODERN ) + wxENUM_MEMBER( wxTELETYPE ) +wxEND_ENUM( wxFontFamily ) + +wxBEGIN_ENUM( wxFontStyle ) + wxENUM_MEMBER( wxNORMAL ) + wxENUM_MEMBER( wxITALIC ) + wxENUM_MEMBER( wxSLANT ) +wxEND_ENUM( wxFontStyle ) + +wxBEGIN_ENUM( wxFontWeight ) + wxENUM_MEMBER( wxNORMAL ) + wxENUM_MEMBER( wxLIGHT ) + wxENUM_MEMBER( wxBOLD ) +wxEND_ENUM( wxFontWeight ) + +IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject,"wx/font.h") + +wxBEGIN_PROPERTIES_TABLE(wxFont) + wxPROPERTY( Size,int, SetPointSize, GetPointSize, 12 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Family, int , SetFamily, GetFamily, (int)wxDEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontFamily + wxPROPERTY( Style, int , SetStyle, GetStyle, (int)wxNORMAL , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontStyle + wxPROPERTY( Weight, int , SetWeight, GetWeight, (int)wxNORMAL , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontWeight + wxPROPERTY( Underlined, bool , SetUnderlined, GetUnderlined, false , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Face, wxString , SetFaceName, GetFaceName, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Encoding, wxFontEncoding , SetEncoding, GetEncoding, wxFONTENCODING_DEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxCONSTRUCTOR_6( wxFont , int , Size , int , Family , int , Style , int , Weight , bool , Underlined , wxString , Face ) + +wxBEGIN_HANDLERS_TABLE(wxFont) +wxEND_HANDLERS_TABLE() + +#else + IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) +#endif + + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxFontRefData - the internal description of the font +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxFontRefData: public wxGDIRefData +{ +public: + // constructors + wxFontRefData() + { + Init(-1, wxSize(0, 0), FALSE, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL, FALSE, wxEmptyString, + wxFONTENCODING_DEFAULT); + } + + wxFontRefData(int size, + const wxSize& pixelSize, + bool sizeUsingPixels, + int family, + int style, + int weight, + bool underlined, + const wxString& faceName, + wxFontEncoding encoding) + { + Init(size, pixelSize, sizeUsingPixels, family, style, weight, + underlined, faceName, encoding); + } + + wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0) + { + Init(info, hFont); + } + + wxFontRefData(const wxFontRefData& data) + { + if ( data.m_nativeFontInfoOk ) + { + Init(data.m_nativeFontInfo); + } + else + { + Init(data.m_pointSize, data.m_pixelSize, data.m_sizeUsingPixels, + data.m_family, data.m_style, data.m_weight, + data.m_underlined, data.m_faceName, data.m_encoding); + } + } + + virtual ~wxFontRefData(); + + // operations + bool Alloc(wxFont *font); + + void Free(); + + // all wxFont accessors + int GetPointSize() const + { + return m_nativeFontInfoOk ? m_nativeFontInfo.GetPointSize() + : m_pointSize; + } + + wxSize GetPixelSize() const + { + return m_nativeFontInfoOk ? m_nativeFontInfo.GetPixelSize() + : m_pixelSize; + } + + bool IsUsingSizeInPixels() const + { + return m_nativeFontInfoOk ? true : m_sizeUsingPixels; + } + + int GetFamily() const + { + return m_family; + } + + int GetStyle() const + { + return m_nativeFontInfoOk ? m_nativeFontInfo.GetStyle() + : m_style; + } + + int GetWeight() const + { + return m_nativeFontInfoOk ? m_nativeFontInfo.GetWeight() + : m_weight; + } + + bool GetUnderlined() const + { + return m_nativeFontInfoOk ? m_nativeFontInfo.GetUnderlined() + : m_underlined; + } + + wxString GetFaceName() const + { + wxString s; + if ( m_nativeFontInfoOk ) + s = m_nativeFontInfo.GetFaceName(); + else + s = m_faceName; + + return s; + } + + wxFontEncoding GetEncoding() const + { + return m_nativeFontInfoOk ? m_nativeFontInfo.GetEncoding() + : m_encoding; + } + + WXHFONT GetHFONT() const { return m_hFont; } + + // ... and setters + void SetPointSize(int pointSize) + { + if ( m_nativeFontInfoOk ) + { + m_nativeFontInfo.SetPointSize(pointSize); + } + else + { + m_pointSize = pointSize; + m_sizeUsingPixels = FALSE; + } + } + + void SetPixelSize(const wxSize& pixelSize) + { + if ( m_nativeFontInfoOk ) + { + m_nativeFontInfo.SetPixelSize(pixelSize); + } + else + { + m_pixelSize = pixelSize; + m_sizeUsingPixels = TRUE; + } + } + + void SetFamily(int family) + { + m_family = family; + } + + void SetStyle(int style) + { + if ( m_nativeFontInfoOk ) + m_nativeFontInfo.SetStyle((wxFontStyle)style); + else + m_style = style; + } + + void SetWeight(int weight) + { + if ( m_nativeFontInfoOk ) + m_nativeFontInfo.SetWeight((wxFontWeight)weight); + else + m_weight = weight; + } + + void SetFaceName(const wxString& faceName) + { + if ( m_nativeFontInfoOk ) + m_nativeFontInfo.SetFaceName(faceName); + else + m_faceName = faceName; + } + + void SetUnderlined(bool underlined) + { + if ( m_nativeFontInfoOk ) + m_nativeFontInfo.SetUnderlined(underlined); + else + m_underlined = underlined; + } + + void SetEncoding(wxFontEncoding encoding) + { + if ( m_nativeFontInfoOk ) + m_nativeFontInfo.SetEncoding(encoding); + else + m_encoding = encoding; + } + + // native font info tests + bool HasNativeFontInfo() const { return m_nativeFontInfoOk; } + + const wxNativeFontInfo& GetNativeFontInfo() const + { return m_nativeFontInfo; } + +protected: + // common part of all ctors + void Init(int size, + const wxSize& pixelSize, + bool sizeUsingPixels, + int family, + int style, + int weight, + bool underlined, + const wxString& faceName, + wxFontEncoding encoding); + + void Init(const wxNativeFontInfo& info, WXHFONT hFont = 0); + + // font characterstics + int m_pointSize; + wxSize m_pixelSize; + bool m_sizeUsingPixels; + int m_family; + int m_style; + int m_weight; + bool m_underlined; + wxString m_faceName; + wxFontEncoding m_encoding; + + // Windows font handle + WXHFONT m_hFont; + + // Native font info + wxNativeFontInfo m_nativeFontInfo; + bool m_nativeFontInfoOk; +}; + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFontRefData +// ---------------------------------------------------------------------------- + +void wxFontRefData::Init(int pointSize, + const wxSize& pixelSize, + bool sizeUsingPixels, + int family, + int style, + int weight, + bool underlined, + const wxString& faceName, + wxFontEncoding encoding) +{ +} + +void wxFontRefData::Init(const wxNativeFontInfo& info, WXHFONT hFont) +{ +} + +wxFontRefData::~wxFontRefData() +{ +} + +bool wxFontRefData::Alloc(wxFont *font) +{ + return false; +} + +void wxFontRefData::Free() +{ +} + +// ---------------------------------------------------------------------------- +// wxNativeFontInfo +// ---------------------------------------------------------------------------- + +void wxNativeFontInfo::SetPixelSize(const wxSize& pixelSize) +{ +} + +// ---------------------------------------------------------------------------- +// wxFont +// ---------------------------------------------------------------------------- + +void wxFont::Init() +{ +} + +bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont) +{ + return false; +} + +wxFont::wxFont(const wxString& fontdesc) +{ +} + +/* Constructor for a font. Note that the real construction is done + * in wxDC::SetFont, when information is available about scaling etc. + */ +bool wxFont::DoCreate(int pointSize, + const wxSize& pixelSize, + bool sizeUsingPixels, + int family, + int style, + int weight, + bool underlined, + const wxString& faceName, + wxFontEncoding encoding) +{ + return false; +} + +wxFont::~wxFont() +{ +} + +// ---------------------------------------------------------------------------- +// real implementation +// ---------------------------------------------------------------------------- + +bool wxFont::RealizeResource() +{ + return false; +} + +bool wxFont::FreeResource(bool WXUNUSED(force)) +{ + return false; +} + +WXHANDLE wxFont::GetResourceHandle() const +{ + return (WXHANDLE)0; +} + +WXHFONT wxFont::GetHFONT() const +{ + return 0; +} + +bool wxFont::IsFree() const +{ + return false; +} + +void wxFont::Unshare() +{ +} + +// ---------------------------------------------------------------------------- +// change font attribute: we recreate font when doing it +// ---------------------------------------------------------------------------- + +void wxFont::SetPointSize(int pointSize) +{ +} + +void wxFont::SetPixelSize(const wxSize& pixelSize) +{ +} + +void wxFont::SetFamily(int family) +{ +} + +void wxFont::SetStyle(int style) +{ +} + +void wxFont::SetWeight(int weight) +{ +} + +void wxFont::SetFaceName(const wxString& faceName) +{ +} + +void wxFont::SetUnderlined(bool underlined) +{ +} + +void wxFont::SetEncoding(wxFontEncoding encoding) +{ +} + +void wxFont::DoSetNativeFontInfo(const wxNativeFontInfo& info) +{ +} + +// ---------------------------------------------------------------------------- +// accessors +// ---------------------------------------------------------------------------- + +int wxFont::GetPointSize() const +{ + return 0; +} + +wxSize wxFont::GetPixelSize() const +{ + return wxSize(0,0); +} + +bool wxFont::IsUsingSizeInPixels() const +{ + return false; +} + +int wxFont::GetFamily() const +{ + return wxFONTFAMILY_ROMAN; +} + +int wxFont::GetStyle() const +{ + return wxFONTSTYLE_NORMAL; +} + +int wxFont::GetWeight() const +{ + return wxFONTWEIGHT_NORMAL; +} + +bool wxFont::GetUnderlined() const +{ + return false; +} + +wxString wxFont::GetFaceName() const +{ + return wxEmptyString; +} + +wxFontEncoding wxFont::GetEncoding() const +{ + return wxFONTENCODING_SYSTEM; +} + +const wxNativeFontInfo *wxFont::GetNativeFontInfo() const +{ + return NULL; +} + +bool wxFont::IsFixedWidth() const +{ + return false; +} + diff --git a/src/palmos/fontdlg.cpp b/src/palmos/fontdlg.cpp new file mode 100644 index 0000000000..37f38b4a65 --- /dev/null +++ b/src/palmos/fontdlg.cpp @@ -0,0 +1,68 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/fontdlg.cpp +// Purpose: wxFontDialog class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "fontdlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_FONTDLG + +#ifndef WX_PRECOMP + #include "wx/defs.h" + #include "wx/utils.h" + #include "wx/dialog.h" +#endif + +#include "wx/fontdlg.h" +#include "wx/palmos/private.h" + +#include "wx/cmndata.h" +#include "wx/log.h" + +#include +#include +#include + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFontDialog +// ---------------------------------------------------------------------------- + +int wxFontDialog::ShowModal() +{ + return wxID_CANCEL; +} + +#endif // wxUSE_FONTDLG diff --git a/src/palmos/fontenum.cpp b/src/palmos/fontenum.cpp new file mode 100644 index 0000000000..c3480e843a --- /dev/null +++ b/src/palmos/fontenum.cpp @@ -0,0 +1,155 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/fontenum.cpp +// Purpose: wxFontEnumerator class for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "fontenum.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_FONTMAP + +#ifndef WX_PRECOMP + #include "wx/font.h" + #include "wx/encinfo.h" +#endif + +#include "wx/palmos/private.h" + +#include "wx/fontutil.h" +#include "wx/fontenum.h" +#include "wx/fontmap.h" + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// the helper class which calls ::EnumFontFamilies() and whose OnFont() is +// called from the callback passed to this function and, in its turn, calls the +// appropariate wxFontEnumerator method +class wxFontEnumeratorHelper +{ +public: + wxFontEnumeratorHelper(wxFontEnumerator *fontEnum); + + // control what exactly are we enumerating + // we enumerate fonts with given enocding + bool SetEncoding(wxFontEncoding encoding); + // we enumerate fixed-width fonts + void SetFixedOnly(bool fixedOnly) { m_fixedOnly = fixedOnly; } + // we enumerate the encodings available in this family + void SetFamily(const wxString& family); + + // call to start enumeration + void DoEnumerate(); + + // called by our font enumeration proc + bool OnFont(const LPLOGFONT lf, const LPTEXTMETRIC tm) const; + +private: + // the object we forward calls to OnFont() to + wxFontEnumerator *m_fontEnum; + + // if != -1, enum only fonts which have this encoding + int m_charset; + + // if not empty, enum only the fonts with this facename + wxString m_facename; + + // if not empty, enum only the fonts in this family + wxString m_family; + + // if TRUE, enum only fixed fonts + bool m_fixedOnly; + + // if TRUE, we enumerate the encodings, not fonts + bool m_enumEncodings; + + // the list of charsets we already found while enumerating charsets + wxArrayInt m_charsets; + + // the list of facenames we already found while enumerating facenames + wxArrayString m_facenames; + + DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper) +}; + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +#ifndef __WXMICROWIN__ +int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, + DWORD dwStyle, LONG lParam); +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxFontEnumeratorHelper +// ---------------------------------------------------------------------------- + +wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum) +{ +} + +void wxFontEnumeratorHelper::SetFamily(const wxString& family) +{ +} + +bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding) +{ + return FALSE; +} + +#define wxFONTENUMPROC FONTENUMPROC + +void wxFontEnumeratorHelper::DoEnumerate() +{ +} + +bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, + const LPTEXTMETRIC tm) const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxFontEnumerator +// ---------------------------------------------------------------------------- + +bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, + bool fixedWidthOnly) +{ + return false; +} + +bool wxFontEnumerator::EnumerateEncodings(const wxString& family) +{ + return false; +} + +#endif // wxUSE_FONTMAP diff --git a/src/palmos/fontutil.cpp b/src/palmos/fontutil.cpp new file mode 100644 index 0000000000..c7aa6c663d --- /dev/null +++ b/src/palmos/fontutil.cpp @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/fontutil.cpp +// Purpose: font-related helper functions +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "fontutil.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/log.h" + #include "wx/intl.h" + #include "wx/encinfo.h" +#endif //WX_PRECOMP + +#include "wx/fontutil.h" +#include "wx/fontmap.h" + +#include "wx/tokenzr.h" + +#ifndef HANGUL_CHARSET +# define HANGUL_CHARSET 129 +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxNativeEncodingInfo +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// helper functions +// ---------------------------------------------------------------------------- + +bool wxGetNativeFontEncoding(wxFontEncoding encoding, + wxNativeEncodingInfo *info) +{ + return false; +} + +bool wxTestFontEncoding(const wxNativeEncodingInfo& info) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxFontEncoding <-> CHARSET_XXX +// ---------------------------------------------------------------------------- + +wxFontEncoding wxGetFontEncFromCharSet(int cs) +{ + return wxFONTENCODING_SYSTEM; +} diff --git a/src/palmos/frame.cpp b/src/palmos/frame.cpp new file mode 100644 index 0000000000..494bfb23a2 --- /dev/null +++ b/src/palmos/frame.cpp @@ -0,0 +1,395 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/frame.cpp +// Purpose: wxFrame +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "frame.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/app.h" + #include "wx/menu.h" + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/settings.h" + #include "wx/dcclient.h" + #include "wx/mdi.h" + #include "wx/panel.h" +#endif // WX_PRECOMP + +#if wxUSE_STATUSBAR + #include "wx/statusbr.h" + #include "wx/generic/statusbr.h" +#endif // wxUSE_STATUSBAR + +#if wxUSE_TOOLBAR + #include "wx/toolbar.h" +#endif // wxUSE_TOOLBAR + +#include "wx/menuitem.h" +#include "wx/log.h" + +#ifdef __WXUNIVERSAL__ + #include "wx/univ/theme.h" + #include "wx/univ/colschem.h" +#endif // __WXUNIVERSAL__ + +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- + +#if wxUSE_MENUS_NATIVE + extern wxMenu *wxCurrentPopupMenu; +#endif // wxUSE_MENUS_NATIVE + +// ---------------------------------------------------------------------------- +// event tables +// ---------------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) + EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) + EVT_PAINT(wxFrame::OnPaint) +END_EVENT_TABLE() + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxFrameStyle ) + +wxBEGIN_FLAGS( wxFrameStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + // frame styles + wxFLAGS_MEMBER(wxSTAY_ON_TOP) + wxFLAGS_MEMBER(wxCAPTION) + wxFLAGS_MEMBER(wxTHICK_FRAME) + wxFLAGS_MEMBER(wxSYSTEM_MENU) + wxFLAGS_MEMBER(wxRESIZE_BORDER) + wxFLAGS_MEMBER(wxRESIZE_BOX) + wxFLAGS_MEMBER(wxCLOSE_BOX) + wxFLAGS_MEMBER(wxMAXIMIZE_BOX) + wxFLAGS_MEMBER(wxMINIMIZE_BOX) + + wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW) + wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT) + + wxFLAGS_MEMBER(wxFRAME_SHAPED) + +wxEND_FLAGS( wxFrameStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h") + +wxBEGIN_PROPERTIES_TABLE(wxFrame) + wxEVENT_PROPERTY( Menu , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent) + + wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + wxPROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxFrame) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// static class members +// ---------------------------------------------------------------------------- + +#if wxUSE_STATUSBAR + #if wxUSE_NATIVE_STATUSBAR + bool wxFrame::m_useNativeStatusBar = TRUE; + #else + bool wxFrame::m_useNativeStatusBar = FALSE; + #endif +#endif // wxUSE_NATIVE_STATUSBAR + +// ---------------------------------------------------------------------------- +// creation/destruction +// ---------------------------------------------------------------------------- + +void wxFrame::Init() +{ + StatusBar=NULL; +} + +bool wxFrame::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name, this) ) + return false; + + return true; +} + +wxFrame::~wxFrame() +{ +} + +// ---------------------------------------------------------------------------- +// wxFrame client size calculations +// ---------------------------------------------------------------------------- + +void wxFrame::DoSetClientSize(int width, int height) +{ +} + +// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc. +void wxFrame::DoGetClientSize(int *x, int *y) const +{ +} + +// ---------------------------------------------------------------------------- +// wxFrame: various geometry-related functions +// ---------------------------------------------------------------------------- + +void wxFrame::Raise() +{ +} + +// generate an artificial resize event +void wxFrame::SendSizeEvent() +{ +} + +#if wxUSE_STATUSBAR +wxStatusBar *wxFrame::OnCreateStatusBar(int number, + long style, + wxWindowID id, + const wxString& name) +{ + wxStatusBar *statusBar = NULL; + +#if wxUSE_NATIVE_STATUSBAR + if ( !UsesNativeStatusBar() ) + { + statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style); + } + else +#endif + { + statusBar = new wxStatusBar(this, id, style, name); + } + + statusBar->SetFieldsCount(number); + + StatusBar=statusBar; + return statusBar; + + return NULL; +} + +void wxFrame::PositionStatusBar() +{ +} +#endif // wxUSE_STATUSBAR + +#if wxUSE_MENUS_NATIVE + +void wxFrame::AttachMenuBar(wxMenuBar *menubar) +{ + wxFrameBase::AttachMenuBar(menubar); + + if ( !menubar ) + { + // actually remove the menu from the frame + m_hMenu = (WXHMENU)0; + } +} + +void wxFrame::InternalSetMenuBar() +{ +} + +bool wxFrame::HandleMenuOpen() +{ + if(!m_frameMenuBar) + return false; + + m_frameMenuBar->LoadMenu(); + return true; +} + +bool wxFrame::HandleMenuSelect(int ItemID) +{ + if (!m_frameMenuBar) + return false; + + int item=m_frameMenuBar->ProcessCommand(ItemID); + if(item==-1) + return false; + + wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item); + commandEvent.SetEventObject(this); + + GetEventHandler()->ProcessEvent(commandEvent); + return true; +} + +#endif // wxUSE_MENUS_NATIVE + +// Responds to colour changes, and passes event on to children. +void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) +{ +} + +void wxFrame::OnPaint(wxPaintEvent& event) +{ + #if wxUSE_STATUSBAR + if(StatusBar!=NULL) + StatusBar->DrawStatusBar(); + #endif +} + +// Pass TRUE to show full screen, FALSE to restore. +bool wxFrame::ShowFullScreen(bool show, long style) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// tool/status bar stuff +// ---------------------------------------------------------------------------- + +#if wxUSE_TOOLBAR + +wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) +{ + return NULL; +} + +void wxFrame::PositionToolBar() +{ +} + +#endif // wxUSE_TOOLBAR + +// ---------------------------------------------------------------------------- +// frame state (iconized/maximized/...) +// ---------------------------------------------------------------------------- + +// propagate our state change to all child frames: this allows us to emulate X +// Windows behaviour where child frames float independently of the parent one +// on the desktop, but are iconized/restored with it +void wxFrame::IconizeChildFrames(bool bIconize) +{ +} + +WXHICON wxFrame::GetDefaultIcon() const +{ + // we don't have any standard icons (any more) + return (WXHICON)0; +} + +// =========================================================================== +// message processing +// =========================================================================== + +// --------------------------------------------------------------------------- +// preprocessing +// --------------------------------------------------------------------------- + +bool wxFrame::MSWTranslateMessage(WXMSG* pMsg) +{ + return false; +} + +// --------------------------------------------------------------------------- +// our private (non virtual) message handlers +// --------------------------------------------------------------------------- + +bool wxFrame::HandlePaint() +{ + return false; +} + +bool wxFrame::HandleSize(int x, int y, WXUINT id) +{ + return false; +} + +bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) +{ + return false; +} + +// --------------------------------------------------------------------------- +// the window proc for wxFrame +// --------------------------------------------------------------------------- + +WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxFrame size management: we exclude the areas taken by menu/status/toolbars +// from the client area, so the client area is what's really available for the +// frame contents +// ---------------------------------------------------------------------------- + +// get the origin of the client area in the client coordinates +wxPoint wxFrame::GetClientAreaOrigin() const +{ + wxPoint pt; + return pt; +} diff --git a/src/palmos/gauge.cpp b/src/palmos/gauge.cpp new file mode 100644 index 0000000000..e8215b6847 --- /dev/null +++ b/src/palmos/gauge.cpp @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/gauge.cpp +// Purpose: wxGauge class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "gauge.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/defs.h" +#endif + +#if wxUSE_GAUGE + +#include "wx/gauge.h" +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +#ifndef PBS_SMOOTH + #define PBS_SMOOTH 0x01 +#endif + +#ifndef PBS_VERTICAL + #define PBS_VERTICAL 0x04 +#endif + +#ifndef PBM_SETBARCOLOR + #define PBM_SETBARCOLOR (WM_USER+9) +#endif + +#ifndef PBM_SETBKCOLOR + #define PBM_SETBKCOLOR 0x2001 +#endif + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxGaugeStyle ) + +wxBEGIN_FLAGS( wxGaugeStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxGA_HORIZONTAL) + wxFLAGS_MEMBER(wxGA_VERTICAL) + wxFLAGS_MEMBER(wxGA_PROGRESSBAR) + wxFLAGS_MEMBER(wxGA_SMOOTH) + +wxEND_FLAGS( wxGaugeStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxGauge, wxControl,"wx/gauge.h") + +wxBEGIN_PROPERTIES_TABLE(wxGauge) + wxPROPERTY( Value , int , SetValue, GetValue, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Range , int , SetRange, GetRange, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( ShadowWidth , int , SetShadowWidth, GetShadowWidth, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( BezelFace , int , SetBezelFace, GetBezelFace, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxGaugeStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxGauge) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxGauge , wxWindow* , Parent , wxWindowID , Id , int , Range , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) +#endif + +// ============================================================================ +// wxGauge implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxGauge creation +// ---------------------------------------------------------------------------- + +bool wxGauge::Create(wxWindow *parent, + wxWindowID id, + int range, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +WXDWORD wxGauge::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// wxGauge geometry +// ---------------------------------------------------------------------------- + +wxSize wxGauge::DoGetBestSize() const +{ + return wxSize(0,0); +} + +// ---------------------------------------------------------------------------- +// wxGauge setters +// ---------------------------------------------------------------------------- + +void wxGauge::SetRange(int r) +{ +} + +void wxGauge::SetValue(int pos) +{ +} + +bool wxGauge::SetForegroundColour(const wxColour& col) +{ + return false; +} + +bool wxGauge::SetBackgroundColour(const wxColour& col) +{ + return false; +} + +#endif // wxUSE_GAUGE + diff --git a/src/palmos/gdiimage.cpp b/src/palmos/gdiimage.cpp new file mode 100644 index 0000000000..ee9a0f062d --- /dev/null +++ b/src/palmos/gdiimage.cpp @@ -0,0 +1,119 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/gdiimage.cpp +// Purpose: wxGDIImage implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "gdiimage.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/log.h" +#endif // WX_PRECOMP + +#include "wx/app.h" + +#include "wx/bitmap.h" +#include "wx/palmos/gdiimage.h" + +#if wxUSE_WXDIB +#include "wx/palmos/dib.h" +#endif + +#include "wx/file.h" + +#include "wx/listimpl.cpp" +WX_DEFINE_LIST(wxGDIImageHandlerList); + +// ---------------------------------------------------------------------------- +// auxiliary functions +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +wxGDIImageHandlerList wxGDIImage::ms_handlers; + +// ---------------------------------------------------------------------------- +// wxGDIImage functions forwarded to wxGDIImageRefData +// ---------------------------------------------------------------------------- + +bool wxGDIImage::FreeResource(bool WXUNUSED(force)) +{ + return false; +} + +WXHANDLE wxGDIImage::GetResourceHandle() const +{ + return NULL; +} + +// ---------------------------------------------------------------------------- +// wxGDIImage handler stuff +// ---------------------------------------------------------------------------- + +void wxGDIImage::AddHandler(wxGDIImageHandler *handler) +{ +} + +void wxGDIImage::InsertHandler(wxGDIImageHandler *handler) +{ +} + +bool wxGDIImage::RemoveHandler(const wxString& name) +{ + return false; +} + +wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& name) +{ + return NULL; +} + +wxGDIImageHandler *wxGDIImage::FindHandler(const wxString& extension, + long type) +{ + return NULL; +} + +wxGDIImageHandler *wxGDIImage::FindHandler(long type) +{ + return NULL; +} + +void wxGDIImage::CleanUpHandlers() +{ +} + +void wxGDIImage::InitStandardHandlers() +{ +} + + diff --git a/src/palmos/gdiobj.cpp b/src/palmos/gdiobj.cpp new file mode 100644 index 0000000000..af61ae425e --- /dev/null +++ b/src/palmos/gdiobj.cpp @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: gdiobj.cpp +// Purpose: wxGDIObject class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "gdiobj.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include +#include "wx/setup.h" +#include "wx/list.h" +#include "wx/utils.h" +#include "wx/app.h" +#endif + +#include "wx/gdiobj.h" + +IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject) + +/* +void wxGDIObject::IncrementResourceUsage(void) +{ +}; + +void wxGDIObject::DecrementResourceUsage(void) +{ +}; + +*/ + diff --git a/src/palmos/glcanvas.cpp b/src/palmos/glcanvas.cpp new file mode 100644 index 0000000000..ac237257a8 --- /dev/null +++ b/src/palmos/glcanvas.cpp @@ -0,0 +1,279 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/glcanvas.cpp +// Purpose: wxGLCanvas, for using OpenGL with wxWidgets +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "glcanvas.h" +#endif + +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) +#pragma hdrstop +#endif + +#if wxUSE_GLCANVAS + +#ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/settings.h" + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/app.h" +#endif + +#include "wx/palmos/private.h" + +// DLL options compatibility check: +#include "wx/build.h" +WX_CHECK_BUILD_OPTIONS("wxGL") + +#include "wx/glcanvas.h" + +static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass"); +static const wxChar *wxGLCanvasClassNameNoRedraw = wxT("wxGLCanvasClassNR"); + +LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam); + +/* + * GLContext implementation + */ + +wxGLContext::wxGLContext(bool WXUNUSED(isRGB), wxGLCanvas *win, const wxPalette& WXUNUSED(palette)) +{ +} + +wxGLContext::wxGLContext( + bool WXUNUSED(isRGB), wxGLCanvas *win, + const wxPalette& WXUNUSED(palette), + const wxGLContext *other /* for sharing display lists */ + ) +{ +} + +wxGLContext::~wxGLContext() +{ +} + +void wxGLContext::SwapBuffers() +{ +} + +void wxGLContext::SetCurrent() +{ +} + +void wxGLContext::SetColour(const wxChar *colour) +{ +} + + +/* + * wxGLCanvas implementation + */ + +IMPLEMENT_CLASS(wxGLCanvas, wxWindow) + +BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow) + EVT_SIZE(wxGLCanvas::OnSize) + EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged) + EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette) +END_EVENT_TABLE() + +wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, long style, const wxString& name, + int *attribList, const wxPalette& palette) : wxWindow() +{ +} + +wxGLCanvas::wxGLCanvas( wxWindow *parent, + const wxGLContext *shared, wxWindowID id, + const wxPoint& pos, const wxSize& size, long style, const wxString& name, + int *attribList, const wxPalette& palette ) + : wxWindow() +{ +} + +// Not very useful for wxMSW, but this is to be wxGTK compliant + +wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id, + const wxPoint& pos, const wxSize& size, long style, const wxString& name, + int *attribList, const wxPalette& palette ): + wxWindow() +{ +} + +wxGLCanvas::~wxGLCanvas() +{ +} + +// Replaces wxWindow::Create functionality, since we need to use a different +// window class +bool wxGLCanvas::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList) +{ +} + +void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC) +{ +} + +void wxGLCanvas::SetupPalette(const wxPalette& palette) +{ +} + +wxPalette wxGLCanvas::CreateDefaultPalette() +{ + wxPalette palette; + + return palette; +} + +void wxGLCanvas::SwapBuffers() +{ +} + +void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) +{ +} + +void wxGLCanvas::SetCurrent() +{ +} + +void wxGLCanvas::SetColour(const wxChar *colour) +{ +} + +void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent& event) +{ +} + +void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent& event) +{ +} + +void glArrayElementEXT(GLint WXUNUSED(i)) +{ +} + +void glColorPointerEXT(GLint WXUNUSED(size), GLenum WXUNUSED(type), GLsizei WXUNUSED(stride), GLsizei WXUNUSED(count), const GLvoid *WXUNUSED(pointer)) +{ +} + +void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count) +{ +} + +void glEdgeFlagPointerEXT(GLsizei WXUNUSED(stride), GLsizei WXUNUSED(count), const GLboolean *WXUNUSED(pointer)) +{ +} + +void glGetPointervEXT(GLenum WXUNUSED(pname), GLvoid* *WXUNUSED(params)) +{ +} + +void glIndexPointerEXT(GLenum WXUNUSED(type), GLsizei WXUNUSED(stride), GLsizei WXUNUSED(count), const GLvoid *WXUNUSED(pointer)) +{ +} + +void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ +} + +void glTexCoordPointerEXT(GLint WXUNUSED(size), GLenum WXUNUSED(type), GLsizei WXUNUSED(stride), GLsizei WXUNUSED(count), const GLvoid *WXUNUSED(pointer)) +{ +} + +void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) +{ +} + +void glColorSubtableEXT(GLenum WXUNUSED(target), GLsizei WXUNUSED(start), GLsizei WXUNUSED(count), GLenum WXUNUSED(format), GLenum WXUNUSED(type), const GLvoid *WXUNUSED(table)) +{ +} + +void glColorTableEXT(GLenum WXUNUSED(target), GLenum WXUNUSED(internalformat), GLsizei WXUNUSED(width), GLenum WXUNUSED(format), GLenum WXUNUSED(type), const GLvoid *WXUNUSED(table)) +{ +} + +void glCopyColorTableEXT(GLenum WXUNUSED(target), GLenum WXUNUSED(internalformat), GLint WXUNUSED(x), GLint WXUNUSED(y), GLsizei WXUNUSED(width)) +{ +} + +void glGetColorTableEXT(GLenum WXUNUSED(target), GLenum WXUNUSED(format), GLenum WXUNUSED(type), GLvoid *WXUNUSED(table)) +{ +} + +void glGetColorTableParamaterfvEXT(GLenum WXUNUSED(target), GLenum WXUNUSED(pname), GLfloat *WXUNUSED(params)) +{ +} + +void glGetColorTavleParameterivEXT(GLenum WXUNUSED(target), GLenum WXUNUSED(pname), GLint *WXUNUSED(params)) +{ +} + +void glLockArraysSGI(GLint WXUNUSED(first), GLsizei WXUNUSED(count)) +{ +} + +void glUnlockArraysSGI() +{ +} + + +void glCullParameterdvSGI(GLenum WXUNUSED(pname), GLdouble* WXUNUSED(params)) +{ +} + +void glCullParameterfvSGI(GLenum WXUNUSED(pname), GLfloat* WXUNUSED(params)) +{ +} + +void glIndexFuncSGI(GLenum WXUNUSED(func), GLclampf WXUNUSED(ref)) +{ +} + +void glIndexMaterialSGI(GLenum WXUNUSED(face), GLenum WXUNUSED(mode)) +{ +} + +void glAddSwapHintRectWin(GLint WXUNUSED(x), GLint WXUNUSED(y), GLsizei WXUNUSED(width), GLsizei WXUNUSED(height)) +{ +} + + +//--------------------------------------------------------------------------- +// wxGLApp +//--------------------------------------------------------------------------- + +IMPLEMENT_CLASS(wxGLApp, wxApp) + +bool wxGLApp::InitGLVisual(int *attribList) +{ + return false; +} + +wxGLApp::~wxGLApp() +{ +} + +#endif + // wxUSE_GLCANVAS diff --git a/src/palmos/help.cpp b/src/palmos/help.cpp new file mode 100644 index 0000000000..b36d28d548 --- /dev/null +++ b/src/palmos/help.cpp @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: helpwin.cpp +// Purpose: Help system: WinHelp implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "helpwin.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/defs.h" +#endif + +#if wxUSE_HELP + +#include "wx/filefn.h" +#include "wx/msw/helpwin.h" + +#include + +#include "wx/palmos/private.h" + +#include + + +IMPLEMENT_DYNAMIC_CLASS(wxWinHelpController, wxHelpControllerBase) + +bool wxWinHelpController::Initialize(const wxString& filename) +{ + return false; +} + +bool wxWinHelpController::LoadFile(const wxString& file) +{ + return false; +} + +bool wxWinHelpController::DisplayContents(void) +{ + return false; +} + +bool wxWinHelpController::DisplaySection(int section) +{ + return false; +} + +bool wxWinHelpController::DisplayContextPopup(int contextId) +{ + return false; +} + +bool wxWinHelpController::DisplayBlock(long block) +{ + return false; +} + +bool wxWinHelpController::KeywordSearch(const wxString& k, + wxHelpSearchMode WXUNUSED(mode)) +{ + return false; +} + +bool wxWinHelpController::Quit(void) +{ + return false; +} + +wxString wxWinHelpController::GetValidFilename(const wxString& file) const +{ + wxString ret; + + return ret; +} + +#endif // wxUSE_HELP diff --git a/src/palmos/icon.cpp b/src/palmos/icon.cpp new file mode 100644 index 0000000000..78367b5875 --- /dev/null +++ b/src/palmos/icon.cpp @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/icon.cpp +// Purpose: wxIcon class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "icon.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/defs.h" + #include "wx/list.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/icon.h" + #include "wx/bitmap.h" + #include "wx/log.h" +#endif + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxIconRefData +// ---------------------------------------------------------------------------- + +void wxIconRefData::Free() +{ +} + +// ---------------------------------------------------------------------------- +// wxIcon +// ---------------------------------------------------------------------------- + +wxIcon::wxIcon(const char bits[], int width, int height) +{ +} + +wxIcon::wxIcon(const wxString& iconfile, + long flags, + int desiredWidth, + int desiredHeight) + +{ +} + +wxIcon::wxIcon(const wxIconLocation& loc) +{ +} + +wxIcon::~wxIcon() +{ +} + +void wxIcon::CopyFromBitmap(const wxBitmap& bmp) +{ +} + +void wxIcon::CreateIconFromXpm(const char **data) +{ +} + +bool wxIcon::LoadFile(const wxString& filename, + long type, + int desiredWidth, int desiredHeight) +{ + return false; +} + diff --git a/src/palmos/imaglist.cpp b/src/palmos/imaglist.cpp new file mode 100644 index 0000000000..44bf917c79 --- /dev/null +++ b/src/palmos/imaglist.cpp @@ -0,0 +1,142 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/imaglist.cpp +// Purpose: wxImageList implementation for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "imaglist.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/icon.h" + #include "wx/dc.h" + #include "wx/string.h" + #include "wx/dcmemory.h" +#endif + +#include "wx/log.h" +#include "wx/intl.h" + +#include "wx/palmos/imaglist.h" +#include "wx/palmos/private.h" + + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxImageList, wxObject) + +#define GetHImageList() ((HIMAGELIST)m_hImageList) + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxImageList creation/destruction +// ---------------------------------------------------------------------------- + +wxImageList::wxImageList() +{ +} + +// Creates an image list +bool wxImageList::Create(int width, int height, bool mask, int initial) +{ + return false; +} + +wxImageList::~wxImageList() +{ +} + +// ---------------------------------------------------------------------------- +// wxImageList attributes +// ---------------------------------------------------------------------------- + +int wxImageList::GetImageCount() const +{ + return 0; +} + +bool wxImageList::GetSize(int WXUNUSED(index), int &width, int &height) const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxImageList operations +// ---------------------------------------------------------------------------- + +int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) + + return 0; +} + +int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour) +{ + return 0; +} + +int wxImageList::Add(const wxIcon& icon) +{ + return 0; +} + +bool wxImageList::Replace(int index, + const wxBitmap& bitmap, const wxBitmap& mask) +{ + return false; +} + +bool wxImageList::Replace(int i, const wxIcon& icon) +{ + return false; +} + +bool wxImageList::Remove(int index) +{ + return false; +} + +bool wxImageList::RemoveAll() +{ + return false; +} + +bool wxImageList::Draw(int index, + wxDC& dc, + int x, int y, + int flags, + bool solidBackground) +{ + return false; +} + diff --git a/src/palmos/iniconf.cpp b/src/palmos/iniconf.cpp new file mode 100644 index 0000000000..369b7e631a --- /dev/null +++ b/src/palmos/iniconf.cpp @@ -0,0 +1,220 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/iniconf.cpp +// Purpose: implementation of wxIniConfig class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "iniconf.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/intl.h" + #include "wx/event.h" + #include "wx/app.h" + #include "wx/utils.h" +#endif //WX_PRECOMP + +// Doesn't yet compile in Unicode mode + +#if wxUSE_CONFIG && !wxUSE_UNICODE + +#include "wx/dynarray.h" +#include "wx/log.h" +#include "wx/config.h" +#include "wx/file.h" + +#include "wx/palmos/iniconf.h" + +#include "wx/palmos/wrapwin.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// we replace all path separators with this character +#define PATH_SEP_REPLACE '_' + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// ctor & dtor +// ---------------------------------------------------------------------------- + +wxIniConfig::wxIniConfig(const wxString& strAppName, + const wxString& strVendor, + const wxString& localFilename, + const wxString& globalFilename, + long style) + : wxConfigBase(strAppName, strVendor, localFilename, globalFilename, style) +{ +} + +wxIniConfig::~wxIniConfig() +{ +} + +// ---------------------------------------------------------------------------- +// path management +// ---------------------------------------------------------------------------- + +void wxIniConfig::SetPath(const wxString& strPath) +{ +} + +const wxString& wxIniConfig::GetPath() const +{ + static wxString s_str; + + return s_str; +} + +wxString wxIniConfig::GetPrivateKeyName(const wxString& szKey) const +{ + wxString strKey; + + return strKey; +} + +wxString wxIniConfig::GetKeyName(const wxString& szKey) const +{ + wxString strKey; + + return strKey; +} + +// ---------------------------------------------------------------------------- +// enumeration +// ---------------------------------------------------------------------------- + +bool wxIniConfig::GetFirstGroup(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const +{ + return FALSE; +} + +bool wxIniConfig::GetNextGroup (wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const +{ + return FALSE; +} + +bool wxIniConfig::GetFirstEntry(wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const +{ + return FALSE; +} + +bool wxIniConfig::GetNextEntry (wxString& WXUNUSED(str), long& WXUNUSED(lIndex)) const +{ + return FALSE; +} + +// ---------------------------------------------------------------------------- +// misc info +// ---------------------------------------------------------------------------- + +size_t wxIniConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const +{ + return (size_t)-1; +} + +size_t wxIniConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const +{ + return (size_t)-1; +} + +bool wxIniConfig::HasGroup(const wxString& WXUNUSED(strName)) const +{ + return FALSE; +} + +bool wxIniConfig::HasEntry(const wxString& WXUNUSED(strName)) const +{ + return FALSE; +} + +// is current group empty? +bool wxIniConfig::IsEmpty() const +{ + return TRUE; +} + +// ---------------------------------------------------------------------------- +// read/write +// ---------------------------------------------------------------------------- + +bool wxIniConfig::DoReadString(const wxString& szKey, wxString *pstr) const +{ + return FALSE; +} + +bool wxIniConfig::DoReadLong(const wxString& szKey, long *pl) const +{ + return FALSE ; +} + +bool wxIniConfig::DoWriteString(const wxString& szKey, const wxString& szValue) +{ + return FALSE; +} + +bool wxIniConfig::DoWriteLong(const wxString& szKey, long lValue) +{ + return FALSE; +} + +bool wxIniConfig::Flush(bool /* bCurrentOnly */) +{ + return FALSE; +} + +// ---------------------------------------------------------------------------- +// delete +// ---------------------------------------------------------------------------- + +bool wxIniConfig::DeleteEntry(const wxString& szKey, bool bGroupIfEmptyAlso) +{ + return FALSE; +} + +bool wxIniConfig::DeleteGroup(const wxString& szKey) +{ + return FALSE; +} + +#ifndef MAX_PATH +#define MAX_PATH 256 +#endif + +bool wxIniConfig::DeleteAll() +{ + return FALSE; +} + +bool wxIniConfig::RenameEntry(const wxString& WXUNUSED(oldName), + const wxString& WXUNUSED(newName)) +{ + return FALSE; +} + +bool wxIniConfig::RenameGroup(const wxString& WXUNUSED(oldName), + const wxString& WXUNUSED(newName)) +{ + return FALSE; +} + +#endif + // wxUSE_CONFIG && wxUSE_UNICODE diff --git a/src/palmos/joystick.cpp b/src/palmos/joystick.cpp new file mode 100644 index 0000000000..ac874f113d --- /dev/null +++ b/src/palmos/joystick.cpp @@ -0,0 +1,257 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: joystick.cpp +// Purpose: wxJoystick class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "joystick.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "wx/string.h" +#include "wx/window.h" + +#if !defined(__WIN32__) && !defined(_MMRESULT_) +typedef UINT MMRESULT; +#endif + +#include "wx/window.h" +#include "wx/palmos/joystick.h" + +IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) + +// Attributes +//////////////////////////////////////////////////////////////////////////// + +wxJoystick::wxJoystick(int joystick) +{ +}; + +wxPoint wxJoystick::GetPosition() const +{ + return wxPoint(0, 0); +} + +int wxJoystick::GetZPosition() const +{ + return 0; +} + +int wxJoystick::GetButtonState() const +{ + return 0; +} + +int wxJoystick::GetPOVPosition() const +{ + return -1; +} + +int wxJoystick::GetPOVCTSPosition() const +{ + return -1; +} + +int wxJoystick::GetRudderPosition() const +{ + return 0; +} + +int wxJoystick::GetUPosition() const +{ + return 0; +} + +int wxJoystick::GetVPosition() const +{ + return 0; +} + +int wxJoystick::GetMovementThreshold() const +{ + return 0; +} + +void wxJoystick::SetMovementThreshold(int threshold) +{ +} + +// Capabilities +//////////////////////////////////////////////////////////////////////////// + +int wxJoystick::GetNumberJoysticks() +{ + return 0; +} + +bool wxJoystick::IsOk() const +{ + return false; +} + +int wxJoystick::GetManufacturerId() const +{ + return 0; +} + +int wxJoystick::GetProductId() const +{ + return 0; +} + +wxString wxJoystick::GetProductName() const +{ + return wxString(""); +} + +int wxJoystick::GetXMin() const +{ + return 0; +} + +int wxJoystick::GetYMin() const +{ + return 0; +} + +int wxJoystick::GetZMin() const +{ + return 0; +} + +int wxJoystick::GetXMax() const +{ + return 0; +} + +int wxJoystick::GetYMax() const +{ + return 0; +} + +int wxJoystick::GetZMax() const +{ + return 0; +} + +int wxJoystick::GetNumberButtons() const +{ + return 0; +} + +int wxJoystick::GetNumberAxes() const +{ + return 0; +} + +int wxJoystick::GetMaxButtons() const +{ + return 0; +} + +int wxJoystick::GetMaxAxes() const +{ + return 0; +} + +int wxJoystick::GetPollingMin() const +{ + return 0; +} + +int wxJoystick::GetPollingMax() const +{ + return 0; +} + +int wxJoystick::GetRudderMin() const +{ + return 0; +} + +int wxJoystick::GetRudderMax() const +{ + return 0; +} + +int wxJoystick::GetUMin() const +{ + return 0; +} + +int wxJoystick::GetUMax() const +{ + return 0; +} + +int wxJoystick::GetVMin() const +{ + return 0; +} + +int wxJoystick::GetVMax() const +{ + return 0; +} + + +bool wxJoystick::HasRudder() const +{ + return false; +} + +bool wxJoystick::HasZ() const +{ + return false; +} + +bool wxJoystick::HasU() const +{ + return false; +} + +bool wxJoystick::HasV() const +{ + return false; +} + +bool wxJoystick::HasPOV() const +{ + return false; +} + +bool wxJoystick::HasPOV4Dir() const +{ + return false; +} + +bool wxJoystick::HasPOVCTS() const +{ + return false; +} + +// Operations +//////////////////////////////////////////////////////////////////////////// + +bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq) +{ + return false; +} + +bool wxJoystick::ReleaseCapture() +{ + return false; +} + diff --git a/src/palmos/listbox.cpp b/src/palmos/listbox.cpp new file mode 100644 index 0000000000..b29d2cc89c --- /dev/null +++ b/src/palmos/listbox.cpp @@ -0,0 +1,324 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/listbox.cpp +// Purpose: wxListBox +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "listbox.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_LISTBOX + +#ifndef WX_PRECOMP +#include "wx/listbox.h" +#include "wx/settings.h" +#include "wx/brush.h" +#include "wx/font.h" +#include "wx/dc.h" +#include "wx/utils.h" +#endif + +#include "wx/window.h" +#include "wx/palmos/private.h" + +#include "wx/dynarray.h" +#include "wx/log.h" + +#if wxUSE_OWNER_DRAWN + #include "wx/ownerdrw.h" +#endif + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxListBoxStyle ) + +wxBEGIN_FLAGS( wxListBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxLB_SINGLE) + wxFLAGS_MEMBER(wxLB_MULTIPLE) + wxFLAGS_MEMBER(wxLB_EXTENDED) + wxFLAGS_MEMBER(wxLB_HSCROLL) + wxFLAGS_MEMBER(wxLB_ALWAYS_SB) + wxFLAGS_MEMBER(wxLB_NEEDED_SB) + wxFLAGS_MEMBER(wxLB_SORT) + +wxEND_FLAGS( wxListBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl,"wx/listbox.h") + +wxBEGIN_PROPERTIES_TABLE(wxListBox) + wxEVENT_PROPERTY( Select , wxEVT_COMMAND_LISTBOX_SELECTED , wxCommandEvent ) + wxEVENT_PROPERTY( DoubleClick , wxEVT_COMMAND_LISTBOX_DOUBLECLICKED , wxCommandEvent ) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY_FLAGS( WindowStyle , wxListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxListBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_4( wxListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) +#endif + +// ============================================================================ +// list box item declaration and implementation +// ============================================================================ + +#if wxUSE_OWNER_DRAWN + +class wxListBoxItem : public wxOwnerDrawn +{ +public: + wxListBoxItem(const wxString& str = wxEmptyString); +}; + +wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE) +{ + // no bitmaps/checkmarks + SetMarginWidth(0); +} + +wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n)) +{ + return new wxListBoxItem(); +} + +#endif //USE_OWNER_DRAWN + +// ============================================================================ +// list box control implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// creation +// ---------------------------------------------------------------------------- + +// Listbox item +wxListBox::wxListBox() +{ +} + +bool wxListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + int n, const wxString choices[], + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +bool wxListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +wxListBox::~wxListBox() +{ +} + +WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// implementation of wxListBoxBase methods +// ---------------------------------------------------------------------------- + +void wxListBox::DoSetFirstItem(int N) +{ +} + +void wxListBox::Delete(int N) +{ +} + +int wxListBox::DoAppend(const wxString& item) +{ + return 0; +} + +void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData) +{ +} + +int wxListBox::FindString(const wxString& s) const +{ + return wxNOT_FOUND; +} + +void wxListBox::Clear() +{ +} + +void wxListBox::Free() +{ +} + +void wxListBox::SetSelection(int N, bool select) +{ +} + +bool wxListBox::IsSelected(int N) const +{ + return false; +} + +wxClientData* wxListBox::DoGetItemClientObject(int n) const +{ + return (wxClientData *)DoGetItemClientData(n); +} + +void *wxListBox::DoGetItemClientData(int n) const +{ + return (void *)NULL; +} + +void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData) +{ +} + +void wxListBox::DoSetItemClientData(int n, void *clientData) +{ +} + +// Return number of selections and an array of selected integers +int wxListBox::GetSelections(wxArrayInt& aSelections) const +{ + return 0; +} + +// Get single selection, for single choice list items +int wxListBox::GetSelection() const +{ + return 0; +} + +// Find string for position +wxString wxListBox::GetString(int N) const +{ + wxString result; + + return result; +} + +void +wxListBox::DoInsertItems(const wxArrayString& items, int pos) +{ +} + +void wxListBox::SetString(int N, const wxString& s) +{ +} + +int wxListBox::GetCount() const +{ + return m_noItems; +} + +// ---------------------------------------------------------------------------- +// helpers +// ---------------------------------------------------------------------------- + +void wxListBox::SetHorizontalExtent(const wxString& s) +{ +} + +wxSize wxListBox::DoGetBestSize() const +{ + return wxSize(0,0); +} + +// ---------------------------------------------------------------------------- +// callbacks +// ---------------------------------------------------------------------------- + +bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxCheckListBox support +// ---------------------------------------------------------------------------- + +#if wxUSE_OWNER_DRAWN + +// drawing +// ------- + +// space beneath/above each row in pixels +// "standard" checklistbox use 1 here, some might prefer 2. 0 is ugly. +#define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1) + +// the height is the same for all items +// TODO should be changed for LBS_OWNERDRAWVARIABLE style listboxes + +// NB: can't forward this to wxListBoxItem because LB_SETITEMDATA +// message is not yet sent when we get here! +bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) +{ + return true; +} + +// forward the message to the appropriate item +bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) +{ + return true; +} + +#endif // wxUSE_OWNER_DRAWN + +#endif // wxUSE_LISTBOX diff --git a/src/palmos/listctrl.cpp b/src/palmos/listctrl.cpp new file mode 100644 index 0000000000..ba7bb430fa --- /dev/null +++ b/src/palmos/listctrl.cpp @@ -0,0 +1,741 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/listctrl.cpp +// Purpose: wxListCtrl +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "listctrl.h" + #pragma implementation "listctrlbase.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_LISTCTRL && defined(__WIN95__) + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/settings.h" +#endif + +#include "wx/textctrl.h" +#include "wx/imaglist.h" +#include "wx/listctrl.h" +#include "wx/dcclient.h" + +#include "wx/palmos/private.h" + +#include "wx/palmos/wrapcctl.h" + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// private helper classes +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// events +// ---------------------------------------------------------------------------- + +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_DRAG) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_RDRAG) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_END_LABEL_EDIT) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ITEM) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_GET_INFO) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_SET_INFO) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_SELECTED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_DESELECTED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_KEY_DOWN) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_INSERT_ITEM) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_CLICK) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_DRAGGING) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_COL_END_DRAG) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_ACTIVATED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_ITEM_FOCUSED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_LIST_CACHE_HINT) + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxListCtrlStyle ) + +wxBEGIN_FLAGS( wxListCtrlStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxLC_LIST) + wxFLAGS_MEMBER(wxLC_REPORT) + wxFLAGS_MEMBER(wxLC_ICON) + wxFLAGS_MEMBER(wxLC_SMALL_ICON) + wxFLAGS_MEMBER(wxLC_ALIGN_TOP) + wxFLAGS_MEMBER(wxLC_ALIGN_LEFT) + wxFLAGS_MEMBER(wxLC_AUTOARRANGE) + wxFLAGS_MEMBER(wxLC_USER_TEXT) + wxFLAGS_MEMBER(wxLC_EDIT_LABELS) + wxFLAGS_MEMBER(wxLC_NO_HEADER) + wxFLAGS_MEMBER(wxLC_SINGLE_SEL) + wxFLAGS_MEMBER(wxLC_SORT_ASCENDING) + wxFLAGS_MEMBER(wxLC_SORT_DESCENDING) + wxFLAGS_MEMBER(wxLC_VIRTUAL) + +wxEND_FLAGS( wxListCtrlStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxControl,"wx/listctrl.h") + +wxBEGIN_PROPERTIES_TABLE(wxListCtrl) + wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent ) + + wxPROPERTY_FLAGS( WindowStyle , wxListCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxListCtrl) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxListCtrl , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) + +/* + TODO : Expose more information of a list's layout etc. via appropriate objects (à la NotebookPageInfo) +*/ +#else +IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl) +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl) +IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) + +IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent) + +BEGIN_EVENT_TABLE(wxListCtrl, wxControl) + EVT_PAINT(wxListCtrl::OnPaint) +END_EVENT_TABLE() + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxListCtrl construction +// ---------------------------------------------------------------------------- + +void wxListCtrl::Init() +{ +} + +bool wxListCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +void wxListCtrl::UpdateStyle() +{ +} + +void wxListCtrl::FreeAllInternalData() +{ +} + +wxListCtrl::~wxListCtrl() +{ +} + +// ---------------------------------------------------------------------------- +// set/get/change style +// ---------------------------------------------------------------------------- + +// Add or remove a single window style +void wxListCtrl::SetSingleStyle(long style, bool add) +{ +} + +// Set the whole window style +void wxListCtrl::SetWindowStyleFlag(long flag) +{ +} + +// ---------------------------------------------------------------------------- +// accessors +// ---------------------------------------------------------------------------- + +/* static */ wxVisualAttributes +wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant) +{ + wxVisualAttributes attrs; + + return attrs; +} + +// Sets the foreground, i.e. text, colour +bool wxListCtrl::SetForegroundColour(const wxColour& col) +{ + return false; +} + +// Sets the background colour +bool wxListCtrl::SetBackgroundColour(const wxColour& col) +{ + return false; +} + +// Gets information about this column +bool wxListCtrl::GetColumn(int col, wxListItem& item) const +{ + return false; +} + +// Sets information about this column +bool wxListCtrl::SetColumn(int col, wxListItem& item) +{ + return false; +} + +// Gets the column width +int wxListCtrl::GetColumnWidth(int col) const +{ + return 0; +} + +// Sets the column width +bool wxListCtrl::SetColumnWidth(int col, int width) +{ + return false; +} + +// 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 wxListCtrl::GetCountPerPage() const +{ + return 0; +} + +// Gets the edit control for editing labels. +wxTextCtrl* wxListCtrl::GetEditControl() const +{ + return NULL; +} + +// Gets information about the item +bool wxListCtrl::GetItem(wxListItem& info) const +{ + return false; +} + +// Sets information about the item +bool wxListCtrl::SetItem(wxListItem& info) +{ + return false; +} + +long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId) +{ + return 0; +} + + +// Gets the item state +int wxListCtrl::GetItemState(long item, long stateMask) const +{ + return 0; +} + +// Sets the item state +bool wxListCtrl::SetItemState(long item, long state, long stateMask) +{ + return false; +} + +// Sets the item image +bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage)) +{ + return false; +} + +// Gets the item text +wxString wxListCtrl::GetItemText(long item) const +{ + wxListItem info; + + return info.m_text; +} + +// Sets the item text +void wxListCtrl::SetItemText(long item, const wxString& str) +{ +} + +// Gets the item data +long wxListCtrl::GetItemData(long item) const +{ + return 0; +} + +// Sets the item data +bool wxListCtrl::SetItemData(long item, long data) +{ + return false; +} + +wxRect wxListCtrl::GetViewRect() const +{ + wxRect rect; + + return rect; +} + +// Gets the item rectangle +bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const +{ + return false; +} + +// Gets the item position +bool wxListCtrl::GetItemPosition(long item, wxPoint& pos) const +{ + return false; +} + +// Sets the item position. +bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos) +{ + return false; +} + +// Gets the number of items in the list control +int wxListCtrl::GetItemCount() const +{ + return 0; +} + +wxSize wxListCtrl::GetItemSpacing() const +{ + return wxSize(0,0); +} + +int wxListCtrl::GetItemSpacing(bool isSmall) const +{ + return 0; +} + +void wxListCtrl::SetItemTextColour( long item, const wxColour &col ) +{ +} + +wxColour wxListCtrl::GetItemTextColour( long item ) const +{ + wxColour col; + + return col; +} + +void wxListCtrl::SetItemBackgroundColour( long item, const wxColour &col ) +{ +} + +wxColour wxListCtrl::GetItemBackgroundColour( long item ) const +{ + wxColour col; + + return col; +} + +// Gets the number of selected items in the list control +int wxListCtrl::GetSelectedItemCount() const +{ + return 0; +} + +// Gets the text colour of the listview +wxColour wxListCtrl::GetTextColour() const +{ + wxColour col; + return col; +} + +// Sets the text colour of the listview +void wxListCtrl::SetTextColour(const wxColour& col) +{ +} + +// Gets the index of the topmost visible item when in +// list or report view +long wxListCtrl::GetTopItem() const +{ + return 0; +} + +// Searches for an item, starting from 'item'. +// 'geometry' is one of +// wxLIST_NEXT_ABOVE/ALL/BELOW/LEFT/RIGHT. +// 'state' is a state bit flag, one or more of +// wxLIST_STATE_DROPHILITED/FOCUSED/SELECTED/CUT. +// item can be -1 to find the first item that matches the +// specified flags. +// Returns the item or -1 if unsuccessful. +long wxListCtrl::GetNextItem(long item, int geom, int state) const +{ + return 0; +} + + +wxImageList *wxListCtrl::GetImageList(int which) const +{ + return NULL; +} + +void wxListCtrl::SetImageList(wxImageList *imageList, int which) +{ +} + +void wxListCtrl::AssignImageList(wxImageList *imageList, int which) +{ +} + +// ---------------------------------------------------------------------------- +// Operations +// ---------------------------------------------------------------------------- + +// Arranges the items +bool wxListCtrl::Arrange(int flag) +{ + return false; +} + +// Deletes an item +bool wxListCtrl::DeleteItem(long item) +{ + return false; +} + +// Deletes all items +bool wxListCtrl::DeleteAllItems() +{ + return false; +} + +// Deletes all items +bool wxListCtrl::DeleteAllColumns() +{ + return false; +} + +// Deletes a column +bool wxListCtrl::DeleteColumn(int col) +{ + return false; +} + +// Clears items, and columns if there are any. +void wxListCtrl::ClearAll() +{ +} + +wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass) +{ + return NULL; +} + +// End label editing, optionally cancelling the edit +bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel)) +{ + return FALSE; +} + +// Ensures this item is visible +bool wxListCtrl::EnsureVisible(long item) +{ + return false; +} + +// Find an item whose label matches this string, starting from the item after 'start' +// or the beginning if 'start' is -1. +long wxListCtrl::FindItem(long start, const wxString& str, bool partial) +{ + return 0; +} + +// Find an item whose data matches this data, starting from the item after 'start' +// or the beginning if 'start' is -1. +// NOTE : Lindsay Mathieson - 14-July-2002 +// No longer use ListView_FindItem as the data attribute is now stored +// in a wxListItemInternalData structure refernced by the actual lParam +long wxListCtrl::FindItem(long start, long data) +{ + return -1; +} + +// Find an item nearest this position in the specified direction, starting from +// the item after 'start' or the beginning if 'start' is -1. +long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction) +{ + return -1; +} + +// Determines which item (if any) is at the specified point, +// giving details in 'flags' (see wxLIST_HITTEST_... flags above) +long wxListCtrl::HitTest(const wxPoint& point, int& flags) +{ + return 0; +} + +// Inserts an item, returning the index of the new item if successful, +// -1 otherwise. +long wxListCtrl::InsertItem(wxListItem& info) +{ + return 0; +} + +long wxListCtrl::InsertItem(long index, const wxString& label) +{ + return 0; +} + +// Inserts an image item +long wxListCtrl::InsertItem(long index, int imageIndex) +{ + return 0; +} + +// Inserts an image/string item +long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) +{ + return 0; +} + +// For list view mode (only), inserts a column. +long wxListCtrl::InsertColumn(long col, wxListItem& item) +{ + return 0; +} + +long wxListCtrl::InsertColumn(long col, + const wxString& heading, + int format, + int width) +{ + return 0; +} + +// scroll the control by the given number of pixels (exception: in list view, +// dx is interpreted as number of columns) +bool wxListCtrl::ScrollList(int dx, int dy) +{ + return FALSE; +} + +// 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. + +// Internal structures for proxying the user compare function +// so that we can pass it the *real* user data + +// translate lParam data and call user func +struct wxInternalDataSort +{ + wxListCtrlCompare user_fn; + long data; +}; + +int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) +{ + struct wxInternalDataSort *internalData = (struct wxInternalDataSort *) lParamSort; + + wxListItemInternalData *data1 = (wxListItemInternalData *) lParam1; + wxListItemInternalData *data2 = (wxListItemInternalData *) lParam2; + + long d1 = (data1 == NULL ? 0 : data1->lParam); + long d2 = (data2 == NULL ? 0 : data2->lParam); + + return internalData->user_fn(d1, d2, internalData->data); + +}; + +bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data) +{ + return FALSE; +} + + + +// ---------------------------------------------------------------------------- +// message processing +// ---------------------------------------------------------------------------- + +bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id) +{ + return false; +} + +bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) +{ + return false; +} + +// see comment at the end of wxListCtrl::GetColumn() +#ifdef NM_CUSTOMDRAW // _WIN32_IE >= 0x0300 + +WXLPARAM wxListCtrl::OnCustomDraw(WXLPARAM lParam) +{ + return CDRF_DODEFAULT; +} + +#endif // NM_CUSTOMDRAW supported + +// Necessary for drawing hrules and vrules, if specified +void wxListCtrl::OnPaint(wxPaintEvent& event) +{ +} + +// ---------------------------------------------------------------------------- +// virtual list controls +// ---------------------------------------------------------------------------- + +wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const +{ + return wxEmptyString; +} + +int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const +{ + return -1; +} + +wxListItemAttr *wxListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const +{ + // no attributes by default + return NULL; +} + +void wxListCtrl::SetItemCount(long count) +{ +} + +void wxListCtrl::RefreshItem(long item) +{ +} + +void wxListCtrl::RefreshItems(long itemFrom, long itemTo) +{ +} + +// ---------------------------------------------------------------------------- +// internal data stuff +// ---------------------------------------------------------------------------- + +static wxListItemInternalData *wxGetInternalData(HWND hwnd, long itemId) +{ + return NULL; +}; + +static +wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId) +{ + return wxGetInternalData(GetHwndOf(ctl), itemId); +}; + +static wxListItemAttr *wxGetInternalDataAttr(wxListCtrl *ctl, long itemId) +{ + return NULL; +}; + +static void wxDeleteInternalData(wxListCtrl* ctl, long itemId) +{ +} + +// ---------------------------------------------------------------------------- +// wxWin <-> MSW items conversions +// ---------------------------------------------------------------------------- + +static void wxConvertFromMSWListItem(HWND hwndListCtrl, + wxListItem& info, + LV_ITEM& lvItem) +{ +} + +static void wxConvertToMSWFlags(long state, long stateMask, LV_ITEM& lvItem) +{ +} + +static void wxConvertToMSWListItem(const wxListCtrl *ctrl, + const wxListItem& info, + LV_ITEM& lvItem) +{ +} + +static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item, + LV_COLUMN& lvCol) +{ +} + +#endif // wxUSE_LISTCTRL + diff --git a/src/palmos/main.cpp b/src/palmos/main.cpp new file mode 100644 index 0000000000..df38c0718e --- /dev/null +++ b/src/palmos/main.cpp @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/main.cpp +// Purpose: wxEnter for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/07/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/event.h" +#include "wx/app.h" +#include "wx/cmdline.h" + +#if wxUSE_GUI + +// ============================================================================ +// implementation: various entry points +// ============================================================================ + +// ---------------------------------------------------------------------------- +// Platform-specific wxEntry +// ---------------------------------------------------------------------------- + +int wxEntry() +{ + /* There is no command line in PalmOS. For now generate a fake arument + * list. Later this may be changed to reflect the application launch code + */ + wxArrayString args; + int argc = args.GetCount(); + + // +1 here for the terminating NULL + wxChar **argv = new wxChar *[argc + 1]; + for ( int i = 0; i < argc; i++ ) + { + argv[i] = wxStrdup(args[i]); + } + + // argv[] must be NULL-terminated + argv[argc] = NULL; + + return wxEntry(argc, argv); +} + +#endif // wxUSE_GUI diff --git a/src/palmos/mdi.cpp b/src/palmos/mdi.cpp new file mode 100644 index 0000000000..32c9d1b051 --- /dev/null +++ b/src/palmos/mdi.cpp @@ -0,0 +1,441 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/mdi.cpp +// Purpose: MDI classes for wx +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "mdi.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_MDI && !defined(__WXUNIVERSAL__) + +#ifndef WX_PRECOMP + #include "wx/setup.h" + #include "wx/frame.h" + #include "wx/menu.h" + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/dialog.h" + #if wxUSE_STATUSBAR + #include "wx/statusbr.h" + #endif + #include "wx/settings.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#include "wx/mdi.h" +#include "wx/palmos/private.h" + +#if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR + #include "wx/palmos/statbr95.h" +#endif + +#if wxUSE_TOOLBAR + #include "wx/toolbar.h" +#endif // wxUSE_TOOLBAR + +#include + +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- + +extern wxMenu *wxCurrentPopupMenu; + +extern const wxChar *wxMDIFrameClassName; // from app.cpp +extern const wxChar *wxMDIChildFrameClassName; +extern const wxChar *wxMDIChildFrameClassNameNoRedraw; +extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); +extern void wxRemoveHandleAssociation(wxWindow *win); + + +// --------------------------------------------------------------------------- +// constants +// --------------------------------------------------------------------------- + +static const int IDM_WINDOWTILE = 4001; +static const int IDM_WINDOWTILEHOR = 4001; +static const int IDM_WINDOWCASCADE = 4002; +static const int IDM_WINDOWICONS = 4003; +static const int IDM_WINDOWNEXT = 4004; +static const int IDM_WINDOWTILEVERT = 4005; +static const int IDM_WINDOWPREV = 4006; + +// This range gives a maximum of 500 MDI children. Should be enough :-) +static const int wxFIRST_MDI_CHILD = 4100; +static const int wxLAST_MDI_CHILD = 4600; + +// Status border dimensions +static const int wxTHICK_LINE_BORDER = 3; +static const int wxTHICK_LINE_WIDTH = 1; + +// --------------------------------------------------------------------------- +// private functions +// --------------------------------------------------------------------------- + +// set the MDI menus (by sending the WM_MDISETMENU message) and update the menu +// of the parent of win (which is supposed to be the MDI client window) +static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow); + +// insert the window menu (subMenu) into menu just before "Help" submenu or at +// the very end if not found +static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu); + +// Remove the window menu +static void RemoveWindowMenu(wxWindow *win, WXHMENU menu); + +// is this an id of an MDI child? +inline bool IsMdiCommandId(int id) +{ + return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD); +} + +// unpack the parameters of WM_MDIACTIVATE message +static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact); + +// return the HMENU of the MDI menu +static inline HMENU GetMDIWindowMenu(wxMDIParentFrame *frame) +{ + wxMenu *menu = frame->GetWindowMenu(); + return menu ? GetHmenuOf(menu) : 0; +} + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxWin macros +// --------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) +IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) + +BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) + EVT_SIZE(wxMDIParentFrame::OnSize) + EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) + EVT_IDLE(wxMDIChildFrame::OnIdle) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) + EVT_SCROLL(wxMDIClientWindow::OnScroll) +END_EVENT_TABLE() + +// =========================================================================== +// wxMDIParentFrame: the frame which contains the client window which manages +// the children +// =========================================================================== + +wxMDIParentFrame::wxMDIParentFrame() +{ +} + +bool wxMDIParentFrame::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +wxMDIParentFrame::~wxMDIParentFrame() +{ +} + +#if wxUSE_MENUS_NATIVE + +void wxMDIParentFrame::InternalSetMenuBar() +{ +} + +#endif // wxUSE_MENUS_NATIVE + +void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) +{ +} + +void wxMDIParentFrame::OnSize(wxSizeEvent&) +{ +} + +// Returns the active MDI child window +wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const +{ + return NULL; +} + +// Create the client window class (don't Create the window, just return a new +// class) +wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() +{ + return new wxMDIClientWindow; +} + +// Responds to colour changes, and passes event on to children. +void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) +{ + event.Skip(); +} + +WXHICON wxMDIParentFrame::GetDefaultIcon() const +{ + // we don't have any standard icons (any more) + return (WXHICON)0; +} + +// --------------------------------------------------------------------------- +// MDI operations +// --------------------------------------------------------------------------- + +void wxMDIParentFrame::Cascade() +{ +} + +void wxMDIParentFrame::Tile() +{ +} + +void wxMDIParentFrame::ArrangeIcons() +{ +} + +void wxMDIParentFrame::ActivateNext() +{ +} + +void wxMDIParentFrame::ActivatePrevious() +{ +} + +// --------------------------------------------------------------------------- +// the MDI parent frame window proc +// --------------------------------------------------------------------------- + +WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ + return 0; +} + +bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate) +{ + return false; +} + +bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) +{ + return false; +} + +WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ + return 0; +} + +bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) +{ + return false; +} + +// =========================================================================== +// wxMDIChildFrame +// =========================================================================== + +void wxMDIChildFrame::Init() +{ +} + +bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +wxMDIChildFrame::~wxMDIChildFrame() +{ +} + +// Set the client size (i.e. leave the calculation of borders etc. +// to wxWidgets) +void wxMDIChildFrame::DoSetClientSize(int width, int height) +{ +} + +void wxMDIChildFrame::DoGetPosition(int *x, int *y) const +{ +} + +void wxMDIChildFrame::InternalSetMenuBar() +{ +} + +WXHICON wxMDIChildFrame::GetDefaultIcon() const +{ + // we don't have any standard icons (any more) + return (WXHICON)0; +} + +// --------------------------------------------------------------------------- +// MDI operations +// --------------------------------------------------------------------------- + +void wxMDIChildFrame::Maximize(bool maximize) +{ +} + +void wxMDIChildFrame::Restore() +{ +} + +void wxMDIChildFrame::Activate() +{ +} + +// --------------------------------------------------------------------------- +// MDI window proc and message handlers +// --------------------------------------------------------------------------- + +WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ + return 0; +} + +bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) +{ + return false; +} + +bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), + WXHWND hwndAct, + WXHWND hwndDeact) +{ + return false; +} + +bool wxMDIChildFrame::HandleWindowPosChanging(void *pos) +{ + return false; +} + +bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo) +{ + return false; +} + +// --------------------------------------------------------------------------- +// MDI specific message translation/preprocessing +// --------------------------------------------------------------------------- + +WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) +{ + return false; +} + +// --------------------------------------------------------------------------- +// misc +// --------------------------------------------------------------------------- + +void wxMDIChildFrame::MSWDestroyWindow() +{ +} + +// Change the client window's extended style so we don't get a client edge +// style when a child is maximised (a double border looks silly.) +bool wxMDIChildFrame::ResetWindowStyle(void *vrect) +{ + return false; +} + +// =========================================================================== +// wxMDIClientWindow: the window of predefined (by Windows) class which +// contains the child frames +// =========================================================================== + +bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) +{ + return false; +} + +// Explicitly call default scroll behaviour +void wxMDIClientWindow::OnScroll(wxScrollEvent& event) +{ + event.Skip(); +} + +void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) +{ +} + +void wxMDIChildFrame::OnIdle(wxIdleEvent& event) +{ + event.Skip(); +} + +// --------------------------------------------------------------------------- +// non member functions +// --------------------------------------------------------------------------- + +static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) +{ +} + +static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) +{ +} + +static void RemoveWindowMenu(wxWindow *win, WXHMENU menu) +{ +} + +static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, + WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact) +{ +} + +#endif // wxUSE_MDI && !defined(__WXUNIVERSAL__) + diff --git a/src/palmos/menu.cpp b/src/palmos/menu.cpp new file mode 100644 index 0000000000..e5177ca4da --- /dev/null +++ b/src/palmos/menu.cpp @@ -0,0 +1,677 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: menu.cpp +// Purpose: wxMenu, wxMenuBar, wxMenuItem +// Author: William Osborne +// Modified by: +// Created: 10/12/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "menu.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_MENUS + +#ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/menu.h" + #include "wx/utils.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#if wxUSE_OWNER_DRAWN + #include "wx/ownerdrw.h" +#endif + +// other standard headers +#include + +#ifdef __PALMOS__ + #include + #include +#endif + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +extern wxMenu *wxCurrentPopupMenu; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the (popup) menu title has this special id +static const int idMenuTitle = -3; + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +#include + +WX_DEFINE_LIST( wxMenuInfoList ) ; + +#if wxUSE_EXTENDED_RTTI + +WX_DEFINE_FLAGS( wxMenuStyle ) + +wxBEGIN_FLAGS( wxMenuStyle ) + wxFLAGS_MEMBER(wxMENU_TEAROFF) +wxEND_FLAGS( wxMenuStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler,"wx/menu.h") + +wxCOLLECTION_TYPE_INFO( wxMenuItem * , wxMenuItemList ) ; + +template<> void wxCollectionToVariantArray( wxMenuItemList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + +wxBEGIN_PROPERTIES_TABLE(wxMenu) + wxEVENT_PROPERTY( Select , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent) + wxPROPERTY( Title, wxString , SetTitle, GetTitle, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxREADONLY_PROPERTY_FLAGS( MenuStyle , wxMenuStyle , long , GetStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + wxPROPERTY_COLLECTION( MenuItems , wxMenuItemList , wxMenuItem* , Append , GetMenuItems , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxMenu) +wxEND_HANDLERS_TABLE() + +wxDIRECT_CONSTRUCTOR_2( wxMenu , wxString , Title , long , MenuStyle ) + +WX_DEFINE_FLAGS( wxMenuBarStyle ) + +wxBEGIN_FLAGS( wxMenuBarStyle ) + wxFLAGS_MEMBER(wxMB_DOCKABLE) +wxEND_FLAGS( wxMenuBarStyle ) + +// the negative id would lead the window (its superclass !) to vetoe streaming out otherwise +bool wxMenuBarStreamingCallback( const wxObject *WXUNUSED(object), wxWriter * , wxPersister * , wxxVariantArray & ) +{ + return true ; +} + +IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuBar, wxWindow ,"wx/menu.h",wxMenuBarStreamingCallback) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxMenuInfo, wxObject , "wx/menu.h" ) + +wxBEGIN_PROPERTIES_TABLE(wxMenuInfo) + wxREADONLY_PROPERTY( Menu , wxMenu* , GetMenu , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxREADONLY_PROPERTY( Title , wxString , GetTitle , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxMenuInfo) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_2( wxMenuInfo , wxMenu* , Menu , wxString , Title ) + +wxCOLLECTION_TYPE_INFO( wxMenuInfo * , wxMenuInfoList ) ; + +template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + +wxBEGIN_PROPERTIES_TABLE(wxMenuBar) + wxPROPERTY_COLLECTION( MenuInfos , wxMenuInfoList , wxMenuInfo* , Append , GetMenuInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxMenuBar) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_DUMMY( wxMenuBar ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler) +IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow) +IMPLEMENT_DYNAMIC_CLASS(wxMenuInfo, wxObject) +#endif + +const wxMenuInfoList& wxMenuBar::GetMenuInfos() const +{ + wxMenuInfoList* list = const_cast< wxMenuInfoList* >( &m_menuInfos ) ; + WX_CLEAR_LIST( wxMenuInfoList , *list ) ; + for( size_t i = 0 ; i < GetMenuCount() ; ++i ) + { + wxMenuInfo* info = new wxMenuInfo() ; + info->Create( const_cast(this)->GetMenu(i) , GetLabelTop(i) ) ; + list->Append( info ) ; + } + return m_menuInfos ; +} + +// --------------------------------------------------------------------------- +// wxMenu construction, adding and removing menu items +// --------------------------------------------------------------------------- + +// Construct a menu with optional title (then use append) +void wxMenu::Init() +{ +} + +// The wxWindow destructor will take care of deleting the submenus. +wxMenu::~wxMenu() +{ +} + +void wxMenu::Break() +{ +} + +void wxMenu::Attach(wxMenuBarBase *menubar) +{ + wxMenuBase::Attach(menubar); +} + +#if wxUSE_ACCEL + +int wxMenu::FindAccel(int id) const +{ + return wxNOT_FOUND; +} + +void wxMenu::UpdateAccel(wxMenuItem *item) +{ +} + +#endif // wxUSE_ACCEL + +// append a new item or submenu to the menu +bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) +{ + if ( IsAttached() && GetMenuBar()->IsAttached() ) + { + // Regenerate the menu resource + GetMenuBar()->Refresh(); + } + + return TRUE; +} + +void wxMenu::EndRadioGroup() +{ +} + +wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) +{ + wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") ); + + if(!wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item)) + { + return NULL; + } + else if(IsAttached() && GetMenuBar()->IsAttached()) + { + // Regenerate the menu resource + GetMenuBar()->Refresh(); + } + + return item; +} + +wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) +{ + if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos)) + return item; + else + return NULL; +} + +wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) +{ + // we need to find the items position in the child list + size_t pos; + wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); + for ( pos = 0; node; pos++ ) + { + if ( node->GetData() == item ) + break; + + node = node->GetNext(); + } + + // DoRemove() (unlike Remove) can only be called for existing item! + wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") ); + + // remove the item from the menu + wxMenuItem *ret=wxMenuBase::DoRemove(item); + + if ( IsAttached() && GetMenuBar()->IsAttached() ) + { + // Regenerate the menu resource + GetMenuBar()->Refresh(); + } + + return ret; +} + +// --------------------------------------------------------------------------- +// accelerator helpers +// --------------------------------------------------------------------------- + +#if wxUSE_ACCEL + +// create the wxAcceleratorEntries for our accels and put them into provided +// array - return the number of accels we have +size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const +{ + size_t count = GetAccelCount(); + for ( size_t n = 0; n < count; n++ ) + { + *accels++ = *m_accels[n]; + } + + return count; +} + +#endif // wxUSE_ACCEL + +// --------------------------------------------------------------------------- +// set wxMenu title +// --------------------------------------------------------------------------- + +void wxMenu::SetTitle(const wxString& label) +{ + m_title = label; + + if ( IsAttached() && GetMenuBar()->IsAttached() ) + { + // Regenerate the menu resource + GetMenuBar()->Refresh(); + } +} + +// --------------------------------------------------------------------------- +// event processing +// --------------------------------------------------------------------------- + +bool wxMenu::PalmCommand(WXUINT WXUNUSED(param), WXWORD id) +{ + return false; +} + +// --------------------------------------------------------------------------- +// other +// --------------------------------------------------------------------------- + +wxWindow *wxMenu::GetWindow() const +{ + return NULL; +} + +// --------------------------------------------------------------------------- +// Menu Bar +// --------------------------------------------------------------------------- + +void wxMenuBar::Init() +{ +} + +wxMenuBar::wxMenuBar() +{ +} + +wxMenuBar::wxMenuBar( long WXUNUSED(style) ) +{ +} + +wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[]) +{ +} + +wxMenuBar::~wxMenuBar() +{ +} + +// --------------------------------------------------------------------------- +// wxMenuBar helpers +// --------------------------------------------------------------------------- + +void wxMenuBar::Refresh() +{ + wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") ); + + // Regenerate the menu resource + LoadMenu(); +} + +WXHMENU wxMenuBar::Create() +{ + return NULL; +} + +int wxMenuBar::PalmPositionForWxMenu(wxMenu *menu, int wxpos) +{ + return -1; +} + +// --------------------------------------------------------------------------- +// wxMenuBar functions to work with the top level submenus +// --------------------------------------------------------------------------- + +void wxMenuBar::EnableTop(size_t pos, bool enable) +{ + // Palm OS does not have support for grayed or disabled items +} + +void wxMenuBar::SetLabelTop(size_t pos, const wxString& label) +{ + wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") ); + + m_titles[pos]=wxStripMenuCodes(label); + + if ( !IsAttached() ) + { + return; + } + + // Regenerate the menu resource + Refresh(); +} + +wxString wxMenuBar::GetLabelTop(size_t pos) const +{ + wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString, + wxT("invalid menu index in wxMenuBar::GetLabelTop") ); + + return wxMenuItem::GetLabelFromText(m_titles[pos]); +} + +// --------------------------------------------------------------------------- +// wxMenuBar construction +// --------------------------------------------------------------------------- + +wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) +{ + wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title); + if ( !menuOld ) + return NULL; + + m_titles[pos]=wxStripMenuCodes(title); + + if ( IsAttached() ) + { + // Regenerate the menu resource + Refresh(); + } + + return menuOld; +} + +bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) +{ + if ( !wxMenuBarBase::Insert(pos, menu, title) ) + return FALSE; + + m_titles.Insert(wxStripMenuCodes(title), pos); + + if ( IsAttached() ) + { + // Regenerate the menu resource + Refresh(); + } + + return TRUE; +} + +bool wxMenuBar::Append(wxMenu *menu, const wxString& title) +{ + if ( !wxMenuBarBase::Append(menu, title) ) + return FALSE; + + m_titles.Add(wxStripMenuCodes(title)); + + if(IsAttached()) + { + // Regenerate the menu resource + Refresh(); + } + + return TRUE; +} + +wxMenu *wxMenuBar::Remove(size_t pos) +{ + wxMenu *menu = wxMenuBarBase::Remove(pos); + if ( !menu ) + return NULL; + + m_titles.RemoveAt(pos); + + if (IsAttached()) + { + // Regenerate the menu resource + Refresh(); + } + + return menu; +} + +#if wxUSE_ACCEL + +void wxMenuBar::RebuildAccelTable() +{ +} + +#endif // wxUSE_ACCEL + +int wxMenuBar::ProcessCommand(int ItemID) +{ + if(!IsAttached()) + return -1; + + int MenuNum=(ItemID/1000)-1; + int ItemNum=(ItemID-(1000*(MenuNum+1))); + + // Should never happen, but it doesn't hurt to check anyway. + if(MenuNum>GetMenuCount()) + return -1; + + // Get the menu + wxMenu *ActiveMenu=GetMenu(MenuNum); + + // Make sure this is a valid item. + if(ItemNum>ActiveMenu->GetMenuItemCount()) + return -1; + + // Get the item + wxMenuItem *ActiveItem=ActiveMenu->FindItemByPosition(ItemNum); + int ActiveID=ActiveItem->GetId(); + + return ActiveID; +} + +/* Palm OS does not have good dynamic menu support. About all you can do with + * the standard API calls is to add new items to an existing drop-down menu and + * hide/show items in a drop-down menu. It is impossible to add, hide, or + * change the label on a drop-down menu. + * + * The easiest and simplest way around this limitation is to modify the Palm OS + * MenuBarType structure directly. This gives limited ability to change the + * label on a drop-down menu. I have not been able to find a safe way to add, + * delete, or resize drop-down menus in OS 6. + * + * The following routine attempt to work around these limitations present in the + * Palm OS API to provide limited dynamic menu support. This solution is far + * from perfect, but the only other option is to wait for PalmSource to add full + * dynamic menu support, or to recreate the Palm OS menu system from scratch. + * + * This system is limited in that no more than 4 drop-down menus are allowed per + * menu bar, and the label for each drop-down menu is limited to 8 characters of + * text. However, this menu system should work for most applications. + * + * Basically the menu routines select one of four menu bars, depending on + * whether or not the requested menu bar has one, two, three, or four drop-down + * menus. + * + * These four "template" menu bars contain one, two, three, or four drop-down + * menus. Each menu has a dummy menu item attached to it to allow the Palm OS + * MenuAddItem function to add the real items. + * + * The labels on the drop-down menus are then replaced with the labels of the + * real menus. + * + * The menu is then attached to the active window and the MenuAddItem API + * function is called to add the items to each drop-down menu. Finally, + * MenuHideItem is called to remove the dummy items from each drop-down menu. + */ +void wxMenuBar::LoadMenu() +{ + int i=0; + int j=0; + + // Handle to the currently running application database + DmOpenRef AppDB; + + // Get app database reference - needed for some Palm OS Menu API calls. + SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB); + + // Get the number of menus + int NumMenus=GetMenuCount(); + + // Set up the pointers and handles + char *PalmOSMenuBarPtr; + MemHandle PalmOSMenuBar; + + // Load the menu template and set up the menu pointers + if(NumMenus==1) + { + PalmOSMenuBar=DmGetResource(AppDB,'MBAR',1000); + PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar); + + PalmOSMenuBarPtr+=74; + } + else if(NumMenus==2) + { + PalmOSMenuBar=DmGetResource(AppDB,'MBAR',2000); + PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar); + + PalmOSMenuBarPtr+=116; + } + else if(NumMenus==3) + { + PalmOSMenuBar=DmGetResource(AppDB,'MBAR',3000); + PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar); + + PalmOSMenuBarPtr+=158; + } + else + { + // We support a maximum of 4 menus, so make sure that do not create + // more than we can handle. + NumMenus=4; + + PalmOSMenuBar=DmGetResource(AppDB,'MBAR',4000); + PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar); + + PalmOSMenuBarPtr+=200; + } + + // Set the proper names for the drop-down triggers. + for(i=0;i8) + LengthToCopy=8; + + MemMove(PalmOSMenuBarPtr,MenuTitle,LengthToCopy); + PalmOSMenuBarPtr+=11; + } + + // We are done with the menu pointer. + MemHandleUnlock(PalmOSMenuBar); + DmReleaseResource(PalmOSMenuBar); + + // We must make the menu active before we can add items to the drop-down + // triggers. + FrmSetMenu(FrmGetActiveForm(),AppDB,NumMenus*1000); + + /* Add the menu items to the drop-down triggers. This must be done after + * setting the triggers, because setting the names of drop-down triggers + * that have a variable number of items requires carefull calculation of + * the offsets in the MenuBarType structure. Setting the triggers first + * avoids this. + */ + for(i=0;iGetMenuItemCount();j++) + { + wxMenuItem *CurrentItem=CurrentMenu->FindItemByPosition(j); + wxString ItemLabel=CurrentItem->GetLabel(); + + if(CurrentItem->IsSeparator()==true) + { + char Separator=MenuSeparatorChar; + if(j==0) + MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,&Separator); + else + MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,&Separator); + } + else + { + if(j==0) + MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,ItemLabel); + else + MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,ItemLabel); + } + } + + // Hide the dummy menu item, since we don't need it anymore. + MenuHideItem(9000+i); + } +} + +void wxMenuBar::Attach(wxFrame *frame) +{ + wxMenuBarBase::Attach(frame); + + LoadMenu(); +} + +#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) +bool wxMenuBar::AddAdornments(long style) +{ + return false; +} +#endif + +void wxMenuBar::Detach() +{ + wxMenuBarBase::Detach(); +} + +#endif // wxUSE_MENUS diff --git a/src/palmos/menuitem.cpp b/src/palmos/menuitem.cpp new file mode 100644 index 0000000000..681d167875 --- /dev/null +++ b/src/palmos/menuitem.cpp @@ -0,0 +1,226 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: menuitem.cpp +// Purpose: wxMenuItem implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "menuitem.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_MENUS + +#ifndef WX_PRECOMP + #include "wx/font.h" + #include "wx/bitmap.h" + #include "wx/settings.h" + #include "wx/font.h" + #include "wx/window.h" + #include "wx/accel.h" + #include "wx/menu.h" + #include "wx/string.h" +#endif + +#include "wx/menuitem.h" +#include "wx/log.h" + +#if wxUSE_ACCEL + #include "wx/accel.h" +#endif // wxUSE_ACCEL + +// --------------------------------------------------------------------------- +// macro +// --------------------------------------------------------------------------- + +// conditional compilation +#if wxUSE_OWNER_DRAWN + #define OWNER_DRAWN_ONLY( code ) if ( IsOwnerDrawn() ) code +#else // !wxUSE_OWNER_DRAWN + #define OWNER_DRAWN_ONLY( code ) +#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// dynamic classes implementation +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI + +bool wxMenuItemStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & ) +{ + const wxMenuItem * mitem = dynamic_cast(object) ; + if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().IsEmpty() ) + { + // we don't stream out the first two items for menus with a title, they will be reconstructed + if ( mitem->GetMenu()->FindItemByPosition(0) == mitem || mitem->GetMenu()->FindItemByPosition(1) == mitem ) + return false ; + } + return true ; +} + +wxBEGIN_ENUM( wxItemKind ) + wxENUM_MEMBER( wxITEM_SEPARATOR ) + wxENUM_MEMBER( wxITEM_NORMAL ) + wxENUM_MEMBER( wxITEM_CHECK ) + wxENUM_MEMBER( wxITEM_RADIO ) +wxEND_ENUM( wxItemKind ) + +IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxMenuItem, wxObject,"wx/menuitem.h",wxMenuItemStreamingCallback) + +wxBEGIN_PROPERTIES_TABLE(wxMenuItem) + wxPROPERTY( Parent,wxMenu*, SetMenu, GetMenu, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Id,int, SetId, GetId, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Text, wxString , SetText, GetText, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Help, wxString , SetHelp, GetHelp, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxREADONLY_PROPERTY( Kind, wxItemKind , GetKind , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( SubMenu,wxMenu*, SetSubMenu, GetSubMenu, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Checked , bool , Check , IsChecked , wxxVariant((bool)false) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Checkable , bool , SetCheckable , IsCheckable , wxxVariant((bool)false) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxMenuItem) +wxEND_HANDLERS_TABLE() + +wxDIRECT_CONSTRUCTOR_6( wxMenuItem , wxMenu* , Parent , int , Id , wxString , Text , wxString , Help , wxItemKind , Kind , wxMenu* , SubMenu ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject) +#endif + +// ---------------------------------------------------------------------------- +// wxMenuItem +// ---------------------------------------------------------------------------- + +// ctor & dtor +// ----------- + +wxMenuItem::wxMenuItem(wxMenu *pParentMenu, + int id, + const wxString& text, + const wxString& strHelp, + wxItemKind kind, + wxMenu *pSubMenu) + : wxMenuItemBase(pParentMenu, id, text, strHelp, kind, pSubMenu) +#if wxUSE_OWNER_DRAWN + , wxOwnerDrawn(text, kind == wxITEM_CHECK, true) +#endif // owner drawn +{ +} + +wxMenuItem::wxMenuItem(wxMenu *parentMenu, + int id, + const wxString& text, + const wxString& help, + bool isCheckable, + wxMenu *subMenu) + : wxMenuItemBase(parentMenu, id, text, help, + isCheckable ? wxITEM_CHECK : wxITEM_NORMAL, subMenu) +#if wxUSE_OWNER_DRAWN + , wxOwnerDrawn(text, isCheckable, true) +#endif // owner drawn +{ +} + +void wxMenuItem::Init() +{ +} + +wxMenuItem::~wxMenuItem() +{ +} + +// misc +// ---- + +// return the id for calling Win32 API functions +int wxMenuItem::GetRealId() const +{ + return 0; +} + +// get item state +// -------------- + +bool wxMenuItem::IsChecked() const +{ + return false; +} + +/* static */ +wxString wxMenuItemBase::GetLabelFromText(const wxString& text) +{ + return wxStripMenuCodes(text); +} + +// radio group stuff +// ----------------- + +void wxMenuItem::SetAsRadioGroupStart() +{ +} + +void wxMenuItem::SetRadioGroupStart(int start) +{ +} + +void wxMenuItem::SetRadioGroupEnd(int end) +{ +} + +// change item state +// ----------------- + +void wxMenuItem::Enable(bool enable) +{ +} + +void wxMenuItem::Check(bool check) +{ +} + +void wxMenuItem::SetText(const wxString& text) +{ +} + +void wxMenuItem::SetCheckable(bool checkable) +{ +} + +// ---------------------------------------------------------------------------- +// wxMenuItemBase +// ---------------------------------------------------------------------------- + +wxMenuItem *wxMenuItemBase::New(wxMenu *parentMenu, + int id, + const wxString& name, + const wxString& help, + wxItemKind kind, + wxMenu *subMenu) +{ + return new wxMenuItem(parentMenu, id, name, help, kind, subMenu); +} + +#endif // wxUSE_MENUS diff --git a/src/palmos/metafile.cpp b/src/palmos/metafile.cpp new file mode 100644 index 0000000000..475c50d7ad --- /dev/null +++ b/src/palmos/metafile.cpp @@ -0,0 +1,216 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/metafile.cpp +// Purpose: wxMetafileDC etc. +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "metafile.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/setup.h" +#endif + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/app.h" +#endif + +#include "wx/metafile.h" + +#if wxUSE_METAFILE && !defined(wxMETAFILE_IS_ENH) + +#include "wx/clipbrd.h" +#include "wx/palmos/private.h" + +#include +#include + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxMetafileRefData +// ---------------------------------------------------------------------------- + +/* + * Metafiles + * Currently, the only purpose for making a metafile is to put + * it on the clipboard. + */ + +wxMetafileRefData::wxMetafileRefData() +{ +} + +wxMetafileRefData::~wxMetafileRefData() +{ +} + +// ---------------------------------------------------------------------------- +// wxMetafile +// ---------------------------------------------------------------------------- + +wxMetafile::wxMetafile(const wxString& file) +{ +} + +wxMetafile::~wxMetafile() +{ +} + +bool wxMetafile::SetClipboard(int width, int height) +{ + return false; +} + +bool wxMetafile::Play(wxDC *dc) +{ + return false; +} + +void wxMetafile::SetHMETAFILE(WXHANDLE mf) +{ +} + +void wxMetafile::SetWindowsMappingMode(int mm) +{ +} + +// ---------------------------------------------------------------------------- +// Metafile device context +// ---------------------------------------------------------------------------- + +// Original constructor that does not takes origin and extent. If you use this, +// *DO* give origin/extent arguments to wxMakeMetafilePlaceable. +wxMetafileDC::wxMetafileDC(const wxString& file) +{ +} + +// New constructor that takes origin and extent. If you use this, don't +// give origin/extent arguments to wxMakeMetafilePlaceable. +wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg) +{ +} + +wxMetafileDC::~wxMetafileDC() +{ +} + +void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y, + long *descent, long *externalLeading, wxFont *theFont, bool WXUNUSED(use16bit)) const +{ +} + +wxMetafile *wxMetafileDC::Close() +{ + return NULL; +} + +void wxMetafileDC::SetMapMode(int mode) +{ +} + +// ---------------------------------------------------------------------------- +// wxMakeMetafilePlaceable +// ---------------------------------------------------------------------------- +#ifdef __WIN32__ +struct RECT32 +{ + short left; + short top; + short right; + short bottom; +}; + +struct mfPLACEABLEHEADER { + DWORD key; + short hmf; + RECT32 bbox; + WORD inch; + DWORD reserved; + WORD checksum; +}; +#else +struct mfPLACEABLEHEADER { + DWORD key; + HANDLE hmf; + RECT bbox; + WORD inch; + DWORD reserved; + WORD checksum; +}; +#endif + +/* + * 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. + * + */ + +bool wxMakeMetafilePlaceable(const wxString& filename, float scale) +{ + return false; +} + +bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, int y2, float scale, bool useOriginAndExtent) +{ + return false; +} + + +#if wxUSE_DRAG_AND_DROP + +// ---------------------------------------------------------------------------- +// wxMetafileDataObject +// ---------------------------------------------------------------------------- + +size_t wxMetafileDataObject::GetDataSize() const +{ + return 0; +} + +bool wxMetafileDataObject::GetDataHere(void *buf) const +{ + return false; +} + +bool wxMetafileDataObject::SetData(size_t WXUNUSED(len), const void *buf) +{ + return false; +} + +#endif // wxUSE_DRAG_AND_DROP + +#endif // wxUSE_METAFILE + diff --git a/src/palmos/mimetype.cpp b/src/palmos/mimetype.cpp new file mode 100644 index 0000000000..294fc87572 --- /dev/null +++ b/src/palmos/mimetype.cpp @@ -0,0 +1,827 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/mimetype.cpp +// Purpose: classes and functions to manage MIME types +// Author: Vadim Zeitlin +// Modified by: +// Created: 23.09.98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence (part of wxExtra library) +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "mimetype.h" +#endif + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// This really doesn't apply to Palm OS +#ifdef __PALMOS__ + +#if wxUSE_MIMETYPE + +#ifndef WX_PRECOMP + #include "wx/string.h" + #if wxUSE_GUI + #include "wx/icon.h" + #include "wx/msgdlg.h" + #endif +#endif //WX_PRECOMP + +#include "wx/log.h" +#include "wx/file.h" +#include "wx/iconloc.h" +#include "wx/intl.h" +#include "wx/dynarray.h" +#include "wx/confbase.h" + +#ifdef __WXMSW__ + #include "wx/palmos/registry.h" + #include "wx/palmos/private.h" +#endif // OS + +#include "wx/palmos/mimetype.h" + +// other standard headers +#include + +// in case we're compiling in non-GUI mode +class WXDLLEXPORT wxIcon; + +// These classes use Windows registry to retrieve the required information. +// +// Keys used (not all of them are documented, so it might actually stop working +// in future versions of Windows...): +// 1. "HKCR\MIME\Database\Content Type" contains subkeys for all known MIME +// types, each key has a string value "Extension" which gives (dot preceded) +// extension for the files of this MIME type. +// +// 2. "HKCR\.ext" contains +// a) unnamed value containing the "filetype" +// b) value "Content Type" containing the MIME type +// +// 3. "HKCR\filetype" contains +// a) unnamed value containing the description +// b) subkey "DefaultIcon" with single unnamed value giving the icon index in +// an icon file +// c) shell\open\command and shell\open\print subkeys containing the commands +// to open/print the file (the positional parameters are introduced by %1, +// %2, ... in these strings, we change them to %s ourselves) + +// although I don't know of any official documentation which mentions this +// location, uses it, so it isn't likely to change +static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\"); + +// this function replaces Microsoft %1 with Unix-like %s +static bool CanonicalizeParams(wxString& command) +{ + // transform it from '%1' to '%s' style format string (now also test for %L + // as apparently MS started using it as well for the same purpose) + + // NB: we don't make any attempt to verify that the string is valid, i.e. + // doesn't contain %2, or second %1 or .... But we do make sure that we + // return a string with _exactly_ one '%s'! + bool foundFilename = false; + size_t len = command.length(); + for ( size_t n = 0; (n < len) && !foundFilename; n++ ) + { + if ( command[n] == wxT('%') && + (n + 1 < len) && + (command[n + 1] == wxT('1') || command[n + 1] == wxT('L')) ) + { + // replace it with '%s' + command[n + 1] = wxT('s'); + + foundFilename = true; + } + } + + return foundFilename; +} + +void wxFileTypeImpl::Init(const wxString& strFileType, const wxString& ext) +{ + // VZ: does it? (FIXME) + wxCHECK_RET( !ext.IsEmpty(), _T("needs an extension") ); + + if ( ext[0u] != wxT('.') ) { + m_ext = wxT('.'); + } + m_ext << ext; + + m_strFileType = strFileType; + if ( !strFileType ) { + m_strFileType = m_ext.AfterFirst('.') + _T("_auto_file"); + } +} + +wxString wxFileTypeImpl::GetVerbPath(const wxString& verb) const +{ + wxString path; + path << m_strFileType << _T("\\shell\\") << verb << _T("\\command"); + return path; +} + +size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs, + wxArrayString *commands, + const wxFileType::MessageParameters& params) const +{ + wxCHECK_MSG( !m_ext.IsEmpty(), 0, _T("GetAllCommands() needs an extension") ); + + if ( m_strFileType.IsEmpty() ) + { + // get it from the registry + wxFileTypeImpl *self = wxConstCast(this, wxFileTypeImpl); + wxRegKey rkey(wxRegKey::HKCR, m_ext); + if ( !rkey.Exists() || !rkey.QueryValue(wxEmptyString, self->m_strFileType) ) + { + wxLogDebug(_T("Can't get the filetype for extension '%s'."), + m_ext.c_str()); + + return 0; + } + } + + // enum all subkeys of HKCR\filetype\shell + size_t count = 0; + wxRegKey rkey(wxRegKey::HKCR, m_strFileType + _T("\\shell")); + long dummy; + wxString verb; + bool ok = rkey.GetFirstKey(verb, dummy); + while ( ok ) + { + wxString command = wxFileType::ExpandCommand(GetCommand(verb), params); + + // we want the open bverb to eb always the first + + if ( verb.CmpNoCase(_T("open")) == 0 ) + { + if ( verbs ) + verbs->Insert(verb, 0); + if ( commands ) + commands->Insert(command, 0); + } + else // anything else than "open" + { + if ( verbs ) + verbs->Add(verb); + if ( commands ) + commands->Add(command); + } + + count++; + + ok = rkey.GetNextKey(verb, dummy); + } + + return count; +} + +// ---------------------------------------------------------------------------- +// modify the registry database +// ---------------------------------------------------------------------------- + +bool wxFileTypeImpl::EnsureExtKeyExists() +{ + wxRegKey rkey(wxRegKey::HKCR, m_ext); + if ( !rkey.Exists() ) + { + if ( !rkey.Create() || !rkey.SetValue(wxEmptyString, m_strFileType) ) + { + wxLogError(_("Failed to create registry entry for '%s' files."), + m_ext.c_str()); + return FALSE; + } + } + + return TRUE; +} + +// ---------------------------------------------------------------------------- +// get the command to use +// ---------------------------------------------------------------------------- + +wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const +{ + // suppress possible error messages + wxLogNull nolog; + wxString strKey; + + if ( wxRegKey(wxRegKey::HKCR, m_ext + _T("\\shell")).Exists() ) + strKey = m_ext; + if ( wxRegKey(wxRegKey::HKCR, m_strFileType + _T("\\shell")).Exists() ) + strKey = m_strFileType; + + if ( !strKey ) + { + // no info + return wxEmptyString; + } + + strKey << wxT("\\shell\\") << verb; + wxRegKey key(wxRegKey::HKCR, strKey + _T("\\command")); + wxString command; + if ( key.Open(wxRegKey::Read) ) { + // it's the default value of the key + if ( key.QueryValue(wxEmptyString, command) ) { + bool foundFilename = CanonicalizeParams(command); + +#if wxUSE_IPC + // look whether we must issue some DDE requests to the application + // (and not just launch it) + strKey += _T("\\DDEExec"); + wxRegKey keyDDE(wxRegKey::HKCR, strKey); + if ( keyDDE.Open(wxRegKey::Read) ) { + wxString ddeCommand, ddeServer, ddeTopic; + keyDDE.QueryValue(wxEmptyString, ddeCommand); + ddeCommand.Replace(_T("%1"), _T("%s")); + + wxRegKey(wxRegKey::HKCR, strKey + _T("\\Application")). + QueryValue(wxEmptyString, ddeServer); + wxRegKey(wxRegKey::HKCR, strKey + _T("\\Topic")). + QueryValue(wxEmptyString, ddeTopic); + + if (ddeTopic.IsEmpty()) + ddeTopic = wxT("System"); + + // HACK: we use a special feature of wxExecute which exists + // just because we need it here: it will establish DDE + // conversation with the program it just launched + command.Prepend(_T("WX_DDE#")); + command << _T('#') << ddeServer + << _T('#') << ddeTopic + << _T('#') << ddeCommand; + } + else +#endif // wxUSE_IPC + if ( !foundFilename ) + { + // we didn't find any '%1' - the application doesn't know which + // file to open (note that we only do it if there is no DDEExec + // subkey) + // + // HACK: append the filename at the end, hope that it will do + command << wxT(" %s"); + } + } + } + //else: no such file type or no value, will return empty string + + return command; +} + +bool +wxFileTypeImpl::GetOpenCommand(wxString *openCmd, + const wxFileType::MessageParameters& params) + const +{ + wxString cmd = GetCommand(wxT("open")); + + *openCmd = wxFileType::ExpandCommand(cmd, params); + + return !openCmd->IsEmpty(); +} + +bool +wxFileTypeImpl::GetPrintCommand(wxString *printCmd, + const wxFileType::MessageParameters& params) + const +{ + wxString cmd = GetCommand(wxT("print")); + + *printCmd = wxFileType::ExpandCommand(cmd, params); + + return !printCmd->IsEmpty(); +} + +// ---------------------------------------------------------------------------- +// getting other stuff +// ---------------------------------------------------------------------------- + +// TODO this function is half implemented +bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions) +{ + if ( m_ext.IsEmpty() ) { + // the only way to get the list of extensions from the file type is to + // scan through all extensions in the registry - too slow... + return FALSE; + } + else { + extensions.Empty(); + extensions.Add(m_ext); + + // it's a lie too, we don't return _all_ extensions... + return TRUE; + } +} + +bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const +{ + // suppress possible error messages + wxLogNull nolog; + wxRegKey key(wxRegKey::HKCR, m_ext); + + return key.Open(wxRegKey::Read) && + key.QueryValue(wxT("Content Type"), *mimeType); +} + +bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const +{ + wxString s; + + if ( !GetMimeType(&s) ) + { + return FALSE; + } + + mimeTypes.Clear(); + mimeTypes.Add(s); + return TRUE; +} + + +bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const +{ + wxString strIconKey; + strIconKey << m_strFileType << wxT("\\DefaultIcon"); + + // suppress possible error messages + wxLogNull nolog; + wxRegKey key(wxRegKey::HKCR, strIconKey); + + if ( key.Open(wxRegKey::Read) ) { + wxString strIcon; + // it's the default value of the key + if ( key.QueryValue(wxEmptyString, strIcon) ) { + // the format is the following: , + // NB: icon index may be negative as well as positive and the full + // path may contain the environment variables inside '%' + wxString strFullPath = strIcon.BeforeLast(wxT(',')), + strIndex = strIcon.AfterLast(wxT(',')); + + // index may be omitted, in which case BeforeLast(',') is empty and + // AfterLast(',') is the whole string + if ( strFullPath.IsEmpty() ) { + strFullPath = strIndex; + strIndex = wxT("0"); + } + + if ( iconLoc ) + { + iconLoc->SetFileName(wxExpandEnvVars(strFullPath)); + + iconLoc->SetIndex(wxAtoi(strIndex)); + } + + return TRUE; + } + } + + // no such file type or no value or incorrect icon entry + return FALSE; +} + +bool wxFileTypeImpl::GetDescription(wxString *desc) const +{ + // suppress possible error messages + wxLogNull nolog; + wxRegKey key(wxRegKey::HKCR, m_strFileType); + + if ( key.Open(wxRegKey::Read) ) { + // it's the default value of the key + if ( key.QueryValue(wxEmptyString, *desc) ) { + return TRUE; + } + } + + return FALSE; +} + +// helper function +wxFileType * +wxMimeTypesManagerImpl::CreateFileType(const wxString& filetype, const wxString& ext) +{ + wxFileType *fileType = new wxFileType; + fileType->m_impl->Init(filetype, ext); + return fileType; +} + +// extension -> file type +wxFileType * +wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& ext) +{ + // add the leading point if necessary + wxString str; + if ( ext[0u] != wxT('.') ) { + str = wxT('.'); + } + str << ext; + + // suppress possible error messages + wxLogNull nolog; + + bool knownExtension = FALSE; + + wxString strFileType; + wxRegKey key(wxRegKey::HKCR, str); + if ( key.Open(wxRegKey::Read) ) { + // it's the default value of the key + if ( key.QueryValue(wxEmptyString, strFileType) ) { + // create the new wxFileType object + return CreateFileType(strFileType, ext); + } + else { + // this extension doesn't have a filetype, but it's known to the + // system and may be has some other useful keys (open command or + // content-type), so still return a file type object for it + knownExtension = TRUE; + } + } + + if ( !knownExtension ) + { + // unknown extension + return NULL; + } + + return CreateFileType(wxEmptyString, ext); +} + +/* +wxFileType * +wxMimeTypesManagerImpl::GetOrAllocateFileTypeFromExtension(const wxString& ext) +{ + wxFileType *fileType = GetFileTypeFromExtension(ext); + if ( !fileType ) + { + fileType = CreateFileType(wxEmptyString, ext); + } + + return fileType; +} +*/ + +// MIME type -> extension -> file type +wxFileType * +wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType) +{ + wxString strKey = MIME_DATABASE_KEY; + strKey << mimeType; + + // suppress possible error messages + wxLogNull nolog; + + wxString ext; + wxRegKey key(wxRegKey::HKCR, strKey); + if ( key.Open(wxRegKey::Read) ) { + if ( key.QueryValue(wxT("Extension"), ext) ) { + return GetFileTypeFromExtension(ext); + } + } + + // unknown MIME type + return NULL; +} + +size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes) +{ + // enumerate all keys under MIME_DATABASE_KEY + wxRegKey key(wxRegKey::HKCR, MIME_DATABASE_KEY); + + wxString type; + long cookie; + bool cont = key.GetFirstKey(type, cookie); + while ( cont ) + { + mimetypes.Add(type); + + cont = key.GetNextKey(type, cookie); + } + + return mimetypes.GetCount(); +} + +// ---------------------------------------------------------------------------- +// create a new association +// ---------------------------------------------------------------------------- + +wxFileType *wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) +{ + wxCHECK_MSG( !ftInfo.GetExtensions().IsEmpty(), NULL, + _T("Associate() needs extension") ); + + bool ok; + int iExtCount = 0 ; + wxString filetype; + wxString extWithDot; + + wxString ext = ftInfo.GetExtensions()[iExtCount]; + + wxCHECK_MSG( !ext.empty(), NULL, + _T("Associate() needs non empty extension") ); + + if ( ext[0u] != _T('.') ) + extWithDot = _T('.'); + extWithDot += ext; + + // start by setting the HKCR\\.ext entries + // default is filetype; content type is mimetype + const wxString& filetypeOrig = ftInfo.GetShortDesc(); + + wxRegKey key(wxRegKey::HKCR, extWithDot); + if ( !key.Exists() ) + { + // create the mapping from the extension to the filetype + ok = key.Create(); + if ( ok ) + { + + if ( filetypeOrig.empty() ) + { + // make it up from the extension + filetype << extWithDot.c_str() + 1 << _T("_file"); + } + else + { + // just use the provided one + filetype = filetypeOrig; + } + + key.SetValue(wxEmptyString, filetype); + } + } + else + { + // key already exists, maybe we want to change it ?? + if (!filetypeOrig.empty()) + { + filetype = filetypeOrig; + key.SetValue(wxEmptyString, filetype); + } + else + { + key.QueryValue(wxEmptyString, filetype); + } + } + // now set a mimetypeif we have it, but ignore it if none + const wxString& mimetype = ftInfo.GetMimeType(); + if ( !mimetype.empty() ) + { + // set the MIME type + ok = key.SetValue(_T("Content Type"), mimetype); + + if ( ok ) + { + // create the MIME key + wxString strKey = MIME_DATABASE_KEY; + strKey << mimetype; + wxRegKey keyMIME(wxRegKey::HKCR, strKey); + ok = keyMIME.Create(); + + if ( ok ) + { + // and provide a back link to the extension + keyMIME.SetValue(_T("Extension"), extWithDot); + } + } + } + + + // now make other extensions have the same filetype + + for (iExtCount=1; iExtCount < ftInfo.GetExtensionsCount(); iExtCount++ ) + { + ext = ftInfo.GetExtensions()[iExtCount]; + if ( ext[0u] != _T('.') ) + extWithDot = _T('.'); + extWithDot += ext; + + wxRegKey key(wxRegKey::HKCR, extWithDot); + if ( !key.Exists() ) key.Create(); + key.SetValue(wxEmptyString, filetype); + + // now set any mimetypes we may have, but ignore it if none + const wxString& mimetype = ftInfo.GetMimeType(); + if ( !mimetype.empty() ) + { + // set the MIME type + ok = key.SetValue(_T("Content Type"), mimetype); + + if ( ok ) + { + // create the MIME key + wxString strKey = MIME_DATABASE_KEY; + strKey << mimetype; + wxRegKey keyMIME(wxRegKey::HKCR, strKey); + ok = keyMIME.Create(); + + if ( ok ) + { + // and provide a back link to the extension + keyMIME.SetValue(_T("Extension"), extWithDot); + } + } + } + + + } // end of for loop; all extensions now point to HKCR\.ext\Default + + // create the filetype key itself (it will be empty for now, but + // SetCommand(), SetDefaultIcon() &c will use it later) + wxRegKey keyFT(wxRegKey::HKCR, filetype); + keyFT.Create(); + + wxFileType *ft = CreateFileType(filetype, extWithDot); + + if (ft) + { + if (! ftInfo.GetOpenCommand ().IsEmpty() ) ft->SetCommand (ftInfo.GetOpenCommand (), wxT("open" ) ); + if (! ftInfo.GetPrintCommand().IsEmpty() ) ft->SetCommand (ftInfo.GetPrintCommand(), wxT("print" ) ); + // chris: I don't like the ->m_impl-> here FIX this ?? + if (! ftInfo.GetDescription ().IsEmpty() ) ft->m_impl->SetDescription (ftInfo.GetDescription ()) ; + if (! ftInfo.GetIconFile().IsEmpty() ) ft->SetDefaultIcon (ftInfo.GetIconFile(), ftInfo.GetIconIndex() ); + + } + return ft; +} + +bool wxFileTypeImpl::SetCommand(const wxString& cmd, + const wxString& verb, + bool WXUNUSED(overwriteprompt)) +{ + wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), FALSE, + _T("SetCommand() needs an extension and a verb") ); + + if ( !EnsureExtKeyExists() ) + return FALSE; + + wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); +#if 0 + if ( rkey.Exists() && overwriteprompt ) + { +#if wxUSE_GUI + wxString old; + rkey.QueryValue(wxEmptyString, old); + if ( wxMessageBox + ( + wxString::Format( + _("Do you want to overwrite the command used to %s " + "files with extension \"%s\" ?\nCurrent value is \n%s, " + "\nNew value is \n%s %1"), // bug here FIX need %1 ?? + verb.c_str(), + m_ext.c_str(), + old.c_str(), + cmd.c_str()), + _("Confirm registry update"), + wxYES_NO | wxICON_QUESTION + ) != wxYES ) +#endif // wxUSE_GUI + { + // cancelled by user + return FALSE; + } + } +#endif + // TODO: + // 1. translate '%s' to '%1' instead of always adding it + // 2. create DDEExec value if needed (undo GetCommand) + return rkey.Create() && rkey.SetValue(wxEmptyString, cmd + _T(" \"%1\"") ); +} + +/* // no longer used +bool wxFileTypeImpl::SetMimeType(const wxString& mimeTypeOrig) +{ + wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, _T("SetMimeType() needs extension") ); + + if ( !EnsureExtKeyExists() ) + return FALSE; + + // VZ: is this really useful? (FIXME) + wxString mimeType; + if ( !mimeTypeOrig ) + { + // make up a default value for it + wxString cmd; + wxSplitPath(GetCommand(_T("open")), NULL, &cmd, NULL); + mimeType << _T("application/x-") << cmd; + } + else + { + mimeType = mimeTypeOrig; + } + + wxRegKey rkey(wxRegKey::HKCR, m_ext); + return rkey.Create() && rkey.SetValue(_T("Content Type"), mimeType); +} +*/ + +bool wxFileTypeImpl::SetDefaultIcon(const wxString& cmd, int index) +{ + wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, _T("SetDefaultIcon() needs extension") ); + wxCHECK_MSG( !m_strFileType.IsEmpty(), FALSE, _T("File key not found") ); +// the next line fails on a SMBshare, I think because it is case mangled +// wxCHECK_MSG( !wxFileExists(cmd), FALSE, _T("Icon file not found.") ); + + if ( !EnsureExtKeyExists() ) + return FALSE; + + wxRegKey rkey(wxRegKey::HKCR, m_strFileType + _T("\\DefaultIcon")); + + return rkey.Create() && + rkey.SetValue(wxEmptyString, + wxString::Format(_T("%s,%d"), cmd.c_str(), index)); +} + +bool wxFileTypeImpl::SetDescription (const wxString& desc) +{ + wxCHECK_MSG( !m_strFileType.IsEmpty(), FALSE, _T("File key not found") ); + wxCHECK_MSG( !desc.IsEmpty(), FALSE, _T("No file description supplied") ); + + if ( !EnsureExtKeyExists() ) + return FALSE; + + wxRegKey rkey(wxRegKey::HKCR, m_strFileType ); + + return rkey.Create() && + rkey.SetValue(wxEmptyString, desc); +} + +// ---------------------------------------------------------------------------- +// remove file association +// ---------------------------------------------------------------------------- + +bool wxFileTypeImpl::Unassociate() +{ + bool result = TRUE; + if ( !RemoveOpenCommand() ) + result = FALSE; + if ( !RemoveDefaultIcon() ) + result = FALSE; + if ( !RemoveMimeType() ) + result = FALSE; + if ( !RemoveDescription() ) + result = FALSE; + +/* + //this might hold other keys, eg some have CSLID keys + if ( result ) + { + // delete the root key + wxRegKey key(wxRegKey::HKCR, m_ext); + if ( key.Exists() ) + result = key.DeleteSelf(); + } +*/ + return result; +} + +bool wxFileTypeImpl::RemoveOpenCommand() +{ + return RemoveCommand(_T("open")); +} + +bool wxFileTypeImpl::RemoveCommand(const wxString& verb) +{ + wxCHECK_MSG( !m_ext.IsEmpty() && !verb.IsEmpty(), FALSE, + _T("RemoveCommand() needs an extension and a verb") ); + + wxString sKey = m_strFileType; + wxRegKey rkey(wxRegKey::HKCR, GetVerbPath(verb)); + + // if the key already doesn't exist, it's a success + return !rkey.Exists() || rkey.DeleteSelf(); +} + +bool wxFileTypeImpl::RemoveMimeType() +{ + wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, _T("RemoveMimeType() needs extension") ); + + wxRegKey rkey(wxRegKey::HKCR, m_ext); + return !rkey.Exists() || rkey.DeleteSelf(); +} + +bool wxFileTypeImpl::RemoveDefaultIcon() +{ + wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, + _T("RemoveDefaultIcon() needs extension") ); + + wxRegKey rkey (wxRegKey::HKCR, m_strFileType + _T("\\DefaultIcon")); + return !rkey.Exists() || rkey.DeleteSelf(); +} + +bool wxFileTypeImpl::RemoveDescription() +{ + wxCHECK_MSG( !m_ext.IsEmpty(), FALSE, + _T("RemoveDescription() needs extension") ); + + wxRegKey rkey (wxRegKey::HKCR, m_strFileType ); + return !rkey.Exists() || rkey.DeleteSelf(); +} + +#endif // wxUSE_MIMETYPE +#endif // __PALMOS__ diff --git a/src/palmos/minifram.cpp b/src/palmos/minifram.cpp new file mode 100644 index 0000000000..5180dd713d --- /dev/null +++ b/src/palmos/minifram.cpp @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: minifram.cpp +// Purpose: wxMiniFrame +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "minifram.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#endif + +#include "wx/minifram.h" + +IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) + diff --git a/src/palmos/msgdlg.cpp b/src/palmos/msgdlg.cpp new file mode 100644 index 0000000000..689982e0d3 --- /dev/null +++ b/src/palmos/msgdlg.cpp @@ -0,0 +1,161 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: msgdlg.cpp +// Purpose: wxMessageDialog +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "msgdlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/defs.h" + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/msgdlg.h" +#endif + +IMPLEMENT_CLASS(wxMessageDialog, wxDialog) + +wxMessageDialog::wxMessageDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + long style, + const wxPoint& WXUNUSED(pos)) +{ +#ifdef __WXDEBUG__ + // check for common programming errors + if ( (style & wxID_OK) == wxID_OK ) + { + // programmer probably confused wxID_OK with wxOK. Correct one is wxOK. + wxFAIL_MSG( _T("wxMessageBox: Did you mean wxOK (and not wxID_OK)?") ); + } +#endif // __WXDEBUG__ + + m_caption = caption; + m_message = message; + m_dialogStyle = style; + m_parent = parent; +} + +int wxMessageDialog::ShowModal() +{ + int AlertID=1000; + int Result=0; + int wxResult=wxID_OK; + + // Handle to the currently running application database + DmOpenRef AppDB; + SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB); + + // Translate wx styles into Palm OS styles + if (m_dialogStyle & wxYES_NO) + { + if (m_dialogStyle & wxCANCEL) + AlertID=1300; // Yes No Cancel + else + AlertID=1200; // Yes No + } + if (m_dialogStyle & wxOK) + { + if (m_dialogStyle & wxCANCEL) + AlertID=1100; // Ok Cancel + else + AlertID=1000; // Ok + } + + // Add the icon styles + if (m_dialogStyle & wxICON_EXCLAMATION) + AlertID=AlertID+0; // Warning + else if (m_dialogStyle & wxICON_HAND) + AlertID=AlertID+1; // Error + else if (m_dialogStyle & wxICON_INFORMATION) + AlertID=AlertID+2; // Information + else if (m_dialogStyle & wxICON_QUESTION) + AlertID=AlertID+3; // Confirmation + + // The Palm OS Dialog API does not support custom titles in a dialog box. + // So we have to set the title by manipulating the resource. + + // Get the alert resource + char *AlertPtr; + MemHandle AlertHandle; + AlertHandle=DmGetResource(AppDB,'Talt',AlertID); + + AlertPtr=(char *)MemHandleLock(AlertHandle); + AlertPtr+=8; + + // Clear out any old title. This must be done with a static array of chars + // because using MemSet is not supported on resources and could result in + // crashes or unpredictable behaviour. + char ClearTitle[25]={' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; + MemMove(AlertPtr,&ClearTitle,25); + + // Get the title length and make sure it is not too long + int TitleLength=m_caption.length(); + if(TitleLength>25) + TitleLength=25; + + // Center the title in the window + int BufferLength=(25-TitleLength)/2; + AlertPtr+=BufferLength; + + // Copy the title + MemMove(AlertPtr,m_caption.c_str(),TitleLength); + + // Release the resource + MemHandleUnlock(AlertHandle); + DmReleaseResource(AlertHandle); + + // Display the dialog + Result=FrmCustomAlert(AppDB,AlertID,m_message.c_str(),"",""); + + // Convert the Palm OS result to wxResult + if(AlertID<1100) + { + // Ok + wxResult=wxID_OK; + } + else if(AlertID<1200) + { + // Ok Cancel + if(Result==0) + wxResult=wxID_OK; + else + wxResult=wxID_CANCEL; + } + else if(AlertID<1300) + { + // Yes No + if(Result==0) + wxResult=wxID_YES; + else + wxResult=wxID_NO; + } + else + { + // Yes No Cancel + if(Result==0) + wxResult=wxID_YES; + else if(Result==1) + wxResult=wxID_NO; + else + wxResult=wxID_CANCEL; + } + + return wxResult; +} + diff --git a/src/palmos/mslu.cpp b/src/palmos/mslu.cpp new file mode 100644 index 0000000000..673c0d51c9 --- /dev/null +++ b/src/palmos/mslu.cpp @@ -0,0 +1,211 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: msw/mslu.cpp +// Purpose: Fixes for bugs in MSLU +// Author: Vaclav Slavik +// Modified by: +// Created: 2002/02/17 +// RCS-ID: $Id$ +// Copyright: (c) 2002 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +// This may or may not apply to Palm OS in the future, but for right now Unicode +// is not supported. +#ifndef __PALMOS__ + +#ifdef __BORLANDC__ +#pragma hdrstop +#include +#endif + +#ifndef WX_PRECOMP + #include "wx/defs.h" +#endif + +#if wxUSE_UNICODE_MSLU + +//------------------------------------------------------------------------ +// +// NB: MSLU only covers Win32 API, it doesn't provide Unicode implementation of +// libc functions. Unfortunately, some of MSVCRT wchar_t functions +// (e.g. _wopen) don't work on Windows 9x, so we have to workaround it +// by calling the char version. We still want to use wchar_t version on +// NT/2000/XP, though, because they allow for Unicode file names. +// +// Moreover, there are bugs in unicows.dll, of course. We have to +// workaround them, too. +// +//------------------------------------------------------------------------ + +#include "wx/msw/private.h" +#include "wx/msw/mslu.h" + +#include +#include +#include + +#ifdef __VISUALC__ + #include +#endif + +// Undef redirection macros defined in wx/msw/mslu.h: +#undef DrawStateW +#undef GetOpenFileNameW +#undef GetSaveFileNameW + +//------------------------------------------------------------------------ +// Wrongly implemented functions from unicows.dll +//------------------------------------------------------------------------ + +#if wxUSE_GUI + +WXDLLEXPORT int wxMSLU_DrawStateW(WXHDC dc, WXHBRUSH br, WXFARPROC outputFunc, + WXLPARAM lData, WXWPARAM wData, + int x, int y, int cx, int cy, + unsigned int flags) +{ + // VS: There's yet another bug in MSLU: DrawStateW behaves like if it was + // expecting char*, not wchar_t* input. We have to use DrawStateA + // explicitly. + + if ( wxUsingUnicowsDll() ) + { + return DrawStateA((HDC)dc, (HBRUSH)br, (DRAWSTATEPROC)outputFunc, + (LPARAM)(const char*) + wxConvLocal.cWX2MB((const wxChar*)lData), + wData, x, y, cx, cy, flags); + } + else + { + return DrawStateW((HDC)dc, (HBRUSH)br, (DRAWSTATEPROC)outputFunc, + lData, wData, x, y, cx, cy, flags); + } +} + +static void wxFixOPENFILENAME(LPOPENFILENAME ofn) +{ +#ifdef OFN_EXPLORER + // VS: there's a bug in unicows.dll - when multiple files are selected, + // of.nFileOffset doesn't point to the first filename but rather to + // the last component of directory name. This bug is known to MSLU + // developers, but they are not going to fix it: "this is a true + // limitation, that we have decided to live with" and "working + // harder on this case just did not seem worth the effort"... + // + // Our only option is to try to fix it ourselves: + + if ( (ofn->Flags & OFN_ALLOWMULTISELECT) && + ofn->lpstrFile[ofn->nFileOffset-1] != wxT('\0') ) + { + if ( wxDirExists(ofn->lpstrFile) ) + { + // 1st component is dir => multiple files selected + ofn->nFileOffset = wxStrlen(ofn->lpstrFile)+1; + } + } +#endif +} + +WXDLLEXPORT int wxMSLU_GetOpenFileNameW(void *ofn) +{ + int ret = GetOpenFileName((LPOPENFILENAME)ofn); + if ( wxUsingUnicowsDll() && ret != 0 ) + wxFixOPENFILENAME((LPOPENFILENAME)ofn); + return ret; +} + +WXDLLEXPORT int wxMSLU_GetSaveFileNameW(void *ofn) +{ + int ret = GetSaveFileName((LPOPENFILENAME)ofn); + if ( wxUsingUnicowsDll() && ret != 0 ) + wxFixOPENFILENAME((LPOPENFILENAME)ofn); + return ret; +} + +#endif // wxUSE_GUI + +//------------------------------------------------------------------------ +// Missing libc file manipulation functions in Win9x +//------------------------------------------------------------------------ + +#if wxUSE_BASE + +WXDLLEXPORT int wxMSLU__trename(const wxChar *oldname, const wxChar *newname) +{ + if ( wxUsingUnicowsDll() ) + return rename(wxConvFile.cWX2MB(oldname), wxConvFile.cWX2MB(newname)); + else + return _trename(oldname, newname); +} + +WXDLLEXPORT int wxMSLU__tremove(const wxChar *name) +{ + if ( wxUsingUnicowsDll() ) + return remove(wxConvFile.cWX2MB(name)); + else + return _tremove(name); +} + +#if defined( __VISUALC__ ) \ + || ( defined(__MINGW32__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ + || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ + || ( defined(__BORLANDC__) && (__BORLANDC__ > 0x460) ) + +WXDLLEXPORT int wxMSLU__wopen(const wxChar *name, int flags, int mode) +{ + if ( wxUsingUnicowsDll() ) +#ifdef __BORLANDC__ + return open(wxConvFile.cWX2MB(name), flags, mode); +#else + return _open(wxConvFile.cWX2MB(name), flags, mode); +#endif + else + return _wopen(name, flags, mode); +} + +WXDLLEXPORT int wxMSLU__waccess(const wxChar *name, int mode) +{ + if ( wxUsingUnicowsDll() ) + return _access(wxConvFile.cWX2MB(name), mode); + else + return _waccess(name, mode); +} + +WXDLLEXPORT int wxMSLU__wmkdir(const wxChar *name) +{ + if ( wxUsingUnicowsDll() ) + return _mkdir(wxConvFile.cWX2MB(name)); + else + return _wmkdir(name); +} + +WXDLLEXPORT int wxMSLU__wrmdir(const wxChar *name) +{ + if ( wxUsingUnicowsDll() ) + return _rmdir(wxConvFile.cWX2MB(name)); + else + return _wrmdir(name); +} + +WXDLLEXPORT int wxMSLU__wstat(const wxChar *name, struct _stat *buffer) +{ + if ( wxUsingUnicowsDll() ) + return _stat((const char*)wxConvFile.cWX2MB(name), buffer); + else + return _wstat(name, buffer); +} + +#endif // compilers having wopen() &c + +#endif // wxUSE_BASE + +#endif // wxUSE_UNICODE_MSLU + +#endif // __PALMOS__ diff --git a/src/palmos/nativdlg.cpp b/src/palmos/nativdlg.cpp new file mode 100644 index 0000000000..015967eb44 --- /dev/null +++ b/src/palmos/nativdlg.cpp @@ -0,0 +1,84 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: nativdlg.cpp +// Purpose: Native dialog loading code (part of wxWindow) +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include + + #include "wx/wx.h" +#endif + +#include "wx/spinbutt.h" + +// --------------------------------------------------------------------------- +// global functions +// --------------------------------------------------------------------------- + +// =========================================================================== +// implementation +// =========================================================================== + +bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id) +{ + return false; +} + +bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name) +{ + return false; +} + +// --------------------------------------------------------------------------- +// look for child by id +// --------------------------------------------------------------------------- + +wxWindow* wxWindow::GetWindowChild1(wxWindowID id) +{ + return NULL; +} + +wxWindow* wxWindow::GetWindowChild(wxWindowID id) +{ + return NULL; +} + +// --------------------------------------------------------------------------- +// create wxWin window from a native HWND +// --------------------------------------------------------------------------- + +wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) +{ + return NULL; +} + +// Make sure the window style (etc.) reflects the HWND style (roughly) +void wxWindow::AdoptAttributesFromHWND(void) +{ +} + diff --git a/src/palmos/notebook.cpp b/src/palmos/notebook.cpp new file mode 100644 index 0000000000..328b7fcd76 --- /dev/null +++ b/src/palmos/notebook.cpp @@ -0,0 +1,412 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/notebook.cpp +// Purpose: implementation of wxNotebook +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "notebook.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_NOTEBOOK + +// wxWidgets +#ifndef WX_PRECOMP + #include "wx/string.h" +#endif // WX_PRECOMP + +#include "wx/log.h" +#include "wx/imaglist.h" +#include "wx/event.h" +#include "wx/control.h" +#include "wx/notebook.h" +#include "wx/app.h" + +#include "wx/palmos/private.h" + +#include "wx/palmos/winundef.h" + +#if wxUSE_UXTHEME +#include "wx/palmos/uxtheme.h" + +#include "wx/radiobut.h" +#include "wx/radiobox.h" +#include "wx/checkbox.h" +#include "wx/bmpbuttn.h" +#include "wx/statline.h" +#include "wx/statbox.h" +#include "wx/stattext.h" +#include "wx/slider.h" +#include "wx/scrolwin.h" +#include "wx/panel.h" +#endif + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// check that the page index is valid +#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount()) + +// hide the ugly cast +#define m_hwnd (HWND)GetHWND() + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// This is a work-around for missing defines in gcc-2.95 headers +#ifndef TCS_RIGHT + #define TCS_RIGHT 0x0002 +#endif + +#ifndef TCS_VERTICAL + #define TCS_VERTICAL 0x0080 +#endif + +#ifndef TCS_BOTTOM + #define TCS_BOTTOM TCS_RIGHT +#endif + +// ---------------------------------------------------------------------------- +// event table +// ---------------------------------------------------------------------------- + +#include + +WX_DEFINE_LIST( wxNotebookPageInfoList ) ; + +DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING) + +BEGIN_EVENT_TABLE(wxNotebook, wxControl) + EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange) + + EVT_SIZE(wxNotebook::OnSize) + + EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) +END_EVENT_TABLE() + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxNotebookStyle ) + +wxBEGIN_FLAGS( wxNotebookStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxNB_FIXEDWIDTH) + wxFLAGS_MEMBER(wxNB_LEFT) + wxFLAGS_MEMBER(wxNB_RIGHT) + wxFLAGS_MEMBER(wxNB_BOTTOM) + +wxEND_FLAGS( wxNotebookStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxControl,"wx/notebook.h") +IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject , "wx/notebook.h" ) + +wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo * , wxNotebookPageInfoList ) ; + +template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + +wxBEGIN_PROPERTIES_TABLE(wxNotebook) + wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent ) + wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent ) + + wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxNotebook) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxNotebook , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle) + + +wxBEGIN_PROPERTIES_TABLE(wxNotebookPageInfo) + wxREADONLY_PROPERTY( Page , wxNotebookPage* , GetPage , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxREADONLY_PROPERTY( Text , wxString , GetText , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxREADONLY_PROPERTY( Selected , bool , GetSelected , false, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxREADONLY_PROPERTY( ImageId , int , GetImageId , -1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxNotebookPageInfo) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , bool , Selected , int , ImageId ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject ) +#endif +IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxNotebook construction +// ---------------------------------------------------------------------------- + +const wxNotebookPageInfoList& wxNotebook::GetPageInfos() const +{ + wxNotebookPageInfoList* list; + + return m_pageInfos ; +} + +// common part of all ctors +void wxNotebook::Init() +{ +} + +// default for dynamic class +wxNotebook::wxNotebook() +{ +} + +// the same arguments as for wxControl +wxNotebook::wxNotebook(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ +} + +// Create() function +bool wxNotebook::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +WXDWORD wxNotebook::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// wxNotebook accessors +// ---------------------------------------------------------------------------- + +size_t wxNotebook::GetPageCount() const +{ + return 0; +} + +int wxNotebook::GetRowCount() const +{ + return 0; +} + +int wxNotebook::SetSelection(size_t nPage) +{ + return 0; +} + +bool wxNotebook::SetPageText(size_t nPage, const wxString& strText) +{ + return false; +} + +wxString wxNotebook::GetPageText(size_t nPage) const +{ + wxString str; + + return str; +} + +int wxNotebook::GetPageImage(size_t nPage) const +{ + return -1; +} + +bool wxNotebook::SetPageImage(size_t nPage, int nImage) +{ + return false; +} + +void wxNotebook::SetImageList(wxImageList* imageList) +{ +} + +// ---------------------------------------------------------------------------- +// wxNotebook size settings +// ---------------------------------------------------------------------------- + +void wxNotebook::SetPageSize(const wxSize& size) +{ +} + +void wxNotebook::SetPadding(const wxSize& padding) +{ +} + +void wxNotebook::SetTabSize(const wxSize& sz) +{ +} + +wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const +{ + return wxSize(0,0); +} + +void wxNotebook::AdjustPageSize(wxNotebookPage *page) +{ +} + +// ---------------------------------------------------------------------------- +// wxNotebook operations +// ---------------------------------------------------------------------------- + +// remove one page from the notebook, without deleting +wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage) +{ + return NULL; +} + +// remove all pages +bool wxNotebook::DeleteAllPages() +{ + return true; +} + +// same as AddPage() but does it at given position +bool wxNotebook::InsertPage(size_t nPage, + wxNotebookPage *pPage, + const wxString& strText, + bool bSelect, + int imageId) +{ + return false; +} + +int wxNotebook::HitTest(const wxPoint& pt, long *flags) const +{ + return 0; +} + + +// ---------------------------------------------------------------------------- +// wxNotebook callbacks +// ---------------------------------------------------------------------------- + +void wxNotebook::OnSize(wxSizeEvent& event) +{ +} + +void wxNotebook::OnSelChange(wxNotebookEvent& event) +{ +} + +bool wxNotebook::MSWTranslateMessage(WXMSG *wxmsg) +{ + return false; +} + +void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) +{ +} + +// ---------------------------------------------------------------------------- +// wxNotebook base class virtuals +// ---------------------------------------------------------------------------- + +#if wxUSE_CONSTRAINTS + +// override these 2 functions to do nothing: everything is done in OnSize + +void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse)) +{ +} + +bool wxNotebook::DoPhase(int WXUNUSED(nPhase)) +{ + return true; +} + +#endif // wxUSE_CONSTRAINTS + +// ---------------------------------------------------------------------------- +// wxNotebook Windows message handlers +// ---------------------------------------------------------------------------- + +bool wxNotebook::MSWOnScroll(int orientation, WXWORD nSBCode, + WXWORD pos, WXHWND control) +{ + return false; +} + +bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result) +{ + return false; +} + +// Windows only: attempts to get colour for UX theme page background +wxColour wxNotebook::GetThemeBackgroundColour() +{ + return wxColour; +} + +// Windows only: attempts to apply the UX theme page background to this page +#if wxUSE_UXTHEME +void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour) +#else +void wxNotebook::ApplyThemeBackground(wxWindow*, const wxColour&) +#endif +{ +} + +#if wxUSE_UXTHEME +WXLRESULT wxNotebook::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} +#endif // #if wxUSE_UXTHEME + +#endif // wxUSE_NOTEBOOK diff --git a/src/palmos/ownerdrw.cpp b/src/palmos/ownerdrw.cpp new file mode 100644 index 0000000000..83dc9bc366 --- /dev/null +++ b/src/palmos/ownerdrw.cpp @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/ownerdrw.cpp +// Purpose: implementation of wxOwnerDrawn class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/font.h" + #include "wx/bitmap.h" + #include "wx/dcmemory.h" + #include "wx/menu.h" + #include "wx/utils.h" +#endif + +#include "wx/settings.h" +#include "wx/ownerdrw.h" +#include "wx/menuitem.h" +#include "wx/fontutil.h" +#include "wx/module.h" + +#if wxUSE_OWNER_DRAWN + +class wxMSWSystemMenuFontModule : public wxModule +{ +public: + + virtual bool OnInit() + { + ms_systemMenuFont = new wxFont; + +#if defined(__WXMSW__) && defined(__WIN32__) && defined(SM_CXMENUCHECK) + NONCLIENTMETRICS nm; + nm.cbSize = sizeof(NONCLIENTMETRICS); + SystemParametersInfo(SPI_GETNONCLIENTMETRICS,0,&nm,0); + + ms_systemMenuButtonWidth = nm.iMenuHeight; + ms_systemMenuHeight = nm.iMenuHeight; + + // create menu font + wxNativeFontInfo info; + memcpy(&info.lf, &nm.lfMenuFont, sizeof(LOGFONT)); + ms_systemMenuFont->Create(info); +#endif + + return true; + } + + virtual void OnExit() + { + delete ms_systemMenuFont; + ms_systemMenuFont = NULL; + } + + static wxFont* ms_systemMenuFont; + static int ms_systemMenuButtonWidth; // windows clean install default + static int ms_systemMenuHeight; // windows clean install default +private: + DECLARE_DYNAMIC_CLASS(wxMSWSystemMenuFontModule) +}; + +// these static variables are by the wxMSWSystemMenuFontModule object +// and reflect the system settings returned by the Win32 API's +// SystemParametersInfo() call. + +wxFont* wxMSWSystemMenuFontModule::ms_systemMenuFont = NULL; +int wxMSWSystemMenuFontModule::ms_systemMenuButtonWidth = 18; // windows clean install default +int wxMSWSystemMenuFontModule::ms_systemMenuHeight = 18; // windows clean install default + +IMPLEMENT_DYNAMIC_CLASS(wxMSWSystemMenuFontModule, wxModule) + +// ============================================================================ +// implementation of wxOwnerDrawn class +// ============================================================================ + +// ctor +// ---- +wxOwnerDrawn::wxOwnerDrawn(const wxString& str, + bool bCheckable, bool bMenuItem) + : m_strName(str) +{ +} + + +// these items will be set during the first invocation of the c'tor, +// because the values will be determined by checking the system settings, +// which is a chunk of code +size_t wxOwnerDrawn::ms_nDefaultMarginWidth = 0; +size_t wxOwnerDrawn::ms_nLastMarginWidth = 0; + + +// drawing +// ------- + +// get size of the item +// The item size includes the menu string, the accel string, +// the bitmap and size for a submenu expansion arrow... +bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) +{ + return false; +} + +// draw the item +bool wxOwnerDrawn::OnDrawItem(wxDC& dc, + const wxRect& rc, + wxODAction act, + wxODStatus st) +{ + return false; +} + + +#endif // wxUSE_OWNER_DRAWN + diff --git a/src/palmos/palette.cpp b/src/palmos/palette.cpp new file mode 100644 index 0000000000..529840dcbd --- /dev/null +++ b/src/palmos/palette.cpp @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palette.cpp +// Purpose: wxPalette +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "palette.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_PALETTE + +#ifndef WX_PRECOMP + #include "wx/palette.h" +#endif + +#include "wx/palmos/private.h" + +IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) + +/* + * Palette + * + */ + +wxPaletteRefData::wxPaletteRefData(void) +{ +} + +wxPaletteRefData::~wxPaletteRefData(void) +{ +} + +wxPalette::wxPalette(void) +{ +} + +wxPalette::wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) +{ +} + +wxPalette::~wxPalette(void) +{ +} + +bool wxPalette::FreeResource(bool WXUNUSED(force)) +{ + return false; +} + +bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue) +{ + return false; +} + +int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const +{ + return 0; +} + +bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const +{ + return false; +} + +void wxPalette::SetHPALETTE(WXHPALETTE pal) +{ +} + +#endif // wxUSE_PALETTE + diff --git a/src/palmos/pen.cpp b/src/palmos/pen.cpp new file mode 100644 index 0000000000..6cfa473f45 --- /dev/null +++ b/src/palmos/pen.cpp @@ -0,0 +1,122 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/pen.cpp +// Purpose: wxPen +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "pen.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include +#include "wx/setup.h" +#include "wx/list.h" +#include "wx/utils.h" +#include "wx/app.h" +#include "wx/pen.h" +#endif + +static int wx2msPenStyle(int wx_style); + +IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) + +wxPenRefData::wxPenRefData() +{ +} + +wxPenRefData::wxPenRefData(const wxPenRefData& data) +{ +} + +wxPenRefData::~wxPenRefData() +{ +} + +// Pens + +wxPen::wxPen() +{ +} + +wxPen::~wxPen() +{ +} + +// Should implement Create +wxPen::wxPen(const wxColour& col, int Width, int Style) +{ +} + +wxPen::wxPen(const wxBitmap& stipple, int Width) +{ +} + +bool wxPen::RealizeResource() +{ + return false; +} + +WXHANDLE wxPen::GetResourceHandle() const +{ + return 0; +} + +bool wxPen::FreeResource(bool WXUNUSED(force)) +{ + return false; +} + +bool wxPen::IsFree() const +{ + return false; +} + +void wxPen::Unshare() +{ +} + +void wxPen::SetColour(const wxColour& col) +{ +} + +void wxPen::SetColour(unsigned char r, unsigned char g, unsigned char b) +{ +} + +void wxPen::SetWidth(int Width) +{ +} + +void wxPen::SetStyle(int Style) +{ +} + +void wxPen::SetStipple(const wxBitmap& Stipple) +{ +} + +void wxPen::SetDashes(int nb_dashes, const wxDash *Dash) +{ +} + +void wxPen::SetJoin(int Join) +{ +} + +void wxPen::SetCap(int Cap) +{ +} + diff --git a/src/palmos/popupwin.cpp b/src/palmos/popupwin.cpp new file mode 100644 index 0000000000..219a66d261 --- /dev/null +++ b/src/palmos/popupwin.cpp @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/popupwin.cpp +// Purpose: implements wxPopupWindow for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "popup.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/defs.h" +#endif //WX_PRECOMP + +#if wxUSE_POPUPWIN + +#include "wx/popupwin.h" + +#include "wx/palmos/private.h" // for GetDesktopWindow() + +IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) + +// ============================================================================ +// implementation +// ============================================================================ + +bool wxPopupWindow::Create(wxWindow *parent, int flags) +{ + return false; +} + +void wxPopupWindow::DoGetPosition(int *x, int *y) const +{ +} + +WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const +{ + return 0; +} + +WXHWND wxPopupWindow::MSWGetParent() const +{ + return (WXHWND) 0; +} + +bool wxPopupWindow::Show(bool show) +{ + return false; +} + +#endif // #if wxUSE_POPUPWIN + diff --git a/src/palmos/printdlg.cpp b/src/palmos/printdlg.cpp new file mode 100644 index 0000000000..aeba3d3ac6 --- /dev/null +++ b/src/palmos/printdlg.cpp @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: printdlg.cpp +// Purpose: wxPrintDialog, wxPageSetupDialog +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "printdlg.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// Don't use the Windows print dialog if we're in wxUniv mode and using +// the PostScript architecture +#if wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXUNIVERSAL__) || !wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) + +#ifndef WX_PRECOMP + #include "wx/app.h" +#endif + +#include "wx/printdlg.h" +#include "wx/dcprint.h" + +#include "wx/palmos/private.h" + +// --------------------------------------------------------------------------- +// wxWin macros +// --------------------------------------------------------------------------- + + IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) + IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog) + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxPrintDialog +// --------------------------------------------------------------------------- + +wxPrintDialog::wxPrintDialog() +{ +} + +wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data) +{ +} + +wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data) +{ +} + +bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data) +{ + return false; +} + +wxPrintDialog::~wxPrintDialog() +{ +} + +int wxPrintDialog::ShowModal() +{ + return wxID_CANCEL; +} + +wxDC *wxPrintDialog::GetPrintDC() +{ + return (wxDC*) NULL; +} + +// --------------------------------------------------------------------------- +// wxPageSetupDialog +// --------------------------------------------------------------------------- + +wxPageSetupDialog::wxPageSetupDialog() +{ +} + +wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data) +{ +} + +bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data) +{ + return false; +} + +wxPageSetupDialog::~wxPageSetupDialog() +{ +} + +int wxPageSetupDialog::ShowModal() +{ + return wxID_CANCEL; +} + +#endif + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/palmos/printpalm.cpp b/src/palmos/printpalm.cpp new file mode 100644 index 0000000000..2051c02818 --- /dev/null +++ b/src/palmos/printpalm.cpp @@ -0,0 +1,130 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: printpalm.cpp +// Purpose: wxPalmPrinter framework +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "printpalm.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/defs.h" + +// Don't use the Windows printer if we're in wxUniv mode and using +// the PostScript architecture +#if wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXUNIVERSAL__) || !wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/palmos/private.h" + #include "wx/utils.h" + #include "wx/dc.h" + #include "wx/app.h" + #include "wx/msgdlg.h" + #include "wx/intl.h" +#endif + +#include "wx/palmos/printpalm.h" +#include "wx/dcprint.h" +#include "wx/printdlg.h" +#include "wx/log.h" +#include "wx/palmos/private.h" + +// --------------------------------------------------------------------------- +// private functions +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// wxWin macros +// --------------------------------------------------------------------------- + + IMPLEMENT_DYNAMIC_CLASS(wxPalmPrinter, wxPrinterBase) + IMPLEMENT_CLASS(wxPalmPrintPreview, wxPrintPreviewBase) + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// Printer +// --------------------------------------------------------------------------- + +wxPalmPrinter::wxPalmPrinter(wxPrintDialogData *data) + : wxPrinterBase(data) +{ +} + +wxPalmPrinter::~wxPalmPrinter() +{ +} + +bool wxPalmPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) +{ + return false; +} + +wxDC* wxPalmPrinter::PrintDialog(wxWindow *parent) +{ + wxDC* dc = (wxDC*) NULL; + + return dc; +} + +bool wxPalmPrinter::Setup(wxWindow *parent) +{ + return false; +} + +/* +* Print preview +*/ + +wxPalmPrintPreview::wxPalmPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintDialogData *data) + : wxPrintPreviewBase(printout, printoutForPrinting, data) +{ +} + +wxPalmPrintPreview::wxPalmPrintPreview(wxPrintout *printout, + wxPrintout *printoutForPrinting, + wxPrintData *data) + : wxPrintPreviewBase(printout, printoutForPrinting, data) +{ +} + +wxPalmPrintPreview::~wxPalmPrintPreview() +{ +} + +bool wxPalmPrintPreview::Print(bool interactive) +{ + return false; +} + +void wxPalmPrintPreview::DetermineScaling() +{ +} + +#endif + // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/palmos/radiobox.cpp b/src/palmos/radiobox.cpp new file mode 100644 index 0000000000..c7674fd5ba --- /dev/null +++ b/src/palmos/radiobox.cpp @@ -0,0 +1,321 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/radiobox.cpp +// Purpose: wxRadioBox implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "radiobox.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_RADIOBOX + +#ifndef WX_PRECOMP + #include "wx/bitmap.h" + #include "wx/brush.h" + #include "wx/radiobox.h" + #include "wx/settings.h" + #include "wx/log.h" +#endif + +#include "wx/palmos/private.h" + +#if wxUSE_TOOLTIPS + #include "wx/tooltip.h" +#endif // wxUSE_TOOLTIPS + +// TODO: wxCONSTRUCTOR +#if 0 // wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxRadioBoxStyle ) + +wxBEGIN_FLAGS( wxRadioBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxRA_SPECIFY_COLS) + wxFLAGS_MEMBER(wxRA_HORIZONTAL) + wxFLAGS_MEMBER(wxRA_SPECIFY_ROWS) + wxFLAGS_MEMBER(wxRA_VERTICAL) + +wxEND_FLAGS( wxRadioBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl,"wx/radiobox.h") + +wxBEGIN_PROPERTIES_TABLE(wxRadioBox) + wxEVENT_PROPERTY( Select , wxEVT_COMMAND_RADIOBOX_SELECTED , wxCommandEvent ) + wxPROPERTY_FLAGS( WindowStyle , wxRadioBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +#else +IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) +#endif + +/* + selection + content + label + dimension + item +*/ + +#define RADIOBTN_PARENT_IS_RADIOBOX 0 + +// --------------------------------------------------------------------------- +// private functions +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// global vars +// --------------------------------------------------------------------------- + +// the pointer to standard radio button wnd proc +static WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL; + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxRadioBox +// --------------------------------------------------------------------------- + +int wxRadioBox::GetCount() const +{ + return 0; +} + +int wxRadioBox::GetColumnCount() const +{ + return 0; +} + +int wxRadioBox::GetRowCount() const +{ + return 0; +} + +// returns the number of rows +int wxRadioBox::GetNumVer() const +{ + return 0; +} + +// returns the number of columns +int wxRadioBox::GetNumHor() const +{ + return 0; +} + +bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) +{ + return FALSE; +} + +// Radio box item +wxRadioBox::wxRadioBox() +{ +} + +bool wxRadioBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + int n, + const wxString choices[], + int majorDim, + long style, + const wxValidator& val, + const wxString& name) +{ + return false; +} + +bool wxRadioBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim, + long style, + const wxValidator& val, + const wxString& name) +{ + return false; +} + +wxRadioBox::~wxRadioBox() +{ +} + +void wxRadioBox::SetString(int item, const wxString& label) +{ +} + +void wxRadioBox::SetSelection(int N) +{ +} + +// Get single selection, for single choice list items +int wxRadioBox::GetSelection() const +{ + return 0; +} + +// Find string for position +wxString wxRadioBox::GetString(int item) const +{ + wxString ret; + + return ret; +} + +// ---------------------------------------------------------------------------- +// size calculations +// ---------------------------------------------------------------------------- + +wxSize wxRadioBox::GetMaxButtonSize() const +{ + return wxSize(0,0); +} + +wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const +{ + return wxSize(0,0); +} + +wxSize wxRadioBox::DoGetBestSize() const +{ + return wxSize(0,0); +} + +// Restored old code. +void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) +{ +} + +void wxRadioBox::GetSize(int *width, int *height) const +{ +} + +void wxRadioBox::GetPosition(int *x, int *y) const +{ +} + +void wxRadioBox::SetFocus() +{ +} + +bool wxRadioBox::Show(bool show) +{ + return false; +} + +// Enable a specific button +void wxRadioBox::Enable(int item, bool enable) +{ +} + +// Enable all controls +bool wxRadioBox::Enable(bool enable) +{ + return false; +} + +// Show a specific button +void wxRadioBox::Show(int item, bool show) +{ +} + +bool wxRadioBox::ContainsHWND(WXHWND hWnd) const +{ + return false; +} + +void wxRadioBox::Command(wxCommandEvent & event) +{ +} + +void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn) +{ +} + +void wxRadioBox::SendNotificationEvent() +{ +} + +bool wxRadioBox::SetFont(const wxFont& font) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// our window proc +// ---------------------------------------------------------------------------- + +WXLRESULT wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), +#if wxUSE_CTL3D + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam +#else + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) +#endif + ) +{ + return (WXHBRUSH)0; +} + +#endif // wxUSE_RADIOBOX diff --git a/src/palmos/radiobut.cpp b/src/palmos/radiobut.cpp new file mode 100644 index 0000000000..5cc2082836 --- /dev/null +++ b/src/palmos/radiobut.cpp @@ -0,0 +1,157 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/radiobut.cpp +// Purpose: wxRadioButton +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "radiobut.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_RADIOBTN + +#ifndef WX_PRECOMP + #include "wx/radiobut.h" + #include "wx/settings.h" + #include "wx/dcscreen.h" +#endif + +#include "wx/palmos/private.h" + +// ============================================================================ +// wxRadioButton implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxRadioButton creation +// ---------------------------------------------------------------------------- + + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxRadioButtonStyle ) + +wxBEGIN_FLAGS( wxRadioButtonStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxRB_GROUP) + +wxEND_FLAGS( wxRadioButtonStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioButton, wxControl,"wx/radiobut.h") + +wxBEGIN_PROPERTIES_TABLE(wxRadioButton) + wxEVENT_PROPERTY( Click , wxEVT_COMMAND_RADIOBUTTON_SELECTED , wxCommandEvent ) + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Value ,bool, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY_FLAGS( WindowStyle , wxRadioButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxRadioButton) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxRadioButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) +#endif + + +void wxRadioButton::Init() +{ +} + +bool wxRadioButton::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxRadioButton functions +// ---------------------------------------------------------------------------- + +void wxRadioButton::SetValue(bool value) +{ +} + +bool wxRadioButton::GetValue() const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxRadioButton event processing +// ---------------------------------------------------------------------------- + +void wxRadioButton::Command (wxCommandEvent& event) +{ +} + +bool wxRadioButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxRadioButton geometry +// ---------------------------------------------------------------------------- + +wxSize wxRadioButton::DoGetBestSize() const +{ + return wxSize(0,0); +} + +#endif // wxUSE_RADIOBTN + diff --git a/src/palmos/regconf.cpp b/src/palmos/regconf.cpp new file mode 100644 index 0000000000..a7db041d31 --- /dev/null +++ b/src/palmos/regconf.cpp @@ -0,0 +1,207 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/regconf.cpp +// Purpose: +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "regconf.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/intl.h" +#endif //WX_PRECOMP + +#include "wx/event.h" +#include "wx/app.h" +#include "wx/log.h" + +#if wxUSE_CONFIG + +#include "wx/config.h" + +#include "wx/palmos/registry.h" +#include "wx/palmos/regconf.h" + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// we put our data in HKLM\SOFTWARE_KEY\appname +#define SOFTWARE_KEY wxString(wxT("Software\\")) + +// ---------------------------------------------------------------------------- +// global functions +// ---------------------------------------------------------------------------- + +// get the value if the key is opened and it exists +bool TryGetValue(const wxRegKey& key, const wxString& str, wxString& strVal) +{ + return false; +} + +bool TryGetValue(const wxRegKey& key, const wxString& str, long *plVal) +{ + return false; +} + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// ctor/dtor +// ---------------------------------------------------------------------------- + +// create the config object which stores its data under HKCU\vendor\app and, if +// style & wxCONFIG_USE_GLOBAL_FILE, under HKLM\vendor\app +wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName, + const wxString& strLocal, const wxString& strGlobal, + long style) + : wxConfigBase(appName, vendorName, strLocal, strGlobal, style) +{ +} + +wxRegConfig::~wxRegConfig() +{ +} + +// ---------------------------------------------------------------------------- +// path management +// ---------------------------------------------------------------------------- + +void wxRegConfig::SetPath(const wxString& strPath) +{ +} + +// ---------------------------------------------------------------------------- +// enumeration (works only with current group) +// ---------------------------------------------------------------------------- + +#define LOCAL_MASK 0x8000 +#define IS_LOCAL_INDEX(l) (((l) & LOCAL_MASK) != 0) + +bool wxRegConfig::GetFirstGroup(wxString& str, long& lIndex) const +{ + return false; +} + +bool wxRegConfig::GetNextGroup(wxString& str, long& lIndex) const +{ + return false; +} + +bool wxRegConfig::GetFirstEntry(wxString& str, long& lIndex) const +{ + return false; +} + +bool wxRegConfig::GetNextEntry(wxString& str, long& lIndex) const +{ + return false; +} + +size_t wxRegConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const +{ + return 0; +} + +size_t wxRegConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// tests for existence +// ---------------------------------------------------------------------------- + +bool wxRegConfig::HasGroup(const wxString& key) const +{ + return false; +} + +bool wxRegConfig::HasEntry(const wxString& key) const +{ + return false; +} + +wxConfigBase::EntryType wxRegConfig::GetEntryType(const wxString& key) const +{ + return wxConfigBase::Type_Integer; +} + +// ---------------------------------------------------------------------------- +// reading/writing +// ---------------------------------------------------------------------------- + +bool wxRegConfig::DoReadString(const wxString& key, wxString *pStr) const +{ + return FALSE; +} + +// this exactly reproduces the string version above except for ExpandEnvVars(), +// we really should avoid this code duplication somehow... + +bool wxRegConfig::DoReadLong(const wxString& key, long *plResult) const +{ + return FALSE; +} + +bool wxRegConfig::DoWriteString(const wxString& key, const wxString& szValue) +{ + return false; +} + +bool wxRegConfig::DoWriteLong(const wxString& key, long lValue) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// renaming +// ---------------------------------------------------------------------------- + +bool wxRegConfig::RenameEntry(const wxString& oldName, const wxString& newName) +{ + return false; +} + +bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// deleting +// ---------------------------------------------------------------------------- + +bool wxRegConfig::DeleteEntry(const wxString& value, bool bGroupIfEmptyAlso) +{ + return false; +} + +bool wxRegConfig::DeleteGroup(const wxString& key) +{ + return false; +} + +bool wxRegConfig::DeleteAll() +{ + return false; +} + +#endif + // wxUSE_CONFIG diff --git a/src/palmos/region.cpp b/src/palmos/region.cpp new file mode 100644 index 0000000000..09130fe703 --- /dev/null +++ b/src/palmos/region.cpp @@ -0,0 +1,243 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/region.cpp +// Purpose: wxRegion implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "region.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#include "wx/region.h" +#include "wx/gdicmn.h" + +IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) +IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) + +// ---------------------------------------------------------------------------- +// wxRegionRefData implementation +// ---------------------------------------------------------------------------- + +// ============================================================================ +// wxRegion implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// ctors and dtor +// ---------------------------------------------------------------------------- + +wxRegion::wxRegion() +{ +} + +wxRegion::wxRegion(WXHRGN hRegion) +{ +} + +wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ +} + +wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight) +{ +} + +wxRegion::wxRegion(const wxRect& rect) +{ +} + +wxRegion::wxRegion(size_t n, const wxPoint *points, int fillStyle) +{ +} + +wxRegion::~wxRegion() +{ +} + +wxObjectRefData *wxRegion::CreateRefData() const +{ + return NULL; +} + +wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const +{ + return NULL; +} + +// ---------------------------------------------------------------------------- +// wxRegion operations +// ---------------------------------------------------------------------------- + +// Clear current region +void wxRegion::Clear() +{ +} + +bool wxRegion::Offset(wxCoord x, wxCoord y) +{ + return false; +} + +// combine another region with this one +bool wxRegion::Combine(const wxRegion& rgn, wxRegionOp op) +{ + return false; +} + +// Combine rectangle (x, y, w, h) with this. +bool wxRegion::Combine(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + wxRegionOp op) +{ + return false; +} + +bool wxRegion::Combine(const wxRect& rect, wxRegionOp op) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxRegion bounding box +// ---------------------------------------------------------------------------- + +// Outer bounds of region +void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const +{ +} + +wxRect wxRegion::GetBox() const +{ + return wxRect(0, 0, 0, 0); +} + +// Is region empty? +bool wxRegion::Empty() const +{ + return true; +} + +// ---------------------------------------------------------------------------- +// wxRegion hit testing +// ---------------------------------------------------------------------------- + +// Does the region contain the point (x,y)? +wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y) const +{ + return wxOutRegion; +} + +// Does the region contain the point pt? +wxRegionContain wxRegion::Contains(const wxPoint& pt) const +{ + return wxOutRegion; +} + +// Does the region contain the rectangle (x, y, w, h)? +wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, + wxCoord w, wxCoord h) const +{ + return wxOutRegion; +} + +// Does the region contain the rectangle rect +wxRegionContain wxRegion::Contains(const wxRect& rect) const +{ + return wxOutRegion; +} + +// Get internal region handle +WXHRGN wxRegion::GetHRGN() const +{ + return 0; +} + +// ============================================================================ +// wxRegionIterator implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxRegionIterator ctors/dtor +// ---------------------------------------------------------------------------- + +void wxRegionIterator::Init() +{ +} + +wxRegionIterator::~wxRegionIterator() +{ +} + +// Initialize iterator for region +wxRegionIterator::wxRegionIterator(const wxRegion& region) +{ +} + +wxRegionIterator& wxRegionIterator::operator=(const wxRegionIterator& ri) +{ + return *this; +} + +// ---------------------------------------------------------------------------- +// wxRegionIterator operations +// ---------------------------------------------------------------------------- + +// Reset iterator for a new region. +void wxRegionIterator::Reset(const wxRegion& region) +{ +} + +wxRegionIterator& wxRegionIterator::operator++() +{ + return *this; +} + +wxRegionIterator wxRegionIterator::operator ++ (int) +{ + return *this; +} + +// ---------------------------------------------------------------------------- +// wxRegionIterator accessors +// ---------------------------------------------------------------------------- + +wxCoord wxRegionIterator::GetX() const +{ + return 0; +} + +wxCoord wxRegionIterator::GetY() const +{ + return 0; +} + +wxCoord wxRegionIterator::GetW() const +{ + return 0; +} + +wxCoord wxRegionIterator::GetH() const +{ + return 0; +} + diff --git a/src/palmos/registry.cpp b/src/palmos/registry.cpp new file mode 100644 index 0000000000..3ab34856a8 --- /dev/null +++ b/src/palmos/registry.cpp @@ -0,0 +1,1027 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/registry.cpp +// Purpose: implementation of registry classes and functions +// Author: Vadim Zeitlin +// Modified by: +// Created: 03.04.98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows licence +// TODO: - parsing of registry key names +// - support of other (than REG_SZ/REG_DWORD) registry types +// - add high level functions (RegisterOleServer, ...) +/////////////////////////////////////////////////////////////////////////////// + +// This really doesn't apply to the Palm OS platform. It would be better to +// support the Palm OS preference database instead. +#ifndef __PALMOS__ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "registry.h" +#endif + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +// other wxWidgets headers +#include "wx/string.h" +#include "wx/intl.h" +#include "wx/log.h" + +#include "wx/palmos/wrapwin.h" + +// other std headers +#include // for _MAX_PATH + +#ifndef _MAX_PATH + #define _MAX_PATH 512 +#endif + +// our header +#define HKEY_DEFINED // already defined in windows.h +#include "wx/palmos/registry.h" + +// some registry functions don't like signed chars +typedef unsigned char *RegString; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the registry name separator (perhaps one day MS will change it to '/' ;-) +#define REG_SEPARATOR wxT('\\') + +// useful for Windows programmers: makes somewhat more clear all these zeroes +// being passed to Windows APIs +#define RESERVED (0) + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// const_cast<> is not yet supported by all compilers +#define CONST_CAST ((wxRegKey *)this)-> + +// and neither is mutable which m_dwLastError should be +#define m_dwLastError CONST_CAST m_dwLastError + +// ---------------------------------------------------------------------------- +// non member functions +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation of wxRegKey class +// ============================================================================ + +// ---------------------------------------------------------------------------- +// static functions and variables +// ---------------------------------------------------------------------------- + +const size_t wxRegKey::nStdKeys = WXSIZEOF(aStdKeys); + +// @@ should take a `StdKey key', but as it's often going to be used in loops +// it would require casts in user code. +const wxChar *wxRegKey::GetStdKeyName(size_t key) +{ + // return empty string if key is invalid + wxCHECK_MSG( key < nStdKeys, wxEmptyString, wxT("invalid key in wxRegKey::GetStdKeyName") ); + + return aStdKeys[key].szName; +} + +const wxChar *wxRegKey::GetStdKeyShortName(size_t key) +{ + // return empty string if key is invalid + wxCHECK( key < nStdKeys, wxEmptyString ); + + return aStdKeys[key].szShortName; +} + +wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey) +{ + wxString strRoot = strKey.BeforeFirst(REG_SEPARATOR); + + HKEY hRootKey = 0; + size_t ui; + for ( ui = 0; ui < nStdKeys; ui++ ) { + if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 || + strRoot.CmpNoCase(aStdKeys[ui].szShortName) == 0 ) { + hRootKey = aStdKeys[ui].hkey; + break; + } + } + + if ( ui == nStdKeys ) { + wxFAIL_MSG(wxT("invalid key prefix in wxRegKey::ExtractKeyName.")); + + hRootKey = HKEY_CLASSES_ROOT; + } + else { + strKey = strKey.After(REG_SEPARATOR); + if ( !strKey.IsEmpty() && strKey.Last() == REG_SEPARATOR ) + strKey.Truncate(strKey.Len() - 1); + } + + return (wxRegKey::StdKey)(int)hRootKey; +} + +wxRegKey::StdKey wxRegKey::GetStdKeyFromHkey(WXHKEY hkey) +{ + for ( size_t ui = 0; ui < nStdKeys; ui++ ) { + if ( (int) aStdKeys[ui].hkey == (int) hkey ) + return (StdKey)ui; + } + + wxFAIL_MSG(wxT("non root hkey passed to wxRegKey::GetStdKeyFromHkey.")); + + return HKCR; +} + +// ---------------------------------------------------------------------------- +// ctors and dtor +// ---------------------------------------------------------------------------- + +wxRegKey::wxRegKey() +{ + m_hRootKey = (WXHKEY) aStdKeys[HKCR].hkey; + + Init(); +} + +wxRegKey::wxRegKey(const wxString& strKey) : m_strKey(strKey) +{ + m_hRootKey = (WXHKEY) aStdKeys[ExtractKeyName(m_strKey)].hkey; + + Init(); +} + +// parent is a predefined (and preopened) key +wxRegKey::wxRegKey(StdKey keyParent, const wxString& strKey) : m_strKey(strKey) +{ + RemoveTrailingSeparator(m_strKey); + m_hRootKey = (WXHKEY) aStdKeys[keyParent].hkey; + + Init(); +} + +// parent is a normal regkey +wxRegKey::wxRegKey(const wxRegKey& keyParent, const wxString& strKey) + : m_strKey(keyParent.m_strKey) +{ + // combine our name with parent's to get the full name + if ( !m_strKey.IsEmpty() && + (strKey.IsEmpty() || strKey[0] != REG_SEPARATOR) ) { + m_strKey += REG_SEPARATOR; + } + + m_strKey += strKey; + RemoveTrailingSeparator(m_strKey); + + m_hRootKey = keyParent.m_hRootKey; + + Init(); +} + +// dtor closes the key releasing system resource +wxRegKey::~wxRegKey() +{ + Close(); +} + +// ---------------------------------------------------------------------------- +// change the key name/hkey +// ---------------------------------------------------------------------------- + +// set the full key name +void wxRegKey::SetName(const wxString& strKey) +{ + Close(); + + m_strKey = strKey; + m_hRootKey = (WXHKEY) aStdKeys[ExtractKeyName(m_strKey)].hkey; +} + +// the name is relative to the parent key +void wxRegKey::SetName(StdKey keyParent, const wxString& strKey) +{ + Close(); + + m_strKey = strKey; + RemoveTrailingSeparator(m_strKey); + m_hRootKey = (WXHKEY) aStdKeys[keyParent].hkey; +} + +// the name is relative to the parent key +void wxRegKey::SetName(const wxRegKey& keyParent, const wxString& strKey) +{ + Close(); + + // combine our name with parent's to get the full name + + // NB: this method is called by wxRegConfig::SetPath() which is a performance + // critical function and so it preallocates space for our m_strKey to + // gain some speed - this is why we only use += here and not = which + // would just free the prealloc'd buffer and would have to realloc it the + // next line! + m_strKey.clear(); + m_strKey += keyParent.m_strKey; + if ( !strKey.IsEmpty() && strKey[0] != REG_SEPARATOR ) + m_strKey += REG_SEPARATOR; + m_strKey += strKey; + + RemoveTrailingSeparator(m_strKey); + + m_hRootKey = keyParent.m_hRootKey; +} + +// hKey should be opened and will be closed in wxRegKey dtor +void wxRegKey::SetHkey(WXHKEY hKey) +{ + Close(); + + m_hKey = hKey; +} + +// ---------------------------------------------------------------------------- +// info about the key +// ---------------------------------------------------------------------------- + +// returns TRUE if the key exists +bool wxRegKey::Exists() const +{ + // opened key has to exist, try to open it if not done yet + return IsOpened() ? TRUE : KeyExists(m_hRootKey, m_strKey); +} + +// returns the full name of the key (prefix is abbreviated if bShortPrefix) +wxString wxRegKey::GetName(bool bShortPrefix) const +{ + StdKey key = GetStdKeyFromHkey((WXHKEY) m_hRootKey); + wxString str = bShortPrefix ? aStdKeys[key].szShortName + : aStdKeys[key].szName; + if ( !m_strKey.IsEmpty() ) + str << _T("\\") << m_strKey; + + return str; +} + +bool wxRegKey::GetKeyInfo(size_t *pnSubKeys, + size_t *pnMaxKeyLen, + size_t *pnValues, + size_t *pnMaxValueLen) const +{ + // old gcc headers incorrectly prototype RegQueryInfoKey() +#if defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__) + #define REG_PARAM (size_t *) +#else + #define REG_PARAM (LPDWORD) +#endif + + // it might be unexpected to some that this function doesn't open the key + wxASSERT_MSG( IsOpened(), _T("key should be opened in GetKeyInfo") ); + + m_dwLastError = ::RegQueryInfoKey + ( + (HKEY) m_hKey, + NULL, // class name + NULL, // (ptr to) size of class name buffer + RESERVED, + REG_PARAM + pnSubKeys, // [out] number of subkeys + REG_PARAM + pnMaxKeyLen, // [out] max length of a subkey name + NULL, // longest subkey class name + REG_PARAM + pnValues, // [out] number of values + REG_PARAM + pnMaxValueLen, // [out] max length of a value name + NULL, // longest value data + NULL, // security descriptor + NULL // time of last modification + ); + +#undef REG_PARAM + + if ( m_dwLastError != ERROR_SUCCESS ) { + wxLogSysError(m_dwLastError, _("Can't get info about registry key '%s'"), + GetName().c_str()); + return FALSE; + } + + return TRUE; +} + +// ---------------------------------------------------------------------------- +// operations +// ---------------------------------------------------------------------------- + +// opens key (it's not an error to call Open() on an already opened key) +bool wxRegKey::Open(AccessMode mode) +{ + if ( IsOpened() ) + return TRUE; + + HKEY tmpKey; + m_dwLastError = ::RegOpenKeyEx + ( + (HKEY) m_hRootKey, + m_strKey, + RESERVED, + mode == Read ? KEY_READ : KEY_ALL_ACCESS, + &tmpKey + ); + + if ( m_dwLastError != ERROR_SUCCESS ) + { + wxLogSysError(m_dwLastError, _("Can't open registry key '%s'"), + GetName().c_str()); + return FALSE; + } + + m_hKey = (WXHKEY) tmpKey; + return TRUE; +} + +// creates key, failing if it exists and !bOkIfExists +bool wxRegKey::Create(bool bOkIfExists) +{ + // check for existence only if asked (i.e. order is important!) + if ( !bOkIfExists && Exists() ) + return FALSE; + + if ( IsOpened() ) + return TRUE; + + HKEY tmpKey; +#ifdef __WXWINCE__ + DWORD disposition; + m_dwLastError = RegCreateKeyEx((HKEY) m_hRootKey, m_strKey, + NULL, // reserved + NULL, // class string + 0, + 0, + NULL, + &tmpKey, + &disposition); +#else + m_dwLastError = RegCreateKey((HKEY) m_hRootKey, m_strKey, &tmpKey); +#endif + if ( m_dwLastError != ERROR_SUCCESS ) { + wxLogSysError(m_dwLastError, _("Can't create registry key '%s'"), + GetName().c_str()); + return FALSE; + } + else + { + m_hKey = (WXHKEY) tmpKey; + return TRUE; + } +} + +// close the key, it's not an error to call it when not opened +bool wxRegKey::Close() +{ + if ( IsOpened() ) { + m_dwLastError = RegCloseKey((HKEY) m_hKey); + m_hKey = 0; + + if ( m_dwLastError != ERROR_SUCCESS ) { + wxLogSysError(m_dwLastError, _("Can't close registry key '%s'"), + GetName().c_str()); + + return FALSE; + } + } + + return TRUE; +} + +bool wxRegKey::RenameValue(const wxChar *szValueOld, const wxChar *szValueNew) +{ + bool ok = TRUE; + if ( HasValue(szValueNew) ) { + wxLogError(_("Registry value '%s' already exists."), szValueNew); + + ok = FALSE; + } + + if ( !ok || + !CopyValue(szValueOld, *this, szValueNew) || + !DeleteValue(szValueOld) ) { + wxLogError(_("Failed to rename registry value '%s' to '%s'."), + szValueOld, szValueNew); + + return FALSE; + } + + return TRUE; +} + +bool wxRegKey::CopyValue(const wxChar *szValue, + wxRegKey& keyDst, + const wxChar *szValueNew) +{ + if ( !szValueNew ) { + // by default, use the same name + szValueNew = szValue; + } + + switch ( GetValueType(szValue) ) { + case Type_String: + { + wxString strVal; + return QueryValue(szValue, strVal) && + keyDst.SetValue(szValueNew, strVal); + } + + case Type_Dword: + /* case Type_Dword_little_endian: == Type_Dword */ + { + long dwVal; + return QueryValue(szValue, &dwVal) && + keyDst.SetValue(szValueNew, dwVal); + } + + // these types are unsupported because I am not sure about how + // exactly they should be copied and because they shouldn't + // occur among the application keys (supposedly created with + // this class) +#ifdef __WIN32__ + case Type_None: + case Type_Expand_String: + case Type_Binary: + case Type_Dword_big_endian: + case Type_Link: + case Type_Multi_String: + case Type_Resource_list: + case Type_Full_resource_descriptor: + case Type_Resource_requirements_list: +#endif // Win32 + default: + wxLogError(_("Can't copy values of unsupported type %d."), + GetValueType(szValue)); + return FALSE; + } +} + +bool wxRegKey::Rename(const wxChar *szNewName) +{ + wxCHECK_MSG( !!m_strKey, FALSE, _T("registry hives can't be renamed") ); + + if ( !Exists() ) { + wxLogError(_("Registry key '%s' does not exist, cannot rename it."), + GetFullName(this)); + + return FALSE; + } + + // do we stay in the same hive? + bool inSameHive = !wxStrchr(szNewName, REG_SEPARATOR); + + // construct the full new name of the key + wxRegKey keyDst; + + if ( inSameHive ) { + // rename the key to the new name under the same parent + wxString strKey = m_strKey.BeforeLast(REG_SEPARATOR); + if ( !!strKey ) { + // don't add '\\' in the start if strFullNewName is empty + strKey += REG_SEPARATOR; + } + + strKey += szNewName; + + keyDst.SetName(GetStdKeyFromHkey(m_hRootKey), strKey); + } + else { + // this is the full name already + keyDst.SetName(szNewName); + } + + bool ok = keyDst.Create(FALSE /* fail if alredy exists */); + if ( !ok ) { + wxLogError(_("Registry key '%s' already exists."), + GetFullName(&keyDst)); + } + else { + ok = Copy(keyDst) && DeleteSelf(); + } + + if ( !ok ) { + wxLogError(_("Failed to rename the registry key '%s' to '%s'."), + GetFullName(this), GetFullName(&keyDst)); + } + else { + m_hRootKey = keyDst.m_hRootKey; + m_strKey = keyDst.m_strKey; + } + + return ok; +} + +bool wxRegKey::Copy(const wxChar *szNewName) +{ + // create the new key first + wxRegKey keyDst(szNewName); + bool ok = keyDst.Create(FALSE /* fail if alredy exists */); + if ( ok ) { + ok = Copy(keyDst); + + // we created the dest key but copying to it failed - delete it + if ( !ok ) { + (void)keyDst.DeleteSelf(); + } + } + + return ok; +} + +bool wxRegKey::Copy(wxRegKey& keyDst) +{ + bool ok = TRUE; + + // copy all sub keys to the new location + wxString strKey; + long lIndex; + bool bCont = GetFirstKey(strKey, lIndex); + while ( ok && bCont ) { + wxRegKey key(*this, strKey); + wxString keyName; + keyName << GetFullName(&keyDst) << REG_SEPARATOR << strKey; + ok = key.Copy((const wxChar*) keyName); + + if ( ok ) + bCont = GetNextKey(strKey, lIndex); + } + + // copy all values + wxString strVal; + bCont = GetFirstValue(strVal, lIndex); + while ( ok && bCont ) { + ok = CopyValue(strVal, keyDst); + + if ( !ok ) { + wxLogSysError(m_dwLastError, + _("Failed to copy registry value '%s'"), + strVal.c_str()); + } + else { + bCont = GetNextValue(strVal, lIndex); + } + } + + if ( !ok ) { + wxLogError(_("Failed to copy the contents of registry key '%s' to '%s'."), GetFullName(this), GetFullName(&keyDst)); + } + + return ok; +} + +// ---------------------------------------------------------------------------- +// delete keys/values +// ---------------------------------------------------------------------------- +bool wxRegKey::DeleteSelf() +{ + { + wxLogNull nolog; + if ( !Open() ) { + // it already doesn't exist - ok! + return TRUE; + } + } + + // prevent a buggy program from erasing one of the root registry keys or an + // immediate subkey (i.e. one which doesn't have '\\' inside) of any other + // key except HKCR (HKCR has some "deleteable" subkeys) + if ( m_strKey.IsEmpty() || + ((m_hRootKey != (WXHKEY) aStdKeys[HKCR].hkey) && + (m_strKey.Find(REG_SEPARATOR) == wxNOT_FOUND)) ) { + wxLogError(_("Registry key '%s' is needed for normal system operation,\ndeleting it will leave your system in unusable state:\noperation aborted."), GetFullName(this)); + + return FALSE; + } + + // we can't delete keys while enumerating because it confuses GetNextKey, so + // we first save the key names and then delete them all + wxArrayString astrSubkeys; + + wxString strKey; + long lIndex; + bool bCont = GetFirstKey(strKey, lIndex); + while ( bCont ) { + astrSubkeys.Add(strKey); + + bCont = GetNextKey(strKey, lIndex); + } + + size_t nKeyCount = astrSubkeys.Count(); + for ( size_t nKey = 0; nKey < nKeyCount; nKey++ ) { + wxRegKey key(*this, astrSubkeys[nKey]); + if ( !key.DeleteSelf() ) + return FALSE; + } + + // now delete this key itself + Close(); + + m_dwLastError = RegDeleteKey((HKEY) m_hRootKey, m_strKey); + // deleting a key which doesn't exist is not considered an error + if ( m_dwLastError != ERROR_SUCCESS && + m_dwLastError != ERROR_FILE_NOT_FOUND ) { + wxLogSysError(m_dwLastError, _("Can't delete key '%s'"), + GetName().c_str()); + return FALSE; + } + + return TRUE; +} + +bool wxRegKey::DeleteKey(const wxChar *szKey) +{ + if ( !Open() ) + return FALSE; + + wxRegKey key(*this, szKey); + return key.DeleteSelf(); +} + +bool wxRegKey::DeleteValue(const wxChar *szValue) +{ + if ( !Open() ) + return FALSE; + + m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue); + + // deleting a value which doesn't exist is not considered an error + if ( (m_dwLastError != ERROR_SUCCESS) && + (m_dwLastError != ERROR_FILE_NOT_FOUND) ) { + wxLogSysError(m_dwLastError, _("Can't delete value '%s' from key '%s'"), + szValue, GetName().c_str()); + return FALSE; + } + + return TRUE; +} + +// ---------------------------------------------------------------------------- +// access to values and subkeys +// ---------------------------------------------------------------------------- + +// return TRUE if value exists +bool wxRegKey::HasValue(const wxChar *szValue) const +{ + // this function should be silent, so suppress possible messages from Open() + wxLogNull nolog; + + if ( !CONST_CAST Open() ) + return FALSE; + + LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey, + WXSTRINGCAST szValue, + RESERVED, + NULL, NULL, NULL); + return dwRet == ERROR_SUCCESS; +} + +// returns TRUE if this key has any values +bool wxRegKey::HasValues() const +{ + // suppress possible messages from GetFirstValue() + wxLogNull nolog; + + // just call GetFirstValue with dummy parameters + wxString str; + long l; + return CONST_CAST GetFirstValue(str, l); +} + +// returns TRUE if this key has any subkeys +bool wxRegKey::HasSubkeys() const +{ + // suppress possible messages from GetFirstKey() + wxLogNull nolog; + + // just call GetFirstKey with dummy parameters + wxString str; + long l; + return CONST_CAST GetFirstKey(str, l); +} + +// returns TRUE if given subkey exists +bool wxRegKey::HasSubKey(const wxChar *szKey) const +{ + // this function should be silent, so suppress possible messages from Open() + wxLogNull nolog; + + if ( !CONST_CAST Open() ) + return FALSE; + + return KeyExists(m_hKey, szKey); +} + +wxRegKey::ValueType wxRegKey::GetValueType(const wxChar *szValue) const +{ + if ( ! CONST_CAST Open() ) + return Type_None; + + DWORD dwType; + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, + &dwType, NULL, NULL); + if ( m_dwLastError != ERROR_SUCCESS ) { + wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"), + GetName().c_str()); + return Type_None; + } + + return (ValueType)dwType; +} + +#ifdef __WIN32__ +bool wxRegKey::SetValue(const wxChar *szValue, long lValue) +{ + if ( CONST_CAST Open() ) { + m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD, + (RegString)&lValue, sizeof(lValue)); + if ( m_dwLastError == ERROR_SUCCESS ) + return TRUE; + } + + wxLogSysError(m_dwLastError, _("Can't set value of '%s'"), + GetFullName(this, szValue)); + return FALSE; +} + +bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const +{ + if ( CONST_CAST Open() ) { + DWORD dwType, dwSize = sizeof(DWORD); + RegString pBuf = (RegString)plValue; + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, + &dwType, pBuf, &dwSize); + if ( m_dwLastError != ERROR_SUCCESS ) { + wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"), + GetName().c_str()); + return FALSE; + } + else { + // check that we read the value of right type + wxASSERT_MSG( IsNumericValue(szValue), + wxT("Type mismatch in wxRegKey::QueryValue().") ); + + return TRUE; + } + } + else + return FALSE; +} + +#endif //Win32 + +bool wxRegKey::QueryValue(const wxChar *szValue, + wxString& strValue, + bool raw) const +{ + if ( CONST_CAST Open() ) { + + // first get the type and size of the data + DWORD dwType, dwSize; + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, + &dwType, NULL, &dwSize); + if ( m_dwLastError == ERROR_SUCCESS ) { + if ( !dwSize ) { + // must treat this case specially as GetWriteBuf() doesn't like + // being called with 0 size + strValue.Empty(); + } + else { + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, + WXSTRINGCAST szValue, + RESERVED, + &dwType, + (RegString)(wxChar*)wxStringBuffer(strValue, dwSize), + &dwSize); + + // expand the var expansions in the string unless disabled +#ifndef __WXWINCE__ + if ( (dwType == REG_EXPAND_SZ) && !raw ) + { + DWORD dwExpSize = ::ExpandEnvironmentStrings(strValue, NULL, 0); + bool ok = dwExpSize != 0; + if ( ok ) + { + wxString strExpValue; + ok = ::ExpandEnvironmentStrings + ( + strValue, + wxStringBuffer(strExpValue, dwExpSize), + dwExpSize + ) != 0; + strValue = strExpValue; + } + + if ( !ok ) + { + wxLogLastError(_T("ExpandEnvironmentStrings")); + } + } +#endif + // __WXWINCE__ + } + + if ( m_dwLastError == ERROR_SUCCESS ) { + // check that it was the right type + wxASSERT_MSG( !IsNumericValue(szValue), + wxT("Type mismatch in wxRegKey::QueryValue().") ); + + return TRUE; + } + } + } + + wxLogSysError(m_dwLastError, _("Can't read value of '%s'"), + GetFullName(this, szValue)); + return FALSE; +} + +bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue) +{ + if ( CONST_CAST Open() ) { + m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_SZ, + (RegString)strValue.c_str(), + (strValue.Len() + 1)*sizeof(wxChar)); + if ( m_dwLastError == ERROR_SUCCESS ) + return TRUE; + } + + wxLogSysError(m_dwLastError, _("Can't set value of '%s'"), + GetFullName(this, szValue)); + return FALSE; +} + +wxString wxRegKey::QueryDefaultValue() const +{ + wxString str; + QueryValue(NULL, str); + return str; +} + +// ---------------------------------------------------------------------------- +// enumeration +// NB: all these functions require an index variable which allows to have +// several concurrently running indexations on the same key +// ---------------------------------------------------------------------------- + +bool wxRegKey::GetFirstValue(wxString& strValueName, long& lIndex) +{ + if ( !Open() ) + return FALSE; + + lIndex = 0; + return GetNextValue(strValueName, lIndex); +} + +bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const +{ + wxASSERT( IsOpened() ); + + // are we already at the end of enumeration? + if ( lIndex == -1 ) + return FALSE; + + wxChar szValueName[1024]; // @@ use RegQueryInfoKey... + DWORD dwValueLen = WXSIZEOF(szValueName); + + m_dwLastError = RegEnumValue((HKEY) m_hKey, lIndex++, + szValueName, &dwValueLen, + RESERVED, + NULL, // [out] type + NULL, // [out] buffer for value + NULL); // [i/o] it's length + + if ( m_dwLastError != ERROR_SUCCESS ) { + if ( m_dwLastError == ERROR_NO_MORE_ITEMS ) { + m_dwLastError = ERROR_SUCCESS; + lIndex = -1; + } + else { + wxLogSysError(m_dwLastError, _("Can't enumerate values of key '%s'"), + GetName().c_str()); + } + + return FALSE; + } + + strValueName = szValueName; + + return TRUE; +} + +bool wxRegKey::GetFirstKey(wxString& strKeyName, long& lIndex) +{ + if ( !Open() ) + return FALSE; + + lIndex = 0; + return GetNextKey(strKeyName, lIndex); +} + +bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const +{ + wxASSERT( IsOpened() ); + + // are we already at the end of enumeration? + if ( lIndex == -1 ) + return FALSE; + + wxChar szKeyName[_MAX_PATH + 1]; + +#ifdef __WXWINCE__ + DWORD sizeName = WXSIZEOF(szKeyName); + m_dwLastError = RegEnumKeyEx((HKEY) m_hKey, lIndex++, szKeyName, & sizeName, + 0, NULL, NULL, NULL); +#else + m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName)); +#endif + + if ( m_dwLastError != ERROR_SUCCESS ) { + if ( m_dwLastError == ERROR_NO_MORE_ITEMS ) { + m_dwLastError = ERROR_SUCCESS; + lIndex = -1; + } + else { + wxLogSysError(m_dwLastError, _("Can't enumerate subkeys of key '%s'"), + GetName().c_str()); + } + + return FALSE; + } + + strKeyName = szKeyName; + return TRUE; +} + +// returns TRUE if the value contains a number (else it's some string) +bool wxRegKey::IsNumericValue(const wxChar *szValue) const + { + ValueType type = GetValueType(szValue); + switch ( type ) { + case Type_Dword: + /* case Type_Dword_little_endian: == Type_Dword */ + case Type_Dword_big_endian: + return TRUE; + + default: + return FALSE; + } + } + +// ============================================================================ +// implementation of global private functions +// ============================================================================ + +bool KeyExists(WXHKEY hRootKey, const wxChar *szKey) +{ + // don't close this key itself for the case of empty szKey! + if ( wxIsEmpty(szKey) ) + return TRUE; + + HKEY hkeyDummy; + if ( ::RegOpenKeyEx + ( + (HKEY)hRootKey, + szKey, + RESERVED, + KEY_READ, // we might not have enough rights for rw access + &hkeyDummy + ) == ERROR_SUCCESS ) + { + ::RegCloseKey(hkeyDummy); + + return TRUE; + } + + return FALSE; +} + +const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue) +{ + static wxString s_str; + s_str = pKey->GetName(); + if ( !wxIsEmpty(szValue) ) + s_str << wxT("\\") << szValue; + + return s_str.c_str(); +} + +void RemoveTrailingSeparator(wxString& str) +{ + if ( !str.IsEmpty() && str.Last() == REG_SEPARATOR ) + str.Truncate(str.Len() - 1); +} + +#endif //Palm OS + diff --git a/src/palmos/renderer.cpp b/src/palmos/renderer.cpp new file mode 100644 index 0000000000..c73da5c1bd --- /dev/null +++ b/src/palmos/renderer.cpp @@ -0,0 +1,191 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/renderer.cpp +// Purpose: implementation of wxRendererNative for Palm OS +// Author: Vadim Zeitlin +// Modified by: +// Created: 20.07.2003 +// RCS-ID: $Id$ +// Copyright: (c) 2003 Vadim Zeitlin +// License: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// Palm OS doesn't really have a theme engine, so this is not needed. +#ifndef __PALMOS__ + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/window.h" + #include "wx/dc.h" +#endif //WX_PRECOMP + +#include "wx/splitter.h" +#include "wx/renderer.h" + +#include "wx/palmos/uxtheme.h" + +// ---------------------------------------------------------------------------- +// wxRendererMSW: wxRendererNative implementation for "old" Win32 systems +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRendererMSW : public wxDelegateRendererNative +{ +public: + wxRendererMSW() { } + + static wxRendererNative& Get(); + +private: + DECLARE_NO_COPY_CLASS(wxRendererMSW) +}; + +// ---------------------------------------------------------------------------- +// wxRendererXP: wxRendererNative implementation for Windows XP and later +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxRendererXP : public wxDelegateRendererNative +{ +public: + wxRendererXP() : wxDelegateRendererNative(wxRendererMSW::Get()) { } + + static wxRendererNative& Get(); + + virtual void DrawSplitterBorder(wxWindow *win, + wxDC& dc, + const wxRect& rect, + int flags = 0); + virtual void DrawSplitterSash(wxWindow *win, + wxDC& dc, + const wxSize& size, + wxCoord position, + wxOrientation orient, + int flags = 0); + virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win); + +private: + DECLARE_NO_COPY_CLASS(wxRendererXP) +}; + +// ============================================================================ +// wxRendererNative and wxRendererMSW implementation +// ============================================================================ + +/* static */ +wxRendererNative& wxRendererNative::GetDefault() +{ + wxUxThemeEngine *themeEngine = wxUxThemeEngine::Get(); + return themeEngine && themeEngine->IsAppThemed() ? wxRendererXP::Get() + : wxRendererMSW::Get(); +} + +/* static */ +wxRendererNative& wxRendererMSW::Get() +{ + static wxRendererMSW s_rendererMSW; + + return s_rendererMSW; +} + +// ============================================================================ +// wxRendererXP implementation +// ============================================================================ + +/* static */ +wxRendererNative& wxRendererXP::Get() +{ + static wxRendererXP s_rendererXP; + + return s_rendererXP; +} + +// ---------------------------------------------------------------------------- +// splitter drawing +// ---------------------------------------------------------------------------- + +// the width of the sash: this is the same as used by Explorer... +static const wxCoord SASH_WIDTH = 4; + +wxSplitterRenderParams +wxRendererXP::GetSplitterParams(const wxWindow * win) +{ + if (win->GetWindowStyle() & wxSP_NO_XP_THEME) + return m_rendererNative.GetSplitterParams(win); + else + return wxSplitterRenderParams(SASH_WIDTH, 0, false); +} + +void +wxRendererXP::DrawSplitterBorder(wxWindow * win, + wxDC& dc, + const wxRect& rect, + int flags) +{ + if (win->GetWindowStyle() & wxSP_NO_XP_THEME) + { + m_rendererNative.DrawSplitterBorder(win, dc, rect, flags); + } +} + +void +wxRendererXP::DrawSplitterSash(wxWindow *win, + wxDC& dc, + const wxSize& size, + wxCoord position, + wxOrientation orient, + int flags) +{ + if (win->GetWindowStyle() & wxSP_NO_XP_THEME) + { + m_rendererNative.DrawSplitterSash( + win, dc, size, position, orient, flags); + return; + } + + // I don't know if it is correct to use the rebar background for the + // splitter but it least this works ok in the default theme + wxUxThemeHandle hTheme(win, L"REBAR"); + if ( hTheme ) + { + RECT rect; + if ( orient == wxVERTICAL ) + { + rect.left = position; + rect.right = position + SASH_WIDTH; + rect.top = 0; + rect.bottom = size.y; + } + else // wxHORIZONTAL + { + rect.left = 0; + rect.right = size.x; + rect.top = position; + rect.bottom = position + SASH_WIDTH; + } + + wxUxThemeEngine::Get()->DrawThemeBackground + ( + (WXHTHEME)hTheme, + dc.GetHDC(), + 3 /* RP_BAND */, + 0 /* no state */ , + &rect, + NULL + ); + } +} + +#endif diff --git a/src/palmos/scrolbar.cpp b/src/palmos/scrolbar.cpp new file mode 100644 index 0000000000..c65ce8e873 --- /dev/null +++ b/src/palmos/scrolbar.cpp @@ -0,0 +1,138 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/scrolbar.cpp +// Purpose: wxScrollBar +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "scrolbar.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_SCROLLBAR + +#ifndef WX_PRECOMP + #include "wx/utils.h" +#endif + +#include "wx/scrolbar.h" +#include "wx/palmos/private.h" +#include "wx/settings.h" + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxScrollBarStyle ) + +wxBEGIN_FLAGS( wxScrollBarStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxSB_HORIZONTAL) + wxFLAGS_MEMBER(wxSB_VERTICAL) + +wxEND_FLAGS( wxScrollBarStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxScrollBar, wxControl,"wx/scrolbar.h") + +wxBEGIN_PROPERTIES_TABLE(wxScrollBar) + wxEVENT_RANGE_PROPERTY( Scroll , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxScrollEvent ) + + wxPROPERTY( ThumbPosition , int , SetThumbPosition, GetThumbPosition, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Range , int , SetRange, GetRange, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( ThumbSize , int , SetThumbSize, GetThumbSize, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( PageSize , int , SetPageSize, GetPageSize, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxScrollBarStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxScrollBar) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxScrollBar , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl) +#endif + +// Scrollbar +bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& wxVALIDATOR_PARAM(validator), + const wxString& name) +{ + return false; +} + +wxScrollBar::~wxScrollBar(void) +{ +} + +bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, + WXWORD pos, WXHWND WXUNUSED(control)) +{ + return false; +} + +void wxScrollBar::SetThumbPosition(int viewStart) +{ +} + +int wxScrollBar::GetThumbPosition(void) const +{ +} + +void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, + bool refresh) +{ +} + + +WXHBRUSH wxScrollBar::OnCtlColor(WXHDC WXUNUSED(pDC), WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), + WXUINT WXUNUSED(message), WXWPARAM WXUNUSED(wParam), WXLPARAM WXUNUSED(lParam)) +{ + return 0; +} + +void wxScrollBar::Command(wxCommandEvent& event) +{ +} + +wxSize wxScrollBar::DoGetBestSize() const +{ + return wxSize(0,0); +} + +#endif // wxUSE_SCROLLBAR diff --git a/src/palmos/settings.cpp b/src/palmos/settings.cpp new file mode 100644 index 0000000000..29414caf5f --- /dev/null +++ b/src/palmos/settings.cpp @@ -0,0 +1,113 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/settings.cpp +// Purpose: wxSystemSettingsNative implementation for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/gdicmn.h" +#endif + +#include "wx/settings.h" + +#ifndef SPI_GETFLATMENU +#define SPI_GETFLATMENU 0x1022 +#endif + +#include "wx/module.h" +#include "wx/fontutil.h" + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// global data +// ---------------------------------------------------------------------------- + +// the font returned by GetFont(wxSYS_DEFAULT_GUI_FONT): it is created when +// GetFont() is called for the first time and deleted by wxSystemSettingsModule +static wxFont *gs_fontDefault = NULL; + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxSystemSettingsNative +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// colours +// ---------------------------------------------------------------------------- + +wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) +{ + return wxNullColour; +} + +// ---------------------------------------------------------------------------- +// fonts +// ---------------------------------------------------------------------------- + +wxFont wxCreateFontFromStockObject(int index) +{ + wxFont font; + return font; +} + +wxFont wxSystemSettingsNative::GetFont(wxSystemFont index) +{ + wxFont font; + return font; +} + +// ---------------------------------------------------------------------------- +// system metrics/features +// ---------------------------------------------------------------------------- + +// Get a system metric, e.g. scrollbar size +int wxSystemSettingsNative::GetMetric(wxSystemMetric index) +{ + return 0; +} + +bool wxSystemSettingsNative::HasFeature(wxSystemFeature index) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// function from wx/msw/wrapcctl.h: there is really no other place for it... +// ---------------------------------------------------------------------------- + +#if wxUSE_LISTCTRL || wxUSE_TREECTRL + +extern wxFont wxGetCCDefaultFont() +{ + wxFont font; + return font; +} + +#endif // wxUSE_LISTCTRL || wxUSE_TREECTRL diff --git a/src/palmos/slider.cpp b/src/palmos/slider.cpp new file mode 100644 index 0000000000..bf3a161a65 --- /dev/null +++ b/src/palmos/slider.cpp @@ -0,0 +1,235 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: slider.cpp +// Purpose: wxSlider +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "slider.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_SLIDER + +#ifndef WX_PRECOMP +#include "wx/utils.h" +#include "wx/brush.h" +#include "wx/slider.h" +#endif + +#include "wx/palmos/slider.h" +#include "wx/palmos/private.h" + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxSliderStyle ) + +wxBEGIN_FLAGS( wxSliderStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxSL_HORIZONTAL) + wxFLAGS_MEMBER(wxSL_VERTICAL) + wxFLAGS_MEMBER(wxSL_AUTOTICKS) + wxFLAGS_MEMBER(wxSL_LABELS) + wxFLAGS_MEMBER(wxSL_LEFT) + wxFLAGS_MEMBER(wxSL_TOP) + wxFLAGS_MEMBER(wxSL_RIGHT) + wxFLAGS_MEMBER(wxSL_BOTTOM) + wxFLAGS_MEMBER(wxSL_BOTH) + wxFLAGS_MEMBER(wxSL_SELRANGE) + +wxEND_FLAGS( wxSliderStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxSlider, wxControl,"wx/scrolbar.h") + +wxBEGIN_PROPERTIES_TABLE(wxSlider) + wxEVENT_RANGE_PROPERTY( Scroll , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxScrollEvent ) + wxEVENT_PROPERTY( Updated , wxEVT_COMMAND_SLIDER_UPDATED , wxCommandEvent ) + + wxPROPERTY( Value , int , SetValue, GetValue , 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Minimum , int , SetMin, GetMin, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Maximum , int , SetMax, GetMax, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( PageSize , int , SetPageSize, GetLineSize, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( LineSize , int , SetLineSize, GetLineSize, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( ThumbLength , int , SetThumbLength, GetThumbLength, 1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxSliderStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxSlider) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_8( wxSlider , wxWindow* , Parent , wxWindowID , Id , int , Value , int , Minimum , int , Maximum , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl) +#endif + +// Slider +wxSlider::wxSlider() +{ +} + +bool wxSlider::Create(wxWindow *parent, wxWindowID id, + int value, int minValue, int maxValue, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +bool wxSlider::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, + WXWORD WXUNUSED(pos), WXHWND control) +{ + return false; +} + +wxSlider::~wxSlider() +{ +} + +int wxSlider::GetValue() const +{ + return 0; +} + +void wxSlider::SetValue(int value) +{ +} + +void wxSlider::DoGetSize(int *width, int *height) const +{ +} + +void wxSlider::GetPosition(int *x, int *y) const +{ +} + +void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags) +{ +} + + +wxSize wxSlider::DoGetBestSize() const +{ + return wxSize(0,0); +} + + +void wxSlider::SetRange(int minValue, int maxValue) +{ +} + +WXHBRUSH wxSlider::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +void wxSlider::SetTickFreq(int n, int pos) +{ +} + +void wxSlider::SetPageSize(int pageSize) +{ +} + +int wxSlider::GetPageSize() const +{ + return 0; +} + +void wxSlider::ClearSel() +{ +} + +void wxSlider::ClearTicks() +{ +} + +void wxSlider::SetLineSize(int lineSize) +{ +} + +int wxSlider::GetLineSize() const +{ + return 0; +} + +int wxSlider::GetSelEnd() const +{ + return 0; +} + +int wxSlider::GetSelStart() const +{ + return 0; +} + +void wxSlider::SetSelection(int minPos, int maxPos) +{ +} + +void wxSlider::SetThumbLength(int len) +{ +} + +int wxSlider::GetThumbLength() const +{ + return 0; +} + +void wxSlider::SetTick(int tickPos) +{ +} + +bool wxSlider::ContainsHWND(WXHWND hWnd) const +{ + return false; +} + +void wxSlider::Command (wxCommandEvent & event) +{ +} + +bool wxSlider::Show(bool show) +{ + return false; +} + +#endif // wxUSE_SLIDER diff --git a/src/palmos/snglinst.cpp b/src/palmos/snglinst.cpp new file mode 100644 index 0000000000..71e9e1b7d2 --- /dev/null +++ b/src/palmos/snglinst.cpp @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/snglinst.cpp +// Purpose: implements wxSingleInstanceChecker class for Win32 using +// named mutexes +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "snglinst.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_SNGLINST_CHECKER + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/log.h" +#endif //WX_PRECOMP + +#include "wx/snglinst.h" + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// wxSingleInstanceCheckerImpl: the real implementation class +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxSingleInstanceCheckerImpl +{ +public: + wxSingleInstanceCheckerImpl() + { + } + + bool Create(const wxString& name) + { + return false; + } + + bool WasOpened() const + { + return false; + } + + ~wxSingleInstanceCheckerImpl() + { + } + +private: + // the result of the CreateMutex() call + bool m_wasOpened; + + // the mutex handle, may be NULL + HANDLE m_hMutex; + + DECLARE_NO_COPY_CLASS(wxSingleInstanceCheckerImpl) +}; + +// ============================================================================ +// wxSingleInstanceChecker implementation +// ============================================================================ + +bool wxSingleInstanceChecker::Create(const wxString& name, + const wxString& WXUNUSED(path)) +{ + return false; +} + +bool wxSingleInstanceChecker::IsAnotherRunning() const +{ + return false; +} + +wxSingleInstanceChecker::~wxSingleInstanceChecker() +{ +} + +#endif // wxUSE_SNGLINST_CHECKER diff --git a/src/palmos/sound.cpp b/src/palmos/sound.cpp new file mode 100644 index 0000000000..dae279ac4b --- /dev/null +++ b/src/palmos/sound.cpp @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: sound.cpp +// Purpose: wxSound +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "sound.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) +#pragma hdrstop +#endif + +#if wxUSE_SOUND + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include "wx/file.h" +#include "wx/sound.h" +#include "wx/palmos/private.h" + +wxSound::wxSound() + : m_waveData(NULL), m_waveLength(0), m_isResource(false) +{ +} + +wxSound::wxSound(const wxString& sFileName, bool isResource) + : m_waveData(NULL), m_waveLength(0), m_isResource(isResource) +{ +} + +wxSound::wxSound(int size, const wxByte* data) + : m_waveData(NULL), m_waveLength(0), m_isResource(false) +{ +} + +wxSound::~wxSound() +{ +} + +bool wxSound::Create(const wxString& fileName, bool isResource) +{ + return false; +} + +bool wxSound::Create(int size, const wxByte* data) +{ + return false; +} + +bool wxSound::DoPlay(unsigned flags) const +{ + return false; +} + +bool wxSound::Free() +{ + return false; +} + +/*static*/ void wxSound::Stop() +{ +} + +#endif // wxUSE_SOUND diff --git a/src/palmos/spinbutt.cpp b/src/palmos/spinbutt.cpp new file mode 100644 index 0000000000..e190fe1fe2 --- /dev/null +++ b/src/palmos/spinbutt.cpp @@ -0,0 +1,178 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/spinbutt.cpp +// Purpose: wxSpinButton +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "spinbutt.h" + #pragma implementation "spinbutbase.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/app.h" +#endif + +#if wxUSE_SPINBTN + +#include "wx/spinbutt.h" + +IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxNotifyEvent) + +#if defined(__WIN95__) + +#include "wx/msw/private.h" + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxSpinButtonStyle ) + +wxBEGIN_FLAGS( wxSpinButtonStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxSP_HORIZONTAL) + wxFLAGS_MEMBER(wxSP_VERTICAL) + wxFLAGS_MEMBER(wxSP_ARROW_KEYS) + wxFLAGS_MEMBER(wxSP_WRAP) + +wxEND_FLAGS( wxSpinButtonStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinButton, wxControl,"wx/spinbut.h") + +wxBEGIN_PROPERTIES_TABLE(wxSpinButton) + wxEVENT_RANGE_PROPERTY( Spin , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxSpinEvent ) + + wxPROPERTY( Value , int , SetValue, GetValue, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Min , int , SetMin, GetMin, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Max , int , SetMax, GetMax, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxSpinButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxSpinButton) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxSpinButton , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl) +#endif + + + +// ---------------------------------------------------------------------------- +// wxSpinButton +// ---------------------------------------------------------------------------- + +bool wxSpinButton::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +wxSpinButton::~wxSpinButton() +{ +} + +// ---------------------------------------------------------------------------- +// size calculation +// ---------------------------------------------------------------------------- + +wxSize wxSpinButton::DoGetBestSize() const +{ + return wxSize(0,0), +} + +// ---------------------------------------------------------------------------- +// Attributes +// ---------------------------------------------------------------------------- + +int wxSpinButton::GetValue() const +{ + return 0; +} + +void wxSpinButton::SetValue(int val) +{ +} + +void wxSpinButton::SetRange(int minVal, int maxVal) +{ +} + +bool wxSpinButton::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, + WXWORD pos, WXHWND control) +{ + return false; +} + +bool wxSpinButton::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *result) +{ + return false; +} + +bool wxSpinButton::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD WXUNUSED(id)) +{ + return false; +} + +#endif // __WIN95__ + +#endif + // wxUSE_SPINCTN + diff --git a/src/palmos/spinctrl.cpp b/src/palmos/spinctrl.cpp new file mode 100644 index 0000000000..b77f962d0b --- /dev/null +++ b/src/palmos/spinctrl.cpp @@ -0,0 +1,251 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/spinctrl.cpp +// Purpose: wxSpinCtrl class implementation for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "spinctrlbase.h" + #pragma implementation "spinctrl.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#if wxUSE_SPINCTRL + +#if defined(__WIN95__) + +#include "wx/spinctrl.h" +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxSpinCtrlStyle ) + +wxBEGIN_FLAGS( wxSpinCtrlStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxSP_HORIZONTAL) + wxFLAGS_MEMBER(wxSP_VERTICAL) + wxFLAGS_MEMBER(wxSP_ARROW_KEYS) + wxFLAGS_MEMBER(wxSP_WRAP) + +wxEND_FLAGS( wxSpinCtrlStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl,"wx/spinbut.h") + +wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl) + wxEVENT_RANGE_PROPERTY( Spin , wxEVT_SCROLL_TOP , wxEVT_SCROLL_ENDSCROLL , wxSpinEvent ) + wxEVENT_PROPERTY( Updated , wxEVT_COMMAND_SPINCTRL_UPDATED , wxCommandEvent ) + wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent ) + wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent ) + + wxPROPERTY( ValueString , wxString , SetValue , GetValue , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) ; + wxPROPERTY( Value , int , SetValue, GetValue, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Min , int , SetMin, GetMin, 0, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Max , int , SetMax, GetMax, 0 , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxSpinCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +/* + TODO PROPERTIES + style wxSP_ARROW_KEYS +*/ +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxSpinCtrl) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxSpinCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , ValueString , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) +#endif + +BEGIN_EVENT_TABLE(wxSpinCtrl, wxSpinButton) + EVT_CHAR(wxSpinCtrl::OnChar) + + EVT_SET_FOCUS(wxSpinCtrl::OnSetFocus) + + EVT_SPIN(-1, wxSpinCtrl::OnSpinChange) +END_EVENT_TABLE() + +#define GetBuddyHwnd() (HWND)(m_hwndBuddy) + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the margin between the up-down control and its buddy (can be arbitrary, +// choose what you like - or may be decide during run-time depending on the +// font size?) +static const int MARGIN_BETWEEN = 1; + +// ============================================================================ +// implementation +// ============================================================================ + +wxArraySpins wxSpinCtrl::ms_allSpins; + +/* static */ +wxSpinCtrl *wxSpinCtrl::GetSpinForTextCtrl(WXHWND hwndBuddy) +{ + return NULL; +} + +// process a WM_COMMAND generated by the buddy text control +bool wxSpinCtrl::ProcessTextCommand(WXWORD cmd, WXWORD WXUNUSED(id)) +{ + return false; +} + +void wxSpinCtrl::OnChar(wxKeyEvent& event) +{ +} + +void wxSpinCtrl::OnSetFocus(wxFocusEvent& event) +{ +} + +// ---------------------------------------------------------------------------- +// construction +// ---------------------------------------------------------------------------- + +bool wxSpinCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + int min, int max, int initial, + const wxString& name) +{ + return false; +} + +wxSpinCtrl::~wxSpinCtrl() +{ +} + +// ---------------------------------------------------------------------------- +// wxTextCtrl-like methods +// ---------------------------------------------------------------------------- + +void wxSpinCtrl::SetValue(const wxString& text) +{ +} + +int wxSpinCtrl::GetValue() const +{ + return 0; +} + +void wxSpinCtrl::SetSelection(long from, long to) +{ +} + +// ---------------------------------------------------------------------------- +// forward some methods to subcontrols +// ---------------------------------------------------------------------------- + +bool wxSpinCtrl::SetFont(const wxFont& font) +{ + return false; +} + +bool wxSpinCtrl::Show(bool show) +{ + return false; +} + +bool wxSpinCtrl::Enable(bool enable) +{ + return false; +} + +void wxSpinCtrl::SetFocus() +{ +} + +// ---------------------------------------------------------------------------- +// event processing +// ---------------------------------------------------------------------------- + +void wxSpinCtrl::OnSpinChange(wxSpinEvent& eventSpin) +{ +} + +// ---------------------------------------------------------------------------- +// size calculations +// ---------------------------------------------------------------------------- + +wxSize wxSpinCtrl::DoGetBestSize() const +{ + return wxSize(0,0); +} + +void wxSpinCtrl::DoMoveWindow(int x, int y, int width, int height) +{ +} + +// get total size of the control +void wxSpinCtrl::DoGetSize(int *x, int *y) const +{ +} + +void wxSpinCtrl::DoGetPosition(int *x, int *y) const +{ +} + +#endif // __WIN95__ + +#endif + // wxUSE_SPINCTRL + diff --git a/src/palmos/statbmp.cpp b/src/palmos/statbmp.cpp new file mode 100644 index 0000000000..935041f02b --- /dev/null +++ b/src/palmos/statbmp.cpp @@ -0,0 +1,162 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: statbmp.cpp +// Purpose: wxStaticBitmap +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "statbmp.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_STATBMP + +#include "wx/window.h" +#include "wx/palmos/private.h" + +#ifndef WX_PRECOMP + #include "wx/icon.h" + #include "wx/statbmp.h" +#endif + +// --------------------------------------------------------------------------- +// macors +// --------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxStaticBitmapStyle ) + +wxBEGIN_FLAGS( wxStaticBitmapStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxStaticBitmapStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBitmap, wxControl,"wx/statbmp.h") + +wxBEGIN_PROPERTIES_TABLE(wxStaticBitmap) + wxPROPERTY_FLAGS( WindowStyle , wxStaticBitmapStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxStaticBitmap) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxStaticBitmap, wxWindow* , Parent , wxWindowID , Id , wxBitmap, Bitmap, wxPoint , Position , wxSize , Size ) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) +#endif + +/* + TODO PROPERTIES : + bitmap +*/ + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxStaticBitmap +// --------------------------------------------------------------------------- + +static wxGDIImage* ConvertImage( const wxGDIImage& bitmap ) +{ + return NULL; +} + +bool wxStaticBitmap::Create(wxWindow *parent, + wxWindowID id, + const wxGDIImage& bitmap, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +wxBorder wxStaticBitmap::GetDefaultBorder() const +{ + return wxBORDER_NONE; +} + +WXDWORD wxStaticBitmap::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +bool wxStaticBitmap::ImageIsOk() const +{ + return false; +} + +void wxStaticBitmap::Free() +{ +} + +wxSize wxStaticBitmap::DoGetBestSize() const +{ + return wxSize(0,0); +} + +void wxStaticBitmap::SetImage( const wxGDIImage* image ) +{ +} + +void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image) +{ +} + +// We need this or the control can never be moved e.g. in Dialog Editor. +WXLRESULT wxStaticBitmap::MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam) +{ + return false; +} + +#endif // wxUSE_STATBMP diff --git a/src/palmos/statbox.cpp b/src/palmos/statbox.cpp new file mode 100644 index 0000000000..4707329cd5 --- /dev/null +++ b/src/palmos/statbox.cpp @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/statbox.cpp +// Purpose: wxStaticBox +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "statbox.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_STATBOX + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/dcclient.h" +#endif + +#include "wx/statbox.h" + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxStaticBoxStyle ) + +wxBEGIN_FLAGS( wxStaticBoxStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxStaticBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox, wxControl,"wx/statbox.h") + +wxBEGIN_PROPERTIES_TABLE(wxStaticBox) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxStaticBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +/* + TODO PROPERTIES : + label +*/ +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxStaticBox) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxStaticBox , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxStaticBox +// ---------------------------------------------------------------------------- + +bool wxStaticBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +wxSize wxStaticBox::DoGetBestSize() const +{ + return wxSize(0,0); +} + +WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +#endif // wxUSE_STATBOX diff --git a/src/palmos/statline.cpp b/src/palmos/statline.cpp new file mode 100644 index 0000000000..3dad578082 --- /dev/null +++ b/src/palmos/statline.cpp @@ -0,0 +1,126 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/statline.cpp +// Purpose: wxStaticLine class +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "statline.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/statline.h" + +#if wxUSE_STATLINE + +#include "wx/palmos/private.h" +#include "wx/log.h" + +#ifndef SS_SUNKEN + #define SS_SUNKEN 0x00001000L +#endif + +#ifndef SS_NOTIFY + #define SS_NOTIFY 0x00000100L +#endif + +// ============================================================================ +// implementation +// ============================================================================ + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxStaticLineStyle ) + +wxBEGIN_FLAGS( wxStaticLineStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxLI_HORIZONTAL) + wxFLAGS_MEMBER(wxLI_VERTICAL) + +wxEND_FLAGS( wxStaticLineStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticLine, wxControl,"wx/statline.h") + +wxBEGIN_PROPERTIES_TABLE(wxStaticLine) + wxPROPERTY_FLAGS( WindowStyle , wxStaticLineStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxStaticLine) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxStaticLine, wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle) + +#else +IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl) +#endif + +/* + TODO PROPERTIES : + style (wxLI_HORIZONTAL) +*/ + +// ---------------------------------------------------------------------------- +// wxStaticLine +// ---------------------------------------------------------------------------- + +bool wxStaticLine::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& sizeOrig, + long style, + const wxString &name) +{ + return false; +} + +WXDWORD wxStaticLine::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +#endif // wxUSE_STATLINE + diff --git a/src/palmos/stattext.cpp b/src/palmos/stattext.cpp new file mode 100644 index 0000000000..1d2724b6a3 --- /dev/null +++ b/src/palmos/stattext.cpp @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/stattext.cpp +// Purpose: wxStaticText +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "stattext.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#if wxUSE_STATTEXT + +#ifndef WX_PRECOMP +#include "wx/event.h" +#include "wx/app.h" +#include "wx/brush.h" +#endif + +#include "wx/stattext.h" +#include "wx/palmos/private.h" + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxStaticTextStyle ) + +wxBEGIN_FLAGS( wxStaticTextStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxST_NO_AUTORESIZE) + wxFLAGS_MEMBER(wxALIGN_LEFT) + wxFLAGS_MEMBER(wxALIGN_RIGHT) + wxFLAGS_MEMBER(wxALIGN_CENTRE) + +wxEND_FLAGS( wxStaticTextStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticText, wxControl,"wx/stattext.h") + +wxBEGIN_PROPERTIES_TABLE(wxStaticText) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxStaticTextStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxStaticText) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxStaticText , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) +#endif + +bool wxStaticText::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +wxBorder wxStaticText::GetDefaultBorder() const +{ + return wxBORDER_NONE; +} + +WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +wxSize wxStaticText::DoGetBestSize() const +{ + return wxSize(0,0); +} + +void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags) +{ +} + +void wxStaticText::SetLabel(const wxString& label) +{ +} + + +bool wxStaticText::SetFont(const wxFont& font) +{ + return false; +} + +#endif // wxUSE_STATTEXT diff --git a/src/palmos/statusbr.cpp b/src/palmos/statusbr.cpp new file mode 100644 index 0000000000..a4dd9a1499 --- /dev/null +++ b/src/palmos/statusbr.cpp @@ -0,0 +1,250 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/statusbr.cpp +// Purpose: Implementation of wxStatusBar for PalmOS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "statusbr.h" +#endif + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/setup.h" + #include "wx/frame.h" + #include "wx/settings.h" + #include "wx/dcclient.h" +#endif + +#if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR + +#include "wx/intl.h" +#include "wx/log.h" +#include "wx/statusbr.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxStatusBarPalm class +// ---------------------------------------------------------------------------- + +wxStatusBarPalm::wxStatusBarPalm() +{ + SetParent(NULL); + m_hWnd = 0; + m_windowId = 0; +} + +bool wxStatusBarPalm::Create(wxWindow *parent, + wxWindowID id, + long style, + const wxString& name) +{ + wxCHECK_MSG( parent, FALSE, wxT("status bar must have a parent") ); + + StatusTextBuffer = NULL; + + SetName(name); + SetParent(parent); + + parent->AddChild(this); + + m_windowId = id == -1 ? NewControlId() : id; + + SetFieldsCount(1); + SubclassWin(m_hWnd); + + return TRUE; +} + +wxStatusBarPalm::~wxStatusBarPalm() +{ + DeleteStatusBuffer(); +} + +void wxStatusBarPalm::SetFieldsCount(int nFields, const int *widths) +{ + // this is a Windows limitation + wxASSERT_MSG( (nFields > 0) && (nFields < 255), _T("too many fields") ); + + wxStatusBarBase::SetFieldsCount(nFields, widths); + + SetFieldsWidth(); +} + +void wxStatusBarPalm::SetStatusWidths(int n, const int widths[]) +{ + wxStatusBarBase::SetStatusWidths(n, widths); + + SetFieldsWidth(); +} + +void wxStatusBarPalm::SetFieldsWidth() +{ + // clear the status bar + DeleteStatusBuffer(); +} + +void wxStatusBarPalm::SetStatusText(const wxString& strText, int nField) +{ + wxCHECK_RET( (nField >= 0) && (nField < m_nFields), + _T("invalid statusbar field index") ); + + SetStatusBufferText(strText,nField); + DrawStatusBar(); +} + +wxString wxStatusBarPalm::GetStatusText(int nField) const +{ + wxCHECK_MSG( (nField >= 0) && (nField < m_nFields), wxEmptyString, + _T("invalid statusbar field index") ); + + wxString text; + return text; +} + +void wxStatusBarPalm::DrawStatusBar() +{ + int i=0; + int leftPos=0; + wxArrayInt widthsAbs; + wxString text; + + RectangleType EraseRect; + EraseRect.topLeft.x=0; + EraseRect.topLeft.y=160-FntCharHeight()-1; + EraseRect.extent.x=159; + EraseRect.extent.y=159; + WinEraseRectangle(&EraseRect,0); + + if(m_nFields>0) + widthsAbs=CalculateAbsWidths(160 - 2*(m_nFields - 1)); + + for(i=0;iInsert(tmp); +} + +wxString wxStatusBarPalm::GetStatusBufferText(int number) +{ + wxListString *st = GetStatusBufferStack(number); + if(st==0) + return ""; + + wxListString::compatibility_iterator top = st->GetFirst(); + return(*top->GetData()); +} + +wxListString *wxStatusBarPalm::GetOrCreateStatusBuffer(int i) +{ + if(!StatusTextBuffer) + { + StatusTextBuffer = new wxListString*[m_nFields]; + + size_t j; + for(j = 0; j < (size_t)m_nFields; ++j) StatusTextBuffer[j] = 0; + } + + if(!StatusTextBuffer[i]) + { + StatusTextBuffer[i] = new wxListString(); + } + else + { + wxListString *st=StatusTextBuffer[i]; + wxListString::compatibility_iterator top = st->GetFirst(); + delete top->GetData(); + st->Erase(top); + delete st; + + StatusTextBuffer[i] = new wxListString(); + } + + return StatusTextBuffer[i]; +} + +wxListString *wxStatusBarPalm::GetStatusBufferStack(int i) const +{ + if(!StatusTextBuffer) + return 0; + return StatusTextBuffer[i]; +} + +void wxStatusBarPalm::DeleteStatusBuffer() +{ + int i=0; + + if(!StatusTextBuffer) + { + return; + } + + for(i=0;iGetFirst(); + delete top->GetData(); + st->Erase(top); + delete st; + StatusTextBuffer[i]=0; + } + } + delete[] m_statusTextStacks; +} + +int wxStatusBarPalm::GetBorderX() const +{ + return 0; +} + +int wxStatusBarPalm::GetBorderY() const +{ + return 0; +} + +void wxStatusBarPalm::SetMinHeight(int height) +{ +} + +bool wxStatusBarPalm::GetFieldRect(int i, wxRect& rect) const +{ +} + +void wxStatusBarPalm::DoMoveWindow(int x, int y, int width, int height) +{ +} + +#endif // wxUSE_NATIVE_STATUSBAR + diff --git a/src/palmos/tabctrl.cpp b/src/palmos/tabctrl.cpp new file mode 100644 index 0000000000..8ba8b74746 --- /dev/null +++ b/src/palmos/tabctrl.cpp @@ -0,0 +1,189 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: tabctrl.cpp +// Purpose: wxTabCtrl +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "tabctrl.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#if defined(__WIN95__) + +#include "wx/tabctrl.h" +#include "wx/app.h" +#include "wx/palmos/imaglist.h" + +IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) + +DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) + +BEGIN_EVENT_TABLE(wxTabCtrl, wxControl) + EVT_SYS_COLOUR_CHANGED(wxTabCtrl::OnSysColourChanged) +END_EVENT_TABLE() + +wxTabCtrl::wxTabCtrl() +{ +} + +bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, + long style, const wxString& name) +{ + return false; +} + +wxTabCtrl::~wxTabCtrl() +{ +} + +bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) +{ + return false; +} + +// Responds to colour changes, and passes event on to children. +void wxTabCtrl::OnSysColourChanged(wxSysColourChangedEvent& event) +{ +} + +// Delete all items +bool wxTabCtrl::DeleteAllItems() +{ + return false; +} + +// Delete an item +bool wxTabCtrl::DeleteItem(int item) +{ + return false; +} + +// Get the selection +int wxTabCtrl::GetSelection() const +{ + return 0; +} + +// Get the tab with the current keyboard focus +int wxTabCtrl::GetCurFocus() const +{ + return 0; +} + +// Get the associated image list +wxImageList* wxTabCtrl::GetImageList() const +{ + return NULL; +} + +// Get the number of items +int wxTabCtrl::GetItemCount() const +{ + return 0; +} + +// Get the rect corresponding to the tab +bool wxTabCtrl::GetItemRect(int item, wxRect& wxrect) const +{ + return false; +} + +// Get the number of rows +int wxTabCtrl::GetRowCount() const +{ + return 0; +} + +// Get the item text +wxString wxTabCtrl::GetItemText(int item) const +{ + wxString str(wxEmptyString); + + return str; +} + +// Get the item image +int wxTabCtrl::GetItemImage(int item) const +{ + return -1; +} + +// Get the item data +void* wxTabCtrl::GetItemData(int item) const +{ + return 0; +} + +// Hit test +int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) +{ + return 0; +} + +// Insert an item +bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) +{ + return false; +} + +// Set the selection +int wxTabCtrl::SetSelection(int item) +{ + return 0; +} + +// Set the image list +void wxTabCtrl::SetImageList(wxImageList* imageList) +{ +} + +// Set the text for an item +bool wxTabCtrl::SetItemText(int item, const wxString& text) +{ + return false; +} + +// Set the image for an item +bool wxTabCtrl::SetItemImage(int item, int image) +{ + return false; +} + +// Set the data for an item +bool wxTabCtrl::SetItemData(int item, void* data) +{ + return false; +} + +// Set the size for a fixed-width tab control +void wxTabCtrl::SetItemSize(const wxSize& size) +{ +} + +// Set the padding between tabs +void wxTabCtrl::SetPadding(const wxSize& padding) +{ +} + + +#endif + // __WIN95__ + diff --git a/src/palmos/taskbar.cpp b/src/palmos/taskbar.cpp new file mode 100644 index 0000000000..3afea437f8 --- /dev/null +++ b/src/palmos/taskbar.cpp @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////// +// File: taskbar.cpp +// Purpose: Implements wxTaskBarIcon class for manipulating icons on +// the task bar. +// Author: Julian Smart +// Modified by: Vaclav Slavik +// Created: 24/3/98 +// RCS-ID: $Id$ +// Copyright: (c) +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma implementation "taskbar.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/defs.h" +#include "wx/window.h" +#include "wx/frame.h" +#include "wx/utils.h" +#include "wx/menu.h" +#endif + +#if defined(__WIN95__) + +#include +#include "wx/taskbar.h" + +#if WXWIN_COMPATIBILITY_2_4 +BEGIN_EVENT_TABLE(wxTaskBarIcon, wxTaskBarIconBase) + EVT_TASKBAR_MOVE (wxTaskBarIcon::_OnMouseMove) + EVT_TASKBAR_LEFT_DOWN (wxTaskBarIcon::_OnLButtonDown) + EVT_TASKBAR_LEFT_UP (wxTaskBarIcon::_OnLButtonUp) + EVT_TASKBAR_RIGHT_DOWN (wxTaskBarIcon::_OnRButtonDown) + EVT_TASKBAR_RIGHT_UP (wxTaskBarIcon::_OnRButtonUp) + EVT_TASKBAR_LEFT_DCLICK (wxTaskBarIcon::_OnLButtonDClick) + EVT_TASKBAR_RIGHT_DCLICK (wxTaskBarIcon::_OnRButtonDClick) +END_EVENT_TABLE() +#endif + + +IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTaskBarIconWindow: helper window +// ---------------------------------------------------------------------------- + +// NB: this class serves two purposes: +// 1. win32 needs a HWND associated with taskbar icon, this provides it +// 2. we need wxTopLevelWindow so that the app doesn't exit when +// last frame is closed but there still is a taskbar icon +class wxTaskBarIconWindow : public wxFrame +{ +public: + wxTaskBarIconWindow(wxTaskBarIcon *icon) + : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0), + m_icon(icon) + { + } + + WXLRESULT MSWWindowProc(WXUINT msg, + WXWPARAM wParam, WXLPARAM lParam) + { + return 0; + } + +private: + wxTaskBarIcon *m_icon; +}; + +// ---------------------------------------------------------------------------- +// wxTaskBarIcon +// ---------------------------------------------------------------------------- + +wxTaskBarIcon::wxTaskBarIcon() +{ +} + +wxTaskBarIcon::~wxTaskBarIcon() +{ +} + +// Operations +bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) +{ + return false; +} + +bool wxTaskBarIcon::RemoveIcon() +{ + return false; +} + +bool wxTaskBarIcon::PopupMenu(wxMenu *menu) +{ + return false; +} + +#if WXWIN_COMPATIBILITY_2_4 +// Overridables +void wxTaskBarIcon::OnMouseMove(wxEvent& e) { e.Skip(); } +void wxTaskBarIcon::OnLButtonDown(wxEvent& e) { e.Skip(); } +void wxTaskBarIcon::OnLButtonUp(wxEvent& e) { e.Skip(); } +void wxTaskBarIcon::OnRButtonDown(wxEvent& e) { e.Skip(); } +void wxTaskBarIcon::OnRButtonUp(wxEvent& e) { e.Skip(); } +void wxTaskBarIcon::OnLButtonDClick(wxEvent& e) { e.Skip(); } +void wxTaskBarIcon::OnRButtonDClick(wxEvent& e) { e.Skip(); } + +void wxTaskBarIcon::_OnMouseMove(wxTaskBarIconEvent& e) + { OnMouseMove(e); } +void wxTaskBarIcon::_OnLButtonDown(wxTaskBarIconEvent& e) + { OnLButtonDown(e); } +void wxTaskBarIcon::_OnLButtonUp(wxTaskBarIconEvent& e) + { OnLButtonUp(e); } +void wxTaskBarIcon::_OnRButtonDown(wxTaskBarIconEvent& e) + { OnRButtonDown(e); } +void wxTaskBarIcon::_OnRButtonUp(wxTaskBarIconEvent& e) + { OnRButtonUp(e); } +void wxTaskBarIcon::_OnLButtonDClick(wxTaskBarIconEvent& e) + { OnLButtonDClick(e); } +void wxTaskBarIcon::_OnRButtonDClick(wxTaskBarIconEvent& e) + { OnRButtonDClick(e); } +#endif + +void wxTaskBarIcon::RegisterWindowMessages() +{ +} + +// ---------------------------------------------------------------------------- +// wxTaskBarIcon window proc +// ---------------------------------------------------------------------------- + +long wxTaskBarIcon::WindowProc(unsigned int msg, + unsigned int WXUNUSED(wParam), + long lParam) +{ + return 0; +} + +#endif // __WIN95__ + diff --git a/src/palmos/textctrl.cpp b/src/palmos/textctrl.cpp new file mode 100644 index 0000000000..e0bdf7e6f5 --- /dev/null +++ b/src/palmos/textctrl.cpp @@ -0,0 +1,747 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/textctrl.cpp +// Purpose: wxTextCtrl +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "textctrl.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_TEXTCTRL + +#ifndef WX_PRECOMP + #include "wx/textctrl.h" + #include "wx/settings.h" + #include "wx/brush.h" + #include "wx/utils.h" + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/app.h" + #include "wx/menu.h" +#endif + +#include "wx/module.h" + +#if wxUSE_CLIPBOARD + #include "wx/clipbrd.h" +#endif + +#include "wx/textfile.h" + +#include "wx/palmos/private.h" +#include "wx/palmos/winundef.h" + +#include + +#if wxUSE_RICHEDIT + +#include "wx/palmos/missing.h" + +#endif // wxUSE_RICHEDIT + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +#if wxUSE_RICHEDIT + +// this module initializes RichEdit DLL(s) if needed +class wxRichEditModule : public wxModule +{ +public: + virtual bool OnInit(); + virtual void OnExit(); + + // load the richedit DLL of at least of required version + static bool Load(int version = 1); + +private: + // the handles to richedit 1.0 and 2.0 (or 3.0) DLLs + static HINSTANCE ms_hRichEdit[2]; + + DECLARE_DYNAMIC_CLASS(wxRichEditModule) +}; + +HINSTANCE wxRichEditModule::ms_hRichEdit[2] = { NULL, NULL }; + +IMPLEMENT_DYNAMIC_CLASS(wxRichEditModule, wxModule) + +#endif // wxUSE_RICHEDIT + +// ---------------------------------------------------------------------------- +// event tables and other macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxTextCtrlStyle ) + +wxBEGIN_FLAGS( wxTextCtrlStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxTE_PROCESS_ENTER) + wxFLAGS_MEMBER(wxTE_PROCESS_TAB) + wxFLAGS_MEMBER(wxTE_MULTILINE) + wxFLAGS_MEMBER(wxTE_PASSWORD) + wxFLAGS_MEMBER(wxTE_READONLY) + wxFLAGS_MEMBER(wxHSCROLL) + wxFLAGS_MEMBER(wxTE_RICH) + wxFLAGS_MEMBER(wxTE_RICH2) + wxFLAGS_MEMBER(wxTE_AUTO_URL) + wxFLAGS_MEMBER(wxTE_NOHIDESEL) + wxFLAGS_MEMBER(wxTE_LEFT) + wxFLAGS_MEMBER(wxTE_CENTRE) + wxFLAGS_MEMBER(wxTE_RIGHT) + wxFLAGS_MEMBER(wxTE_DONTWRAP) + wxFLAGS_MEMBER(wxTE_LINEWRAP) + wxFLAGS_MEMBER(wxTE_WORDWRAP) + +wxEND_FLAGS( wxTextCtrlStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxTextCtrl, wxControl,"wx/textctrl.h") + +wxBEGIN_PROPERTIES_TABLE(wxTextCtrl) + wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent ) + wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent ) + + wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Value , wxString , SetValue, GetValue, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY_FLAGS( WindowStyle , wxTextCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxTextCtrl) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_6( wxTextCtrl , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size , long , WindowStyle) +#else +IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl) +#endif + + +BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) + EVT_CHAR(wxTextCtrl::OnChar) + EVT_DROP_FILES(wxTextCtrl::OnDropFiles) + +#if wxUSE_RICHEDIT + EVT_RIGHT_UP(wxTextCtrl::OnRightClick) +#endif + + EVT_MENU(wxID_CUT, wxTextCtrl::OnCut) + EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy) + EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste) + EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo) + EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo) + EVT_MENU(wxID_CLEAR, wxTextCtrl::OnDelete) + EVT_MENU(wxID_SELECTALL, wxTextCtrl::OnSelectAll) + + EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut) + EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy) + EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste) + EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo) + EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo) + EVT_UPDATE_UI(wxID_CLEAR, wxTextCtrl::OnUpdateDelete) + EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll) + + EVT_SET_FOCUS(wxTextCtrl::OnSetFocus) +END_EVENT_TABLE() + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// creation +// ---------------------------------------------------------------------------- + +void wxTextCtrl::Init() +{ +} + +wxTextCtrl::~wxTextCtrl() +{ +} + +bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +// Make sure the window style (etc.) reflects the HWND style (roughly) +void wxTextCtrl::AdoptAttributesFromHWND() +{ +} + +WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +void wxTextCtrl::SetWindowStyleFlag(long style) +{ +} + +// ---------------------------------------------------------------------------- +// set/get the controls text +// ---------------------------------------------------------------------------- + +wxString wxTextCtrl::GetValue() const +{ + wxString res; + + return res; +} + +wxString wxTextCtrl::GetRange(long from, long to) const +{ + wxString str; + + return str; +} + +void wxTextCtrl::SetValue(const wxString& value) +{ +} + +#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) + +// TODO: using memcpy() would improve performance a lot for big amounts of text + +DWORD CALLBACK +wxRichEditStreamIn(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb) +{ + return 0; +} + +// helper struct used to pass parameters from wxTextCtrl to wxRichEditStreamOut +struct wxStreamOutData +{ + wchar_t *wpc; + size_t len; +}; + +DWORD CALLBACK +wxRichEditStreamOut(DWORD_PTR dwCookie, BYTE *buf, LONG cb, LONG *pcb) +{ + return 0; +} + + +#if wxUSE_UNICODE_MSLU + #define UNUSED_IF_MSLU(param) +#else + #define UNUSED_IF_MSLU(param) param +#endif + +bool +wxTextCtrl::StreamIn(const wxString& value, + wxFontEncoding UNUSED_IF_MSLU(encoding), + bool selectionOnly) +{ + return false; +} + +#if !wxUSE_UNICODE_MSLU + +wxString +wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const +{ + wxString out; + + return out; +} + +#endif // !wxUSE_UNICODE_MSLU + +#endif // wxUSE_RICHEDIT + +void wxTextCtrl::WriteText(const wxString& value) +{ +} + +void wxTextCtrl::DoWriteText(const wxString& value, bool selectionOnly) +{ +} + +void wxTextCtrl::AppendText(const wxString& text) +{ +} + +void wxTextCtrl::Clear() +{ +} + +#ifdef __WIN32__ + +bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event) +{ + return false; +} + +#endif // __WIN32__ + +// ---------------------------------------------------------------------------- +// Clipboard operations +// ---------------------------------------------------------------------------- + +void wxTextCtrl::Copy() +{ +} + +void wxTextCtrl::Cut() +{ +} + +void wxTextCtrl::Paste() +{ +} + +bool wxTextCtrl::HasSelection() const +{ + return false; +} + +bool wxTextCtrl::CanCopy() const +{ + return false; +} + +bool wxTextCtrl::CanCut() const +{ + return false; +} + +bool wxTextCtrl::CanPaste() const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// Accessors +// ---------------------------------------------------------------------------- + +void wxTextCtrl::SetEditable(bool editable) +{ +} + +void wxTextCtrl::SetInsertionPoint(long pos) +{ +} + +void wxTextCtrl::SetInsertionPointEnd() +{ +} + +long wxTextCtrl::GetInsertionPoint() const +{ + return 0; +} + +long wxTextCtrl::GetLastPosition() const +{ + return 0; +} + +// If the return values from and to are the same, there is no +// selection. +void wxTextCtrl::GetSelection(long* from, long* to) const +{ +} + +bool wxTextCtrl::IsEditable() const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// selection +// ---------------------------------------------------------------------------- + +void wxTextCtrl::SetSelection(long from, long to) +{ +} + +void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret) +{ +} + +// ---------------------------------------------------------------------------- +// Working with files +// ---------------------------------------------------------------------------- + +bool wxTextCtrl::LoadFile(const wxString& file) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// Editing +// ---------------------------------------------------------------------------- + +void wxTextCtrl::Replace(long from, long to, const wxString& value) +{ +} + +void wxTextCtrl::Remove(long from, long to) +{ +} + +bool wxTextCtrl::IsModified() const +{ + return false; +} + +void wxTextCtrl::MarkDirty() +{ +} + +void wxTextCtrl::DiscardEdits() +{ +} + +int wxTextCtrl::GetNumberOfLines() const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// Positions <-> coords +// ---------------------------------------------------------------------------- + +long wxTextCtrl::XYToPosition(long x, long y) const +{ + return 0; +} + +bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const +{ + return false; +} + +wxTextCtrlHitTestResult +wxTextCtrl::HitTest(const wxPoint& pt, wxTextCoord *col, wxTextCoord *row) const +{ + return wxTE_HT_UNKNOWN; +} + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- + +void wxTextCtrl::ShowPosition(long pos) +{ +} + +long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const +{ + return 0; +} + +int wxTextCtrl::GetLineLength(long lineNo) const +{ + return 0; +} + +wxString wxTextCtrl::GetLineText(long lineNo) const +{ + wxString str; + + return str; +} + +void wxTextCtrl::SetMaxLength(unsigned long len) +{ +} + +// ---------------------------------------------------------------------------- +// Undo/redo +// ---------------------------------------------------------------------------- + +void wxTextCtrl::Undo() +{ +} + +void wxTextCtrl::Redo() +{ +} + +bool wxTextCtrl::CanUndo() const +{ +} + +bool wxTextCtrl::CanRedo() const +{ +} + +// ---------------------------------------------------------------------------- +// caret handling (Windows only) +// ---------------------------------------------------------------------------- + +bool wxTextCtrl::ShowNativeCaret(bool show) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// implemenation details +// ---------------------------------------------------------------------------- + +void wxTextCtrl::Command(wxCommandEvent & event) +{ +} + +void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event) +{ +} + +// ---------------------------------------------------------------------------- +// kbd input processing +// ---------------------------------------------------------------------------- + +bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* pMsg) +{ + return false; +} + +void wxTextCtrl::OnChar(wxKeyEvent& event) +{ +} + +WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// text control event processing +// ---------------------------------------------------------------------------- + +bool wxTextCtrl::SendUpdateEvent() +{ + return false; +} + +bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +{ + return false; +} + +WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor), +#if wxUSE_CTL3D + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam +#else + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam) +#endif + ) +{ + return (WXHBRUSH) 0; +} + +bool wxTextCtrl::AdjustSpaceLimit() +{ + return false; +} + +bool wxTextCtrl::AcceptsFocus() const +{ + return false; +} + +wxSize wxTextCtrl::DoGetBestSize() const +{ + return wxSize(0,0); +} + +// ---------------------------------------------------------------------------- +// standard handlers for standard edit menu events +// ---------------------------------------------------------------------------- + +void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event)) +{ +} + +void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event) +{ +} + +void wxTextCtrl::OnRightClick(wxMouseEvent& event) +{ +} + +void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event)) +{ +} + +// the rest of the file only deals with the rich edit controls +#if wxUSE_RICHEDIT + +// ---------------------------------------------------------------------------- +// EN_LINK processing +// ---------------------------------------------------------------------------- + +bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// colour setting for the rich edit controls +// ---------------------------------------------------------------------------- + +bool wxTextCtrl::SetBackgroundColour(const wxColour& colour) +{ + return false; +} + +bool wxTextCtrl::SetForegroundColour(const wxColour& colour) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// styling support for rich edit controls +// ---------------------------------------------------------------------------- + +#if wxUSE_RICHEDIT + +bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) +{ + return false; +} + +bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style) +{ + return false; +} + +bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) +{ + return false; +} + +#endif + +// ---------------------------------------------------------------------------- +// wxRichEditModule +// ---------------------------------------------------------------------------- + +bool wxRichEditModule::OnInit() +{ + return false; +} + +void wxRichEditModule::OnExit() +{ +} + +/* static */ +bool wxRichEditModule::Load(int version) +{ + return false; +} + +#endif // wxUSE_RICHEDIT + +#endif // wxUSE_TEXTCTRL diff --git a/src/palmos/tglbtn.cpp b/src/palmos/tglbtn.cpp new file mode 100644 index 0000000000..ead4ee1eaa --- /dev/null +++ b/src/palmos/tglbtn.cpp @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/tglbtn.cpp +// Purpose: Definition of the wxToggleButton class, which implements a +// toggle button. +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declatations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/tglbtn.h" + +#if wxUSE_TOGGLEBTN + +#ifndef WX_PRECOMP + #include "wx/button.h" + #include "wx/brush.h" + #include "wx/dcscreen.h" + #include "wx/settings.h" + + #include "wx/log.h" +#endif // WX_PRECOMP + +#include "wx/palmos/private.h" + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) + +#define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxToggleButton +// ---------------------------------------------------------------------------- + +bool wxToggleButton::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) +{ + wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId); + event.SetInt(GetValue()); + event.SetEventObject(this); + ProcessCommand(event); + return TRUE; +} + +// Single check box item +bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +wxBorder wxToggleButton::GetDefaultBorder() const +{ + return wxBORDER_NONE; +} + +WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const +{ + return 0; +} + +void wxToggleButton::SetLabel(const wxString& label) +{ +} + +wxSize wxToggleButton::DoGetBestSize() const +{ + return wxSize(0,0); +} + +void wxToggleButton::SetValue(bool val) +{ +} + +#ifndef BST_CHECKED +#define BST_CHECKED 0x0001 +#endif + +bool wxToggleButton::GetValue() const +{ + return false; +} + +void wxToggleButton::Command(wxCommandEvent & event) +{ +} + +#endif // wxUSE_TOGGLEBTN + diff --git a/src/palmos/thread.cpp b/src/palmos/thread.cpp new file mode 100644 index 0000000000..6883854f73 --- /dev/null +++ b/src/palmos/thread.cpp @@ -0,0 +1,598 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/thread.cpp +// Purpose: wxThread Implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "thread.h" +#endif + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#if defined(__BORLANDC__) + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/app.h" +#endif + +#if wxUSE_THREADS + +#include "wx/apptrait.h" + +#include "wx/palmos/private.h" +#include "wx/palmos/missing.h" + +#include "wx/module.h" +#include "wx/thread.h" + +// must have this symbol defined to get _beginthread/_endthread declarations +#ifndef _MT + #define _MT +#endif + +#if defined(__BORLANDC__) + #if !defined(__MT__) + // I can't set -tWM in the IDE (anyone?) so have to do this + #define __MT__ + #endif + + #if !defined(__MFC_COMPAT__) + // Needed to know about _beginthreadex etc.. + #define __MFC_COMPAT__ + #endif +#endif // BC++ + +// define wxUSE_BEGIN_THREAD if the compiler has _beginthreadex() function +// which should be used instead of Win32 ::CreateThread() if possible +#if defined(__VISUALC__) || \ + (defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)) || \ + (defined(__GNUG__) && defined(__MSVCRT__)) || \ + defined(__WATCOMC__) || defined(__MWERKS__) + +#ifndef __WXWINCE__ + #undef wxUSE_BEGIN_THREAD + #define wxUSE_BEGIN_THREAD +#endif + +#endif + +#ifdef wxUSE_BEGIN_THREAD + // the return type of the thread function entry point + typedef unsigned THREAD_RETVAL; + + // the calling convention of the thread function entry point + #define THREAD_CALLCONV __stdcall +#else + // the settings for CreateThread() + typedef DWORD THREAD_RETVAL; + #define THREAD_CALLCONV WINAPI +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// the possible states of the thread ("=>" shows all possible transitions from +// this state) +enum wxThreadState +{ + STATE_NEW, // didn't start execution yet (=> RUNNING) + STATE_RUNNING, // thread is running (=> PAUSED, CANCELED) + STATE_PAUSED, // thread is temporarily suspended (=> RUNNING) + STATE_CANCELED, // thread should terminate a.s.a.p. (=> EXITED) + STATE_EXITED // thread is terminating +}; + +// ---------------------------------------------------------------------------- +// this module globals +// ---------------------------------------------------------------------------- + +// TLS index of the slot where we store the pointer to the current thread +static DWORD gs_tlsThisThread = 0xFFFFFFFF; + +// id of the main thread - the one which can call GUI functions without first +// calling wxMutexGuiEnter() +static DWORD gs_idMainThread = 0; + +// if it's false, some secondary thread is holding the GUI lock +static bool gs_bGuiOwnedByMainThread = true; + +// critical section which controls access to all GUI functions: any secondary +// thread (i.e. except the main one) must enter this crit section before doing +// any GUI calls +static wxCriticalSection *gs_critsectGui = NULL; + +// critical section which protects gs_nWaitingForGui variable +static wxCriticalSection *gs_critsectWaitingForGui = NULL; + +// critical section which serializes WinThreadStart() and WaitForTerminate() +// (this is a potential bottleneck, we use a single crit sect for all threads +// in the system, but normally time spent inside it should be quite short) +static wxCriticalSection *gs_critsectThreadDelete = NULL; + +// number of threads waiting for GUI in wxMutexGuiEnter() +static size_t gs_nWaitingForGui = 0; + +// are we waiting for a thread termination? +static bool gs_waitingForThread = false; + +// ============================================================================ +// Windows implementation of thread and related classes +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxCriticalSection +// ---------------------------------------------------------------------------- + +wxCriticalSection::wxCriticalSection() +{ +} + +wxCriticalSection::~wxCriticalSection() +{ +} + +void wxCriticalSection::Enter() +{ +} + +void wxCriticalSection::Leave() +{ +} + +// ---------------------------------------------------------------------------- +// wxMutex +// ---------------------------------------------------------------------------- + +class wxMutexInternal +{ +public: + wxMutexInternal(wxMutexType mutexType); + ~wxMutexInternal(); + + bool IsOk() const { return m_mutex != NULL; } + + wxMutexError Lock() { return LockTimeout(INFINITE); } + wxMutexError TryLock() { return LockTimeout(0); } + wxMutexError Unlock(); + +private: + wxMutexError LockTimeout(DWORD milliseconds); + + HANDLE m_mutex; + + DECLARE_NO_COPY_CLASS(wxMutexInternal) +}; + +// all mutexes are recursive under Win32 so we don't use mutexType +wxMutexInternal::wxMutexInternal(wxMutexType WXUNUSED(mutexType)) +{ +} + +wxMutexInternal::~wxMutexInternal() +{ +} + +wxMutexError wxMutexInternal::LockTimeout(DWORD milliseconds) +{ + return wxMUTEX_NO_ERROR; +} + +wxMutexError wxMutexInternal::Unlock() +{ + return wxMUTEX_NO_ERROR; +} + +// -------------------------------------------------------------------------- +// wxSemaphore +// -------------------------------------------------------------------------- + +// a trivial wrapper around Win32 semaphore +class wxSemaphoreInternal +{ +public: + wxSemaphoreInternal(int initialcount, int maxcount); + ~wxSemaphoreInternal(); + + bool IsOk() const { return m_semaphore != NULL; } + + wxSemaError Wait() { return WaitTimeout(INFINITE); } + + wxSemaError TryWait() + { + wxSemaError rc = WaitTimeout(0); + if ( rc == wxSEMA_TIMEOUT ) + rc = wxSEMA_BUSY; + + return rc; + } + + wxSemaError WaitTimeout(unsigned long milliseconds); + + wxSemaError Post(); + +private: + HANDLE m_semaphore; + + DECLARE_NO_COPY_CLASS(wxSemaphoreInternal) +}; + +wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) +{ +} + +wxSemaphoreInternal::~wxSemaphoreInternal() +{ +} + +wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds) +{ + return wxSEMA_NO_ERROR; +} + +wxSemaError wxSemaphoreInternal::Post() +{ + return wxSEMA_NO_ERROR; +} + +// ---------------------------------------------------------------------------- +// wxThread implementation +// ---------------------------------------------------------------------------- + +// wxThreadInternal class +// ---------------------- + +class wxThreadInternal +{ +public: + wxThreadInternal(wxThread *thread) + { + m_thread = thread; + m_hThread = 0; + m_state = STATE_NEW; + m_priority = WXTHREAD_DEFAULT_PRIORITY; + m_nRef = 1; + } + + ~wxThreadInternal() + { + Free(); + } + + void Free() + { + if ( m_hThread ) + { + if ( !::CloseHandle(m_hThread) ) + { + wxLogLastError(wxT("CloseHandle(thread)")); + } + + m_hThread = 0; + } + } + + // create a new (suspended) thread (for the given thread object) + bool Create(wxThread *thread, unsigned int stackSize); + + // wait for the thread to terminate, either by itself, or by asking it + // (politely, this is not Kill()!) to do it + wxThreadError WaitForTerminate(wxCriticalSection& cs, + wxThread::ExitCode *pRc, + wxThread *threadToDelete = NULL); + + // kill the thread unconditionally + wxThreadError Kill(); + + // suspend/resume/terminate + bool Suspend(); + bool Resume(); + void Cancel() { m_state = STATE_CANCELED; } + + // thread state + void SetState(wxThreadState state) { m_state = state; } + wxThreadState GetState() const { return m_state; } + + // thread priority + void SetPriority(unsigned int priority); + unsigned int GetPriority() const { return m_priority; } + + // thread handle and id + HANDLE GetHandle() const { return m_hThread; } + DWORD GetId() const { return m_tid; } + + // thread function + static THREAD_RETVAL THREAD_CALLCONV WinThreadStart(void *thread); + + void KeepAlive() + { + if ( m_thread->IsDetached() ) + ::InterlockedIncrement(&m_nRef); + } + + void LetDie() + { + if ( m_thread->IsDetached() && !::InterlockedDecrement(&m_nRef) ) + delete m_thread; + } + +private: + // the thread we're associated with + wxThread *m_thread; + + HANDLE m_hThread; // handle of the thread + wxThreadState m_state; // state, see wxThreadState enum + unsigned int m_priority; // thread priority in "wx" units + DWORD m_tid; // thread id + + // number of threads which need this thread to remain alive, when the count + // reaches 0 we kill the owning wxThread -- and die ourselves with it + LONG m_nRef; + + DECLARE_NO_COPY_CLASS(wxThreadInternal) +}; + +// small class which keeps a thread alive during its lifetime +class wxThreadKeepAlive +{ +public: + wxThreadKeepAlive(wxThreadInternal& thrImpl) : m_thrImpl(thrImpl) + { m_thrImpl.KeepAlive(); } + ~wxThreadKeepAlive() + { m_thrImpl.LetDie(); } + +private: + wxThreadInternal& m_thrImpl; +}; + + +THREAD_RETVAL THREAD_CALLCONV wxThreadInternal::WinThreadStart(void *param) +{ + THREAD_RETVAL rc; + + return rc; +} + +void wxThreadInternal::SetPriority(unsigned int priority) +{ +} + +bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize) +{ + return false; +} + +wxThreadError wxThreadInternal::Kill() +{ + return wxTHREAD_NO_ERROR; +} + +wxThreadError +wxThreadInternal::WaitForTerminate(wxCriticalSection& cs, + wxThread::ExitCode *pRc, + wxThread *threadToDelete) +{ + return wxTHREAD_NO_ERROR; +} + +bool wxThreadInternal::Suspend() +{ + return true; +} + +bool wxThreadInternal::Resume() +{ + return true; +} + +// static functions +// ---------------- + +wxThread *wxThread::This() +{ + return NULL; +} + +bool wxThread::IsMain() +{ + return true; +} + +void wxThread::Yield() +{ +} + +void wxThread::Sleep(unsigned long milliseconds) +{ +} + +int wxThread::GetCPUCount() +{ + return 1; +} + +unsigned long wxThread::GetCurrentId() +{ + return 0; +} + +bool wxThread::SetConcurrency(size_t level) +{ + return true; +} + +// ctor and dtor +// ------------- + +wxThread::wxThread(wxThreadKind kind) +{ +} + +wxThread::~wxThread() +{ +} + +// create/start thread +// ------------------- + +wxThreadError wxThread::Create(unsigned int stackSize) +{ + return wxTHREAD_NO_ERROR; +} + +wxThreadError wxThread::Run() +{ + return wxTHREAD_RUNNING; +} + +// suspend/resume thread +// --------------------- + +wxThreadError wxThread::Pause() +{ + return wxTHREAD_NO_ERROR; +} + +wxThreadError wxThread::Resume() +{ + return wxTHREAD_NO_ERROR; +} + +// stopping thread +// --------------- + +wxThread::ExitCode wxThread::Wait() +{ + return 0; +} + +wxThreadError wxThread::Delete(ExitCode *pRc) +{ + return wxTHREAD_NO_ERROR; +} + +wxThreadError wxThread::Kill() +{ + return wxTHREAD_NO_ERROR; +} + +void wxThread::Exit(ExitCode status) +{ +} + +// priority setting +// ---------------- + +void wxThread::SetPriority(unsigned int prio) +{ +} + +unsigned int wxThread::GetPriority() const +{ + return 1; +} + +unsigned long wxThread::GetId() const +{ + return 0; +} + +bool wxThread::IsRunning() const +{ + return true; +} + +bool wxThread::IsAlive() const +{ + return true; +} + +bool wxThread::IsPaused() const +{ + return false; +} + +bool wxThread::TestDestroy() +{ + return true; +} + +// ---------------------------------------------------------------------------- +// Automatic initialization for thread module +// ---------------------------------------------------------------------------- + +class wxThreadModule : public wxModule +{ +public: + virtual bool OnInit(); + virtual void OnExit(); + +private: + DECLARE_DYNAMIC_CLASS(wxThreadModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule) + +bool wxThreadModule::OnInit() +{ + return true; +} + +void wxThreadModule::OnExit() +{ +} + +// ---------------------------------------------------------------------------- +// under Windows, these functions are implemented using a critical section and +// not a mutex, so the names are a bit confusing +// ---------------------------------------------------------------------------- + +void WXDLLIMPEXP_BASE wxMutexGuiEnter() +{ +} + +void WXDLLIMPEXP_BASE wxMutexGuiLeave() +{ +} + +void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter() +{ +} + +bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread() +{ + return true; +} + +// wake up the main thread if it's in ::GetMessage() +void WXDLLIMPEXP_BASE wxWakeUpMainThread() +{ +} + +bool WXDLLIMPEXP_BASE wxIsWaitingForThread() +{ + return false; +} + +// ---------------------------------------------------------------------------- +// include common implementation code +// ---------------------------------------------------------------------------- + +#include "wx/thrimpl.cpp" + +#endif // wxUSE_THREADS + diff --git a/src/palmos/timer.cpp b/src/palmos/timer.cpp new file mode 100644 index 0000000000..254369d4b0 --- /dev/null +++ b/src/palmos/timer.cpp @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/timer.cpp +// Purpose: wxTimer implementation +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "timer.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_TIMER + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/list.h" + #include "wx/event.h" + #include "wx/app.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#include "wx/hashmap.h" + +#include "wx/timer.h" + +#include "wx/palmos/private.h" + +// from utils.cpp +extern "C" WXDLLIMPEXP_BASE HWND +wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc); + +// ---------------------------------------------------------------------------- +// private globals +// ---------------------------------------------------------------------------- + +// define a hash containing all the timers: it is indexed by timer id and +// contains the corresponding timer +WX_DECLARE_HASH_MAP(unsigned long, wxTimer *, wxIntegerHash, wxIntegerEqual, + wxTimerMap); + +static wxTimerMap g_timerMap; + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +void WINAPI wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); + +// ---------------------------------------------------------------------------- +// macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler) + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxTimer class +// ---------------------------------------------------------------------------- + +void wxTimer::Init() +{ +} + +wxTimer::~wxTimer() +{ +} + +bool wxTimer::Start(int milliseconds, bool oneShot) +{ + return false; +} + +void wxTimer::Stop() +{ +} + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +void wxProcessTimer(wxTimer& timer) +{ +} + +void WINAPI wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) +{ +} + +#endif // wxUSE_TIMER + diff --git a/src/palmos/toolbar.cpp b/src/palmos/toolbar.cpp new file mode 100644 index 0000000000..9720b721fb --- /dev/null +++ b/src/palmos/toolbar.cpp @@ -0,0 +1,289 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/toolbar.cpp +// Purpose: wxToolBar +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "toolbar.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/frame.h" + #include "wx/log.h" + #include "wx/intl.h" + #include "wx/dynarray.h" + #include "wx/settings.h" + #include "wx/bitmap.h" + #include "wx/dcmemory.h" + #include "wx/control.h" +#endif + +#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE + +#include "wx/toolbar.h" +#include "wx/sysopt.h" + +#include "wx/palmos/private.h" + +#include "wx/palmos/wrapcctl.h" + +#include "wx/app.h" // for GetComCtl32Version + +// ---------------------------------------------------------------------------- +// conditional compilation +// ---------------------------------------------------------------------------- + +// wxWidgets previously always considered that toolbar buttons have light grey +// (0xc0c0c0) background and so ignored any bitmap masks - however, this +// doesn't work with XPMs which then appear to have black background. To make +// this work, we must respect the bitmap masks - which we do now. This should +// be ok in any case, but to restore 100% compatible with the old version +// behaviour, you can set this to 0. +#define USE_BITMAP_MASKS 1 + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) + +/* + TOOLBAR PROPERTIES + tool + bitmap + bitmap2 + tooltip + longhelp + radio (bool) + toggle (bool) + separator + style ( wxNO_BORDER | wxTB_HORIZONTAL) + bitmapsize + margins + packing + separation + + dontattachtoframe +*/ + +BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) + EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent) + EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged) +END_EVENT_TABLE() + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +class wxToolBarTool : public wxToolBarToolBase +{ +public: + wxToolBarTool(wxToolBar *tbar, + int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp) + : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, + clientData, shortHelp, longHelp) + { + } + + wxToolBarTool(wxToolBar *tbar, wxControl *control) + : wxToolBarToolBase(tbar, control) + { + } + + virtual void SetLabel(const wxString& label) + { + } + + // set/get the number of separators which we use to cover the space used by + // a control in the toolbar + void SetSeparatorsCount(size_t count) { m_nSepCount = count; } + size_t GetSeparatorsCount() const { return m_nSepCount; } + +private: + size_t m_nSepCount; + + DECLARE_NO_COPY_CLASS(wxToolBarTool) +}; + + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxToolBarTool +// ---------------------------------------------------------------------------- + +wxToolBarToolBase *wxToolBar::CreateTool(int id, + const wxString& label, + const wxBitmap& bmpNormal, + const wxBitmap& bmpDisabled, + wxItemKind kind, + wxObject *clientData, + const wxString& shortHelp, + const wxString& longHelp) +{ + return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind, + clientData, shortHelp, longHelp); +} + +wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control) +{ + return new wxToolBarTool(this, control); +} + +// ---------------------------------------------------------------------------- +// wxToolBar construction +// ---------------------------------------------------------------------------- + +void wxToolBar::Init() +{ +} + +bool wxToolBar::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +void wxToolBar::Recreate() +{ +} + +wxToolBar::~wxToolBar() +{ +} + +wxSize wxToolBar::DoGetBestSize() const +{ + return wxSize(0,0); +} + +// ---------------------------------------------------------------------------- +// adding/removing tools +// ---------------------------------------------------------------------------- + +bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) +{ + return false; +} + +bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) +{ + return false; +} + +bool wxToolBar::Realize() +{ + return false; +} + +// ---------------------------------------------------------------------------- +// toolbar geometry +// ---------------------------------------------------------------------------- + +void wxToolBar::SetToolBitmapSize(const wxSize& size) +{ +} + +void wxToolBar::SetRows(int nRows) +{ +} + +// The button size is bigger than the bitmap size +wxSize wxToolBar::GetToolSize() const +{ + return wxSize(0,0); +} + +static +wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools, + size_t index ) +{ + return 0; +} + +wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const +{ + return NULL; +} + +void wxToolBar::UpdateSize() +{ +} + +// ---------------------------------------------------------------------------- +// toolbar styles +// --------------------------------------------------------------------------- + +void wxToolBar::SetWindowStyleFlag(long style) +{ +} + +// ---------------------------------------------------------------------------- +// tool state +// ---------------------------------------------------------------------------- + +void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable) +{ +} + +void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle) +{ +} + +void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) +{ +} + +// ---------------------------------------------------------------------------- +// event handlers +// ---------------------------------------------------------------------------- + +// Responds to colour changes, and passes event on to children. +void wxToolBar::OnSysColourChanged(wxSysColourChangedEvent& event) +{ +} + +void wxToolBar::OnMouseEvent(wxMouseEvent& event) +{ +} + +#endif // wxUSE_TOOLBAR + diff --git a/src/palmos/tooltip.cpp b/src/palmos/tooltip.cpp new file mode 100644 index 0000000000..0cc8b44402 --- /dev/null +++ b/src/palmos/tooltip.cpp @@ -0,0 +1,151 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/tooltip.cpp +// Purpose: wxToolTip class implementation for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#if wxUSE_TOOLTIPS + +#include "wx/tooltip.h" +#include "wx/palmos/private.h" + +#include "wx/palmos/wrapcctl.h" + +// VZ: normally, the trick with subclassing the tooltip control and processing +// TTM_WINDOWFROMPOINT should work but, somehow, it doesn't. I leave the +// code here for now (but it's not compiled) in case we need it later. +// +// For now I use an ugly workaround and process TTN_NEEDTEXT directly in +// radio button wnd proc - fixing TTM_WINDOWFROMPOINT code would be nice +// because it would then work for all controls, not only radioboxes but for +// now I don't understand what's wrong with it... +#define wxUSE_TTM_WINDOWFROMPOINT 0 + +// ---------------------------------------------------------------------------- +// global variables +// ---------------------------------------------------------------------------- + +// the tooltip parent window +WXHWND wxToolTip::ms_hwndTT = (WXHWND)NULL; + +#if wxUSE_TTM_WINDOWFROMPOINT + +// the tooltip window proc +static WNDPROC gs_wndprocToolTip = (WNDPROC)NULL; + +#endif // wxUSE_TTM_WINDOWFROMPOINT + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// send a message to the tooltip control +inline LRESULT SendTooltipMessage(WXHWND hwnd, + UINT msg, + WPARAM wParam, + void *lParam) +{ + return 0; +} + +// send a message to all existing tooltip controls +static void SendTooltipMessageToAll(WXHWND hwnd, + UINT msg, + WPARAM wParam, + LPARAM lParam) +{ +} + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// static functions +// ---------------------------------------------------------------------------- + +void wxToolTip::Enable(bool flag) +{ +} + +void wxToolTip::SetDelay(long milliseconds) +{ +} + +// --------------------------------------------------------------------------- +// implementation helpers +// --------------------------------------------------------------------------- + +// create the tooltip ctrl for our parent frame if it doesn't exist yet +WXHWND wxToolTip::GetToolTipCtrl() +{ + return (WXHWND) 0; +} + +void wxToolTip::RelayEvent(WXMSG *msg) +{ +} + +// ---------------------------------------------------------------------------- +// ctor & dtor +// ---------------------------------------------------------------------------- + +IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) + +wxToolTip::wxToolTip(const wxString &tip) + : m_text(tip) +{ +} + +wxToolTip::~wxToolTip() +{ +} + +// ---------------------------------------------------------------------------- +// others +// ---------------------------------------------------------------------------- + +void wxToolTip::Remove() +{ +} + +void wxToolTip::Add(WXHWND hWnd) +{ +} + +void wxToolTip::SetWindow(wxWindow *win) +{ +} + +void wxToolTip::SetTip(const wxString& tip) +{ +} + +#endif // wxUSE_TOOLTIPS diff --git a/src/palmos/toplevel.cpp b/src/palmos/toplevel.cpp new file mode 100644 index 0000000000..f820532a0d --- /dev/null +++ b/src/palmos/toplevel.cpp @@ -0,0 +1,291 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/toplevel.cpp +// Purpose: implements wxTopLevelWindow for Palm OS +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "toplevel.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/toplevel.h" + #include "wx/dialog.h" + #include "wx/string.h" + #include "wx/log.h" + #include "wx/intl.h" + #include "wx/frame.h" + #include "wx/containr.h" // wxSetFocusToChild() +#endif //WX_PRECOMP + +#include "wx/module.h" + +#include "wx/display.h" + +#ifndef ICON_BIG + #define ICON_BIG 1 +#endif + +#ifndef ICON_SMALL + #define ICON_SMALL 0 +#endif + + +// ---------------------------------------------------------------------------- +// globals +// ---------------------------------------------------------------------------- + +// the name of the default wxWidgets class +extern const wxChar *wxCanvasClassName; + +// Pointer to the currently active frame for the form event handler. +wxFrame* ActiveParentFrame; + +// ============================================================================ +// wxTopLevelWindowPalm implementation +// ============================================================================ + +BEGIN_EVENT_TABLE(wxTopLevelWindowPalm, wxTopLevelWindowBase) + EVT_ACTIVATE(wxTopLevelWindowPalm::OnActivate) +END_EVENT_TABLE() + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowPalm creation +// ---------------------------------------------------------------------------- + +void wxTopLevelWindowPalm::Init() +{ +} + +WXDWORD wxTopLevelWindowPalm::PalmGetStyle(long style, WXDWORD *exflags) const +{ + return 0; +} + +WXHWND wxTopLevelWindowPalm::PalmGetParent() const +{ + return NULL; +} + +bool wxTopLevelWindowPalm::CreateDialog(const void *dlgTemplate, + const wxString& title, + const wxPoint& pos, + const wxSize& size) +{ + return false; +} + +bool wxTopLevelWindowPalm::CreateFrame(const wxString& title, + const wxPoint& pos, + const wxSize& size) +{ + return false; +} + +bool wxTopLevelWindowPalm::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + ActiveParentFrame=NULL; + + wxTopLevelWindows.Append(this); + + if ( parent ) + parent->AddChild(this); + + m_windowId = id == -1 ? NewControlId() : id; + + FrameForm=FrmNewForm(m_windowId,title,0,0,160,160,false,0,NULL,0,NULL,0); + if(FrameForm==0) + return false; + + FrmSetEventHandler(FrameForm,FrameFormHandleEvent); + + return true; +} + +bool wxTopLevelWindowPalm::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name, + wxFrame* PFrame) +{ + wxTopLevelWindows.Append(this); + + if ( parent ) + parent->AddChild(this); + + m_windowId = id == -1 ? NewControlId() : id; + + FrameForm=FrmNewForm(m_windowId,title,0,0,160,160,false,0,NULL,0,NULL,0); + if(FrameForm==0) + return false; + + FrmSetEventHandler(FrameForm,FrameFormHandleEvent); + + FrmSetActiveForm(FrameForm); + + ActiveParentFrame=PFrame; + + return true; +} + +wxTopLevelWindowPalm::~wxTopLevelWindowPalm() +{ +} + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowPalm showing +// ---------------------------------------------------------------------------- + +void wxTopLevelWindowPalm::DoShowWindow(int nShowCmd) +{ +} + +bool wxTopLevelWindowPalm::Show(bool show) +{ + FrmDrawForm(FrameForm); + + wxPaintEvent event(m_windowId); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); + + return true; +} + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowPalm maximize/minimize +// ---------------------------------------------------------------------------- + +void wxTopLevelWindowPalm::Maximize(bool maximize) +{ +} + +bool wxTopLevelWindowPalm::IsMaximized() const +{ + return false; +} + +void wxTopLevelWindowPalm::Iconize(bool iconize) +{ +} + +bool wxTopLevelWindowPalm::IsIconized() const +{ + return false; +} + +void wxTopLevelWindowPalm::Restore() +{ +} + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowPalm fullscreen +// ---------------------------------------------------------------------------- + +bool wxTopLevelWindowPalm::ShowFullScreen(bool show, long style) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxTopLevelWindowPalm misc +// ---------------------------------------------------------------------------- + +void wxTopLevelWindowPalm::SetIcon(const wxIcon& icon) +{ +} + +void wxTopLevelWindowPalm::SetIcons(const wxIconBundle& icons) +{ +} + +bool wxTopLevelWindowPalm::EnableCloseButton(bool enable) +{ + return false; +} + +#ifndef __WXWINCE__ + +bool wxTopLevelWindowPalm::SetShape(const wxRegion& region) +{ + return false; +} + +#endif // !__WXWINCE__ + +// ---------------------------------------------------------------------------- +// wxTopLevelWindow event handling +// ---------------------------------------------------------------------------- + +void wxTopLevelWindowPalm::OnActivate(wxActivateEvent& event) +{ +} + +/* Palm OS Event handler for the window + * + * This function *must* be located outside of the wxTopLevelWindow class because + * the Palm OS API expects a standalone C function as a callback. You cannot + * pass a pointer to a member function of a C++ class as a callback because the + * prototypes don't match. (A member function has a hidden "this" pointer as + * its first parameter). + * + * This event handler uses a global pointer to the current wxFrame to process + * the events generated by the Palm OS form API. I know this is ugly, but right + * now I can't think of any other way to deal with this problem. If someone + * finds a better solution, please let me know. My email address is + * wbo@freeshell.org + */ +static Boolean FrameFormHandleEvent(EventType* pEvent) +{ + Boolean fHandled = false; + FormType* pForm; + WinHandle hWindow; + int ItemID=0; + + switch (pEvent->eType) { + case ctlSelectEvent: + break; +#if wxUSE_MENUS_NATIVE + case menuOpenEvent: + fHandled=ActiveParentFrame->HandleMenuOpen(); + break; + case menuEvent: + ItemID=pEvent->data.menu.itemID; + fHandled=ActiveParentFrame->HandleMenuSelect(ItemID); + break; +#endif + default: + break; + } + + return fHandled; +} diff --git a/src/palmos/treectrl.cpp b/src/palmos/treectrl.cpp new file mode 100644 index 0000000000..f8e143d949 --- /dev/null +++ b/src/palmos/treectrl.cpp @@ -0,0 +1,791 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/treectrl.cpp +// Purpose: wxTreeCtrl +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "treectrl.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_TREECTRL + +#include "wx/palmos/private.h" + +// Set this to 1 to be _absolutely_ sure that repainting will work for all +// comctl32.dll versions +#define wxUSE_COMCTL32_SAFELY 0 + +#include "wx/app.h" +#include "wx/log.h" +#include "wx/dynarray.h" +#include "wx/imaglist.h" +#include "wx/settings.h" +#include "wx/msw/treectrl.h" +#include "wx/msw/dragimag.h" + +#include "wx/palmos/wrapcctl.h" + +// macros to hide the cast ugliness +// -------------------------------- + +// ptr is the real item id, i.e. wxTreeItemId::m_pItem +#define HITEM_PTR(ptr) (HTREEITEM)(ptr) + +// item here is a wxTreeItemId +#define HITEM(item) HITEM_PTR((item).m_pItem) + +// the native control doesn't support multiple selections under MSW and we +// have 2 ways to emulate them: either using TVS_CHECKBOXES style and let +// checkboxes be the selection status (checked == selected) or by really +// emulating everything, i.e. intercepting mouse and key events &c. The first +// approach is much easier but doesn't work with comctl32.dll < 4.71 and also +// looks quite ugly. +#define wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE 0 + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// private classes +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + +#if wxUSE_EXTENDED_RTTI +WX_DEFINE_FLAGS( wxTreeCtrlStyle ) + +wxBEGIN_FLAGS( wxTreeCtrlStyle ) + // new style border flags, we put them first to + // use them for streaming out + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + + wxFLAGS_MEMBER(wxTR_EDIT_LABELS) + wxFLAGS_MEMBER(wxTR_NO_BUTTONS) + wxFLAGS_MEMBER(wxTR_HAS_BUTTONS) + wxFLAGS_MEMBER(wxTR_TWIST_BUTTONS) + wxFLAGS_MEMBER(wxTR_NO_LINES) + wxFLAGS_MEMBER(wxTR_FULL_ROW_HIGHLIGHT) + wxFLAGS_MEMBER(wxTR_LINES_AT_ROOT) + wxFLAGS_MEMBER(wxTR_HIDE_ROOT) + wxFLAGS_MEMBER(wxTR_ROW_LINES) + wxFLAGS_MEMBER(wxTR_HAS_VARIABLE_ROW_HEIGHT) + wxFLAGS_MEMBER(wxTR_SINGLE) + wxFLAGS_MEMBER(wxTR_MULTIPLE) + wxFLAGS_MEMBER(wxTR_EXTENDED) + wxFLAGS_MEMBER(wxTR_DEFAULT_STYLE) + +wxEND_FLAGS( wxTreeCtrlStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxTreeCtrl, wxControl,"wx/treectrl.h") + +wxBEGIN_PROPERTIES_TABLE(wxTreeCtrl) + wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent ) + wxEVENT_RANGE_PROPERTY( TreeEvent , wxEVT_COMMAND_TREE_BEGIN_DRAG , wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK , wxTreeEvent ) + wxPROPERTY_FLAGS( WindowStyle , wxTreeCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxTreeCtrl) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_5( wxTreeCtrl , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) +#else +IMPLEMENT_DYNAMIC_CLASS(wxTreeCtrl, wxControl) +#endif + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// indices in gs_expandEvents table below +enum +{ + IDX_COLLAPSE, + IDX_EXPAND, + IDX_WHAT_MAX +}; + +enum +{ + IDX_DONE, + IDX_DOING, + IDX_HOW_MAX +}; + +// handy table for sending events - it has to be initialized during run-time +// now so can't be const any more +static /* const */ wxEventType gs_expandEvents[IDX_WHAT_MAX][IDX_HOW_MAX]; + +/* + but logically it's a const table with the following entries: += +{ + { wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxEVT_COMMAND_TREE_ITEM_COLLAPSING }, + { wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxEVT_COMMAND_TREE_ITEM_EXPANDING } +}; +*/ + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// construction and destruction +// ---------------------------------------------------------------------------- + +void wxTreeCtrl::Init() +{ +} + +bool wxTreeCtrl::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& validator, + const wxString& name) +{ + return false; +} + +wxTreeCtrl::~wxTreeCtrl() +{ +} + +// ---------------------------------------------------------------------------- +// accessors +// ---------------------------------------------------------------------------- + +/* static */ wxVisualAttributes +wxTreeCtrl::GetClassDefaultAttributes(wxWindowVariant variant) +{ + wxVisualAttributes attrs; + + return attrs; +} + + +// simple wrappers which add error checking in debug mode + +bool wxTreeCtrl::DoGetItem(wxTreeViewItem* tvItem) const +{ + return false; +} + +void wxTreeCtrl::DoSetItem(wxTreeViewItem* tvItem) +{ +} + +size_t wxTreeCtrl::GetCount() const +{ + return 0; +} + +unsigned int wxTreeCtrl::GetIndent() const +{ + return 0; +} + +void wxTreeCtrl::SetIndent(unsigned int indent) +{ +} + +wxImageList *wxTreeCtrl::GetImageList() const +{ + return m_imageListNormal; +} + +wxImageList *wxTreeCtrl::GetStateImageList() const +{ + return m_imageListState; +} + +void wxTreeCtrl::SetAnyImageList(wxImageList *imageList, int which) +{ +} + +void wxTreeCtrl::SetImageList(wxImageList *imageList) +{ +} + +void wxTreeCtrl::SetStateImageList(wxImageList *imageList) +{ +} + +void wxTreeCtrl::AssignImageList(wxImageList *imageList) +{ +} + +void wxTreeCtrl::AssignStateImageList(wxImageList *imageList) +{ +} + +size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, + bool recursively) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// control colours +// ---------------------------------------------------------------------------- + +bool wxTreeCtrl::SetBackgroundColour(const wxColour &colour) +{ + return false; +} + +bool wxTreeCtrl::SetForegroundColour(const wxColour &colour) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// Item access +// ---------------------------------------------------------------------------- + +wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const +{ + return wxString; +} + +void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) +{ +} + +int wxTreeCtrl::DoGetItemImageFromData(const wxTreeItemId& item, + wxTreeItemIcon which) const +{ + return -1; +} + +void wxTreeCtrl::DoSetItemImageFromData(const wxTreeItemId& item, + int image, + wxTreeItemIcon which) const +{ +} + +void wxTreeCtrl::DoSetItemImages(const wxTreeItemId& item, + int image, + int imageSel) +{ +} + +int wxTreeCtrl::GetItemImage(const wxTreeItemId& item, + wxTreeItemIcon which) const +{ + return -1; +} + +void wxTreeCtrl::SetItemImage(const wxTreeItemId& item, int image, + wxTreeItemIcon which) +{ +} + +wxTreeItemData *wxTreeCtrl::GetItemData(const wxTreeItemId& item) const +{ + return NULL; +} + +void wxTreeCtrl::SetItemData(const wxTreeItemId& item, wxTreeItemData *data) +{ +} + +void wxTreeCtrl::SetIndirectItemData(const wxTreeItemId& item, + wxTreeItemIndirectData *data) +{ +} + +bool wxTreeCtrl::HasIndirectData(const wxTreeItemId& item) const +{ + return false; +} + +void wxTreeCtrl::SetItemHasChildren(const wxTreeItemId& item, bool has) +{ +} + +void wxTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold) +{ +} + +void wxTreeCtrl::SetItemDropHighlight(const wxTreeItemId& item, bool highlight) +{ +} + +void wxTreeCtrl::RefreshItem(const wxTreeItemId& item) +{ +} + +wxColour wxTreeCtrl::GetItemTextColour(const wxTreeItemId& item) const +{ + return wxNullColour; +} + +wxColour wxTreeCtrl::GetItemBackgroundColour(const wxTreeItemId& item) const +{ + return wxNullColour; +} + +wxFont wxTreeCtrl::GetItemFont(const wxTreeItemId& item) const +{ + return wxNullFont; +} + +void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item, + const wxColour& col) +{ +} + +void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item, + const wxColour& col) +{ +} + +void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font) +{ +} + +// ---------------------------------------------------------------------------- +// Item status +// ---------------------------------------------------------------------------- + +bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const +{ + return false; +} + +bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const +{ + return false; +} + +bool wxTreeCtrl::IsExpanded(const wxTreeItemId& item) const +{ + return false; +} + +bool wxTreeCtrl::IsSelected(const wxTreeItemId& item) const +{ + return false; +} + +bool wxTreeCtrl::IsBold(const wxTreeItemId& item) const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// navigation +// ---------------------------------------------------------------------------- + +wxTreeItemId wxTreeCtrl::GetRootItem() const +{ + // Root may be real (visible) or virtual (hidden). + if ( GET_VIRTUAL_ROOT() ) + return TVI_ROOT; + + return wxTreeItemId(TreeView_GetRoot(GetHwnd())); +} + +wxTreeItemId wxTreeCtrl::GetSelection() const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetItemParent(const wxTreeItemId& item) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item, + wxTreeItemIdValue& cookie) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item), + wxTreeItemIdValue& cookie) const +{ + return 0; +} + +#if WXWIN_COMPATIBILITY_2_4 + +wxTreeItemId wxTreeCtrl::GetFirstChild(const wxTreeItemId& item, + long& cookie) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetNextChild(const wxTreeItemId& WXUNUSED(item), + long& cookie) const +{ + return 0; +} + +#endif // WXWIN_COMPATIBILITY_2_4 + +wxTreeItemId wxTreeCtrl::GetLastChild(const wxTreeItemId& item) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetNextSibling(const wxTreeItemId& item) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetFirstVisibleItem() const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// multiple selections emulation +// ---------------------------------------------------------------------------- + +bool wxTreeCtrl::IsItemChecked(const wxTreeItemId& item) const +{ + return false; +} + +void wxTreeCtrl::SetItemCheck(const wxTreeItemId& item, bool check) +{ +} + +size_t wxTreeCtrl::GetSelections(wxArrayTreeItemIds& selections) const +{ + return 0; +} + +// ---------------------------------------------------------------------------- +// Usual operations +// ---------------------------------------------------------------------------- + +wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, + wxTreeItemId hInsertAfter, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) +{ + return 0; +} + +// for compatibility only +#if WXWIN_COMPATIBILITY_2_4 + +wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, + const wxString& text, + int image, int selImage, + long insertAfter) +{ + return 0; +} + +#endif // WXWIN_COMPATIBILITY_2_4 + +wxTreeItemId wxTreeCtrl::AddRoot(const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::PrependItem(const wxTreeItemId& parent, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, + const wxTreeItemId& idPrevious, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::InsertItem(const wxTreeItemId& parent, + size_t index, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) +{ + return 0; +} + +wxTreeItemId wxTreeCtrl::AppendItem(const wxTreeItemId& parent, + const wxString& text, + int image, int selectedImage, + wxTreeItemData *data) +{ + return 0; +} + +void wxTreeCtrl::Delete(const wxTreeItemId& item) +{ + return 0; +} + +// delete all children (but don't delete the item itself) +void wxTreeCtrl::DeleteChildren(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::DeleteAllItems() +{ +} + +void wxTreeCtrl::DoExpand(const wxTreeItemId& item, int flag) +{ +} + +void wxTreeCtrl::Expand(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::Collapse(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::CollapseAndReset(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::Toggle(const wxTreeItemId& item) +{ +} + +#if WXWIN_COMPATIBILITY_2_4 +void wxTreeCtrl::ExpandItem(const wxTreeItemId& item, int action) +{ +} +#endif + +void wxTreeCtrl::Unselect() +{ +} + +void wxTreeCtrl::UnselectAll() +{ +} + +void wxTreeCtrl::SelectItem(const wxTreeItemId& item, bool select) +{ +} + +void wxTreeCtrl::UnselectItem(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::ToggleItemSelection(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item) +{ +} + +void wxTreeCtrl::ScrollTo(const wxTreeItemId& item) +{ +} + +wxTextCtrl *wxTreeCtrl::GetEditControl() const +{ + return NULL; +} + +void wxTreeCtrl::DeleteTextCtrl() +{ +} + +wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item, + wxClassInfo* textControlClass) +{ + return NULL; +} + +// End label editing, optionally cancelling the edit +void wxTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges) +{ +} + +wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& flags) +{ + return 0; +} + +bool wxTreeCtrl::GetBoundingRect(const wxTreeItemId& item, + wxRect& rect, + bool textOnly) const +{ + return false; +} + +// ---------------------------------------------------------------------------- +// sorting stuff +// ---------------------------------------------------------------------------- + +// this is just a tiny namespace which is friend to wxTreeCtrl and so can use +// functions such as IsDataIndirect() +class wxTreeSortHelper +{ +public: + static int CALLBACK Compare(LPARAM data1, LPARAM data2, LPARAM tree); + +private: + static wxTreeItemId GetIdFromData(wxTreeCtrl *tree, LPARAM item) + { + wxTreeItemData *data = (wxTreeItemData *)item; + if ( tree->IsDataIndirect(data) ) + { + data = ((wxTreeItemIndirectData *)data)->GetData(); + } + + return data->GetId(); + } +}; + +int CALLBACK wxTreeSortHelper::Compare(LPARAM pItem1, + LPARAM pItem2, + LPARAM htree) +{ + wxCHECK_MSG( pItem1 && pItem2, 0, + wxT("sorting tree without data doesn't make sense") ); + + wxTreeCtrl *tree = (wxTreeCtrl *)htree; + + return tree->OnCompareItems(GetIdFromData(tree, pItem1), + GetIdFromData(tree, pItem2)); +} + +int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1, + const wxTreeItemId& item2) +{ + return wxStrcmp(GetItemText(item1), GetItemText(item2)); +} + +void wxTreeCtrl::SortChildren(const wxTreeItemId& item) +{ + wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); + + // rely on the fact that TreeView_SortChildren does the same thing as our + // default behaviour, i.e. sorts items alphabetically and so call it + // directly if we're not in derived class (much more efficient!) + if ( GetClassInfo() == CLASSINFO(wxTreeCtrl) ) + { + TreeView_SortChildren(GetHwnd(), HITEM(item), 0); + } + else + { + TV_SORTCB tvSort; + tvSort.hParent = HITEM(item); + tvSort.lpfnCompare = wxTreeSortHelper::Compare; + tvSort.lParam = (LPARAM)this; + TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */); + } +} + +// ---------------------------------------------------------------------------- +// implementation +// ---------------------------------------------------------------------------- + +bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id) +{ + return false; +} + +WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return 0; +} + +// process WM_NOTIFY Windows message +bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// State control. +// ---------------------------------------------------------------------------- + +// why do they define INDEXTOSTATEIMAGEMASK but not the inverse? +#define STATEIMAGEMASKTOINDEX(state) (((state) & TVIS_STATEIMAGEMASK) >> 12) + +void wxTreeCtrl::SetState(const wxTreeItemId& node, int state) +{ +} + +int wxTreeCtrl::GetState(const wxTreeItemId& node) +{ + return 0; +} + +#endif // wxUSE_TREECTRL + diff --git a/src/palmos/utils.cpp b/src/palmos/utils.cpp new file mode 100644 index 0000000000..67fb7c304b --- /dev/null +++ b/src/palmos/utils.cpp @@ -0,0 +1,235 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/utils.cpp +// Purpose: Various utilities +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif //WX_PRECOMP + +#include "wx/apptrait.h" +#include "wx/dynload.h" + +#include "wx/confbase.h" // for wxExpandEnvVars() + +#include "wx/timer.h" + +// VZ: there is some code using NetXXX() functions to get the full user name: +// I don't think it's a good idea because they don't work under Win95 and +// seem to return the same as wxGetUserId() under NT. If you really want +// to use them, just #define USE_NET_API +#undef USE_NET_API + +#ifdef USE_NET_API + #include +#endif // USE_NET_API + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// In the WIN.INI file +static const wxChar WX_SECTION[] = wxT("wxWindows"); +static const wxChar eUSERNAME[] = wxT("UserName"); + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// get host name and related +// ---------------------------------------------------------------------------- + +// Get hostname only (without domain name) +bool wxGetHostName(wxChar *buf, int maxSize) +{ + return false; +} + +// get full hostname (with domain name if possible) +bool wxGetFullHostName(wxChar *buf, int maxSize) +{ + return false; +} + +// Get user ID e.g. jacs +bool wxGetUserId(wxChar *buf, int maxSize) +{ + return false; +} + +// Get user name e.g. Julian Smart +bool wxGetUserName(wxChar *buf, int maxSize) +{ + return false; +} + +const wxChar* wxGetHomeDir(wxString *pstr) +{ + return NULL; +} + +wxChar *wxGetUserHome(const wxString& WXUNUSED(user)) +{ + return NULL; +} + +bool wxDirExists(const wxString& dir) +{ + return false; +} + +bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// env vars +// ---------------------------------------------------------------------------- + +bool wxGetEnv(const wxString& var, wxString *value) +{ + return false; +} + +bool wxSetEnv(const wxString& var, const wxChar *value) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// process management +// ---------------------------------------------------------------------------- + +// structure used to pass parameters from wxKill() to wxEnumFindByPidProc() +int wxKill(long pid, wxSignal sig, wxKillError *krc) +{ + return 0; +} + +// Execute a program in an Interactive Shell +bool wxShell(const wxString& command) +{ + return false; +} + +// Shutdown or reboot the PC +bool wxShutdown(wxShutdownFlags wFlags) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// misc +// ---------------------------------------------------------------------------- + +// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) +long wxGetFreeMemory() +{ + return 0; +} + +unsigned long wxGetProcessId() +{ + return 0; +} + +// Emit a beeeeeep +void wxBell() +{ +} + +wxString wxGetOsDescription() +{ + wxString str; + + return str; +} + +wxToolkitInfo& wxAppTraits::GetToolkitInfo() +{ + static wxToolkitInfo info; + info.name = _T("wxBase"); + return info; +} + +// ---------------------------------------------------------------------------- +// sleep functions +// ---------------------------------------------------------------------------- + +void wxMilliSleep(unsigned long milliseconds) +{ +} + +void wxMicroSleep(unsigned long microseconds) +{ +} + +void wxSleep(int nSecs) +{ +} + +// ---------------------------------------------------------------------------- +// font encoding <-> Win32 codepage conversion functions +// ---------------------------------------------------------------------------- + +extern WXDLLIMPEXP_BASE long wxEncodingToCharset(wxFontEncoding encoding) +{ + return 0; +} + +// we have 2 versions of wxCharsetToCodepage(): the old one which directly +// looks up the vlaues in the registry and the new one which is more +// politically correct and has more chances to work on other Windows versions +// as well but the old version is still needed for !wxUSE_FONTMAP case +#if wxUSE_FONTMAP + +#include "wx/fontmap.h" + +extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding) +{ + return 0; +} + +extern long wxCharsetToCodepage(const wxChar *name) +{ + return 0; +} + +#else // !wxUSE_FONTMAP + +#include "wx/palmos/registry.h" + +// this should work if Internet Exploiter is installed +extern long wxCharsetToCodepage(const wxChar *name) +{ + return 0; +} + +#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP + diff --git a/src/palmos/utilsexc.cpp b/src/palmos/utilsexc.cpp new file mode 100644 index 0000000000..943fa3e3ab --- /dev/null +++ b/src/palmos/utilsexc.cpp @@ -0,0 +1,102 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: palmos/utilsexec.cpp +// Purpose: wxExecute implementation for MSW +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif + +#include "wx/stream.h" +#include "wx/process.h" + +#include "wx/apptrait.h" + +#include "wx/module.h" + +#include + +#include +#include +#include + +#if wxUSE_IPC + #include "wx/dde.h" // for WX_DDE hack in wxExecute +#endif // wxUSE_IPC + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// this module globals +// ---------------------------------------------------------------------------- + +// we need to create a hidden window to receive the process termination +// notifications and for this we need a (Win) class name for it which we will +// register the first time it's needed +static const wxChar *wxMSWEXEC_WNDCLASSNAME = wxT("_wxExecute_Internal_Class"); +static const wxChar *gs_classForHiddenWindow = NULL; + +// ---------------------------------------------------------------------------- +// private types +// ---------------------------------------------------------------------------- + +// ============================================================================ +// implementation +// ============================================================================ + +// ============================================================================ +// wxExecute functions family +// ============================================================================ + +#if wxUSE_IPC + +// connect to the given server via DDE and ask it to execute the command +static bool wxExecuteDDE(const wxString& ddeServer, + const wxString& ddeTopic, + const wxString& ddeCommand) +{ + return false; +} + +#endif // wxUSE_IPC + +long wxExecute(const wxString& cmd, int flags, wxProcess *handler) +{ + return 0; +} + +long wxExecute(wxChar **argv, int flags, wxProcess *handler) +{ + return 0; +} + diff --git a/src/palmos/utilsgui.cpp b/src/palmos/utilsgui.cpp new file mode 100644 index 0000000000..01d1b3d561 --- /dev/null +++ b/src/palmos/utilsgui.cpp @@ -0,0 +1,179 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: palmos/utilsgui.cpp +// Purpose: Various utility functions only available in GUI +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/cursor.h" + #include "wx/window.h" + #include "wx/utils.h" +#endif //WX_PRECOMP + +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// functions to work with .INI files +// ---------------------------------------------------------------------------- + +// Reading and writing resources (eg WIN.INI, .Xdefaults) +#if wxUSE_RESOURCES +bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file) +{ + return false; +} + +bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) +{ + return false; +} + +bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file) +{ + return false; +} + +bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file) +{ + return false; +} + +bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file) +{ + return false; +} + +bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) +{ + return false; +} + +bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file) +{ + return false; +} + +bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file) +{ + return false; +} +#endif // wxUSE_RESOURCES + +// --------------------------------------------------------------------------- +// helper functions for showing a "busy" cursor +// --------------------------------------------------------------------------- + +static int gs_wxBusyCursorCount = 0; + +// Set the cursor to the busy cursor for all windows +void wxBeginBusyCursor(wxCursor *cursor) +{ +} + +// Restore cursor to normal +void wxEndBusyCursor() +{ +} + +// true if we're between the above two calls +bool wxIsBusy() +{ + return false; +} + +// Check whether this window wants to process messages, e.g. Stop button +// in long calculations. +bool wxCheckForInterrupt(wxWindow *wnd) +{ + return false; +} + +// MSW only: get user-defined resource from the .res file. +// Returns NULL or newly-allocated memory, so use delete[] to clean up. + +wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) +{ + return NULL; +} + +// ---------------------------------------------------------------------------- +// get display info +// ---------------------------------------------------------------------------- + +// See also the wxGetMousePosition in window.cpp +// Deprecated: use wxPoint wxGetMousePosition() instead +void wxGetMousePosition( int* x, int* y ) +{ +}; + +// Return true if we have a colour display +bool wxColourDisplay() +{ + return false; +} + +// Returns depth of screen +int wxDisplayDepth() +{ + return 0; +} + +// Get size of display +void wxDisplaySize(int *width, int *height) +{ +} + +void wxDisplaySizeMM(int *width, int *height) +{ +} + +void wxClientDisplayRect(int *x, int *y, int *width, int *height) +{ +} + +// --------------------------------------------------------------------------- +// window information functions +// --------------------------------------------------------------------------- + +wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd) +{ + wxString str; + + return str; +} + +wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) +{ + wxString str; + + return str; +} + +WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) +{ + return 0; +} + + diff --git a/src/palmos/volume.cpp b/src/palmos/volume.cpp new file mode 100644 index 0000000000..df0f89b4a7 --- /dev/null +++ b/src/palmos/volume.cpp @@ -0,0 +1,268 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/volume.cpp +// Purpose: wxFSVolume - encapsulates system volume information +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "fsvolume.h" +#endif + +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_FSVOLUME + +#ifndef WX_PRECOMP + #if wxUSE_GUI + #include "wx/icon.h" + #endif + #include "wx/intl.h" +#endif // WX_PRECOMP + +#include "wx/dir.h" +#include "wx/hashmap.h" +#include "wx/dynlib.h" +#include "wx/arrimpl.cpp" + +#include "wx/volume.h" + +#include "wx/palmos/missing.h" + +#if wxUSE_BASE + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Dynamic library function defs. +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +static wxDynamicLibrary s_mprLib; + +typedef DWORD (WINAPI* WNetOpenEnumPtr)(DWORD, DWORD, DWORD, LPNETRESOURCE, LPHANDLE); +typedef DWORD (WINAPI* WNetEnumResourcePtr)(HANDLE, LPDWORD, LPVOID, LPDWORD); +typedef DWORD (WINAPI* WNetCloseEnumPtr)(HANDLE); + +static WNetOpenEnumPtr s_pWNetOpenEnum; +static WNetEnumResourcePtr s_pWNetEnumResource; +static WNetCloseEnumPtr s_pWNetCloseEnum; + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Globals/Statics +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +static long s_cancelSearch = FALSE; + +struct FileInfo +{ + FileInfo(unsigned flag=0, wxFSVolumeKind type=wxFS_VOL_OTHER) : + m_flags(flag), m_type(type) {} + + FileInfo(const FileInfo& other) { *this = other; } + FileInfo& operator=(const FileInfo& other) + { + m_flags = other.m_flags; + m_type = other.m_type; + return *this; + } + + unsigned m_flags; + wxFSVolumeKind m_type; +}; +WX_DECLARE_STRING_HASH_MAP(FileInfo, FileInfoMap); +// Cygwin bug (?) destructor for global s_fileInfo is called twice... +static FileInfoMap& GetFileInfoMap() +{ + static FileInfoMap s_fileInfo(25); + + return s_fileInfo; +} +#define s_fileInfo (GetFileInfoMap()) + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// Local helper functions. +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +//============================================================================= +// Function: GetBasicFlags +// Purpose: Set basic flags, primarily wxFS_VOL_REMOTE and wxFS_VOL_REMOVABLE. +// Notes: - Local and mapped drives are mounted by definition. We have no +// way to determine mounted status of network drives, so assume that +// all drives are mounted, and let the caller decide otherwise. +// - Other flags are 'best guess' from type of drive. The system will +// not report the file attributes with any degree of accuracy. +//============================================================================= +static unsigned GetBasicFlags(const wxChar* filename) +{ + unsigned flags = wxFS_VOL_MOUNTED; + + return flags; +} // GetBasicFlags + +//============================================================================= +// Function: FilteredAdd +// Purpose: Add a file to the list if it meets the filter requirement. +// Notes: - See GetBasicFlags for remarks about the Mounted flag. +//============================================================================= +static bool FilteredAdd(wxArrayString& list, const wxChar* filename, + unsigned flagsSet, unsigned flagsUnset) +{ + return false; +} // FilteredAdd + +//============================================================================= +// Function: BuildListFromNN +// Purpose: Append or remove items from the list +// Notes: - There is no way to find all disconnected NN items, or even to find +// all items while determining which are connected and not. So this +// function will find either all items or connected items. +//============================================================================= +static void BuildListFromNN(wxArrayString& list, NETRESOURCE* pResSrc, + unsigned flagsSet, unsigned flagsUnset) +{ +} // BuildListFromNN + +//============================================================================= +// Function: CompareFcn +// Purpose: Used to sort the NN list alphabetically, case insensitive. +//============================================================================= +static int CompareFcn(wxString* first, wxString* second) +{ + return wxStricmp(first->c_str(), second->c_str()); +} // CompareFcn + +//============================================================================= +// Function: BuildRemoteList +// Purpose: Append Network Neighborhood items to the list. +// Notes: - Mounted gets transalated into Connected. FilteredAdd is told +// to ignore the Mounted flag since we need to handle it in a weird +// way manually. +// - The resulting list is sorted alphabetically. +//============================================================================= +static bool BuildRemoteList(wxArrayString& list, NETRESOURCE* pResSrc, + unsigned flagsSet, unsigned flagsUnset) +{ + return false; +} // BuildRemoteList + +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// wxFSVolume +//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +//============================================================================= +// Function: GetVolumes +// Purpose: Generate and return a list of all volumes (drives) available. +// Notes: +//============================================================================= +wxArrayString wxFSVolumeBase::GetVolumes(int flagsSet, int flagsUnset) +{ + wxArrayString list; + + return list; +} // GetVolumes + +//============================================================================= +// Function: CancelSearch +// Purpose: Instruct an active search to stop. +// Notes: - This will only sensibly be called by a thread other than the one +// performing the search. This is the only thread-safe function +// provided by the class. +//============================================================================= +void wxFSVolumeBase::CancelSearch() +{ +} // CancelSearch + +//============================================================================= +// Function: constructor +// Purpose: default constructor +//============================================================================= +wxFSVolumeBase::wxFSVolumeBase() +{ +} // wxVolume + +//============================================================================= +// Function: constructor +// Purpose: constructor that calls Create +//============================================================================= +wxFSVolumeBase::wxFSVolumeBase(const wxString& name) +{ +} // wxVolume + +//============================================================================= +// Function: Create +// Purpose: Finds, logs in, etc. to the request volume. +//============================================================================= +bool wxFSVolumeBase::Create(const wxString& name) +{ + return false; +} // Create + +//============================================================================= +// Function: IsOk +// Purpose: returns TRUE if the volume is legal. +// Notes: For fixed disks, it must exist. For removable disks, it must also +// be present. For Network Shares, it must also be logged in, etc. +//============================================================================= +bool wxFSVolumeBase::IsOk() const +{ + return false; +} // IsOk + +//============================================================================= +// Function: GetKind +// Purpose: Return the type of the volume. +//============================================================================= +wxFSVolumeKind wxFSVolumeBase::GetKind() const +{ + return wxFS_VOL_OTHER; +} + +//============================================================================= +// Function: GetFlags +// Purpose: Return the caches flags for this volume. +// Notes: - Returns -1 if no flags were cached. +//============================================================================= +int wxFSVolumeBase::GetFlags() const +{ + return -1; +} // GetFlags + +#endif // wxUSE_BASE + +// ============================================================================ +// wxFSVolume +// ============================================================================ + +#if wxUSE_GUI + +void wxFSVolume::InitIcons() +{ +} + +//============================================================================= +// Function: GetIcon +// Purpose: return the requested icon. +//============================================================================= + +wxIcon wxFSVolume::GetIcon(wxFSIconType type) const +{ + return m_icons[type]; +} // GetIcon + +#endif // wxUSE_GUI + +#endif // wxUSE_FSVOLUME + diff --git a/src/palmos/window.cpp b/src/palmos/window.cpp new file mode 100644 index 0000000000..7be136109f --- /dev/null +++ b/src/palmos/window.cpp @@ -0,0 +1,1160 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: src/palmos/windows.cpp +// Purpose: wxWindow +// Author: William Osborne +// Modified by: +// Created: 10/13/04 +// RCS-ID: $Id: +// Copyright: (c) William Osborne +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "window.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include "wx/window.h" + #include "wx/accel.h" + #include "wx/setup.h" + #include "wx/menu.h" + #include "wx/dc.h" + #include "wx/dcclient.h" + #include "wx/dcmemory.h" + #include "wx/utils.h" + #include "wx/app.h" + #include "wx/layout.h" + #include "wx/dialog.h" + #include "wx/frame.h" + #include "wx/listbox.h" + #include "wx/button.h" + #include "wx/msgdlg.h" + #include "wx/settings.h" + #include "wx/statbox.h" +#endif + +#if wxUSE_OWNER_DRAWN && !defined(__WXUNIVERSAL__) + #include "wx/ownerdrw.h" +#endif + +#include "wx/module.h" + +#if wxUSE_DRAG_AND_DROP + #include "wx/dnd.h" +#endif + +#if wxUSE_ACCESSIBILITY + #include "wx/access.h" +#endif + +#include "wx/menuitem.h" +#include "wx/log.h" + +#if wxUSE_TOOLTIPS + #include "wx/tooltip.h" +#endif + +#if wxUSE_CARET + #include "wx/caret.h" +#endif // wxUSE_CARET + +#if wxUSE_SPINCTRL + #include "wx/spinctrl.h" +#endif // wxUSE_SPINCTRL + +#include "wx/intl.h" +#include "wx/log.h" + +#include "wx/textctrl.h" +#include "wx/notebook.h" +#include "wx/listctrl.h" + +#include + +#include "wx/palmos/window.h" + +// --------------------------------------------------------------------------- +// global variables +// --------------------------------------------------------------------------- + +#if wxUSE_MENUS_NATIVE +wxMenu *wxCurrentPopupMenu = NULL; +#endif // wxUSE_MENUS_NATIVE + +#ifdef __WXWINCE__ +extern wxChar *wxCanvasClassName; +#else +extern const wxChar *wxCanvasClassName; +#endif + +// true if we had already created the std colour map, used by +// wxGetStdColourMap() and wxWindow::OnSysColourChanged() (FIXME-MT) +static bool gs_hasStdCmap = false; + +// --------------------------------------------------------------------------- +// private functions +// --------------------------------------------------------------------------- + +// --------------------------------------------------------------------------- +// event tables +// --------------------------------------------------------------------------- + +// in wxUniv/Palm this class is abstract because it doesn't have DoPopupMenu() +// method +#ifdef __WXUNIVERSAL__ + IMPLEMENT_ABSTRACT_CLASS(wxWindowPalm, wxWindowBase) +#else // __WXPalm__ +#if wxUSE_EXTENDED_RTTI + +// windows that are created from a parent window during its Create method, eg. spin controls in a calendar controls +// must never been streamed out separately otherwise chaos occurs. Right now easiest is to test for negative ids, as +// windows with negative ids never can be recreated anyway + +bool wxWindowStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & ) +{ + return false; +} + +IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxWindow, wxWindowBase,"wx/window.h", wxWindowStreamingCallback) + +// make wxWindowList known before the property is used + +wxCOLLECTION_TYPE_INFO( wxWindow* , wxWindowList ) ; + +template<> void wxCollectionToVariantArray( wxWindowList const &theList, wxxVariantArray &value) +{ + wxListCollectionToVariantArray( theList , value ) ; +} + +WX_DEFINE_FLAGS( wxWindowStyle ) + +wxBEGIN_FLAGS( wxWindowStyle ) + // new style border flags, we put them first to + // use them for streaming out + + wxFLAGS_MEMBER(wxBORDER_SIMPLE) + wxFLAGS_MEMBER(wxBORDER_SUNKEN) + wxFLAGS_MEMBER(wxBORDER_DOUBLE) + wxFLAGS_MEMBER(wxBORDER_RAISED) + wxFLAGS_MEMBER(wxBORDER_STATIC) + wxFLAGS_MEMBER(wxBORDER_NONE) + + // old style border flags + wxFLAGS_MEMBER(wxSIMPLE_BORDER) + wxFLAGS_MEMBER(wxSUNKEN_BORDER) + wxFLAGS_MEMBER(wxDOUBLE_BORDER) + wxFLAGS_MEMBER(wxRAISED_BORDER) + wxFLAGS_MEMBER(wxSTATIC_BORDER) + wxFLAGS_MEMBER(wxBORDER) + + // standard window styles + wxFLAGS_MEMBER(wxTAB_TRAVERSAL) + wxFLAGS_MEMBER(wxCLIP_CHILDREN) + wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) + wxFLAGS_MEMBER(wxWANTS_CHARS) + wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) + wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) + wxFLAGS_MEMBER(wxVSCROLL) + wxFLAGS_MEMBER(wxHSCROLL) + +wxEND_FLAGS( wxWindowStyle ) + +wxBEGIN_PROPERTIES_TABLE(wxWindow) + wxEVENT_PROPERTY( Close , wxEVT_CLOSE_WINDOW , wxCloseEvent) + wxEVENT_PROPERTY( Create , wxEVT_CREATE , wxWindowCreateEvent ) + wxEVENT_PROPERTY( Destroy , wxEVT_DESTROY , wxWindowDestroyEvent ) + // Always constructor Properties first + + wxREADONLY_PROPERTY( Parent,wxWindow*, GetParent, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Id,wxWindowID, SetId, GetId, wxID_ANY, 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) + wxPROPERTY( Position,wxPoint, SetPosition , GetPosition, wxDefaultPosition , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // pos + wxPROPERTY( Size,wxSize, SetSize, GetSize, wxDefaultSize , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // size + wxPROPERTY( WindowStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style + + // Then all relations of the object graph + + wxREADONLY_PROPERTY_COLLECTION( Children , wxWindowList , wxWindowBase* , GetWindowChildren , wxPROP_OBJECT_GRAPH /*flags*/ , wxT("Helpstring") , wxT("group")) + + // and finally all other properties + + wxPROPERTY( ExtraStyle , long , SetExtraStyle , GetExtraStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // extstyle + wxPROPERTY( BackgroundColour , wxColour , SetBackgroundColour , GetBackgroundColour , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // bg + wxPROPERTY( ForegroundColour , wxColour , SetForegroundColour , GetForegroundColour , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // fg + wxPROPERTY( Enabled , bool , Enable , IsEnabled , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + wxPROPERTY( Shown , bool , Show , IsShown , wxxVariant((bool)true) , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +#if 0 + // possible property candidates (not in xrc) or not valid in all subclasses + wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxT("") ) + wxPROPERTY( Font , wxFont , SetFont , GetWindowFont , ) + wxPROPERTY( Label,wxString, SetLabel, GetLabel, wxT("") ) + // MaxHeight, Width , MinHeight , Width + // TODO switch label to control and title to toplevels + + wxPROPERTY( ThemeEnabled , bool , SetThemeEnabled , GetThemeEnabled , ) + //wxPROPERTY( Cursor , wxCursor , SetCursor , GetCursor , ) + // wxPROPERTY( ToolTip , wxString , SetToolTip , GetToolTipText , ) + wxPROPERTY( AutoLayout , bool , SetAutoLayout , GetAutoLayout , ) + + + +#endif +wxEND_PROPERTIES_TABLE() + +wxBEGIN_HANDLERS_TABLE(wxWindow) +wxEND_HANDLERS_TABLE() + +wxCONSTRUCTOR_DUMMY(wxWindow) + +#else + IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) +#endif +#endif // __WXUNIVERSAL__/__WXPalm__ + +BEGIN_EVENT_TABLE(wxWindowPalm, wxWindowBase) + EVT_ERASE_BACKGROUND(wxWindowPalm::OnEraseBackground) + EVT_SYS_COLOUR_CHANGED(wxWindowPalm::OnSysColourChanged) + EVT_INIT_DIALOG(wxWindowPalm::OnInitDialog) +END_EVENT_TABLE() + +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxWindow utility functions +// --------------------------------------------------------------------------- + +// Find an item given the MS Windows id +wxWindow *wxWindowPalm::FindItem(long id) const +{ + return NULL; +} + +// Find an item given the MS Windows handle +wxWindow *wxWindowPalm::FindItemByHWND(WXHWND hWnd, bool controlOnly) const +{ + return NULL; +} + +// Default command handler +bool wxWindowPalm::PalmCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// constructors and such +// ---------------------------------------------------------------------------- + +void wxWindowPalm::Init() +{ +} + +// Destructor +wxWindowPalm::~wxWindowPalm() +{ +} + +// real construction (Init() must have been called before!) +bool wxWindowPalm::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) +{ + return false; +} + +FormType *wxWindowPalm::GetFormPtr() +{ + return FrameForm; +} +void wxWindowPalm::SetFormPtr(FormType *FormPtr) +{ + FrameForm=FormPtr; +} + +// --------------------------------------------------------------------------- +// basic operations +// --------------------------------------------------------------------------- + +void wxWindowPalm::SetFocus() +{ +} + +void wxWindowPalm::SetFocusFromKbd() +{ +} + +// Get the window with the focus +wxWindow *wxWindowBase::DoFindFocus() +{ + return NULL; +} + +bool wxWindowPalm::Enable(bool enable) +{ + return false; +} + +bool wxWindowPalm::Show(bool show) +{ + return false; +} + +// Raise the window to the top of the Z order +void wxWindowPalm::Raise() +{ +} + +// Lower the window to the bottom of the Z order +void wxWindowPalm::Lower() +{ +} + +void wxWindowPalm::SetTitle( const wxString& title) +{ +} + +wxString wxWindowPalm::GetTitle() const +{ + return wxString(""); +} + +void wxWindowPalm::DoCaptureMouse() +{ +} + +void wxWindowPalm::DoReleaseMouse() +{ +} + +/* static */ wxWindow *wxWindowBase::GetCapture() +{ + return NULL; +} + +bool wxWindowPalm::SetFont(const wxFont& font) +{ + return false; +} +bool wxWindowPalm::SetCursor(const wxCursor& cursor) +{ + return false; +} + +void wxWindowPalm::WarpPointer (int x, int y) +{ +} + +// --------------------------------------------------------------------------- +// scrolling stuff +// --------------------------------------------------------------------------- + +// convert wxHORIZONTAL/wxVERTICAL to SB_HORZ/SB_VERT +static inline int wxDirToWinStyle(int orient) +{ + return 0; +} + +int wxWindowPalm::GetScrollPos(int orient) const +{ + return 0; +} + +// This now returns the whole range, not just the number +// of positions that we can scroll. +int wxWindowPalm::GetScrollRange(int orient) const +{ + return 0; +} + +int wxWindowPalm::GetScrollThumb(int orient) const +{ + return 0; +} + +void wxWindowPalm::SetScrollPos(int orient, int pos, bool refresh) +{ +} + +// New function that will replace some of the above. +void wxWindowPalm::SetScrollbar(int orient, + int pos, + int pageSize, + int range, + bool refresh) +{ +} + +void wxWindowPalm::ScrollWindow(int dx, int dy, const wxRect *prect) +{ +} + +bool wxWindowPalm::ScrollLines(int lines) +{ + return false; +} + +bool wxWindowPalm::ScrollPages(int pages) +{ + return false; +} + +// --------------------------------------------------------------------------- +// subclassing +// --------------------------------------------------------------------------- + +void wxWindowPalm::SubclassWin(WXHWND hWnd) +{ +} + +void wxWindowPalm::UnsubclassWin() +{ +} + +bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// Style handling +// ---------------------------------------------------------------------------- + +void wxWindowPalm::SetWindowStyleFlag(long flags) +{ +} + +WXDWORD wxWindowPalm::PalmGetStyle(long flags, WXDWORD *exstyle) const +{ + return 0; +} + +// Setup background and foreground colours correctly +void wxWindowPalm::SetupColours() +{ +} + +bool wxWindowPalm::IsMouseInWindow() const +{ + return false; +} + +void wxWindowPalm::OnInternalIdle() +{ +} + +// Set this window to be the child of 'parent'. +bool wxWindowPalm::Reparent(wxWindowBase *parent) +{ + return false; +} + +void wxWindowPalm::Freeze() +{ +} + +void wxWindowPalm::Thaw() +{ +} + +void wxWindowPalm::Refresh(bool eraseBack, const wxRect *rect) +{ +} + +void wxWindowPalm::Update() +{ +} + +// --------------------------------------------------------------------------- +// drag and drop +// --------------------------------------------------------------------------- + + +#if wxUSE_DRAG_AND_DROP +void wxWindowPalm::SetDropTarget(wxDropTarget *pDropTarget) +{ +} +#endif // wxUSE_DRAG_AND_DROP + +// old style file-manager drag&drop support: we retain the old-style +// DragAcceptFiles in parallel with SetDropTarget. +void wxWindowPalm::DragAcceptFiles(bool accept) +{ +} + +// ---------------------------------------------------------------------------- +// tooltips +// ---------------------------------------------------------------------------- + +#if wxUSE_TOOLTIPS + +void wxWindowPalm::DoSetToolTip(wxToolTip *tooltip) +{ +} + +#endif // wxUSE_TOOLTIPS + +// --------------------------------------------------------------------------- +// moving and resizing +// --------------------------------------------------------------------------- + +// Get total size +void wxWindowPalm::DoGetSize(int *x, int *y) const +{ +} + +// Get size *available for subwindows* i.e. excluding menu bar etc. +void wxWindowPalm::DoGetClientSize(int *x, int *y) const +{ +} + +void wxWindowPalm::DoGetPosition(int *x, int *y) const +{ +} + +void wxWindowPalm::DoScreenToClient(int *x, int *y) const +{ +} + +void wxWindowPalm::DoClientToScreen(int *x, int *y) const +{ +} + +void wxWindowPalm::DoMoveWindow(int x, int y, int width, int height) +{ +} + +// set the size of the window: if the dimensions are positive, just use them, +// but if any of them is equal to -1, it means that we must find the value for +// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in +// which case -1 is a valid value for x and y) +// +// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate +// the width/height to best suit our contents, otherwise we reuse the current +// width/height +void wxWindowPalm::DoSetSize(int x, int y, int width, int height, int sizeFlags) +{ +} + +void wxWindowPalm::DoSetClientSize(int width, int height) +{ +} + +// For implementation purposes - sometimes decorations make the client area +// smaller +wxPoint wxWindowPalm::GetClientAreaOrigin() const +{ + return wxPoint(0, 0); +} + +// --------------------------------------------------------------------------- +// text metrics +// --------------------------------------------------------------------------- + +int wxWindowPalm::GetCharHeight() const +{ + return 0; +} + +int wxWindowPalm::GetCharWidth() const +{ + return 0; +} + +void wxWindowPalm::GetTextExtent(const wxString& string, + int *x, int *y, + int *descent, int *externalLeading, + const wxFont *theFont) const +{ +} + +// --------------------------------------------------------------------------- +// popup menu +// --------------------------------------------------------------------------- + +#if wxUSE_MENUS_NATIVE + +// yield for WM_COMMAND events only, i.e. process all WM_COMMANDs in the queue +// immediately, without waiting for the next event loop iteration +// +// NB: this function should probably be made public later as it can almost +// surely replace wxYield() elsewhere as well +static void wxYieldForCommandsOnly() +{ +} + +bool wxWindowPalm::DoPopupMenu(wxMenu *menu, int x, int y) +{ + return false; +} + +#endif // wxUSE_MENUS_NATIVE + +// =========================================================================== +// pre/post message processing +// =========================================================================== + +WXLRESULT wxWindowPalm::PalmDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +bool wxWindowPalm::PalmProcessMessage(WXMSG* pMsg) +{ + return false; +} + +bool wxWindowPalm::PalmTranslateMessage(WXMSG* pMsg) +{ + return false; +} + +bool wxWindowPalm::PalmShouldPreProcessMessage(WXMSG* WXUNUSED(pMsg)) +{ + return false; +} + +// --------------------------------------------------------------------------- +// Main wxWidgets window proc and the window proc for wxWindow +// --------------------------------------------------------------------------- + +// Hook for new window just as it's being created, when the window isn't yet +// associated with the handle + +// implementation of wxWindowCreationHook class: it just sets gs_winBeingCreated to the +// window being created and insures that it's always unset back later +wxWindowCreationHook::wxWindowCreationHook(wxWindowPalm *winBeingCreated) +{ +} + +wxWindowCreationHook::~wxWindowCreationHook() +{ +} + +WXLRESULT wxWindowPalm::PalmWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +// ---------------------------------------------------------------------------- +// wxWindow <-> HWND map +// ---------------------------------------------------------------------------- + +wxWinHashTable *wxWinHandleHash = NULL; + +wxWindow *wxFindWinFromHandle(WXHWND hWnd) +{ + return NULL; +} + +void wxRemoveHandleAssociation(wxWindowPalm *win) +{ +} + +// ---------------------------------------------------------------------------- +// various Palm speciic class dependent functions +// ---------------------------------------------------------------------------- + +// Default destroyer - override if you destroy it in some other way +// (e.g. with MDI child windows) +void wxWindowPalm::PalmDestroyWindow() +{ +} + +bool wxWindowPalm::PalmGetCreateWindowCoords(const wxPoint& pos, + const wxSize& size, + int& x, int& y, + int& w, int& h) const +{ + return false; +} + +WXHWND wxWindowPalm::PalmGetParent() const +{ + return NULL; +} + +bool wxWindowPalm::PalmCreate(const wxChar *wclass, + const wxChar *title, + const wxPoint& pos, + const wxSize& size, + WXDWORD style, + WXDWORD extendedStyle) +{ + return false; +} + +// =========================================================================== +// Palm message handlers +// =========================================================================== + +// --------------------------------------------------------------------------- +// WM_NOTIFY +// --------------------------------------------------------------------------- + +#ifdef __WIN95__ + +bool wxWindowPalm::HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) +{ + return false; +} + +#if wxUSE_TOOLTIPS + +bool wxWindowPalm::HandleTooltipNotify(WXUINT code, + WXLPARAM lParam, + const wxString& ttip) +{ + return false; +} + +#endif // wxUSE_TOOLTIPS + +bool wxWindowPalm::PalmOnNotify(int WXUNUSED(idCtrl), + WXLPARAM lParam, + WXLPARAM* WXUNUSED(result)) +{ + return false; +} + +#endif // __WIN95__ + +// --------------------------------------------------------------------------- +// end session messages +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleQueryEndSession(long logOff, bool *mayEnd) +{ + return false; +} + +bool wxWindowPalm::HandleEndSession(bool endSession, long logOff) +{ + return false; +} + +// --------------------------------------------------------------------------- +// window creation/destruction +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleCreate(WXLPCREATESTRUCT cs, bool *mayCreate) +{ + return false; +} + +bool wxWindowPalm::HandleDestroy() +{ + return false; +} + +// --------------------------------------------------------------------------- +// activation/focus +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleActivate(int state, + bool WXUNUSED(minimized), + WXHWND WXUNUSED(activate)) +{ + return false; +} + +bool wxWindowPalm::HandleSetFocus(WXHWND hwnd) +{ + return false; +} + +bool wxWindowPalm::HandleKillFocus(WXHWND hwnd) +{ + return false; +} + +// --------------------------------------------------------------------------- +// miscellaneous +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleShow(bool show, int WXUNUSED(status)) +{ + return false; +} + +bool wxWindowPalm::HandleInitDialog(WXHWND WXUNUSED(hWndFocus)) +{ + return false; +} + +bool wxWindowPalm::HandleDropFiles(WXWPARAM wParam) +{ + return false; +} + + +bool wxWindowPalm::HandleSetCursor(WXHWND WXUNUSED(hWnd), + short nHitTest, + int WXUNUSED(mouseMsg)) +{ + return false; +} + +// --------------------------------------------------------------------------- +// owner drawn stuff +// --------------------------------------------------------------------------- + +#if (wxUSE_OWNER_DRAWN && wxUSE_MENUS_NATIVE) || \ + (wxUSE_CONTROLS && !defined(__WXUNIVERSAL__)) + #define WXUNUSED_UNLESS_ODRAWN(param) param +#else + #define WXUNUSED_UNLESS_ODRAWN(param) +#endif + +bool +wxWindowPalm::PalmOnDrawItem(int WXUNUSED_UNLESS_ODRAWN(id), + WXDRAWITEMSTRUCT * WXUNUSED_UNLESS_ODRAWN(itemStruct)) +{ + return false; +} + +bool +wxWindowPalm::PalmOnMeasureItem(int WXUNUSED_UNLESS_ODRAWN(id), + WXMEASUREITEMSTRUCT * + WXUNUSED_UNLESS_ODRAWN(itemStruct)) +{ + return false; +} + +// --------------------------------------------------------------------------- +// colours and palettes +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleSysColorChange() +{ + return false; +} + +bool wxWindowPalm::HandleDisplayChange() +{ + return false; +} + +bool wxWindowPalm::HandleCtlColor(WXHBRUSH *brush, + WXHDC pDC, + WXHWND pWnd, + WXUINT nCtlColor, + WXUINT message, + WXWPARAM wParam, + WXLPARAM lParam) +{ + return false; +} + +// Define for each class of dialog and control +WXHBRUSH wxWindowPalm::OnCtlColor(WXHDC WXUNUSED(hDC), + WXHWND WXUNUSED(hWnd), + WXUINT WXUNUSED(nCtlColor), + WXUINT WXUNUSED(message), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam)) +{ + return (WXHBRUSH)0; +} + +bool wxWindowPalm::HandlePaletteChanged(WXHWND hWndPalChange) +{ + return false; +} + +bool wxWindowPalm::HandleCaptureChanged(WXHWND hWndGainedCapture) +{ + return false; +} + +bool wxWindowPalm::HandleQueryNewPalette() +{ + return false; +} + +// Responds to colour changes: passes event on to children. +void wxWindowPalm::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) +{ +} + +// --------------------------------------------------------------------------- +// painting +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandlePaint() +{ + return false; +} + +// Can be called from an application's OnPaint handler +void wxWindowPalm::OnPaint(wxPaintEvent& event) +{ +} + +bool wxWindowPalm::HandleEraseBkgnd(WXHDC hdc) +{ + return false; +} + +void wxWindowPalm::OnEraseBackground(wxEraseEvent& event) +{ +} + +// --------------------------------------------------------------------------- +// moving and resizing +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleMinimize() +{ + return false; +} + +bool wxWindowPalm::HandleMaximize() +{ + return false; +} + +bool wxWindowPalm::HandleMove(int x, int y) +{ + return false; +} + +bool wxWindowPalm::HandleMoving(wxRect& rect) +{ + return false; +} + +bool wxWindowPalm::HandleSize(int WXUNUSED(w), int WXUNUSED(h), + WXUINT WXUNUSED(flag)) +{ + return false; +} + +bool wxWindowPalm::HandleSizing(wxRect& rect) +{ + return false; +} + +bool wxWindowPalm::HandleGetMinMaxInfo(void *mmInfo) +{ + return false; +} + +// --------------------------------------------------------------------------- +// command messages +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control) +{ + return false; +} + +// --------------------------------------------------------------------------- +// mouse events +// --------------------------------------------------------------------------- + +void wxWindowPalm::InitMouseEvent(wxMouseEvent& event, + int x, int y, + WXUINT flags) +{ +} + +// Windows doesn't send the mouse events to the static controls (which are +// transparent in the sense that their WM_NCHITTEST handler returns +// HTTRANSPARENT) at all but we want all controls to receive the mouse events +// and so we manually check if we don't have a child window under mouse and if +// we do, send the event to it instead of the window Windows had sent WM_XXX +// to. +// +// Notice that this is not done for the mouse move events because this could +// (would?) be too slow, but only for clicks which means that the static texts +// still don't get move, enter nor leave events. +static wxWindowPalm *FindWindowForMouseEvent(wxWindowPalm *win, int *x, int *y) //TW:REQ:Univ +{ + return NULL; +} + +bool wxWindowPalm::HandleMouseEvent(WXUINT msg, int x, int y, WXUINT flags) +{ + return false; +} + +bool wxWindowPalm::HandleMouseMove(int x, int y, WXUINT flags) +{ + return false; +} + + +bool wxWindowPalm::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + + +// --------------------------------------------------------------------------- +// keyboard handling +// --------------------------------------------------------------------------- + +// create the key event of the given type for the given key - used by +// HandleChar and HandleKeyDown/Up +wxKeyEvent wxWindowPalm::CreateKeyEvent(wxEventType evType, + int id, + WXLPARAM lParam, + WXWPARAM wParam) const +{ + wxKeyEvent event(evType); + + return event; +} + +// isASCII is true only when we're called from WM_CHAR handler and not from +// WM_KEYDOWN one +bool wxWindowPalm::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII) +{ + return false; +} + +bool wxWindowPalm::HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +bool wxWindowPalm::HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +int wxWindowPalm::HandleMenuChar(int chAccel, WXLPARAM lParam) +{ + return 0; +} + +// --------------------------------------------------------------------------- +// joystick +// --------------------------------------------------------------------------- + +bool wxWindowPalm::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags) +{ + return false; +} + +// --------------------------------------------------------------------------- +// scrolling +// --------------------------------------------------------------------------- + +bool wxWindowPalm::PalmOnScroll(int orientation, WXWORD wParam, + WXWORD pos, WXHWND control) +{ + return false; +} + +// =========================================================================== +// global functions +// =========================================================================== + +void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont *the_font) +{ +} + +// Returns 0 if was a normal ASCII value, not a special key. This indicates that +// the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead. +int wxCharCodePalmToWX(int keySym, WXLPARAM lParam) +{ + return 0; +} + +int wxCharCodeWXToPalm(int id, bool *isVirtual) +{ + return 0; +} + +bool wxGetKeyState(wxKeyCode key) +{ + return false; +} + +wxWindow *wxGetActiveWindow() +{ + return NULL; +} + +extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) +{ + return NULL; +} + +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) + +void wxSetKeyboardHook(bool doIt) +{ +} + +#endif // !__WXMICROWIN__ + +#ifdef __WXDEBUG__ +const char *wxGetMessageName(int message) +{ + return ""; +} +#endif //__WXDEBUG__ + +// Find the wxWindow at the current mouse position, returning the mouse +// position. +wxWindow* wxFindWindowAtPointer(wxPoint& pt) +{ + return NULL; +} + +wxWindow* wxFindWindowAtPoint(const wxPoint& pt) +{ + return NULL; +} + +// Get the current mouse position. +wxPoint wxGetMousePosition() +{ + return wxPoint(0, 0); +} + +#if wxUSE_HOTKEY + +bool wxWindowPalm::RegisterHotKey(int hotkeyId, int modifiers, int keycode) +{ + return false; +} + +bool wxWindowPalm::UnregisterHotKey(int hotkeyId) +{ + return false; +} + +#if wxUSE_ACCEL + +bool wxWindowPalm::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam) +{ + return false; +} + +#endif // wxUSE_ACCEL + +#endif // wxUSE_HOTKEY + + -- 2.45.2