From 457814b5aa2ee5c83abc65a6aee2a3ebcb1af34f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 22 May 1998 19:57:05 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/docsrc.rsp | 85 + distrib/msw/generic.rsp | 538 ++++++ distrib/msw/msw.rsp | 128 ++ distrib/msw/tardist.bat | 117 ++ distrib/msw/wx_hlp.rsp | 2 + distrib/msw/wx_html.rsp | 38 + distrib/msw/wx_pdf.rsp | 1 + distrib/msw/zipdist.bat | 34 + samples/checklst/bell.bmp | Bin 0 -> 370 bytes samples/checklst/checklst.cpp | 185 ++ samples/checklst/checklst.def | 8 + samples/checklst/checklst.rc | 6 + samples/checklst/makefile.b32 | 64 + samples/checklst/makefile.dos | 65 + samples/checklst/makefile.g95 | 37 + samples/checklst/makefile.nt | 64 + samples/checklst/mondrian.ico | Bin 0 -> 766 bytes samples/checklst/nosound.bmp | Bin 0 -> 370 bytes samples/checklst/sound.bmp | Bin 0 -> 370 bytes samples/dialogs/aiai.ico | Bin 0 -> 766 bytes samples/dialogs/dialogs.cpp | 293 ++++ samples/dialogs/dialogs.def | 8 + samples/dialogs/dialogs.h | 73 + samples/dialogs/dialogs.rc | 3 + samples/dialogs/makefile.b32 | 62 + samples/dialogs/makefile.bcc | 74 + samples/dialogs/makefile.dos | 81 + samples/dialogs/makefile.g95 | 35 + samples/dialogs/makefile.nt | 63 + samples/dialogs/makefile.sc | 35 + samples/dialogs/makefile.unx | 58 + samples/dialogs/makefile.vms | 38 + samples/dialogs/makefile.wat | 43 + samples/dnd/d_and_d.txt | 167 ++ samples/dnd/dnd.cpp | 264 +++ samples/dnd/dnd.def | 8 + samples/dnd/dnd.rc | 3 + samples/dnd/makefile.b32 | 64 + samples/dnd/makefile.dos | 65 + samples/dnd/makefile.g95 | 37 + samples/dnd/makefile.nt | 64 + samples/dnd/mondrian.ico | Bin 0 -> 766 bytes samples/docview/aiai.ico | Bin 0 -> 766 bytes samples/docview/chart.ico | Bin 0 -> 766 bytes samples/docview/doc.cpp | 275 +++ samples/docview/doc.h | 98 ++ samples/docview/doc.ico | Bin 0 -> 766 bytes samples/docview/docview.cpp | 274 +++ samples/docview/docview.def | 8 + samples/docview/docview.h | 66 + samples/docview/docview.rc | 6 + samples/docview/makefile.b32 | 67 + samples/docview/makefile.bcc | 77 + samples/docview/makefile.dos | 74 + samples/docview/makefile.g95 | 43 + samples/docview/makefile.nt | 75 + samples/docview/makefile.sc | 38 + samples/docview/makefile.unx | 64 + samples/docview/makefile.vms | 44 + samples/docview/makefile.wat | 43 + samples/docview/notepad.ico | Bin 0 -> 766 bytes samples/docview/view.cpp | 284 +++ samples/docview/view.h | 79 + samples/listctrl/aiai.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/small1.ico | Bin 0 -> 1078 bytes samples/listctrl/bitmaps/toolbrai.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/toolchar.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/toolchec.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/tooldata.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/toolgame.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/toolnote.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/tooltime.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/tooltodo.ico | Bin 0 -> 766 bytes samples/listctrl/bitmaps/toolword.ico | Bin 0 -> 766 bytes samples/listctrl/listtest.cpp | 480 +++++ samples/listctrl/listtest.def | 8 + samples/listctrl/listtest.h | 80 + samples/listctrl/listtest.rc | 16 + samples/listctrl/makefile.b32 | 63 + samples/listctrl/makefile.bcc | 73 + samples/listctrl/makefile.dos | 81 + samples/listctrl/makefile.g95 | 37 + samples/listctrl/makefile.nt | 64 + samples/listctrl/makefile.sc | 35 + samples/listctrl/makefile.unx | 58 + samples/listctrl/makefile.vms | 38 + samples/listctrl/makefile.wat | 43 + samples/listctrl/mondrian.ico | Bin 0 -> 766 bytes samples/mdi/bitmaps/abacus.bmp | Bin 0 -> 566 bytes samples/mdi/bitmaps/aiai.xbm | 38 + samples/mdi/bitmaps/bitmap1.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/bitmap2.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/brush.bmp | Bin 0 -> 740 bytes samples/mdi/bitmaps/calc.bmp | Bin 0 -> 702 bytes samples/mdi/bitmaps/chart.bmp | Bin 0 -> 600 bytes samples/mdi/bitmaps/colour.bmp | Bin 0 -> 734 bytes samples/mdi/bitmaps/copy.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/cut.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/dirplain.xbm | 14 + samples/mdi/bitmaps/draft.xbm | 14 + samples/mdi/bitmaps/drawing.xbm | 14 + samples/mdi/bitmaps/files.bmp | Bin 0 -> 672 bytes samples/mdi/bitmaps/flowchar.xbm | 14 + samples/mdi/bitmaps/help.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/helpcs.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/magnify.bmp | Bin 0 -> 722 bytes samples/mdi/bitmaps/mike.bmp | Bin 0 -> 708 bytes samples/mdi/bitmaps/new.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/open.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/page.bmp | Bin 0 -> 714 bytes samples/mdi/bitmaps/paste.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/preview.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/print.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/save.bmp | Bin 0 -> 238 bytes samples/mdi/bitmaps/screw.bmp | Bin 0 -> 636 bytes samples/mdi/bitmaps/shapes.bmp | Bin 0 -> 780 bytes samples/mdi/bitmaps/speaker.bmp | Bin 0 -> 648 bytes samples/mdi/bitmaps/telephon.bmp | Bin 0 -> 676 bytes samples/mdi/bitmaps/therm.bmp | Bin 0 -> 812 bytes samples/mdi/bitmaps/tick.bmp | Bin 0 -> 220 bytes samples/mdi/bitmaps/torch.bmp | Bin 0 -> 706 bytes samples/mdi/bitmaps/wrench.bmp | Bin 0 -> 744 bytes samples/mdi/bitmaps/write.xbm | 14 + samples/memcheck/makefile.b32 | 65 + samples/memcheck/makefile.bcc | 77 + samples/memcheck/makefile.dos | 87 + samples/memcheck/makefile.g95 | 38 + samples/memcheck/makefile.nt | 62 + samples/memcheck/makefile.unx | 62 + samples/memcheck/makefile.wat | 43 + samples/memcheck/memcheck.cpp | 121 ++ samples/memcheck/memcheck.def | 8 + samples/memcheck/memcheck.rc | 3 + samples/memcheck/mondrian.ico | Bin 0 -> 766 bytes samples/resource/aiai.ico | Bin 0 -> 766 bytes samples/resource/dialog1.wxr | 27 + samples/resource/makefile.b32 | 64 + samples/resource/makefile.bcc | 74 + samples/resource/makefile.dos | 86 + samples/resource/makefile.g95 | 36 + samples/resource/makefile.nt | 63 + samples/resource/makefile.sc | 35 + samples/resource/makefile.unx | 76 + samples/resource/makefile.vms | 38 + samples/resource/makefile.wat | 42 + samples/resource/menu1.wxr | 13 + samples/resource/resource.cpp | 174 ++ samples/resource/resource.def | 9 + samples/resource/resource.h | 49 + samples/resource/resource.rc | 7 + samples/treectrl/aiai.ico | Bin 0 -> 766 bytes samples/treectrl/makefile.b32 | 62 + samples/treectrl/makefile.bcc | 73 + samples/treectrl/makefile.dos | 81 + samples/treectrl/makefile.g95 | 38 + samples/treectrl/makefile.nt | 64 + samples/treectrl/makefile.sc | 35 + samples/treectrl/makefile.unx | 58 + samples/treectrl/makefile.vms | 38 + samples/treectrl/makefile.wat | 43 + samples/treectrl/mondrian.ico | Bin 0 -> 766 bytes samples/treectrl/treetest.cpp | 383 ++++ samples/treectrl/treetest.def | 9 + samples/treectrl/treetest.h | 69 + samples/treectrl/treetest.rc | 7 + samples/validate/aiai.ico | Bin 0 -> 766 bytes samples/validate/makefile.b32 | 65 + samples/validate/makefile.bcc | 73 + samples/validate/makefile.dos | 81 + samples/validate/makefile.g95 | 37 + samples/validate/makefile.nt | 64 + samples/validate/makefile.sc | 35 + samples/validate/makefile.unx | 58 + samples/validate/makefile.vms | 38 + samples/validate/makefile.wat | 43 + samples/validate/mondrian.ico | Bin 0 -> 766 bytes samples/validate/validate.cpp | 105 ++ samples/validate/validate.def | 9 + samples/validate/validate.h | 55 + samples/validate/validate.rc | 3 + utils/dialoged/src/aiai.ico | Bin 0 -> 766 bytes utils/dialoged/src/bitmaps/alignb.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/alignb.xbm | 9 + utils/dialoged/src/bitmaps/alignl.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/alignl.xbm | 9 + utils/dialoged/src/bitmaps/alignr.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/alignr.xbm | 9 + utils/dialoged/src/bitmaps/alignt.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/alignt.xbm | 9 + utils/dialoged/src/bitmaps/arrow.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/arrow.xbm | 13 + utils/dialoged/src/bitmaps/bmpbuttn.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/bmpbuttn.xbm | 11 + utils/dialoged/src/bitmaps/button.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/button.xbm | 13 + utils/dialoged/src/bitmaps/canvas.xbm | 13 + utils/dialoged/src/bitmaps/check.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/check.xbm | 13 + utils/dialoged/src/bitmaps/choice.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/choice.xbm | 13 + utils/dialoged/src/bitmaps/copysize.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/copysize.xbm | 8 + utils/dialoged/src/bitmaps/cpp.xbm | 9 + utils/dialoged/src/bitmaps/cross.bmp | Bin 0 -> 198 bytes utils/dialoged/src/bitmaps/dialog.bmp | Bin 0 -> 566 bytes utils/dialoged/src/bitmaps/dialog.xbm | 13 + utils/dialoged/src/bitmaps/frame.xbm | 13 + utils/dialoged/src/bitmaps/gauge.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/gauge.xbm | 11 + utils/dialoged/src/bitmaps/group.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/group.xbm | 13 + utils/dialoged/src/bitmaps/help.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/help.xbm | 9 + utils/dialoged/src/bitmaps/horiz.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/horiz.xbm | 9 + utils/dialoged/src/bitmaps/listbox.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/listbox.xbm | 13 + utils/dialoged/src/bitmaps/load.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/load.xbm | 9 + utils/dialoged/src/bitmaps/message.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/message.xbm | 13 + utils/dialoged/src/bitmaps/mtext.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/mtext.xbm | 13 + utils/dialoged/src/bitmaps/new.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/new.xbm | 8 + utils/dialoged/src/bitmaps/open.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/panel.xbm | 13 + utils/dialoged/src/bitmaps/picture.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/picture.xbm | 11 + utils/dialoged/src/bitmaps/radio.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/radio.xbm | 13 + utils/dialoged/src/bitmaps/report.xbm | 9 + utils/dialoged/src/bitmaps/save.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/save.xbm | 9 + utils/dialoged/src/bitmaps/scroll.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/scroll.xbm | 11 + utils/dialoged/src/bitmaps/slider.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/slider.xbm | 11 + utils/dialoged/src/bitmaps/text.bmp | Bin 0 -> 382 bytes utils/dialoged/src/bitmaps/text.xbm | 13 + utils/dialoged/src/bitmaps/textsw.xbm | 13 + utils/dialoged/src/bitmaps/tick.bmp | Bin 0 -> 198 bytes utils/dialoged/src/bitmaps/toback.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/toback.xbm | 8 + utils/dialoged/src/bitmaps/tofront.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/tofront.xbm | 8 + utils/dialoged/src/bitmaps/tree.xbm | 9 + utils/dialoged/src/bitmaps/treeicn.xbm | 46 + utils/dialoged/src/bitmaps/vert.bmp | Bin 0 -> 238 bytes utils/dialoged/src/bitmaps/vert.xbm | 9 + utils/dialoged/src/bitmaps/wxbuild.xbm | 46 + utils/dialoged/src/bitmaps/wxwin.xbm | 12 + utils/dialoged/src/dialoged.cpp | 53 + utils/dialoged/src/dialoged.def | 8 + utils/dialoged/src/dialoged.h | 36 + utils/dialoged/src/dialoged.ico | Bin 0 -> 766 bytes utils/dialoged/src/dialoged.rc | 41 + utils/dialoged/src/dlghndlr.cpp | 1029 +++++++++++ utils/dialoged/src/dlghndlr.h | 123 ++ utils/dialoged/src/editrpal.cpp | 309 ++++ utils/dialoged/src/editrpal.h | 71 + utils/dialoged/src/makefile.b32 | 69 + utils/dialoged/src/makefile.bcc | 87 + utils/dialoged/src/makefile.dos | 193 +++ utils/dialoged/src/makefile.g95 | 61 + utils/dialoged/src/makefile.nt | 155 ++ utils/dialoged/src/makefile.sc | 36 + utils/dialoged/src/makefile.unx | 123 ++ utils/dialoged/src/makefile.wat | 62 + utils/dialoged/src/reseditr.cpp | 2114 +++++++++++++++++++++++ utils/dialoged/src/reseditr.h | 378 ++++ utils/dialoged/src/reswrite.cpp | 726 ++++++++ utils/dialoged/src/winprop.cpp | 1578 +++++++++++++++++ utils/dialoged/src/winprop.h | 293 ++++ utils/wxprop/src/aiai.ico | Bin 0 -> 766 bytes utils/wxprop/src/cross.bmp | Bin 0 -> 198 bytes utils/wxprop/src/makefile.b32 | 74 + utils/wxprop/src/makefile.bcc | 95 + utils/wxprop/src/makefile.dos | 138 ++ utils/wxprop/src/makefile.g95 | 54 + utils/wxprop/src/makefile.nt | 143 ++ utils/wxprop/src/makefile.unx | 105 ++ utils/wxprop/src/makefile.wat | 47 + utils/wxprop/src/prop.cpp | 1112 ++++++++++++ utils/wxprop/src/prop.h | 317 ++++ utils/wxprop/src/propform.cpp | 726 ++++++++ utils/wxprop/src/propform.h | 286 +++ utils/wxprop/src/proplist.cpp | 1849 ++++++++++++++++++++ utils/wxprop/src/proplist.h | 539 ++++++ utils/wxprop/src/test.cpp | 321 ++++ utils/wxprop/src/test.def | 8 + utils/wxprop/src/test.h | 127 ++ utils/wxprop/src/test.rc | 8 + utils/wxprop/src/tick.bmp | Bin 0 -> 198 bytes 294 files changed, 22682 insertions(+) create mode 100644 distrib/msw/docsrc.rsp create mode 100644 distrib/msw/generic.rsp create mode 100644 distrib/msw/msw.rsp create mode 100755 distrib/msw/tardist.bat create mode 100644 distrib/msw/wx_hlp.rsp create mode 100644 distrib/msw/wx_html.rsp create mode 100644 distrib/msw/wx_pdf.rsp create mode 100755 distrib/msw/zipdist.bat create mode 100644 samples/checklst/bell.bmp create mode 100644 samples/checklst/checklst.cpp create mode 100644 samples/checklst/checklst.def create mode 100644 samples/checklst/checklst.rc create mode 100644 samples/checklst/makefile.b32 create mode 100644 samples/checklst/makefile.dos create mode 100644 samples/checklst/makefile.g95 create mode 100644 samples/checklst/makefile.nt create mode 100644 samples/checklst/mondrian.ico create mode 100644 samples/checklst/nosound.bmp create mode 100644 samples/checklst/sound.bmp create mode 100644 samples/dialogs/aiai.ico create mode 100644 samples/dialogs/dialogs.cpp create mode 100644 samples/dialogs/dialogs.def create mode 100644 samples/dialogs/dialogs.h create mode 100644 samples/dialogs/dialogs.rc create mode 100644 samples/dialogs/makefile.b32 create mode 100644 samples/dialogs/makefile.bcc create mode 100644 samples/dialogs/makefile.dos create mode 100644 samples/dialogs/makefile.g95 create mode 100644 samples/dialogs/makefile.nt create mode 100644 samples/dialogs/makefile.sc create mode 100644 samples/dialogs/makefile.unx create mode 100644 samples/dialogs/makefile.vms create mode 100644 samples/dialogs/makefile.wat create mode 100644 samples/dnd/d_and_d.txt create mode 100644 samples/dnd/dnd.cpp create mode 100644 samples/dnd/dnd.def create mode 100644 samples/dnd/dnd.rc create mode 100644 samples/dnd/makefile.b32 create mode 100644 samples/dnd/makefile.dos create mode 100644 samples/dnd/makefile.g95 create mode 100644 samples/dnd/makefile.nt create mode 100644 samples/dnd/mondrian.ico create mode 100644 samples/docview/aiai.ico create mode 100644 samples/docview/chart.ico create mode 100644 samples/docview/doc.cpp create mode 100644 samples/docview/doc.h create mode 100644 samples/docview/doc.ico create mode 100644 samples/docview/docview.cpp create mode 100644 samples/docview/docview.def create mode 100644 samples/docview/docview.h create mode 100644 samples/docview/docview.rc create mode 100644 samples/docview/makefile.b32 create mode 100644 samples/docview/makefile.bcc create mode 100644 samples/docview/makefile.dos create mode 100644 samples/docview/makefile.g95 create mode 100644 samples/docview/makefile.nt create mode 100644 samples/docview/makefile.sc create mode 100644 samples/docview/makefile.unx create mode 100644 samples/docview/makefile.vms create mode 100644 samples/docview/makefile.wat create mode 100644 samples/docview/notepad.ico create mode 100644 samples/docview/view.cpp create mode 100644 samples/docview/view.h create mode 100644 samples/listctrl/aiai.ico create mode 100644 samples/listctrl/bitmaps/small1.ico create mode 100644 samples/listctrl/bitmaps/toolbrai.ico create mode 100644 samples/listctrl/bitmaps/toolchar.ico create mode 100644 samples/listctrl/bitmaps/toolchec.ico create mode 100644 samples/listctrl/bitmaps/tooldata.ico create mode 100644 samples/listctrl/bitmaps/toolgame.ico create mode 100644 samples/listctrl/bitmaps/toolnote.ico create mode 100644 samples/listctrl/bitmaps/tooltime.ico create mode 100644 samples/listctrl/bitmaps/tooltodo.ico create mode 100644 samples/listctrl/bitmaps/toolword.ico create mode 100644 samples/listctrl/listtest.cpp create mode 100644 samples/listctrl/listtest.def create mode 100644 samples/listctrl/listtest.h create mode 100644 samples/listctrl/listtest.rc create mode 100644 samples/listctrl/makefile.b32 create mode 100644 samples/listctrl/makefile.bcc create mode 100644 samples/listctrl/makefile.dos create mode 100644 samples/listctrl/makefile.g95 create mode 100644 samples/listctrl/makefile.nt create mode 100644 samples/listctrl/makefile.sc create mode 100644 samples/listctrl/makefile.unx create mode 100644 samples/listctrl/makefile.vms create mode 100644 samples/listctrl/makefile.wat create mode 100644 samples/listctrl/mondrian.ico create mode 100644 samples/mdi/bitmaps/abacus.bmp create mode 100644 samples/mdi/bitmaps/aiai.xbm create mode 100644 samples/mdi/bitmaps/bitmap1.bmp create mode 100644 samples/mdi/bitmaps/bitmap2.bmp create mode 100644 samples/mdi/bitmaps/brush.bmp create mode 100644 samples/mdi/bitmaps/calc.bmp create mode 100644 samples/mdi/bitmaps/chart.bmp create mode 100644 samples/mdi/bitmaps/colour.bmp create mode 100644 samples/mdi/bitmaps/copy.bmp create mode 100644 samples/mdi/bitmaps/cut.bmp create mode 100644 samples/mdi/bitmaps/dirplain.xbm create mode 100644 samples/mdi/bitmaps/draft.xbm create mode 100644 samples/mdi/bitmaps/drawing.xbm create mode 100644 samples/mdi/bitmaps/files.bmp create mode 100644 samples/mdi/bitmaps/flowchar.xbm create mode 100644 samples/mdi/bitmaps/help.bmp create mode 100644 samples/mdi/bitmaps/helpcs.bmp create mode 100644 samples/mdi/bitmaps/magnify.bmp create mode 100644 samples/mdi/bitmaps/mike.bmp create mode 100644 samples/mdi/bitmaps/new.bmp create mode 100644 samples/mdi/bitmaps/open.bmp create mode 100644 samples/mdi/bitmaps/page.bmp create mode 100644 samples/mdi/bitmaps/paste.bmp create mode 100644 samples/mdi/bitmaps/preview.bmp create mode 100644 samples/mdi/bitmaps/print.bmp create mode 100644 samples/mdi/bitmaps/save.bmp create mode 100644 samples/mdi/bitmaps/screw.bmp create mode 100644 samples/mdi/bitmaps/shapes.bmp create mode 100644 samples/mdi/bitmaps/speaker.bmp create mode 100644 samples/mdi/bitmaps/telephon.bmp create mode 100644 samples/mdi/bitmaps/therm.bmp create mode 100644 samples/mdi/bitmaps/tick.bmp create mode 100644 samples/mdi/bitmaps/torch.bmp create mode 100644 samples/mdi/bitmaps/wrench.bmp create mode 100644 samples/mdi/bitmaps/write.xbm create mode 100644 samples/memcheck/makefile.b32 create mode 100644 samples/memcheck/makefile.bcc create mode 100644 samples/memcheck/makefile.dos create mode 100644 samples/memcheck/makefile.g95 create mode 100644 samples/memcheck/makefile.nt create mode 100644 samples/memcheck/makefile.unx create mode 100644 samples/memcheck/makefile.wat create mode 100644 samples/memcheck/memcheck.cpp create mode 100644 samples/memcheck/memcheck.def create mode 100644 samples/memcheck/memcheck.rc create mode 100644 samples/memcheck/mondrian.ico create mode 100644 samples/resource/aiai.ico create mode 100644 samples/resource/dialog1.wxr create mode 100644 samples/resource/makefile.b32 create mode 100644 samples/resource/makefile.bcc create mode 100644 samples/resource/makefile.dos create mode 100644 samples/resource/makefile.g95 create mode 100644 samples/resource/makefile.nt create mode 100644 samples/resource/makefile.sc create mode 100644 samples/resource/makefile.unx create mode 100644 samples/resource/makefile.vms create mode 100644 samples/resource/makefile.wat create mode 100644 samples/resource/menu1.wxr create mode 100644 samples/resource/resource.cpp create mode 100644 samples/resource/resource.def create mode 100644 samples/resource/resource.h create mode 100644 samples/resource/resource.rc create mode 100644 samples/treectrl/aiai.ico create mode 100644 samples/treectrl/makefile.b32 create mode 100644 samples/treectrl/makefile.bcc create mode 100644 samples/treectrl/makefile.dos create mode 100644 samples/treectrl/makefile.g95 create mode 100644 samples/treectrl/makefile.nt create mode 100644 samples/treectrl/makefile.sc create mode 100644 samples/treectrl/makefile.unx create mode 100644 samples/treectrl/makefile.vms create mode 100644 samples/treectrl/makefile.wat create mode 100644 samples/treectrl/mondrian.ico create mode 100644 samples/treectrl/treetest.cpp create mode 100644 samples/treectrl/treetest.def create mode 100644 samples/treectrl/treetest.h create mode 100644 samples/treectrl/treetest.rc create mode 100644 samples/validate/aiai.ico create mode 100644 samples/validate/makefile.b32 create mode 100644 samples/validate/makefile.bcc create mode 100644 samples/validate/makefile.dos create mode 100644 samples/validate/makefile.g95 create mode 100644 samples/validate/makefile.nt create mode 100644 samples/validate/makefile.sc create mode 100644 samples/validate/makefile.unx create mode 100644 samples/validate/makefile.vms create mode 100644 samples/validate/makefile.wat create mode 100644 samples/validate/mondrian.ico create mode 100644 samples/validate/validate.cpp create mode 100644 samples/validate/validate.def create mode 100644 samples/validate/validate.h create mode 100644 samples/validate/validate.rc create mode 100644 utils/dialoged/src/aiai.ico create mode 100644 utils/dialoged/src/bitmaps/alignb.bmp create mode 100644 utils/dialoged/src/bitmaps/alignb.xbm create mode 100644 utils/dialoged/src/bitmaps/alignl.bmp create mode 100644 utils/dialoged/src/bitmaps/alignl.xbm create mode 100644 utils/dialoged/src/bitmaps/alignr.bmp create mode 100644 utils/dialoged/src/bitmaps/alignr.xbm create mode 100644 utils/dialoged/src/bitmaps/alignt.bmp create mode 100644 utils/dialoged/src/bitmaps/alignt.xbm create mode 100644 utils/dialoged/src/bitmaps/arrow.bmp create mode 100644 utils/dialoged/src/bitmaps/arrow.xbm create mode 100644 utils/dialoged/src/bitmaps/bmpbuttn.bmp create mode 100644 utils/dialoged/src/bitmaps/bmpbuttn.xbm create mode 100644 utils/dialoged/src/bitmaps/button.bmp create mode 100644 utils/dialoged/src/bitmaps/button.xbm create mode 100644 utils/dialoged/src/bitmaps/canvas.xbm create mode 100644 utils/dialoged/src/bitmaps/check.bmp create mode 100644 utils/dialoged/src/bitmaps/check.xbm create mode 100644 utils/dialoged/src/bitmaps/choice.bmp create mode 100644 utils/dialoged/src/bitmaps/choice.xbm create mode 100644 utils/dialoged/src/bitmaps/copysize.bmp create mode 100644 utils/dialoged/src/bitmaps/copysize.xbm create mode 100644 utils/dialoged/src/bitmaps/cpp.xbm create mode 100644 utils/dialoged/src/bitmaps/cross.bmp create mode 100644 utils/dialoged/src/bitmaps/dialog.bmp create mode 100644 utils/dialoged/src/bitmaps/dialog.xbm create mode 100644 utils/dialoged/src/bitmaps/frame.xbm create mode 100644 utils/dialoged/src/bitmaps/gauge.bmp create mode 100644 utils/dialoged/src/bitmaps/gauge.xbm create mode 100644 utils/dialoged/src/bitmaps/group.bmp create mode 100644 utils/dialoged/src/bitmaps/group.xbm create mode 100644 utils/dialoged/src/bitmaps/help.bmp create mode 100644 utils/dialoged/src/bitmaps/help.xbm create mode 100644 utils/dialoged/src/bitmaps/horiz.bmp create mode 100644 utils/dialoged/src/bitmaps/horiz.xbm create mode 100644 utils/dialoged/src/bitmaps/listbox.bmp create mode 100644 utils/dialoged/src/bitmaps/listbox.xbm create mode 100644 utils/dialoged/src/bitmaps/load.bmp create mode 100644 utils/dialoged/src/bitmaps/load.xbm create mode 100644 utils/dialoged/src/bitmaps/message.bmp create mode 100644 utils/dialoged/src/bitmaps/message.xbm create mode 100644 utils/dialoged/src/bitmaps/mtext.bmp create mode 100644 utils/dialoged/src/bitmaps/mtext.xbm create mode 100644 utils/dialoged/src/bitmaps/new.bmp create mode 100644 utils/dialoged/src/bitmaps/new.xbm create mode 100644 utils/dialoged/src/bitmaps/open.bmp create mode 100644 utils/dialoged/src/bitmaps/panel.xbm create mode 100644 utils/dialoged/src/bitmaps/picture.bmp create mode 100644 utils/dialoged/src/bitmaps/picture.xbm create mode 100644 utils/dialoged/src/bitmaps/radio.bmp create mode 100644 utils/dialoged/src/bitmaps/radio.xbm create mode 100644 utils/dialoged/src/bitmaps/report.xbm create mode 100644 utils/dialoged/src/bitmaps/save.bmp create mode 100644 utils/dialoged/src/bitmaps/save.xbm create mode 100644 utils/dialoged/src/bitmaps/scroll.bmp create mode 100644 utils/dialoged/src/bitmaps/scroll.xbm create mode 100644 utils/dialoged/src/bitmaps/slider.bmp create mode 100644 utils/dialoged/src/bitmaps/slider.xbm create mode 100644 utils/dialoged/src/bitmaps/text.bmp create mode 100644 utils/dialoged/src/bitmaps/text.xbm create mode 100644 utils/dialoged/src/bitmaps/textsw.xbm create mode 100644 utils/dialoged/src/bitmaps/tick.bmp create mode 100644 utils/dialoged/src/bitmaps/toback.bmp create mode 100644 utils/dialoged/src/bitmaps/toback.xbm create mode 100644 utils/dialoged/src/bitmaps/tofront.bmp create mode 100644 utils/dialoged/src/bitmaps/tofront.xbm create mode 100644 utils/dialoged/src/bitmaps/tree.xbm create mode 100644 utils/dialoged/src/bitmaps/treeicn.xbm create mode 100644 utils/dialoged/src/bitmaps/vert.bmp create mode 100644 utils/dialoged/src/bitmaps/vert.xbm create mode 100644 utils/dialoged/src/bitmaps/wxbuild.xbm create mode 100644 utils/dialoged/src/bitmaps/wxwin.xbm create mode 100644 utils/dialoged/src/dialoged.cpp create mode 100644 utils/dialoged/src/dialoged.def create mode 100644 utils/dialoged/src/dialoged.h create mode 100644 utils/dialoged/src/dialoged.ico create mode 100644 utils/dialoged/src/dialoged.rc create mode 100644 utils/dialoged/src/dlghndlr.cpp create mode 100644 utils/dialoged/src/dlghndlr.h create mode 100644 utils/dialoged/src/editrpal.cpp create mode 100644 utils/dialoged/src/editrpal.h create mode 100644 utils/dialoged/src/makefile.b32 create mode 100644 utils/dialoged/src/makefile.bcc create mode 100644 utils/dialoged/src/makefile.dos create mode 100644 utils/dialoged/src/makefile.g95 create mode 100644 utils/dialoged/src/makefile.nt create mode 100644 utils/dialoged/src/makefile.sc create mode 100644 utils/dialoged/src/makefile.unx create mode 100644 utils/dialoged/src/makefile.wat create mode 100644 utils/dialoged/src/reseditr.cpp create mode 100644 utils/dialoged/src/reseditr.h create mode 100644 utils/dialoged/src/reswrite.cpp create mode 100644 utils/dialoged/src/winprop.cpp create mode 100644 utils/dialoged/src/winprop.h create mode 100644 utils/wxprop/src/aiai.ico create mode 100644 utils/wxprop/src/cross.bmp create mode 100644 utils/wxprop/src/makefile.b32 create mode 100644 utils/wxprop/src/makefile.bcc create mode 100644 utils/wxprop/src/makefile.dos create mode 100644 utils/wxprop/src/makefile.g95 create mode 100644 utils/wxprop/src/makefile.nt create mode 100644 utils/wxprop/src/makefile.unx create mode 100644 utils/wxprop/src/makefile.wat create mode 100644 utils/wxprop/src/prop.cpp create mode 100644 utils/wxprop/src/prop.h create mode 100644 utils/wxprop/src/propform.cpp create mode 100644 utils/wxprop/src/propform.h create mode 100644 utils/wxprop/src/proplist.cpp create mode 100644 utils/wxprop/src/proplist.h create mode 100644 utils/wxprop/src/test.cpp create mode 100644 utils/wxprop/src/test.def create mode 100644 utils/wxprop/src/test.h create mode 100644 utils/wxprop/src/test.rc create mode 100644 utils/wxprop/src/tick.bmp diff --git a/distrib/msw/docsrc.rsp b/distrib/msw/docsrc.rsp new file mode 100644 index 0000000000..1c18faefe8 --- /dev/null +++ b/distrib/msw/docsrc.rsp @@ -0,0 +1,85 @@ +docs/latex/wx/*.tex +docs/latex/wx/*.sty +docs/latex/wx/*.bib +docs/latex/wx/*.hpj +docs/latex/wx/*.ini +docs/latex/wx/*.txt +docs/latex/wx/*.cnt +docs/latex/wx/*.eps +docs/latex/wx/*.bmp +docs/latex/wx/*.gif +docs/latex/wx/*.wmf + +docs/latex/porting/*.tex +docs/latex/porting/*.sty +docs/latex/porting/*.bib +docs/latex/porting/*.hpj +docs/latex/porting/*.ini +docs/latex/porting/*.txt +docs/latex/porting/*.cnt +docs/latex/porting/*.eps +docs/latex/porting/*.gif +docs/latex/porting/*.bmp + +utils/wxhelp/docs/*.tex +utils/wxhelp/docs/*.txt +utils/wxhelp/docs/*.hpj +utils/wxhelp/docs/*.ini +utils/wxhelp/docs/*.bmp +utils/wxhelp/docs/*.wmf +utils/wxhelp/docs/*.gif + +utils/tex2rtf/docs/*.tex +utils/tex2rtf/docs/*.txt +utils/tex2rtf/docs/*.hpj +utils/tex2rtf/docs/*.bib +utils/tex2rtf/docs/*.ini +utils/tex2rtf/docs/*.sty +utils/tex2rtf/docs/*.bmp +utils/tex2rtf/docs/*.shg +utils/tex2rtf/docs/*.wmf +utils/tex2rtf/docs/*.gif + +utils/wxtree/docs/*.tex +utils/wxtree/docs/*.ini +utils/wxtree/docs/*.bib +utils/wxtree/docs/*.txt +utils/wxtree/docs/*.hpj +utils/wxtree/docs/*.bmp +utils/wxtree/docs/*.wmf +utils/wxtree/docs/*.gif + +utils/wxgraph/docs/*.tex +utils/wxgraph/docs/*.ini +utils/wxgraph/docs/*.bib +utils/wxgraph/docs/*.txt +utils/wxgraph/docs/*.hpj +utils/wxgraph/docs/*.bmp +utils/wxgraph/docs/*.wmf +utils/wxgraph/docs/*.gif + +utils/mfutils/docs/*.tex +utils/mfutils/docs/*.txt +utils/mfutils/docs/*.hpj +utils/mfutils/docs/*.wmf +utils/mfutils/docs/*.bmp + +utils/wxprop/docs/*.txt +utils/wxprop/docs/*.hpj +utils/wxprop/docs/*.tex +utils/wxprop/docs/*.ini +utils/wxprop/docs/*.eps +utils/wxprop/docs/*.bmp +utils/wxprop/docs/*.wmf +utils/wxprop/docs/*.gif + +utils/dialoged/docs/*.txt +utils/dialoged/docs/*.hpj +utils/dialoged/docs/*.tex +utils/dialoged/docs/*.ini +utils/dialoged/docs/*.eps +utils/dialoged/docs/*.bmp +utils/dialoged/docs/*.wmf +utils/dialoged/docs/*.gif + + diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp new file mode 100644 index 0000000000..170669e78d --- /dev/null +++ b/distrib/msw/generic.rsp @@ -0,0 +1,538 @@ +distrib/*.* + +docs/readme.txt +docs/install.txt +docs/release.txt +docs/changes.txt +docs/upgrade.txt +docs/todo.txt +docs/licence.txt +docs/symbols.txt + +src/common/*.cpp +src/common/dosyacc.c +src/common/doslex.c +src/common/vmsyacc.c +src/common/vmslex.c +src/common/*.l +src/common/*.y +src/common/*.inc + +src/generic/*.cpp +src/generic/*.c +src/generic/*.inc + +src/png/*.c +src/png/*.h +src/png/makefile.* +src/png/INSTALL +src/png/CHANGES +src/png/README +src/png/TODO +src/png/*.1 +src/png/*.3 +src/png/*.5 +src/png/scripts/* + +src/zlib/*.c +src/zlib/*.h +src/zlib/INDEX +src/zlib/README +src/zlib/ChangeLog +src/zlib/configure +src/zlib/*.txt +src/zlib/makefile.* +src/zlib/*.com +src/zlib/*.3 +src/zlib/*.mms + +include/wx/*.h +include/wx/wx_setup.vms +include/wx/common/*.h +include/wx/generic/*.h +lib/dummy + +bin/*.* + +tools/gettext/*.* + +bitmaps/xpm/16x16/*.* +bitmaps/xpm/32x32/*.* +bitmaps/xpm/64x64/*.* +bitmaps/xpm/misc/*.* +bitmaps/*.* +bitmaps/bmp/16x15/*.* +bitmaps/bmp/10x8/*.* +bitmaps/ico/32x32/*.* + +afm/*.* + +utils/*.txt +utils/make*.* + +utils/xpmshow/src/makefile.* +utils/xpmshow/src/*.cpp +utils/xpmshow/src/*.h +utils/xpmshow/src/*.def +utils/xpmshow/src/*.rc +utils/xpmshow/src/*.xpm +utils/xpmshow/src/*.bmp +utils/xpmshow/src/*.ico + +utils/wxhelp/src/*.cpp +utils/wxhelp/src/*.h +utils/wxhelp/src/makefile.* +utils/wxhelp/src/*.xbm +utils/wxhelp/src/*.txt +utils/wxhelp/src/*.ico +utils/wxhelp/src/*.def +utils/wxhelp/src/*.rc + +utils/tex2rtf/src/wxwin/*.* +utils/tex2rtf/src/*.cpp +utils/tex2rtf/src/*.h +utils/tex2rtf/src/make*.* +utils/tex2rtf/src/*.xbm +utils/tex2rtf/src/*.sty +utils/tex2rtf/src/*.ini +utils/tex2rtf/src/*.inf +utils/tex2rtf/lib/dummy +utils/tex2rtf/src/*.bmp +utils/tex2rtf/src/*.ico +utils/tex2rtf/src/*.def +utils/tex2rtf/src/*.rc +utils/tex2rtf/tools/lacheck/*.* +utils/tex2rtf/tools/tcheck/*.awk +utils/tex2rtf/tools/tcheck/*.pl +utils/tex2rtf/tools/tcheck/*.bat + +utils/wxtree/src/*.cpp +utils/wxtree/src/*.h +utils/wxtree/src/makefile.* +utils/wxtree/src/*.xbm +utils/wxtree/lib/dummy +utils/wxtree/src/*.ico +utils/wxtree/src/*.def +utils/wxtree/src/*.rc + +utils/wxgraph/src/*.cpp +utils/wxgraph/src/*.c +utils/wxgraph/src/*.h +utils/wxgraph/src/makefile.* +utils/wxgraph/src/*.xbm +utils/wxgraph/lib/dummy +utils/wxgraph/src/*.ico +utils/wxgraph/src/*.def +utils/wxgraph/src/*.rc + +utils/mfutils/src/*.cpp +utils/mfutils/src/*.h +utils/mfutils/src/*.rc +utils/mfutils/src/*.def +utils/mfutils/src/makefile.* +utils/mfutils/src/*.txt +utils/mfutils/lib/dummy +utils/mfutils/src/*.ico +utils/mfutils/src/*.def +utils/mfutils/src/*.bmp +utils/mfutils/src/*.ico + +utils/rcparser/src/*.cpp +utils/rcparser/src/*.c +utils/rcparser/src/*.h +utils/rcparser/src/makefile.* +utils/rcparser/src/*.xbm +utils/rcparser/lib/dummy +utils/rcparser/src/*.ico +utils/rcparser/src/*.def +utils/rcparser/src/*.rc +utils/rcparser/src/*.rh + +utils/colours/*.h +utils/colours/*.cpp +utils/colours/*.def +utils/colours/*.rc +utils/colours/makefile.* +utils/colours/*.xbm +utils/colours/*.txt + +utils/wxprop/src/*.h +utils/wxprop/src/*.cpp +utils/wxprop/src/*.def +utils/wxprop/src/*.rc +utils/wxprop/src/makefile.* +utils/wxprop/src/*.xbm +utils/wxprop/src/*.txt +utils/wxprop/src/*.ico +utils/wxprop/src/*.bmp +utils/wxprop/lib/dummy + +utils/dialoged/src/bitmaps/*.xbm +utils/dialoged/src/*.h +utils/dialoged/src/*.cpp +utils/dialoged/src/*.def +utils/dialoged/src/*.rc +utils/dialoged/src/makefile.* +utils/dialoged/src/*.xbm +utils/dialoged/src/*.txt +utils/dialoged/src/*.inf +utils/dialoged/test/*.h +utils/dialoged/src/*.ico +utils/dialoged/src/*.prj +utils/dialoged/src/*.bmp +utils/dialoged/src/bitmaps/*.bmp +utils/dialoged/test/*.cpp +utils/dialoged/test/*.def +utils/dialoged/test/*.rc +utils/dialoged/test/makefile.* +utils/dialoged/lib/dummy +utils/dialoged/test/*.ico +utils/dialoged/test/*.prj +utils/dialoged/test/*.bmp + +samples/*.txt +samples/makefile.* + +samples/hello/*.cpp +samples/hello/*.h +samples/hello/*.def +samples/hello/makefile.* +samples/hello/*.xbm +samples/hello/*.txt +samples/hello/*.ico +samples/hello/*.bmp +samples/hello/*.rc +samples/hello/*.wav + +samples/dynamic/*.cpp +samples/dynamic/*.h +samples/dynamic/*.def +samples/dynamic/makefile.* +samples/dynamic/*.xbm +samples/dynamic/*.txt +samples/dynamic/*.ico +samples/dynamic/*.bmp +samples/dynamic/*.rc +samples/dynamic/*.wav + +samples/bombs/*.cpp +samples/bombs/*.h +samples/bombs/*.def +samples/bombs/makefile.* +samples/bombs/*.xbm +samples/bombs/*.txt +samples/bombs/*.ico +samples/bombs/*.bmp +samples/bombs/*.rc + +samples/ipc/*.cpp +samples/ipc/*.h +samples/ipc/*.def +samples/ipc/makefile.* +samples/ipc/*.xbm +samples/ipc/*.ico +samples/ipc/*.rc + +samples/types/*.cpp +samples/types/*.h +samples/types/*.def +samples/types/*.rc +samples/types/*.txt +samples/types/makefile.* +samples/types/*.xbm +samples/types/*.ico + +samples/resource/*.cpp +samples/resource/*.h +samples/resource/*.def +samples/resource/*.rc +samples/resource/*.txt +samples/resource/*.wxr +samples/resource/makefile.* +samples/resource/*.xbm +samples/resource/*.ico + +samples/animate/*.cpp +samples/animate/*.h +samples/animate/*.def +samples/animate/makefile.* +samples/animate/*.xbm +samples/animate/*.ico +samples/animate/*.rc + +samples/mdi/*.cpp +samples/mdi/*.h +samples/mdi/*.def +samples/mdi/makefile.* +samples/mdi/*.xbm +samples/mdi/*.ico +samples/mdi/*.rc +samples/mdi/bitmaps/*.bmp +samples/mdi/bitmaps/*.ico + +samples/minimal/*.cpp +samples/minimal/*.h +samples/minimal/*.def +samples/minimal/makefile.* +samples/minimal/*.xbm +samples/minimal/*.ico +samples/minimal/*.rc + +samples/controls/*.cpp +samples/controls/*.h +samples/controls/*.def +samples/controls/makefile.* +samples/controls/*.xbm +samples/controls/*.ico +samples/controls/*.bmp +samples/controls/*.rc + +samples/fractal/*.cpp +samples/fractal/*.h +samples/fractal/*.def +samples/fractal/makefile.* +samples/fractal/*.xbm +samples/fractal/*.ico +samples/fractal/*.rc + +samples/layout/*.cpp +samples/layout/*.h +samples/layout/*.def +samples/layout/makefile.* +samples/layout/*.xbm +samples/layout/*.ico +samples/layout/*.rc +samples/layout/*.bmp +samples/layout/*.xpm + +samples/printing/*.cpp +samples/printing/*.h +samples/printing/*.def +samples/printing/makefile.* +samples/printing/*.xbm +samples/printing/*.txt +samples/printing/*.ico +samples/printing/*.bmp +samples/printing/*.rc + +samples/tbarsmpl/*.cpp +samples/tbarsmpl/*.h +samples/tbarsmpl/*.def +samples/tbarsmpl/makefile.* +samples/tbarsmpl/*.txt +samples/tbarsmpl/*.xbm +samples/tbarsmpl/bitmaps/*.xbm +samples/tbarsmpl/*.ico +samples/tbarsmpl/*.bmp +samples/tbarsmpl/*.rc +samples/tbarsmpl/bitmaps/*.bmp + +samples/tbar95/*.cpp +samples/tbar95/*.h +samples/tbar95/*.def +samples/tbar95/makefile.* +samples/tbar95/*.txt +samples/tbar95/*.xbm +samples/tbar95/bitmaps/*.xbm +samples/tbar95/*.ico +samples/tbar95/*.bmp +samples/tbar95/*.rc +samples/tbar95/bitmaps/*.bmp + +samples/tbarmsw/*.cpp +samples/tbarmsw/*.h +samples/tbarmsw/*.def +samples/tbarmsw/makefile.* +samples/tbarmsw/*.txt +samples/tbarmsw/*.xbm +samples/tbarmsw/bitmaps/*.xbm +samples/tbarmsw/*.ico +samples/tbarmsw/*.bmp +samples/tbarmsw/*.rc +samples/tbarmsw/bitmaps/*.bmp + +samples/docview/*.h +samples/docview/*.cpp +samples/docview/*.def +samples/docview/*.rc +samples/docview/makefile.* +samples/docview/*.xbm +samples/docview/*.txt +samples/docview/*.ico +samples/docview/*.bmp + +samples/memcheck/*.h +samples/memcheck/*.cpp +samples/memcheck/*.def +samples/memcheck/*.rc +samples/memcheck/makefile.* +samples/memcheck/*.xbm +samples/memcheck/*.txt +samples/memcheck/*.ico +samples/memcheck/*.bmp + +samples/odbc/*.h +samples/odbc/*.cpp +samples/odbc/*.def +samples/odbc/*.rc +samples/odbc/makefile.* +samples/odbc/*.inf +samples/odbc/*.xbm +samples/odbc/*.ico +samples/odbc/*.bmp +samples/odbc/*.dbf +samples/odbc/*.cdx +samples/odbc/odbc32.lib + +samples/dialogs/*.h +samples/dialogs/*.cpp +samples/dialogs/*.def +samples/dialogs/*.rc +samples/dialogs/makefile.* +samples/dialogs/*.xbm +samples/dialogs/*.txt +samples/dialogs/*.bmp +samples/dialogs/*.ico + +samples/wxpoem/*.cpp +samples/wxpoem/*.h +samples/wxpoem/*.def +samples/wxpoem/*.rc +samples/wxpoem/*.inf +samples/wxpoem/*.txt +samples/wxpoem/makefile.* +samples/wxpoem/*.xbm +samples/wxpoem/*.ico +samples/wxpoem/*.bmp +samples/wxpoem/*.dat + +samples/pressup/*.cpp +samples/pressup/*.c +samples/pressup/*.h +samples/pressup/*.def +samples/pressup/*.rc +samples/pressup/*.inf +samples/pressup/*.txt +samples/pressup/makefile.* +samples/pressup/*.xbm +samples/pressup/*.ico +samples/pressup/*.bmp + +samples/validate/*.cpp +samples/validate/*.h +samples/validate/*.def +samples/validate/*.rc +samples/validate/*.inf +samples/validate/*.txt +samples/validate/makefile.* +samples/validate/*.xbm +samples/validate/*.ico +samples/validate/*.bmp + +samples/events/*.cpp +samples/events/*.h +samples/events/*.def +samples/events/*.rc +samples/events/*.inf +samples/events/*.txt +samples/events/makefile.* +samples/events/*.xbm +samples/events/*.ico +samples/events/*.bmp + +samples/treectrl/*.cpp +samples/treectrl/*.h +samples/treectrl/*.def +samples/treectrl/*.rc +samples/treectrl/*.txt +samples/treectrl/makefile.* +samples/treectrl/*.xbm +samples/treectrl/bitmaps/*.xbm +samples/treectrl/*.ico +samples/treectrl/*.bmp +samples/treectrl/bitmaps/*.bmp +samples/treectrl/bitmaps/*.ico + +samples/listctrl/*.cpp +samples/listctrl/*.h +samples/listctrl/*.def +samples/listctrl/*.rc +samples/listctrl/*.txt +samples/listctrl/makefile.* +samples/listctrl/*.xbm +samples/listctrl/bitmaps/*.xbm +samples/listctrl/*.ico +samples/listctrl/*.bmp +samples/listctrl/bitmaps/*.bmp +samples/listctrl/bitmaps/*.ico + +samples/splitter/*.cpp +samples/splitter/*.h +samples/splitter/*.def +samples/splitter/*.rc +samples/splitter/*.txt +samples/splitter/makefile.* +samples/splitter/*.xbm +samples/splitter/*.ico +samples/splitter/*.bmp + +samples/grid/*.cpp +samples/grid/*.h +samples/grid/*.def +samples/grid/*.rc +samples/grid/*.txt +samples/grid/makefile.* +samples/grid/*.xbm +samples/grid/*.ico +samples/grid/*.bmp + +samples/internat/*.cpp +samples/internat/*.h +samples/internat/*.def +samples/internat/*.rc +samples/internat/*.txt +samples/internat/makefile.* +samples/internat/*.xbm +samples/internat/*.po +samples/internat/*.ico +samples/internat/*.bmp +samples/internat/*.mo + +samples/checklst/*.cpp +samples/checklst/*.h +samples/checklst/*.def +samples/checklst/*.rc +samples/checklst/*.txt +samples/checklst/makefile.* +samples/checklst/*.xbm +samples/checklst/*.ico +samples/checklst/*.bmp + +samples/dnd/*.cpp +samples/dnd/*.h +samples/dnd/makefile.* +samples/dnd/*.rc +samples/dnd/*.def +samples/dnd/*.bmp +samples/dnd/*.ico +samples/dnd/*.txt + +samples/tab/*.cpp +samples/tab/*.h +samples/tab/makefile.* +samples/tab/*.rc +samples/tab/*.def +samples/tab/*.bmp +samples/tab/*.ico +samples/tab/*.txt + +samples/png/*.cpp +samples/png/*.h +samples/png/makefile.* +samples/png/*.rc +samples/png/*.def +samples/png/*.bmp +samples/png/*.ico +samples/png/*.txt +samples/png/*.png + diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp new file mode 100644 index 0000000000..436d000b55 --- /dev/null +++ b/distrib/msw/msw.rsp @@ -0,0 +1,128 @@ +docs/msw/*.txt + +src/makeb32.env +src/makebcc.env +src/makemsw.env +src/makewat.env +src/makesc.env +src/makeg95.env +src/makem95.env +src/ntwxwin.mak +src/makefile.bcc +src/makefile.dos +src/makefile.nt +src/*.bat + +src/common/dosyacc.c +src/common/doslex.c + +src/msw/*.cpp +src/msw/*.h +src/msw/makefile.* +src/msw/*.lst +src/msw/*.def + +src/msw/ctl3d/*.* +src/msw/ctl3d/msvc/*.* +src/msw/ctl3d/wat32/*.* +src/msw/ctl3d/wat386/*.* +src/msw/ctl3d/borland/*.* +src/msw/ole/*.cpp +src/msw/*.prj + +include/wx/msw/*.h +include/wx/msw/*.rc +include/wx/msw/ctl3d/*.h +include/wx/msw/gnuwin32/*.h +include/wx/msw/ole/*.h +include/wx/msw/*.cur +include/wx/msw/*.ico +include/wx/msw/*.bmp + +lib/dummy + +samples/ownerdrw/*.cpp +samples/ownerdrw/*.h +samples/ownerdrw/makefile.* +samples/ownerdrw/*.rc +samples/ownerdrw/*.def +samples/ownerdrw/*.bmp +samples/ownerdrw/*.ico +samples/ownerdrw/*.txt + +samples/taskbar/*.cpp +samples/taskbar/*.h +samples/taskbar/makefile.* +samples/taskbar/*.rc +samples/taskbar/*.def +samples/taskbar/*.bmp +samples/taskbar/*.ico +samples/taskbar/*.txt + +samples/regtest/*.cpp +samples/regtest/*.h +samples/regtest/makefile.* +samples/regtest/*.rc +samples/regtest/*.def +samples/regtest/*.bmp +samples/regtest/*.ico +samples/regtest/*.txt + +samples/nativdlg/*.cpp +samples/nativdlg/*.h +samples/nativdlg/*.def +samples/nativdlg/*.rc +samples/nativdlg/*.txt +samples/nativdlg/makefile.* +samples/nativdlg/*.xbm +samples/nativdlg/*.ico +samples/nativdlg/*.bmp + +samples/mfc/*.h +samples/mfc/*.cpp +samples/mfc/*.def +samples/mfc/*.rc +samples/mfc/makefile.* +samples/mfc/*.txt +samples/mfc/*.bmp +samples/mfc/*.ico + +samples/joytest/*.h +samples/joytest/*.cpp +samples/joytest/*.def +samples/joytest/*.rc +samples/joytest/makefile.* +samples/joytest/*.txt +samples/joytest/*.bmp +samples/joytest/*.wav +samples/joytest/*.ico + +utils/nplugin/make*.* +utils/nplugin/src/*.cpp +utils/nplugin/src/*.h +utils/nplugin/src/*.rc +utils/nplugin/src/*.def +utils/nplugin/src/makefile.* +utils/nplugin/src/*.txt +utils/nplugin/samples/simple/*.cpp +utils/nplugin/samples/simple/*.h +utils/nplugin/samples/simple/*.rc +utils/nplugin/samples/simple/*.def +utils/nplugin/samples/simple/makefile.* +utils/nplugin/samples/simple/*.txt +utils/nplugin/samples/gui/*.cpp +utils/nplugin/samples/gui/*.h +utils/nplugin/samples/gui/*.rc +utils/nplugin/samples/gui/*.def +utils/nplugin/samples/gui/makefile.* +utils/nplugin/samples/gui/*.txt +utils/nplugin/docs/*.tex +utils/nplugin/docs/*.txt +utils/nplugin/docs/*.hpj +utils/nplugin/docs/*.eps +utils/nplugin/docs/*.ps +utils/nplugin/docs/*.ini +utils/nplugin/docs/*.cnt +utils/nplugin/docs/*.hlp +utils/nplugin/lib/dummy + diff --git a/distrib/msw/tardist.bat b/distrib/msw/tardist.bat new file mode 100755 index 0000000000..91ce1fdf16 --- /dev/null +++ b/distrib/msw/tardist.bat @@ -0,0 +1,117 @@ +@echo off +rem Tar up an external distribution of wxWindows 2.0: but +rem putting in separate ASCII and binary files +rem This seems to be the one that works, using +rem separate tar programs for conversion/non-conversion +rem of ASCII/binary files. + +if "%1" == "" goto usage +if "%2" == "" goto usage +echo About to archive an external wxWindows 2.0 distribution: +echo From %1 +echo To %2\wx200_1.tgz, %2\wx200_2.tgz, %2\wx200hlp.tgz, %2\wx200ps.tgz, %2\wx200htm.tgz +echo CTRL-C if this is not correct. +inkey /W4 `Press any key to continue...` %%input + +erase %2\*.tgz +cd %1 + +rem First, expand the wildcards in the rsp files + +rem Create empty list file +erase %1\distrib\*.lis +c:\bin\touch %1\distrib\wx200asc.lis +c:\bin\touch %1\distrib\wx200bin.lis +c:\bin\touch %1\distrib\wx200hlp.lis +c:\bin\touch %1\distrib\wx200ps.lis +c:\bin\touch %1\distrib\wx200xlp.lis + +rem Create a .rsp file with backslashes instead +rem of forward slashes +rem No need if using ls2 (from UNIX95 distribution) +rem sed -e "s/\//\\/g" %1\distrib\wx_asc.rsp > %1\distrib\wx_asc.rs2 + +call %1\distrib\expdwild.bat %1\distrib\wx_asc.rsp %1\distrib\wx200asc.lis +call %1\distrib\expdwild.bat %1\distrib\util_asc.rsp %1\distrib\wx200asc.lis +call %1\distrib\expdwild.bat %1\distrib\smpl_asc.rsp %1\distrib\wx200asc.lis +rem call %1\distrib\expdwild.bat %1\distrib\wxim1asc.rsp %1\distrib\wx200asc.lis +rem call %1\distrib\expdwild.bat %1\distrib\wxim2asc.rsp %1\distrib\wx200asc.lis + +call %1\distrib\expdwild.bat %1\distrib\wx_bin.rsp %1\distrib\wx200bin.lis +call %1\distrib\expdwild.bat %1\distrib\util_bin.rsp %1\distrib\wx200bin.lis +call %1\distrib\expdwild.bat %1\distrib\smpl_bin.rsp %1\distrib\wx200bin.lis +rem call %1\distrib\expdwild.bat %1\distrib\wxim1bin.rsp %1\distrib\wx200bin.lis + +rem Docs +call %1\distrib\expdwild.bat %1\distrib\wx_hlp.rsp %1\distrib\wx200hlp.lis +call %1\distrib\expdwild.bat %1\distrib\wx_ps.rsp %1\distrib\wx200ps.lis +call %1\distrib\expdwild.bat %1\distrib\wx_html.rsp %1\distrib\wx200htm.lis +call %1\distrib\expdwild.bat %1\distrib\wx_pdf.rsp %1\distrib\wx200pdf.lis + +rem Do some further massaging of the .lis files +sed -e "s/\\/\//g" %1\distrib\wx200asc.lis > c:\temp\temp.tmp +sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200asc.lis + +sed -e "s/\\/\//g" %1\distrib\wx200bin.lis > c:\temp\temp.tmp +sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200bin.lis + +sed -e "s/\\/\//g" %1\distrib\wx200hlp.lis > c:\temp\temp.tmp +sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200hlp.lis + +sed -e "s/\\/\//g" %1\distrib\wx200ps.lis > c:\temp\temp.tmp +sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200ps.lis + +sed -e "s/\\/\//g" %1\distrib\wx200htm.lis > c:\temp\temp.tmp +sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200htm.lis + +sed -e "s/\\/\//g" %1\distrib\wx200pdf.lis > c:\temp\temp.tmp +sed -e "s/D:\/wx\///g" c:\temp\temp.tmp > %1\distrib\wx200pdf.lis + +rem 'tar' converts linefeeds. +tar -c -T %1\distrib\wx200asc.lis -f %2\wx200.tar +rem pause Press a key to continue. + +rem This converts to lower case +ren %2\wx200.tar %2\wx200_1.tar +gzip32 %2\wx200_1.tar +ren %2\wx200_1.tar.gz %2\wx200_1.tgz + +rem No linefeed conversion wanted +rem Note: GNU tar seems to crash with a full destination path, so +rem pander to it. +targnu -c -T %1\distrib\wx200bin.lis -f wx200_2.tar +move wx200_2.tar %2 +gzip32 %2\wx200_2.tar +ren %2\wx200_2.tar.gz %2\wx200_2.tgz + +targnu -c -T %1\distrib\wx200hlp.lis -f wx200_hlp.tar +move wx200_hlp.tar %2 +gzip32 %2\wx200_hlp.tar +ren %2\wx200_hlp.tar.gz %2\wx200hlp.tgz + +tar -c -T %1\distrib\wx200ps.lis -f %2\wx200ps.tar +gzip32 %2\wx200ps.tar +ren %2\wx200ps.tar.gz %2\wx200ps.tgz + +targnu -c -T %1\distrib\wx200htm.lis -f wx200htm.tar +move wx200htm.tar %2 +gzip32 %2\wx200htm.tar +ren %2\wx200htm.tar.gz %2\wx200htm.tgz + +targnu -c -T %1\distrib\wx200pdf.lis -f wx200pdf.tar +move wx200pdf.tar %2 +gzip32 %2\wx200pdf.tar +ren %2\wx200pdf.tar.gz %2\wx200pdf.tgz + +cd %2 +echo wxWindows archived. +goto end + +:usage +echo Tar/gzip wxWindows distribution under DOS, making an ASCII and binary file +echo Usage: tardist source destination +echo e.g. tardist d:\wx d:\wx\deliver + +:end + + diff --git a/distrib/msw/wx_hlp.rsp b/distrib/msw/wx_hlp.rsp new file mode 100644 index 0000000000..1a72b4735b --- /dev/null +++ b/distrib/msw/wx_hlp.rsp @@ -0,0 +1,2 @@ +docs/winhelp/*.hlp +docs/winhelp/*.cnt diff --git a/distrib/msw/wx_html.rsp b/distrib/msw/wx_html.rsp new file mode 100644 index 0000000000..8324d3a231 --- /dev/null +++ b/distrib/msw/wx_html.rsp @@ -0,0 +1,38 @@ +docs/html/*.htm +docs/html/*.gif + +docs/html/wx/*.htm +docs/html/wx/*.gif +docs/html/porting/*.htm +docs/html/porting/*.gif +docs/html/faq/*.htm +docs/html/faq/*.gif +docs/html/techref/*.htm +docs/html/techref/*.gif +docs/html/prologio/*.htm +docs/html/prologio/*.gif +docs/html/dialoged/*.htm +docs/html/dialoged/*.gif +docs/html/wxbuild/*.htm +docs/html/wxbuild/*.gif +docs/html/wxtab/*.htm +docs/html/wxtab/*.gif +docs/html/wxchart/*.htm +docs/html/wxchart/*.gif +docs/html/wxtree/*.htm +docs/html/wxtree/*.gif +docs/html/wxgraph/*.htm +docs/html/wxgraph/*.gif +docs/html/wxgrid/*.htm +docs/html/wxgrid/*.gif +docs/html/wxhelp/*.htm +docs/html/wxhelp/*.gif +docs/html/wxhelp2/*.htm +docs/html/wxhelp2/*.gif +docs/html/wxprop/*.htm +docs/html/wxprop/*.gif +docs/html/winstall/*.htm +docs/html/winstall/*.gif +docs/html/tex2rtf/*.htm +docs/html/tex2rtf/*.gif + diff --git a/distrib/msw/wx_pdf.rsp b/distrib/msw/wx_pdf.rsp new file mode 100644 index 0000000000..6a979c3678 --- /dev/null +++ b/distrib/msw/wx_pdf.rsp @@ -0,0 +1 @@ +docs/pdf/*.pdf diff --git a/distrib/msw/zipdist.bat b/distrib/msw/zipdist.bat new file mode 100755 index 0000000000..ffdb4253e7 --- /dev/null +++ b/distrib/msw/zipdist.bat @@ -0,0 +1,34 @@ +@echo off +rem Zip up an external, generic + Windows distribution of wxWindows 2.0 +if "%1" == "" goto usage +if "%2" == "" goto usage +echo About to archive an external wxWindows distribution: +echo From %1 +echo To %2\wx200gen.zip, %2\wx200doc.zip, %2\wx200msw.zip, %2\wx200ps.zip, %2\wx200hlp.zip, %2\wx200htm.zip, %2\wx200pdf.zip +echo CTRL-C if this is not correct. +pause + +erase %2\wx200*.zip + +cd %1 +echo Zipping... +zip32 -@ %2\wx200gen.zip < %1\distrib\generic.rsp +zip32 -@ %2\wx200msw.zip < %1\distrib\msw.rsp +zip32 -@ %2\wx200doc.zip < %1\distrib\docsrc.rsp + +rem zip32 -@ %2\wx200ps.zip < %1\distrib\wx_ps.rsp +zip32 -@ %2\wx200hlp.zip < %1\distrib\wx_hlp.rsp +zip32 -@ %2\wx200htm.zip < %1\distrib\wx_html.rsp +zip32 -@ %2\wx200pdf.zip < %1\distrib\wx_pdf.rsp + +cd %2 + +echo wxWindows archived. +goto end + +:usage +echo DOS wxWindows distribution. +echo Usage: zipdistgeneric source destination +echo e.g. zipdistgeneric c:\wx b: + +:end diff --git a/samples/checklst/bell.bmp b/samples/checklst/bell.bmp new file mode 100644 index 0000000000000000000000000000000000000000..279b827162f2b745c005fc802938a84f0ce5890a GIT binary patch literal 370 zcmb7*HZ}&$B zw=fcw0f;p=!k7u@ps`;V%cT)}F?J!_0&p#!2&% vld<$VEqU&p<3Ns5`Nf_+KG?%$w#sLQx8`|ei8_4vBY&s8ZsYZro@o37zjK0f literal 0 HcmV?d00001 diff --git a/samples/checklst/checklst.cpp b/samples/checklst/checklst.cpp new file mode 100644 index 0000000000..a44be861b1 --- /dev/null +++ b/samples/checklst/checklst.cpp @@ -0,0 +1,185 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: checklst.cpp +// Purpose: wxCheckListBox sample +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.11.97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// headers & declarations +// ============================================================================ + +// 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 + +#include "wx/ownerdrw.h" +#include "wx/menuitem.h" +#include "wx/msw/checklst.h" + +// Define a new application type +class CheckListBoxApp: public wxApp +{ +public: + bool OnInit(); +}; + +// Define a new frame type +class CheckListBoxFrame : public wxFrame +{ +public: + // ctor & dtor + CheckListBoxFrame(wxFrame *frame, char *title, int x, int y, int w, int h); + ~CheckListBoxFrame(); + + // notifications + void OnQuit (wxCommandEvent& event); + void OnAbout (wxCommandEvent& event); + void OnListboxSelect (wxCommandEvent& event); + void OnCheckboxToggle (wxCommandEvent& event); + void OnListboxDblClick (wxCommandEvent& event); + bool OnClose () { return TRUE; } + + DECLARE_EVENT_TABLE() + +private: + wxCheckListBox *m_pListBox; +}; + +enum +{ + Menu_Quit = 1, + Control_First = 1000, + Control_Listbox, Control_Listbox2, +}; + +BEGIN_EVENT_TABLE(CheckListBoxFrame, wxFrame) + EVT_MENU(Menu_Quit, CheckListBoxFrame::OnQuit) + EVT_LISTBOX(Control_Listbox, CheckListBoxFrame::OnListboxSelect) + EVT_CHECKLISTBOX(Control_Listbox, CheckListBoxFrame::OnCheckboxToggle) + EVT_COMMAND(Control_Listbox, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, + CheckListBoxFrame::OnListboxDblClick) +END_EVENT_TABLE() + +IMPLEMENT_APP(CheckListBoxApp); + +// init our app: create windows +bool CheckListBoxApp::OnInit(void) +{ + CheckListBoxFrame *pFrame = new CheckListBoxFrame(NULL, "wxWindows Ownerdraw Sample", + 50, 50, 450, 320); + SetTopWindow(pFrame); + + return TRUE; +} + +// main frame constructor +CheckListBoxFrame::CheckListBoxFrame(wxFrame *frame, char *title, int x, int y, int w, int h) + : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) +{ + // set the icon + SetIcon(wxIcon("mondrian")); + + // Make a menubar + wxMenu *file_menu = new wxMenu; + + // construct submenu + file_menu->Append(Menu_Quit, "E&xit"); + + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + SetMenuBar(menu_bar); + + // make a panel with some controls + wxPanel *pPanel = new wxPanel(this, -1, wxPoint(0, 0), + wxSize(400, 200), wxTAB_TRAVERSAL); + + // check list box + static const char* aszChoices[] = { "Hello", "world", "and", + "goodbye", "cruel", "world", + "-------", "owner-drawn", "listbox" }; + + wxString *astrChoices = new wxString[WXSIZEOF(aszChoices)]; + uint ui; + for ( ui = 0; ui < WXSIZEOF(aszChoices); ui++ ) + astrChoices[ui] = aszChoices[ui]; + + m_pListBox = new wxCheckListBox + ( + pPanel, // parent + Control_Listbox, // control id + wxPoint(10, 10), // listbox poistion + wxSize(400, 200), // listbox size + WXSIZEOF(aszChoices), // number of strings + astrChoices // array of strings + ); + + delete [] astrChoices; + + for ( ui = 0; ui < WXSIZEOF(aszChoices); ui += 2 ) { + m_pListBox->GetItem(ui)->SetBackColor(wxColor(200, 200, 200)); + } + + m_pListBox->Check(2); + + // create the status line + const int widths[] = { -1, 60 }; + CreateStatusBar(2); + SetStatusWidths(2, widths); + SetStatusText("no selection", 0); + + Show(TRUE); +} + +CheckListBoxFrame::~CheckListBoxFrame() +{ +} + +void CheckListBoxFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void CheckListBoxFrame::OnAbout(wxCommandEvent& event) +{ + wxMessageDialog dialog(this, "Demo of wxCheckListBox control\n" + "About wxCheckListBox", wxYES_NO | wxCANCEL); + dialog.ShowModal(); +} + +void CheckListBoxFrame::OnListboxSelect(wxCommandEvent& event) +{ + wxString strSelection; + uint nSel = event.GetSelection(); + strSelection.sprintf("item %d selected (%schecked)", nSel, + m_pListBox->IsChecked(nSel) ? "" : "not "); + SetStatusText(strSelection); +} + +void CheckListBoxFrame::OnListboxDblClick(wxCommandEvent& event) +{ + wxString strSelection; + strSelection.sprintf("item %d double clicked", m_pListBox->GetSelection()); + wxMessageDialog dialog(this, strSelection); + dialog.ShowModal(); +} + +void CheckListBoxFrame::OnCheckboxToggle(wxCommandEvent& event) +{ + wxString strSelection; + uint nItem = event.GetInt(); + strSelection.sprintf("item %d was %schecked", nItem, + m_pListBox->IsChecked(nItem) ? "" : "un"); + SetStatusText(strSelection); +} \ No newline at end of file diff --git a/samples/checklst/checklst.def b/samples/checklst/checklst.def new file mode 100644 index 0000000000..57c46fbcb1 --- /dev/null +++ b/samples/checklst/checklst.def @@ -0,0 +1,8 @@ +NAME CHECKLST +DESCRIPTION 'wxCheckListBox sample' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 4048 +STACKSIZE 16000 diff --git a/samples/checklst/checklst.rc b/samples/checklst/checklst.rc new file mode 100644 index 0000000000..bbc00bdf4b --- /dev/null +++ b/samples/checklst/checklst.rc @@ -0,0 +1,6 @@ +mondrian ICON "mondrian.ico" +bell BITMAP "bell.bmp" +sound BITMAP "sound.bmp" +nosound BITMAP "nosound.bmp" +#include "wx/msw/wx.rc" + diff --git a/samples/checklst/makefile.b32 b/samples/checklst/makefile.b32 new file mode 100644 index 0000000000..59adb52171 --- /dev/null +++ b/samples/checklst/makefile.b32 @@ -0,0 +1,64 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds checklst example (DOS). + +# WXWIN and BCCDIR are set by parent make + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +WXLIBDIR = $(WXDIR)\lib +WXINC = $(WXDIR)\include\msw +WXLIB = $(WXLIBDIR)\wx32.lib +LIBS=$(WXLIB) cw32 import32 + +TARGET=checklst + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = checklst.obj + +$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) +$(TARGET).def +! + brc32 -K $(TARGET).res + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +checklst.obj: checklst.$(SRCSUFF) + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + diff --git a/samples/checklst/makefile.dos b/samples/checklst/makefile.dos new file mode 100644 index 0000000000..c33ea5e450 --- /dev/null +++ b/samples/checklst/makefile.dos @@ -0,0 +1,65 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds checklst example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\samples\checklst + +!ifndef FINAL +FINAL=0 +!endif + +HEADERS = +SOURCES = checklst.$(SRCSUFF) +OBJECTS = checklst.obj + +all: checklst.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + +checklst.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) checklst.obj checklst.def checklst.res + link $(LINKFLAGS) @<< +checklst.obj $(WXDIR)\src\msw\dummy.obj, +checklst, +NUL, +$(LIBS), +checklst.def +; +<< + rc -K checklst.res + +checklst.obj: checklst.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +checklst.res : checklst.rc $(WXDIR)\include\wx\msw\wx.rc + rc -r /i$(WXDIR)\include checklst + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/checklst/makefile.g95 b/samples/checklst/makefile.g95 new file mode 100644 index 0000000000..3fb8e70772 --- /dev/null +++ b/samples/checklst/makefile.g95 @@ -0,0 +1,37 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for checklst example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/makeg95.env + +OBJECTS = $(OBJDIR)/checklst.$(OBJSUFF) $(OBJDIR)/checklst_resources.$(OBJSUFF) + +all: $(OBJDIR) checklst$(GUISUFFIX)$(EXESUFF) + +wx: + +$(OBJDIR): + mkdir $(OBJDIR) + +checklst$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o checklst$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS) + +$(OBJDIR)/checklst.$(OBJSUFF): checklst.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ checklst.$(SRCSUFF) + +$(OBJDIR)/checklst_resources.o: checklst.rc + $(RESCOMP) -i checklst.rc -o $(OBJDIR)/checklst_resources.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) checklst$(GUISUFFIX).exe core *.rsc *.res diff --git a/samples/checklst/makefile.nt b/samples/checklst/makefile.nt new file mode 100644 index 0000000000..44c4478783 --- /dev/null +++ b/samples/checklst/makefile.nt @@ -0,0 +1,64 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds checklst example (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +WXUSINGDLL=0 + +!include $(WXDIR)\src\ntwxwin.mak + +THISDIR = $(WXDIR)\samples\checklst +PROGRAM=checklst + +OBJECTS = $(PROGRAM).obj + +$(PROGRAM): $(PROGRAM).exe + +all: wx $(PROGRAM).exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res +$(LIBS) +<< + + +$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/checklst/mondrian.ico b/samples/checklst/mondrian.ico new file mode 100644 index 0000000000000000000000000000000000000000..2310c5d275a87af295d5ea8dc79ea417a5e74c53 GIT binary patch literal 766 zcmZQzU<5)11px*Sc)`TLAO@s0fLH;D9e|jTfdxnc0Zq|zPkz&Y5tOT>ViEgNe#Und7c3jaG4fmA29pB?wt*V}zU*n{yx zKhe+h2?s{t6>%>VfET5V#7IPIjad&pE_xTydDLRCui=mL)_3-O6xqmmjX@V%1&+p1 z@j_)yir0!H1u@@~GXa#7@&T5DG I*kKgF8+G_}MF0Q* literal 0 HcmV?d00001 diff --git a/samples/checklst/sound.bmp b/samples/checklst/sound.bmp new file mode 100644 index 0000000000000000000000000000000000000000..26f5f1883e29c465f0243ccff4ba2766b980229e GIT binary patch literal 370 zcma)#K@I{T5CogVWPO1C!FTN4zYq`Vk(=M*VVkfu;|Q8;vI5gn44r1a-jaOX(F=8= z&Q#I?l@`}6DH2Deyc-It)=IaB=0~j=QEVF_kG}LLKf`E^u%iV8dx9~Z{F&2#nOj6; Xd)eh_c=Y<>_}B8WjGS#|+C9N5tAudn literal 0 HcmV?d00001 diff --git a/samples/dialogs/aiai.ico b/samples/dialogs/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3db6563cc0b9f4588e1e994fe54b90a3cb1d6c1 GIT binary patch literal 766 zcmc(bJ930T3`Bcft}@v=+L+MC@X_W5#I6lE$3$=(hlEfB4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8= +#include +#include +#include +#include + +#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW +#include +#include +#endif + +#include "dialogs.h" + +IMPLEMENT_APP(MyApp) + +MyCanvas *myCanvas = NULL; + +// A macro needed for some compilers (AIX) that need 'main' to be defined +// in the application itself. +IMPLEMENT_WXWIN_MAIN + +// `Main program' equivalent, creating windows and returning main app frame +bool MyApp::OnInit(void) +{ + m_canvasTextColour = wxColour("BLACK"); + m_canvasFont = *wxNORMAL_FONT; + + // Create the main frame window + MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300)); + + // Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(DIALOGS_CHOOSE_COLOUR, "&Choose colour"); + +#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW + file_menu->Append(DIALOGS_CHOOSE_COLOUR_GENERIC, "Choose colour (&generic)"); +#endif + + file_menu->AppendSeparator(); + file_menu->Append(DIALOGS_CHOOSE_FONT, "Choose &font"); + +#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW + file_menu->Append(DIALOGS_CHOOSE_FONT_GENERIC, "Choose f&ont (generic)"); + +#endif + file_menu->AppendSeparator(); + file_menu->Append(DIALOGS_MESSAGE_BOX, "&Message box"); + file_menu->Append(DIALOGS_TEXT_ENTRY, "Text &entry"); + file_menu->Append(DIALOGS_SINGLE_CHOICE, "&Single choice"); + file_menu->AppendSeparator(); + file_menu->Append(DIALOGS_FILE_OPEN, "&Open file"); + file_menu->Append(DIALOGS_FILE_SAVE, "Sa&ve file"); + file_menu->Append(DIALOGS_DIR_CHOOSE, "&Choose a directory"); + file_menu->AppendSeparator(); + file_menu->Append(wxID_EXIT, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + frame->SetMenuBar(menu_bar); + + myCanvas = new MyCanvas(frame); + myCanvas->SetBackgroundColour(*wxWHITE); + + frame->Centre(wxBOTH); + + // Show the frame + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +// My frame constructor +MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size): + wxFrame(parent, -1, title, pos, size) +{} + +void MyFrame::ChooseColour(wxCommandEvent& event) +{ + wxColourData data; + data.SetChooseFull(TRUE); + for (int i = 0; i < 16; i++) + { + wxColour colour(i*16, i*16, i*16); + data.SetCustomColour(i, colour); + } + + wxColourDialog *dialog = new wxColourDialog(this, &data); + if (dialog->ShowModal() == wxID_OK) + { + wxColourData retData = dialog->GetColourData(); + wxColour col = retData.GetColour(); +// wxBrush *brush = wxTheBrushList->FindOrCreateBrush(&col, wxSOLID); + myCanvas->SetBackgroundColour(col); + myCanvas->Clear(); + myCanvas->Refresh(); + } + dialog->Close(); +} + +void MyFrame::ChooseFont(wxCommandEvent& event) +{ + wxFontData data; + data.SetInitialFont(wxGetApp().m_canvasFont); + data.SetColour(wxGetApp().m_canvasTextColour); + + wxFontDialog *dialog = new wxFontDialog(this, &data); + if (dialog->ShowModal() == wxID_OK) + { + wxFontData retData = dialog->GetFontData(); + wxGetApp().m_canvasFont = retData.GetChosenFont(); + wxGetApp().m_canvasTextColour = retData.GetColour(); + myCanvas->Refresh(); + } + dialog->Close(); +} + +#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW +void MyFrame::ChooseColourGeneric(wxCommandEvent& event) +{ + wxColourData data; + data.SetChooseFull(TRUE); + for (int i = 0; i < 16; i++) + { + wxColour colour(i*16, i*16, i*16); + data.SetCustomColour(i, colour); + } + + wxGenericColourDialog *dialog = new wxGenericColourDialog(this, &data); + if (dialog->ShowModal() == wxID_OK) + { + wxColourData retData = dialog->GetColourData(); + wxColour col = retData.GetColour(); +// wxBrush *brush = wxTheBrushList->FindOrCreateBrush(&col, wxSOLID); + myCanvas->SetBackgroundColour(col); + myCanvas->Clear(); + myCanvas->Refresh(); + } + dialog->Close(); +} + +void MyFrame::ChooseFontGeneric(wxCommandEvent& event) +{ + wxFontData data; + data.SetInitialFont(wxGetApp().m_canvasFont); + data.SetColour(wxGetApp().m_canvasTextColour); + + wxGenericFontDialog *dialog = new wxGenericFontDialog(this, &data); + if (dialog->ShowModal() == wxID_OK) + { + wxFontData retData = dialog->GetFontData(); + wxGetApp().m_canvasFont = retData.GetChosenFont(); + wxGetApp().m_canvasTextColour = retData.GetColour(); + myCanvas->Refresh(); + } + dialog->Close(); +} +#endif + +void MyFrame::MessageBox(wxCommandEvent& event) +{ + wxMessageDialog dialog(this, "This is a message box\nA long, long string to test out the message box properly", + "Message box text", wxYES_NO|wxCANCEL); + + dialog.ShowModal(); +} + +void MyFrame::TextEntry(wxCommandEvent& event) +{ + wxTextEntryDialog dialog(this, "This is a small sample\nA long, long string to test out the text entrybox", + "Please enter a string", "Default value", wxOK|wxCANCEL); + + if (dialog.ShowModal() == wxID_OK) + { + wxMessageDialog dialog2(this, dialog.GetValue(), "Got string"); + dialog2.ShowModal(); + } +} + +void MyFrame::SingleChoice(wxCommandEvent& event) +{ + const wxString choices[] = { "One", "Two", "Three", "Four", "Five" } ; + int n = 5; + + wxSingleChoiceDialog dialog(this, "This is a small sample\nA single-choice convenience dialog", + "Please select a value", n, (const wxString *)choices); + + if (dialog.ShowModal() == wxID_OK) + { + wxMessageDialog dialog2(this, dialog.GetStringSelection(), "Got string"); + dialog2.ShowModal(); + } +} + +void MyFrame::FileOpen(wxCommandEvent& event) +{ + wxFileDialog dialog(this, "Testing open file dialog", "", "", "*.txt", 0); + + if (dialog.ShowModal() == wxID_OK) + { + wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path"); + dialog2.ShowModal(); + } +} + +void MyFrame::FileSave(wxCommandEvent& event) +{ + wxFileDialog dialog(this, "Testing save file dialog", "", "", + "Text files (*.txt)|*.txt|Document files (*.doc)|*.doc", + wxSAVE|wxOVERWRITE_PROMPT); + + if (dialog.ShowModal() == wxID_OK) + { + char buf[400]; + sprintf(buf, "%s, filter %d", (const char *)dialog.GetPath(), dialog.GetFilterIndex()); + wxMessageDialog dialog2(this, wxString(buf), "Selected path"); + dialog2.ShowModal(); + } +} + +void MyFrame::DirChoose(wxCommandEvent& event) +{ + wxDirDialog dialog(this, "Testing directory picker", ""); + + if (dialog.ShowModal() == wxID_OK) + { + wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path"); + dialog2.ShowModal(); + } +} + +void MyFrame::OnExit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyCanvas::OnPaint(wxPaintEvent& event) +{ + wxPaintDC dc(this); + dc.SetFont(wxGetApp().m_canvasFont); + dc.SetTextForeground(wxGetApp().m_canvasTextColour); + dc.SetBackgroundMode(wxTRANSPARENT); + dc.DrawText("wxWindows common dialogs test application", 10, 10); +} + +BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) + EVT_PAINT(MyCanvas::OnPaint) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(DIALOGS_CHOOSE_COLOUR, MyFrame::ChooseColour) + EVT_MENU(DIALOGS_CHOOSE_FONT, MyFrame::ChooseFont) + EVT_MENU(DIALOGS_MESSAGE_BOX, MyFrame::MessageBox) + EVT_MENU(DIALOGS_TEXT_ENTRY, MyFrame::TextEntry) + EVT_MENU(DIALOGS_SINGLE_CHOICE, MyFrame::SingleChoice) + EVT_MENU(DIALOGS_FILE_OPEN, MyFrame::FileOpen) + EVT_MENU(DIALOGS_FILE_SAVE, MyFrame::FileSave) + EVT_MENU(DIALOGS_DIR_CHOOSE, MyFrame::DirChoose) +#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW + EVT_MENU(DIALOGS_CHOOSE_COLOUR_GENERIC, MyFrame::ChooseColourGeneric) + EVT_MENU(DIALOGS_CHOOSE_FONT_GENERIC, MyFrame::ChooseFontGeneric) +#endif + EVT_MENU(wxID_EXIT, MyFrame::OnExit) +END_EVENT_TABLE() + diff --git a/samples/dialogs/dialogs.def b/samples/dialogs/dialogs.def new file mode 100644 index 0000000000..cb06200c15 --- /dev/null +++ b/samples/dialogs/dialogs.def @@ -0,0 +1,8 @@ +NAME Dialogs +DESCRIPTION 'wxWindows Dialogs example' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/samples/dialogs/dialogs.h b/samples/dialogs/dialogs.h new file mode 100644 index 0000000000..39c199a35a --- /dev/null +++ b/samples/dialogs/dialogs.h @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dialogs.h +// Purpose: Common dialogs demo +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOGSH__ +#define __DIALOGSH__ + +// Define a new application type +class MyApp: public wxApp +{ public: + bool OnInit(void); + + wxFont m_canvasFont; + wxColour m_canvasTextColour; +}; + +// Define a new frame type +class MyFrame: public wxFrame +{ public: + MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, + const wxSize& size); + bool OnClose(void) { return TRUE; } + + void ChooseColour(wxCommandEvent& event); + void ChooseFont(wxCommandEvent& event); + void MessageBox(wxCommandEvent& event); + void SingleChoice(wxCommandEvent& event); + void TextEntry(wxCommandEvent& event); + void FileOpen(wxCommandEvent& event); + void FileSave(wxCommandEvent& event); + void DirChoose(wxCommandEvent& event); + +#if !defined(__WINDOWS__) || USE_GENERIC_DIALOGS_IN_MSW + void ChooseColourGeneric(wxCommandEvent& event); + void ChooseFontGeneric(wxCommandEvent& event); +#endif + void OnExit(wxCommandEvent& event); +DECLARE_EVENT_TABLE() +}; + +class MyCanvas: public wxScrolledWindow +{ + public: + MyCanvas(wxWindow *parent): + wxScrolledWindow(parent) + { + } + void OnPaint(wxPaintEvent& event); +DECLARE_EVENT_TABLE() +}; + + +// Menu IDs +#define DIALOGS_CHOOSE_COLOUR 1 +#define DIALOGS_CHOOSE_COLOUR_GENERIC 2 +#define DIALOGS_CHOOSE_FONT 3 +#define DIALOGS_CHOOSE_FONT_GENERIC 4 +#define DIALOGS_MESSAGE_BOX 5 +#define DIALOGS_SINGLE_CHOICE 6 +#define DIALOGS_TEXT_ENTRY 7 +#define DIALOGS_FILE_OPEN 8 +#define DIALOGS_FILE_SAVE 9 +#define DIALOGS_DIR_CHOOSE 10 + +#endif + diff --git a/samples/dialogs/dialogs.rc b/samples/dialogs/dialogs.rc new file mode 100644 index 0000000000..233da61284 --- /dev/null +++ b/samples/dialogs/dialogs.rc @@ -0,0 +1,3 @@ +aiai_icn ICON "aiai.ico" +#include "wx/msw/wx.rc" + diff --git a/samples/dialogs/makefile.b32 b/samples/dialogs/makefile.b32 new file mode 100644 index 0000000000..e314db0425 --- /dev/null +++ b/samples/dialogs/makefile.b32 @@ -0,0 +1,62 @@ +# +# File: makefile.bcc +# Author: Adnre Beltman +# Created: 1995 +# Updated: +# Copyright: (c) 1995, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dialogs example (DOS). + +# WXWIN and BCCDIR are set by parent make + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +WXLIBDIR = $(WXDIR)\lib +WXLIB=$(WXLIBDIR)\wx32.lib +LIBS=$(WXLIB) cw32 import32 + +TARGET=dialogs + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = dialogs.obj + +$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) +! + brc32 -K $(TARGET).res + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +dialogs.obj: dialogs.$(SRCSUFF) + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + diff --git a/samples/dialogs/makefile.bcc b/samples/dialogs/makefile.bcc new file mode 100644 index 0000000000..fb3bcc4b7b --- /dev/null +++ b/samples/dialogs/makefile.bcc @@ -0,0 +1,74 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dialogs example (DOS). + +!if "$(BCCDIR)" == "" +!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 +!endif + +!if "$(WXWIN)" == "" +!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx +!endif + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makebcc.env + +THISDIR = $(WXDIR)\samples\dialogs +WXLIB = $(WXDIR)\lib\wx.lib +LIBS=$(WXLIB) mathwl cwl import +INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw +CFG=$(WXDIR)\src\wxwin.cfg + +!ifndef FINAL +FINAL=0 +!endif + +!if "$(FINAL)" == "0" +#LINKFLAGS=/v /Vt /Twe /s /L$(WXDIR)\lib;$(BCCDIR)\lib +LINKFLAGS=/Vt /Twe /s /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -O2 +DEBUG_FLAGS= +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = dialogs.obj + +dialogs: dialogs.exe + +all: dialogs.exe + +dialogs.exe: $(WXLIB) dialogs.obj dialogs.def dialogs.res + tlink $(LINKFLAGS) @&&! +c0wl.obj dialogs.obj +dialogs +nul +$(LIBS) +dialogs.def +! + rc -31 -K dialogs.res + +.$(SRCSUFF).obj: + bcc $(CPPFLAGS) -c {$< } + +dialogs.obj: dialogs.$(SRCSUFF) + +dialogs.res : dialogs.rc $(WXDIR)\include\msw\wx.rc + rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa dialogs + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws diff --git a/samples/dialogs/makefile.dos b/samples/dialogs/makefile.dos new file mode 100644 index 0000000000..dd0e10c4a1 --- /dev/null +++ b/samples/dialogs/makefile.dos @@ -0,0 +1,81 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dialogs example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\samples\dialogs +WXLIB = $(WXDIR)\lib\wx.lib +LIBS=$(WXLIB) oldnames libw llibcew commdlg shell ddeml + +!ifndef FINAL +FINAL=0 +!endif + +INC=/I$(WXDIR)\include\msw /I$(WXDIR)\include\base + +# Set this to nothing if using MS C++ 7 +ZOPTION=/Z7 + +!if "$(FINAL)" == "0" +CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od /YuWX_PREC.H /DDEBUG=$(DEBUG) /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch $(INC) +LINKFLAGS=/NOD /CO /ONERROR:NOEXE /SEG:512 +!else +CPPFLAGS=/AL /W3 /G2sw /Ox /YuWX_PREC.H /Dwx_msw /DDEBUG=$(DEBUG) /Fp$(WXDIR)\src\msw\wx.pch $(INC) +LINKFLAGS=/NOD /ONERROR:NOEXE /SEG:512 +!endif + +HEADERS = +SOURCES = dialogs.$(SRCSUFF) +OBJECTS = dialogs.obj + +all: dialogs.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + + +dialogs.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(OBJECTS) dialogs.def dialogs.res + link $(LINKFLAGS) @<< +$(OBJECTS) $(WXDIR)\src\msw\dummy.obj, +dialogs, +NUL, +$(LIBS), +dialogs.def +; +<< + rc -30 -K dialogs.res + +dialogs.obj: dialogs.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +dialogs.res : dialogs.rc $(WXDIR)\include\msw\wx.rc + rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw dialogs + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/dialogs/makefile.g95 b/samples/dialogs/makefile.g95 new file mode 100644 index 0000000000..c579ce37e1 --- /dev/null +++ b/samples/dialogs/makefile.g95 @@ -0,0 +1,35 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for dialogs example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/makeg95.env + +OBJECTS = $(OBJDIR)/dialogs.$(OBJSUFF) $(OBJDIR)/dialogs_resources.$(OBJSUFF) + +all: $(OBJDIR) dialogs$(GUISUFFIX) + +$(OBJDIR): + mkdir $(OBJDIR) + +dialogs$(GUISUFFIX): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o dialogs$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS) + +$(OBJDIR)/dialogs.$(OBJSUFF): dialogs.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ dialogs.$(SRCSUFF) + +$(OBJDIR)/dialogs_resources.o: dialogs.rc + $(RESCOMP) -i dialogs.rc -o $(OBJDIR)/dialogs_resources.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) dialogs$(GUISUFFIX).exe core *.rsc *.res diff --git a/samples/dialogs/makefile.nt b/samples/dialogs/makefile.nt new file mode 100644 index 0000000000..cec864579d --- /dev/null +++ b/samples/dialogs/makefile.nt @@ -0,0 +1,63 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dialogs example (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\ntwxwin.mak + +THISDIR = $(WXDIR)\samples\dialogs +PROGRAM=dialogs + +OBJECTS = $(PROGRAM).obj + +$(PROGRAM): $(PROGRAM).exe + +all: wx $(PROGRAM).exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res +$(LIBS) +<< + + +$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) dialogs.h $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + + +clean: + -erase *.obj + -erase *.sbr + -erase *.exe + -erase *.res + -erase *.map + -erase *.pdb + diff --git a/samples/dialogs/makefile.sc b/samples/dialogs/makefile.sc new file mode 100644 index 0000000000..428af8452c --- /dev/null +++ b/samples/dialogs/makefile.sc @@ -0,0 +1,35 @@ +# Symantec C++ makefile for dialogs example +# NOTE that peripheral libraries are now dealt in main wxWindows makefile. + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makesc.env + +WXLIB = $(WXDIR)\lib\wx.lib +INCDIR = $(WXDIR)\include +MSWINC = $(INCDIR)\msw +BASEINC = $(INCDIR)\base + +CC=sc +RC=rc +CFLAGS = -o -ml -W -Dwx_msw +LDFLAGS = -ml -W + +INCLUDE=$(BASEINC);$(MSWINC) + +LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib + +.$(SRCSUFF).obj: + *$(CC) -c $(CFLAGS) -I$(INCLUDE) $< + +.rc.res: + *$(RC) -r -I$(INCLUDE) $< + +dialogs.exe: dialogs.obj dialogs.def dialogs.res + *$(CC) $(LDFLAGS) -o$@ $** $(LIBS) + +clean: + -del *.obj + -del *.exe + -del *.res + -del *.map + -del *.rws diff --git a/samples/dialogs/makefile.unx b/samples/dialogs/makefile.unx new file mode 100644 index 0000000000..c993443b2b --- /dev/null +++ b/samples/dialogs/makefile.unx @@ -0,0 +1,58 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for dialogs example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/make.env + +OBJECTS = $(OBJDIR)/dialogs.$(OBJSUFF) + +.SUFFIXES: + +all: $(OBJDIR) dialogs$(GUISUFFIX) + +wx: + + +motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK= + +xview: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview + $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' + +hp: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp + $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \ + XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)' + +$(OBJDIR): + mkdir $(OBJDIR) + +dialogs$(GUISUFFIX): $(OBJDIR)/dialogs.$(OBJSUFF) $(WXLIB) + $(CC) $(LDFLAGS) -o dialogs$(GUISUFFIX) $(OBJDIR)/dialogs.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/dialogs.$(OBJSUFF): dialogs.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ dialogs.$(SRCSUFF) + +clean_motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany + +clean_ol: + $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany + +clean_hp: + $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany + +cleanany: + rm -f $(OBJECTS) dialogs$(GUISUFFIX) core diff --git a/samples/dialogs/makefile.vms b/samples/dialogs/makefile.vms new file mode 100644 index 0000000000..9b76b144f3 --- /dev/null +++ b/samples/dialogs/makefile.vms @@ -0,0 +1,38 @@ +#************************************************************************ +# Makefile for MINIMAL under VMS +# by Stefan Hammes +# (incomplete) update history: +# 11.04.95 +#************************************************************************ + +#************************************************************************ +# Definition section +# (cave: definitions and includes must begin with ',') +#************************************************************************ + +APPOPTS = +APPDEFS = +APPINCS = + +#************************************************************************ +# Module section +#************************************************************************ + +# Name of main module +MAIN = minimal + +# Object modules of the application. +OBJS = minimal.obj +OBJLIST =minimal.obj + +.include [--.src]makevms.env + +# main dependency +$(MAIN).exe : $(OBJS) + $(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option + - purge *.exe + +#************************************************************************ +# Header file depedencies following +#************************************************************************ + diff --git a/samples/dialogs/makefile.wat b/samples/dialogs/makefile.wat new file mode 100644 index 0000000000..c20f6c064c --- /dev/null +++ b/samples/dialogs/makefile.wat @@ -0,0 +1,43 @@ +# +# Makefile for WATCOM +# +# Created by D.Chubraev, chubraev@iem.ee.ethz.ch +# 8 Nov 1994 +# + +WXDIR = ..\.. + +!include $(WXDIR)\src\makewat.env + +WXLIB = $(WXDIR)\lib +NAME = dialogs +LNK = $(name).lnk +OBJS = $(name).obj + +all: $(name).exe + +$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib + wlink @$(LNK) + $(BINDCOMMAND) $(name).res + +$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc + $(RC) $(RESFLAGS1) $(name).rc + +$(LNK) : makefile.wat + %create $(LNK) + @%append $(LNK) debug all + @%append $(LNK) system $(LINKOPTION) + @%append $(LNK) $(MINDATA) + @%append $(LNK) $(MAXDATA) + @%append $(LNK) $(STACK) + @%append $(LNK) name $(name) + @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib + @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i + @for %i in ($(OBJS)) do @%append $(LNK) file %i + +thing: .SYMBOLIC + echo $(WATLIBDIR) + +clean: .SYMBOLIC + -erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex + diff --git a/samples/dnd/d_and_d.txt b/samples/dnd/d_and_d.txt new file mode 100644 index 0000000000..b85b7c1570 --- /dev/null +++ b/samples/dnd/d_and_d.txt @@ -0,0 +1,167 @@ + Drag-and-Drop Support in wxWindows + ================================== + +1. Overview + -------- + + a) What is it? + + We're calling drag-and-drop (or d&d for short) the OLE mechanism of data +transfer. Please note that it's not the same thing as the file oriented d&d +of Windows 3.1 "File Manager" which is designed for and limited to the file +names only. + + OLE d&d allows application to transfer data of any type to the same or +another process. + + + b) How is it done? (user's point of view) + + To start a d&d operation the user presses the mouse button 1 (left) and +drags the selected object to another window (which must be at least partially +visible on the screen) or to an icon on the taskbar in which case the +corresponding window will be automatically restored. To finish the operation, +the user releases the button. Default d&d operation is "move", but several key +act as modifiers: keeping down the key at the moment of drop does +"copy", while or force the "move" (makes sense if default isn't +"move"). + + + c) How is it done? (programmer's point of view) + + There are several objects participating in a d&d operation. First of all, +there is the data object itself. Second, there is the drop source which is +responsible for creating the data object (if it doesn't exist yet) and starting +the d&d operation. Finally, the drop target recieves the notification when +the data is dropped onto the associated window (see below) and is responsible +for pasting the data and returning the result code (copy, move or failure). +There is one class for each one of these roles in wxWindows d&d implementation, +plese see their descriptions below for details. + + + +2. Drop Target + ----------- + + a) Being a drop target + + ... is as easy as deriving your window class from wxDropTarget and +associating it with a wxWindow object (or perhaps some wxWindow-derived class, +such as wxFrame). The pure virtual function wxDropTarget::OnDrop() must be +implemented in your application and will be called whenever the mouse button +is released over the window in question. Other virtual functions that will be +called in the process of the d&d operation are OnEnter and OnLeave. + +@@ should OnDragOver() be user overridable also? + + You should associate wxDropTarget and wxWindow calling SetDropTarget: + wxWindow *pWindow = GetTopWindow(); + pWindow->SetDropTarget(new MyDropTarget); + +The object created passed to SetDropTarget becomes the propriety of wxWindow +and will be deleted with the window (or when you call SetDropTarget next +time). You can always break the association by calling SetDropTarget(NULL). + + When some data is dragged over a window, the program must decide if it's +going to accept this data or not. The virtual function IsAcceptedData() is +called to do it. The default implementation takes care of OLE interface +pointer manipulations and only requires you to override GetCountFormats() +and GetFormat(n) functions to let it know what data formats you support. +If it's not flexible enough for your application (i.e. the set of supported +formats changes over time...), you should override IsAcceptedData(). In 99% +of cases the default implementation is ok and you only have to return count +of supported formats (CF_xxx constants or one of your custom formats which +must have been registered) and their values. + + b) OnDrop(long x, long y, const void *pData) + + (x, y) are drop point (client) coordinates, pData is the pointer to data + (whatever it is). + + If 'true' is returned from OnDrop, the operation is considered to be + successful and the corresponding code (MOVE or COPY depending on the + keyboard control keys) is returned. Otherwise, the operation is cancelled. + + Please remember that returning 'true' here may mean 'move' and so the + drop source will delete the corresponding data - which would lead to + data loss if you didn't paste it properly. + + c) OnEnter() + + called when the mouse enters the window: you might use this function to + give some additional visual feedback. + + d) OnLeave() + + called when the mouse leaves the window; might be a good place to clean +up things allocated in OnEnter. + + e) Simple wxDropTarget specializations + + Two (very simple) wxDropTarget-derived classes are provided for two most +common situations: d&d of text and file d&d. To use them you only need to +override one virtual function OnDropText in wxTextDropTarget's case and +OnDropFiles for wxFileDropTarget. + + The (x, y) are the same as for OnDrop() function. OnDropText's last +parameter points to a (always ANSI, not Unicode) text string, while +OnDropFiles() parameter is the array of file names just dropped (and the +count of them is passed in the 3rd parameter). + +3. Data Object + ----------- + + a) Drag and drop and clipboard + + The effect of a d&d operation is the same as using the clipboard to +cut/copy and paste data and it would be nice to use the same code to implement +these two data transfer mechanisms. The wxDataObject allows you to do exactly +this. It encapsulates the data which can be passed either through the clipboard +or d&d. + + + b) Data format + + There are several standard clipboard formats, such as text, bitmap or +metafile picture. All of them are defined in wxDataObject::StdFormats +enumeration. Of course, it's not always enough and you'll often need your +own format for data transfer. The simple helper class wxDataFormat may help +you: when you create an object of this class, it registers a new clipboard +data format identified by the string passed to it's ctor. + + After your new format is registered, you may use it as any other one. + +4. Drop Source + ----------- + + a) Starting the d&d operation + + In order to start the d&d operation you should call the DoDragDrop function +(typically in reply to a "mouse button press" message). NB: DoDragDrop() is a +blocking function which enters into it's own message loop and may return after +an arbitrarily long time interval. During it, the QueryContinueDrag() is called +whenever the mouse or keyboard state changes. The default behaviour is quite +reasonable for 99% of cases: the drag operation is cancelled if the key +is preessed and the drop is initiated if the mouse button is released. + + b) After the end of d&d + + The drop source behaviour depends on DoDragDrop() return code. If it +returns wxDropSource::None or wxDropSource::Copy there is normally nothing to +do, but you shouldn't forget to delete your data if it returns the +wxDropSource::Move code. + + c) DoDragDrop + + d) QueryContinueDrag + + +5. Remarks + ------- + + +@@@@ TODO: support tymed != TYMED_HGLOBAL; + better support of CF_BMP, CF_METAFILE + scrolling support!! (how?) + sample demonstrating use of user-defined formats + sample which really does something useful diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp new file mode 100644 index 0000000000..8b6fb25f47 --- /dev/null +++ b/samples/dnd/dnd.cpp @@ -0,0 +1,264 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: dnd.cpp +// Purpose: Drag and drop sample +// Author: Vadim Zeitlin +// Modified by: +// Created: 13.11.97 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Vadim Zeitlin +// Licence: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// headers & declarations +// ============================================================================ + +// 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 + +#include "wx/intl.h" +#include "wx/log.h" + +#include "wx/dnd.h" + +// ---------------------------------------------------------------------------- +// Derive 2 simple classes which just put in the listbox the strings (text or +// file names) we drop on them +// ---------------------------------------------------------------------------- +class DnDText : public wxTextDropTarget +{ +public: + DnDText(wxListBox *pOwner) { m_pOwner = pOwner; } + + virtual bool OnDropText(long x, long y, const char *psz); + +private: + wxListBox *m_pOwner; +}; + +class DnDFile : public wxFileDropTarget +{ +public: + DnDFile(wxListBox *pOwner) { m_pOwner = pOwner; } + + virtual bool OnDropFiles(long x, long y, + size_t nFiles, const char * const aszFiles[]); + +private: + wxListBox *m_pOwner; +}; + +// ---------------------------------------------------------------------------- +// Define a new application type +// ---------------------------------------------------------------------------- +class DnDApp : public wxApp +{ +public: + bool OnInit(); +}; + +IMPLEMENT_APP(DnDApp); + +// ---------------------------------------------------------------------------- +// Define a new frame type +// ---------------------------------------------------------------------------- +class DnDFrame : public wxFrame +{ +public: + DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h); + ~DnDFrame(); + + void OnPaint(wxPaintEvent& event); + void OnQuit (wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnHelp (wxCommandEvent& event); + + bool OnClose(); + + DECLARE_EVENT_TABLE() + +private: + wxListBox *m_ctrlFile, + *m_ctrlText; + wxTextCtrl *m_ctrlLog; + + wxLogTarget *m_pLog, *m_pLogPrev; +}; + +// ---------------------------------------------------------------------------- +// IDs for the menu commands +// ---------------------------------------------------------------------------- +enum +{ + Menu_Quit = 1, + Menu_About = 101, + Menu_Help, +}; + +BEGIN_EVENT_TABLE(DnDFrame, wxFrame) + EVT_MENU(Menu_Quit, DnDFrame::OnQuit) + EVT_MENU(Menu_About, DnDFrame::OnAbout) + EVT_MENU(Menu_Help, DnDFrame::OnHelp) + + //EVT_PAINT(DnDFrame::OnPaint) +END_EVENT_TABLE() + +// `Main program' equivalent, creating windows and returning main app frame +bool DnDApp::OnInit(void) +{ + // create the main frame window + DnDFrame *frame = new DnDFrame(NULL, "Drag & Drop wxWindows App", + 50, 50, 450, 340); + + // activate it + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h) + : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) +{ + SetIcon(wxIcon("mondrian")); + + // construct menu + wxMenu *file_menu = new wxMenu; + file_menu->Append(Menu_Help, "&Help"); + file_menu->Append(Menu_About, "&About"); + file_menu->AppendSeparator(); + file_menu->Append(Menu_Quit, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + SetMenuBar(menu_bar); + + // make a panel with 3 subwindows + wxPoint pos(0, 0); + wxSize size(400, 200); + + wxString strFile("Drop files here!"), strText("Drop text on me"); + + m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL); + m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL); + m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size, + wxTE_MULTILINE | wxTE_READONLY | + wxSUNKEN_BORDER| wxHSCROLL); + + // redirect log messages to the text window (don't forget to delete it!) +// m_pLog = new wxLogTextCtrl(m_ctrlLog); + m_pLog = NULL; + m_pLogPrev = wxLogTarget::SetActiveTarget(m_pLog); + + // associate drop targets with 2 text controls + m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile)); + m_ctrlText->SetDropTarget(new DnDText(m_ctrlText)); + + wxLayoutConstraints *c; + + c = new wxLayoutConstraints; + c->left.SameAs (this, wxLeft); + c->top.SameAs (this, wxTop); + c->right.PercentOf(this, wxRight, 50); + c->height.PercentOf(this, wxHeight, 50); + m_ctrlFile->SetConstraints(c); + + c = new wxLayoutConstraints; + c->left.SameAs (m_ctrlFile, wxRight); + c->top.SameAs (this, wxTop); + c->right.SameAs (this, wxRight); + c->height.PercentOf(this, wxHeight, 50); + m_ctrlText->SetConstraints(c); + + c = new wxLayoutConstraints; + c->left.SameAs (this, wxLeft); + c->right.SameAs (this, wxRight); + c->height.PercentOf(this, wxHeight, 50); + c->bottom.SameAs(this, wxBottom); + + m_ctrlLog->SetConstraints(c); + + SetAutoLayout(TRUE); +} + +void DnDFrame::OnQuit(wxCommandEvent& /* event */) +{ + Close(TRUE); +} + +void DnDFrame::OnAbout(wxCommandEvent& /* event */) +{ + wxMessageDialog dialog(this, + "Drag-&-Drop Demo\n" + "Please see File|Help for details", + "About wxDnD"); + + dialog.ShowModal(); +} + +void DnDFrame::OnHelp(wxCommandEvent& /* event */) +{ + wxMessageDialog dialog(this, +"This small program demonstrates drag & drop support in wxWindows.\n" +"The program window consists of 3 parts: the bottom pane is for\n" +"debug messages, so that you can see what's going on inside.\n" +"The top part is split into 2 listboxes, the left one accepts\n" +"files and the right one accepts text.\n" +"\n" +"To test it: open wordpad (write.exe), select some text in it and\n" +"drag it to the right listbox (you'll notice the usual visual\n" +"feedback, i.e. the cursor will change). Also, try dragging some\n" +"files (you can select several at once) from Windows Explorer (or\n" +"File Manager) to the left pane. Hold down Ctrl/Shift keys when\n" +"you drop text (doesn't work with files) and see what changes.\n" +"\n" +"Please address any questions/bug reports/suggestions &c to\n" +"Vadim Zeitlin ", + "wxDnD Help"); + + dialog.ShowModal(); +} + +bool DnDFrame::OnClose() +{ + return TRUE; +} + +DnDFrame::~DnDFrame() +{ + if ( m_pLog != NULL ) { + if ( wxLogTarget::SetActiveTarget(m_pLogPrev) == m_pLog ) + delete m_pLog; + } +} + +// ---------------------------------------------------------------------------- +// Notifications called by the base class +// ---------------------------------------------------------------------------- +bool DnDText::OnDropText(long, long, const char *psz) +{ + m_pOwner->Append(psz); + + return TRUE; +} + +bool DnDFile::OnDropFiles(long, long, size_t nFiles, + const char * const aszFiles[]) +{ + wxString str; + str.Printf("%d files dropped", nFiles); + m_pOwner->Append(str); + for ( size_t n = 0; n < nFiles; n++ ) { + m_pOwner->Append(aszFiles[n]); + } + + return TRUE; +} diff --git a/samples/dnd/dnd.def b/samples/dnd/dnd.def new file mode 100644 index 0000000000..8a76b2d093 --- /dev/null +++ b/samples/dnd/dnd.def @@ -0,0 +1,8 @@ +NAME DND +DESCRIPTION 'Drag and drop sample' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 4048 +STACKSIZE 16000 diff --git a/samples/dnd/dnd.rc b/samples/dnd/dnd.rc new file mode 100644 index 0000000000..7655c62a4c --- /dev/null +++ b/samples/dnd/dnd.rc @@ -0,0 +1,3 @@ +mondrian ICON "mondrian.ico" +#include "wx/msw/wx.rc" + diff --git a/samples/dnd/makefile.b32 b/samples/dnd/makefile.b32 new file mode 100644 index 0000000000..7644caa99a --- /dev/null +++ b/samples/dnd/makefile.b32 @@ -0,0 +1,64 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dnd example (DOS). + +# WXWIN and BCCDIR are set by parent make + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +WXLIBDIR = $(WXDIR)\lib +WXINC = $(WXDIR)\include\msw +WXLIB = $(WXLIBDIR)\wx32.lib +LIBS=$(WXLIB) cw32 import32 ole2w32 + +TARGET=dnd + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = dnd.obj + +$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) +$(TARGET).def +! + brc32 -K $(TARGET).res + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +dnd.obj: dnd.$(SRCSUFF) + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + diff --git a/samples/dnd/makefile.dos b/samples/dnd/makefile.dos new file mode 100644 index 0000000000..46906a90e4 --- /dev/null +++ b/samples/dnd/makefile.dos @@ -0,0 +1,65 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dnd example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\samples\dnd + +!ifndef FINAL +FINAL=0 +!endif + +HEADERS = +SOURCES = dnd.$(SRCSUFF) +OBJECTS = dnd.obj + +all: dnd.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + +dnd.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) dnd.obj dnd.def dnd.res + link $(LINKFLAGS) @<< +dnd.obj $(WXDIR)\src\msw\dummy.obj, +dnd, +NUL, +$(LIBS), +dnd.def +; +<< + rc -K dnd.res + +dnd.obj: dnd.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +dnd.res : dnd.rc $(WXDIR)\include\wx\msw\wx.rc + rc -r /i$(WXDIR)\include dnd + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/dnd/makefile.g95 b/samples/dnd/makefile.g95 new file mode 100644 index 0000000000..d62f860121 --- /dev/null +++ b/samples/dnd/makefile.g95 @@ -0,0 +1,37 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for dnd example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/makeg95.env + +OBJECTS = $(OBJDIR)/dnd.$(OBJSUFF) $(OBJDIR)/dnd_resources.$(OBJSUFF) + +all: $(OBJDIR) dnd$(GUISUFFIX)$(EXESUFF) + +wx: + +$(OBJDIR): + mkdir $(OBJDIR) + +dnd$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o dnd$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS) + +$(OBJDIR)/dnd.$(OBJSUFF): dnd.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ dnd.$(SRCSUFF) + +$(OBJDIR)/dnd_resources.o: dnd.rc + $(RESCOMP) -i dnd.rc -o $(OBJDIR)/dnd_resources.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) dnd$(GUISUFFIX).exe core *.rsc *.res diff --git a/samples/dnd/makefile.nt b/samples/dnd/makefile.nt new file mode 100644 index 0000000000..b7c81a7092 --- /dev/null +++ b/samples/dnd/makefile.nt @@ -0,0 +1,64 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds dnd example (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +WXUSINGDLL=0 + +!include $(WXDIR)\src\ntwxwin.mak + +THISDIR = $(WXDIR)\samples\dnd +PROGRAM=dnd + +OBJECTS = $(PROGRAM).obj + +$(PROGRAM): $(PROGRAM).exe + +all: wx $(PROGRAM).exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res +$(LIBS) +<< + + +$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/dnd/mondrian.ico b/samples/dnd/mondrian.ico new file mode 100644 index 0000000000000000000000000000000000000000..2310c5d275a87af295d5ea8dc79ea417a5e74c53 GIT binary patch literal 766 zcmZQzU<5)11px*Sc)`TLAO@s0fLH;D9e|jTfdxnc0Z4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8==$?nzrhpQAOg_h$ceBh&-)D#M=FYfwAK(fEMk@u943z>%&;>f z=!p!jQ1(F`;nH6b*Hp8L=}Yy==?UxKFw{4E#S*@E9qb%1@FoA3!Ig3>`OK~z z@un-8v!Fv^(aWyarIV9>RrS_!4*ko4OA?3t$%K}!rwqfamwPXT8Ywru6t38 f@y15=$>%IlxrN6sR{!aD literal 0 HcmV?d00001 diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp new file mode 100644 index 0000000000..5e871203a6 --- /dev/null +++ b/samples/docview/doc.cpp @@ -0,0 +1,275 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: doc.cpp +// Purpose: Implements document functionality +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma implementation +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#if !USE_DOC_VIEW_ARCHITECTURE +#error You must set USE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h! +#endif + +#include "doc.h" +#include "view.h" + +IMPLEMENT_DYNAMIC_CLASS(DrawingDocument, wxDocument) + +DrawingDocument::DrawingDocument(void) +{ +} + +DrawingDocument::~DrawingDocument(void) +{ + doodleSegments.DeleteContents(TRUE); +} + +ostream& DrawingDocument::SaveObject(ostream& stream) +{ + wxDocument::SaveObject(stream); + + stream << doodleSegments.Number() << '\n'; + wxNode *node = doodleSegments.First(); + while (node) + { + DoodleSegment *segment = (DoodleSegment *)node->Data(); + segment->SaveObject(stream); + stream << '\n'; + + node = node->Next(); + } + return stream; +} + +istream& DrawingDocument::LoadObject(istream& stream) +{ + wxDocument::LoadObject(stream); + + int n = 0; + stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleSegment *segment = new DoodleSegment; + segment->LoadObject(stream); + doodleSegments.Append(segment); + } + + return stream; +} + +DoodleSegment::DoodleSegment(void) +{ +} + +DoodleSegment::DoodleSegment(DoodleSegment& seg) +{ + wxNode *node = seg.lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + DoodleLine *newLine = new DoodleLine; + newLine->x1 = line->x1; + newLine->y1 = line->y1; + newLine->x2 = line->x2; + newLine->y2 = line->y2; + + lines.Append(newLine); + + node = node->Next(); + } +} + +DoodleSegment::~DoodleSegment(void) +{ + lines.DeleteContents(TRUE); +} + +ostream& DoodleSegment::SaveObject(ostream& stream) +{ + stream << lines.Number() << '\n'; + wxNode *node = lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + stream << line->x1 << " " << line->y1 << " " << line->x2 << " " << line->y2 << "\n"; + node = node->Next(); + } + return stream; +} + +istream& DoodleSegment::LoadObject(istream& stream) +{ + int n = 0; + stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleLine *line = new DoodleLine; + stream >> line->x1 >> line->y1 >> line->x2 >> line->y2; + lines.Append(line); + } + return stream; +} + +void DoodleSegment::Draw(wxDC *dc) +{ + wxNode *node = lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + dc->DrawLine(line->x1, line->y1, line->x2, line->y2); + node = node->Next(); + } +} + +/* + * Implementation of drawing command + */ + +DrawingCommand::DrawingCommand(const wxString& name, int command, DrawingDocument *ddoc, DoodleSegment *seg): + wxCommand(TRUE, name) +{ + doc = ddoc; + segment = seg; + cmd = command; +} + +DrawingCommand::~DrawingCommand(void) +{ + if (segment) + delete segment; +} + +bool DrawingCommand::Do(void) +{ + switch (cmd) + { + case DOODLE_CUT: + { + // Cut the last segment + if (doc->GetDoodleSegments().Number() > 0) + { + wxNode *node = doc->GetDoodleSegments().Last(); + if (segment) + delete segment; + + segment = (DoodleSegment *)node->Data(); + delete node; + + doc->Modify(TRUE); + doc->UpdateAllViews(); + } + break; + } + case DOODLE_ADD: + { + doc->GetDoodleSegments().Append(new DoodleSegment(*segment)); + doc->Modify(TRUE); + doc->UpdateAllViews(); + break; + } + } + return TRUE; +} + +bool DrawingCommand::Undo(void) +{ + switch (cmd) + { + case DOODLE_CUT: + { + // Paste the segment + if (segment) + { + doc->GetDoodleSegments().Append(segment); + doc->Modify(TRUE); + doc->UpdateAllViews(); + segment = NULL; + } + doc->Modify(TRUE); + doc->UpdateAllViews(); + break; + } + case DOODLE_ADD: + { + // Cut the last segment + if (doc->GetDoodleSegments().Number() > 0) + { + wxNode *node = doc->GetDoodleSegments().Last(); + DoodleSegment *seg = (DoodleSegment *)node->Data(); + delete seg; + delete node; + + doc->Modify(TRUE); + doc->UpdateAllViews(); + } + } + } + return TRUE; +} + +IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument) + +// Since text windows have their own method for saving to/loading from files, +// we override OnSave/OpenDocument instead of Save/LoadObject +bool TextEditDocument::OnSaveDocument(const wxString& filename) +{ + TextEditView *view = (TextEditView *)GetFirstView(); + + if (!view->textsw->SaveFile(filename)) + return FALSE; + Modify(FALSE); + return TRUE; +} + +bool TextEditDocument::OnOpenDocument(const wxString& filename) +{ + TextEditView *view = (TextEditView *)GetFirstView(); + if (!view->textsw->LoadFile(filename)) + return FALSE; + + SetFilename(filename, TRUE); + Modify(FALSE); + UpdateAllViews(); + return TRUE; +} + +bool TextEditDocument::IsModified(void) const +{ + TextEditView *view = (TextEditView *)GetFirstView(); + if (view) + { + return (wxDocument::IsModified() || view->textsw->Modified()); + } + else + return wxDocument::IsModified(); +} + +void TextEditDocument::Modify(bool mod) +{ + TextEditView *view = (TextEditView *)GetFirstView(); + + wxDocument::Modify(mod); + + if (!mod && view && view->textsw) + view->textsw->DiscardEdits(); +} diff --git a/samples/docview/doc.h b/samples/docview/doc.h new file mode 100644 index 0000000000..a83b45c877 --- /dev/null +++ b/samples/docview/doc.h @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: doc.h +// Purpose: Document classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma interface +#endif + +#ifndef __DOCSAMPLEH__ +#define __DOCSAMPLEH__ + +#include "wx/docview.h" + +// Plots a line from one point to the other +class DoodleLine: public wxObject +{ + public: + long x1; + long y1; + long x2; + long y2; +}; + +// Contains a list of lines: represents a mouse-down doodle +class DoodleSegment: public wxObject +{ + public: + wxList lines; + + DoodleSegment(void); + DoodleSegment(DoodleSegment& seg); + ~DoodleSegment(void); + + void Draw(wxDC *dc); + ostream& SaveObject(ostream& stream); + istream& LoadObject(istream& stream); +}; + +class DrawingDocument: public wxDocument +{ + DECLARE_DYNAMIC_CLASS(DrawingDocument) + private: + public: + wxList doodleSegments; + + DrawingDocument(void); + ~DrawingDocument(void); + + ostream& SaveObject(ostream& stream); + istream& LoadObject(istream& stream); + + inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; }; +}; + +#define DOODLE_CUT 1 +#define DOODLE_ADD 2 + +class DrawingCommand: public wxCommand +{ + protected: + DoodleSegment *segment; + DrawingDocument *doc; + int cmd; + public: + DrawingCommand(const wxString& name, int cmd, DrawingDocument *ddoc, DoodleSegment *seg); + ~DrawingCommand(void); + + bool Do(void); + bool Undo(void); +}; + +class TextEditDocument: public wxDocument +{ + DECLARE_DYNAMIC_CLASS(TextEditDocument) + private: + public: +/* + ostream& SaveObject(ostream& stream); + istream& LoadObject(istream& stream); +*/ + virtual bool OnSaveDocument(const wxString& filename); + virtual bool OnOpenDocument(const wxString& filename); + virtual bool IsModified(void) const; + virtual void Modify(bool mod); + + TextEditDocument(void) {} + ~TextEditDocument(void) {} +}; + + +#endif diff --git a/samples/docview/doc.ico b/samples/docview/doc.ico new file mode 100644 index 0000000000000000000000000000000000000000..34b1d7bc936820eecbbf4acbb26617eaf0d7eb9e GIT binary patch literal 766 zcma)(J#vFE6oemfW=N-0X-%11kV{Z=1$C5WCI^E9FykxGC1n~07ap&7^<#&Oi%6{W zR?_<w_Y*{$>xD00eY#3t4mZ6Q~Xno&v0^u`25yh$@ zHUBN{XS32_gyJt5fhF$0p#3E55wAb&n$LIxyz1H@S_i3uwcrZ}b(JNje; z0Pq`te84Aw!ykY=Hy2cZ(g}bzKzd=b@_+6p>DhEZWp#1%FbJvU&ML6<%`cgJZ-+N`{1J}oC06$K7q>)I2FK5 w^@a;MC$j_hm1@Q{`~6IfJZK+PGM07{#|p_(Q9N^=xsJR&xiw}x5FEC?0?FYnj{pDw literal 0 HcmV?d00001 diff --git a/samples/docview/docview.cpp b/samples/docview/docview.cpp new file mode 100644 index 0000000000..a36407e97c --- /dev/null +++ b/samples/docview/docview.cpp @@ -0,0 +1,274 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: docview.cpp +// Purpose: Document/view demo +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma implementation "docview.h" +#endif + +/* + * Purpose: Document/view architecture demo for wxWindows class library + * Run with no arguments for multiple top-level windows, -single + * for a single window. + */ + + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#if !USE_DOC_VIEW_ARCHITECTURE +#error You must set USE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h! +#endif + +#include "wx/docview.h" + +#include "docview.h" +#include "doc.h" +#include "view.h" + +MyFrame *frame = NULL; + +// In single window mode, don't have any child windows; use +// main window. +bool singleWindowMode = FALSE; + +IMPLEMENT_APP(MyApp) + +MyApp::MyApp(void) +{ + m_docManager = NULL; +} + +bool MyApp::OnInit(void) +{ + //// Find out if we're: + //// SDI : multiple windows and documents but not MDI + //// MDI : multiple windows and documents with containing frame - MSW only) + /// single window : (one document at a time, only one frame, as in Windows Write) + if (argc > 1) + { + if (strcmp(argv[1], "-single") == 0) + { + singleWindowMode = TRUE; + } + } + + //// Create a document manager + m_docManager = new wxDocManager; + + //// Create a template relating drawing documents to their views + (void) new wxDocTemplate(m_docManager, "Drawing", "*.drw", "", "drw", "Drawing Doc", "Drawing View", + CLASSINFO(DrawingDocument), CLASSINFO(DrawingView)); + + if (singleWindowMode) + { + // If we've only got one window, we only get to edit + // one document at a time. Therefore no text editing, just + // doodling. + m_docManager->SetMaxDocsOpen(1); + } + else + //// Create a template relating text documents to their views + (void) new wxDocTemplate(m_docManager, "Text", "*.txt", "", "txt", "Text Doc", "Text View", + CLASSINFO(TextEditDocument), CLASSINFO(TextEditView)); + + //// Create the main frame window + frame = new MyFrame(m_docManager, NULL, "DocView Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE); + + //// Give it an icon (this is ignored in MDI mode: uses resources) +#ifdef __WINDOWS__ + frame->SetIcon(wxIcon("doc_icn")); +#endif +#ifdef __X__ + frame->SetIcon(wxIcon("aiai.xbm")); +#endif + + //// Make a menubar + wxMenu *file_menu = new wxMenu; + wxMenu *edit_menu = NULL; + + file_menu->Append(wxID_NEW, "&New..."); + file_menu->Append(wxID_OPEN, "&Open..."); + + if (singleWindowMode) + { + file_menu->Append(wxID_CLOSE, "&Close"); + file_menu->Append(wxID_SAVE, "&Save"); + file_menu->Append(wxID_SAVEAS, "Save &As..."); + file_menu->AppendSeparator(); + file_menu->Append(wxID_PRINT, "&Print..."); + file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); + file_menu->Append(wxID_PREVIEW, "Print Pre&view"); + + edit_menu = new wxMenu; + edit_menu->Append(wxID_UNDO, "&Undo"); + edit_menu->Append(wxID_REDO, "&Redo"); + edit_menu->AppendSeparator(); + edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); + + frame->editMenu = edit_menu; + } + + file_menu->AppendSeparator(); + file_menu->Append(wxID_EXIT, "E&xit"); + + // A nice touch: a history of files visited. Use this menu. + m_docManager->FileHistoryUseMenu(file_menu); + + wxMenu *help_menu = new wxMenu; + help_menu->Append(DOCVIEW_ABOUT, "&About"); + + wxMenuBar *menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); + if (edit_menu) + menu_bar->Append(edit_menu, "&Edit"); + menu_bar->Append(help_menu, "&Help"); + + if (singleWindowMode) + frame->canvas = frame->CreateCanvas(NULL, frame); + + //// Associate the menu bar with the frame + frame->SetMenuBar(menu_bar); + + frame->Centre(wxBOTH); + frame->Show(TRUE); + + SetTopWindow(frame); + return TRUE; +} + +int MyApp::OnExit(void) +{ + delete m_docManager; + return 0; +} + +/* + * Centralised code for creating a document frame. + * Called from view.cpp, when a view is created, but not used at all + * in 'single window' mode. + */ + +wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas) +{ + //// Make a child frame + wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), "Child Frame", + wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE); + +#ifdef __WINDOWS__ + subframe->SetIcon(wxString(isCanvas ? "chrt_icn" : "notepad_icn")); +#endif +#ifdef __X__ + subframe->SetIcon(wxIcon("aiai.xbm")); +#endif + + //// Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(wxID_NEW, "&New..."); + file_menu->Append(wxID_OPEN, "&Open..."); + file_menu->Append(wxID_CLOSE, "&Close"); + file_menu->Append(wxID_SAVE, "&Save"); + file_menu->Append(wxID_SAVEAS, "Save &As..."); + + if (isCanvas) + { + file_menu->AppendSeparator(); + file_menu->Append(wxID_PRINT, "&Print..."); + file_menu->Append(wxID_PRINT_SETUP, "Print &Setup..."); + file_menu->Append(wxID_PREVIEW, "Print Pre&view"); + } + + wxMenu *edit_menu = NULL; + + if (isCanvas) + { + edit_menu = new wxMenu; + edit_menu->Append(wxID_UNDO, "&Undo"); + edit_menu->Append(wxID_REDO, "&Redo"); + edit_menu->AppendSeparator(); + edit_menu->Append(DOCVIEW_CUT, "&Cut last segment"); + + doc->GetCommandProcessor()->SetEditMenu(edit_menu); + } + + wxMenu *help_menu = new wxMenu; + help_menu->Append(DOCVIEW_ABOUT, "&About"); + + wxMenuBar *menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); + if (isCanvas) + menu_bar->Append(edit_menu, "&Edit"); + menu_bar->Append(help_menu, "&Help"); + + //// Associate the menu bar with the frame + subframe->SetMenuBar(menu_bar); + + subframe->Centre(wxBOTH); + + return subframe; +} + +/* + * This is the top-level window of the application. + */ + +IMPLEMENT_CLASS(MyFrame, wxDocParentFrame) +BEGIN_EVENT_TABLE(MyFrame, wxDocParentFrame) + EVT_MENU(DOCVIEW_ABOUT, MyFrame::OnAbout) +END_EVENT_TABLE() + +MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title, + const wxPoint& pos, const wxSize& size, const long type): + wxDocParentFrame(manager, frame, title, pos, size, type) +{ + // This pointer only needed if in single window mode + canvas = NULL; + editMenu = NULL; +} + +void MyFrame::OnAbout(wxCommandEvent& event) +{ + (void)wxMessageBox("DocView Demo\nAuthor: Julian Smart julian.smart@ukonline.co.uk\nUsage: docview.exe [-single]", "About DocView"); +} + +// Creates a canvas. Called either from view.cc when a new drawing +// view is created, or in OnInit as a child of the main window, +// if in 'single window' mode. +MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent) +{ + int width, height; + parent->GetClientSize(&width, &height); + + // Non-retained canvas + MyCanvas *canvas = new MyCanvas(view, parent, wxPoint(0, 0), wxSize(width, height), 0); + canvas->SetCursor(wxCursor(wxCURSOR_PENCIL)); + + // Give it scrollbars + canvas->SetScrollbars(20, 20, 50, 50); + + return canvas; +} + +MyFrame *GetMainFrame(void) +{ + return frame; +} + diff --git a/samples/docview/docview.def b/samples/docview/docview.def new file mode 100644 index 0000000000..78ac0eda3f --- /dev/null +++ b/samples/docview/docview.def @@ -0,0 +1,8 @@ +NAME DocView +DESCRIPTION 'Document architecture test' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/samples/docview/docview.h b/samples/docview/docview.h new file mode 100644 index 0000000000..b48e4de09c --- /dev/null +++ b/samples/docview/docview.h @@ -0,0 +1,66 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: docview.h +// Purpose: Document/view demo +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma interface "docview.h" +#endif + +#ifndef __DOCVIEWSAMPLEH__ +#define __DOCVIEWSAMPLEH__ + +#include "wx/docview.h" + +class wxDocManager; + +// Define a new application +class MyApp: public wxApp +{ + public: + MyApp(void); + bool OnInit(void); + int OnExit(void); + + wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas); + + protected: + wxDocManager* m_docManager; +}; + +DECLARE_APP(MyApp) + +// Define a new frame +class MyCanvas; +class MyFrame: public wxDocParentFrame +{ + DECLARE_CLASS(MyFrame) + public: + wxMenu *editMenu; + + // This pointer only needed if in single window mode + MyCanvas *canvas; + + MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, + const long type); + + void OnAbout(wxCommandEvent& event); + MyCanvas *CreateCanvas(wxView *view, wxFrame *parent); + +DECLARE_EVENT_TABLE() +}; + +extern MyFrame *GetMainFrame(void); + +#define DOCVIEW_CUT 1 +#define DOCVIEW_ABOUT 2 + +extern bool singleWindowMode; + +#endif diff --git a/samples/docview/docview.rc b/samples/docview/docview.rc new file mode 100644 index 0000000000..bd13d9b0c4 --- /dev/null +++ b/samples/docview/docview.rc @@ -0,0 +1,6 @@ +doc_icn ICON "doc.ico" +aiai_icn ICON "aiai.ico" +chrt_icn ICON "chart.ico" +notepad_icn ICON "notepad.ico" +#include "wx/msw/wx.rc" + diff --git a/samples/docview/makefile.b32 b/samples/docview/makefile.b32 new file mode 100644 index 0000000000..f81b4d3365 --- /dev/null +++ b/samples/docview/makefile.b32 @@ -0,0 +1,67 @@ +# +# File: makefile.b32 +# Author: Patrick Halke +# Created: 1995 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds 32bit buttonbar example. + +# WXWIN and BCCDIR are set by parent make + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makeb32.env + +WXLIBDIR = $(WXDIR)\lib +WXLIB=$(WXLIBDIR)\wx32.lib +LIBS=$(WXLIB) cw32 import32 + +TARGET=docview + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = docview.obj doc.obj view.obj + +$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) +! + brc32 -K $(TARGET).res + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +docview.obj: docview.$(SRCSUFF) docview.h + +doc.obj: doc.$(SRCSUFF) doc.h + +view.obj: view.$(SRCSUFF) view.h + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + diff --git a/samples/docview/makefile.bcc b/samples/docview/makefile.bcc new file mode 100644 index 0000000000..186bee0653 --- /dev/null +++ b/samples/docview/makefile.bcc @@ -0,0 +1,77 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds docview example (DOS). + +!if "$(BCCDIR)" == "" +!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 +!endif + +!if "$(WXWIN)" == "" +!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx +!endif + +!ifndef FINAL +FINAL=0 +!endif + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makebcc.env + +THISDIR = $(WXDIR)\samples\docview +WXLIB = $(WXDIR)\lib\wx.lib +LIBS=$(WXLIB) mathwl cwl import +INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw +CFG=$(WXDIR)\src\wxwin.cfg + +!if "$(FINAL)" == "0" +LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -O2 +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = docview.obj doc.obj view.obj + +docview: docview.exe + +all: docview.exe + +docview.exe: $(WXLIB) $(OBJECTS) docview.def docview.res + tlink $(LINKFLAGS) @&&! +c0wl.obj $(OBJECTS) +docview +nul +$(LIBS) +docview.def +! + rc -30 -K docview.res + +.$(SRCSUFF).obj: + bcc $(CPPFLAGS) -c {$< } + +docview.obj: docview.$(SRCSUFF) + +doc.obj: doc.$(SRCSUFF) + +view.obj: view.$(SRCSUFF) + +docview.res : docview.rc $(WXDIR)\include\msw\wx.rc + rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa docview + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws diff --git a/samples/docview/makefile.dos b/samples/docview/makefile.dos new file mode 100644 index 0000000000..3e32b22dce --- /dev/null +++ b/samples/docview/makefile.dos @@ -0,0 +1,74 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1995 +# Updated: +# Copyright: (c) 1995, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds docview example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\samples\docview +INC=/I$(WXDIR)\include + +HEADERS = docview.h +SOURCES = docview.$(SRCSUFF) +OBJECTS = docview.obj doc.obj view.obj + +all: docview.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + + +docview.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(OBJECTS) docview.def docview.res + link $(LINKFLAGS) @<< +$(WXDIR)\src\msw\dummy.obj $(OBJECTS), +docview, +NUL, +$(LIBS), +docview.def +; +<< + rc -30 -K docview.res + +docview.obj: docview.h docview.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +view.obj: view.h view.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +doc.obj: doc.h doc.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +docview.res : docview.rc $(WXDIR)\include\wx\msw\wx.rc + rc -r /dFAFA_LIB /i$(WXDIR)\include docview + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb + diff --git a/samples/docview/makefile.g95 b/samples/docview/makefile.g95 new file mode 100644 index 0000000000..5fe3bf52db --- /dev/null +++ b/samples/docview/makefile.g95 @@ -0,0 +1,43 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for docview example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/makeg95.env + +OBJECTS = $(OBJDIR)/docview.$(OBJSUFF) $(OBJDIR)/view.$(OBJSUFF) $(OBJDIR)/doc.$(OBJSUFF)\ + $(OBJDIR)/docview_resources.$(OBJSUFF) + + +all: $(OBJDIR) docview$(GUISUFFIX) + +$(OBJDIR): + mkdir $(OBJDIR) + +docview$(GUISUFFIX): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o docview$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/docview.$(OBJSUFF): docview.$(SRCSUFF) docview.h doc.h view.h + $(CC) -c $(CPPFLAGS) -o $@ docview.$(SRCSUFF) + +$(OBJDIR)/doc.$(OBJSUFF): doc.$(SRCSUFF) doc.h + $(CC) -c $(CPPFLAGS) -o $@ doc.$(SRCSUFF) + +$(OBJDIR)/view.$(OBJSUFF): view.$(SRCSUFF) view.h + $(CC) -c $(CPPFLAGS) -o $@ view.$(SRCSUFF) + +$(OBJDIR)/docview_resources.o: docview.rc + $(RESCOMP) -i docview.rc -o $(OBJDIR)/docview_resources.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) docview$(GUISUFFIX).exe core *.rsc *.res diff --git a/samples/docview/makefile.nt b/samples/docview/makefile.nt new file mode 100644 index 0000000000..d17489dd3a --- /dev/null +++ b/samples/docview/makefile.nt @@ -0,0 +1,75 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds docview example (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +WXUSINGDLL=0 + +!include $(WXDIR)\src\ntwxwin.mak + +THISDIR = $(WXDIR)\samples\docview +PROGRAM=docview + +OBJECTS = $(PROGRAM).obj doc.obj view.obj + +$(PROGRAM): $(PROGRAM).exe + +all: wx $(PROGRAM).exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res +$(LIBS) +<< + +$(PROGRAM).obj: $(PROGRAM).h doc.h view.h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +doc.obj: doc.h doc.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +view.obj: view.h view.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.pdb + -erase *.sbr + + diff --git a/samples/docview/makefile.sc b/samples/docview/makefile.sc new file mode 100644 index 0000000000..250054f91f --- /dev/null +++ b/samples/docview/makefile.sc @@ -0,0 +1,38 @@ +# Symantec C++ makefile for docview example +# NOTE that peripheral libraries are now dealt in main wxWindows makefile. + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makesc.env + +WXLIB = $(WXDIR)\lib\wx.lib +INCDIR = $(WXDIR)\include +MSWINC = $(INCDIR)\msw +BASEINC = $(INCDIR)\base + +CC=sc +RC=rc +CFLAGS = -o -ml -W -Dwx_msw +LDFLAGS = -ml -W + +INCLUDE=$(BASEINC);$(MSWINC) + +LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib + +OBJECTS=docview.obj view.obj doc.obj + +.$(SRCSUFF).obj: + *$(CC) -c $(CFLAGS) -I$(INCLUDE) $< + +.rc.res: + *$(RC) -r -I$(INCLUDE) $< + +docview.exe: $(OBJECTS) docview.def docview.res + *$(CC) $(LDFLAGS) -o$@ $(OBJECTS) docview.def $(LIBS) + *$(RC) -k docview.res + +clean: + -del *.obj + -del *.exe + -del *.res + -del *.map + -del *.rws diff --git a/samples/docview/makefile.unx b/samples/docview/makefile.unx new file mode 100644 index 0000000000..bbdccc3fc4 --- /dev/null +++ b/samples/docview/makefile.unx @@ -0,0 +1,64 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for docview example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/make.env + +OBJECTS = $(OBJDIR)/docview.$(OBJSUFF) $(OBJDIR)/view.$(OBJSUFF) $(OBJDIR)/doc.$(OBJSUFF) + +.SUFFIXES: + +all: $(OBJDIR) wx$(GUISUFFIX) docview$(GUISUFFIX) + +wx_motif: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif + +wx_ol: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview +motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK= + +xview: + $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' + +hp: + $(MAKE) -f makefile,unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \ + XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)' + +$(OBJDIR): + mkdir $(OBJDIR) + +docview$(GUISUFFIX): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o docview$(GUISUFFIX) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/docview.$(OBJSUFF): docview.$(SRCSUFF) docview.h doc.h view.h + $(CC) -c $(CPPFLAGS) -o $@ docview.$(SRCSUFF) + +$(OBJDIR)/doc.$(OBJSUFF): doc.$(SRCSUFF) doc.h + $(CC) -c $(CPPFLAGS) -o $@ doc.$(SRCSUFF) + +$(OBJDIR)/view.$(OBJSUFF): view.$(SRCSUFF) view.h + $(CC) -c $(CPPFLAGS) -o $@ view.$(SRCSUFF) + +clean_motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany + +clean_ol: + $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany + +clean_hp: + $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany + +cleanany: + rm -f $(OBJECTS) docview$(GUISUFFIX) core diff --git a/samples/docview/makefile.vms b/samples/docview/makefile.vms new file mode 100644 index 0000000000..1a64fc7f30 --- /dev/null +++ b/samples/docview/makefile.vms @@ -0,0 +1,44 @@ +#************************************************************************ +# Makefile for DOCVIEW under VMS +# by Stefan Hammes +# (incomplete) update history: +# 09.06.95 +#************************************************************************ + +#************************************************************************ +# Definition section +# (cave: definitions and includes must begin with ',') +#************************************************************************ + +APPOPTS = +APPDEFS = +APPINCS = + +#************************************************************************ +# Module section +#************************************************************************ + +# Name of main module +MAIN = docview + +# Object modules of the application. +OBJS = docview.obj view.obj doc.obj +OBJLIST =docview.obj,view.obj,doc.obj + +.include [--.src]makevms.env + +# main dependency +$(MAIN).exe : $(OBJS) + $(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option + - purge *.exe + +#************************************************************************ +# Header file depedencies following +#************************************************************************ + +docview.$(OBJSUFF) : docview.$(SRCSUFF) docview.h doc.h view.h + +doc.$(OBJSUFF) : doc.$(SRCSUFF) doc.h + +view.$(OBJSUFF) : view.$(SRCSUFF) view.h + diff --git a/samples/docview/makefile.wat b/samples/docview/makefile.wat new file mode 100644 index 0000000000..bafa16f3a5 --- /dev/null +++ b/samples/docview/makefile.wat @@ -0,0 +1,43 @@ +# +# Makefile for WATCOM +# +# Created by D.Chubraev, chubraev@iem.ee.ethz.ch +# 8 Nov 1994 +# + +WXDIR = ..\.. + +!include $(WXDIR)\src\makewat.env + +WXLIB = $(WXDIR)\lib +NAME = docview +LNK = $(name).lnk +OBJS = $(name).obj doc.obj view.obj + +all: $(name).exe + +$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib + wlink @$(LNK) + $(BINDCOMMAND) $(name).res + +$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc + $(RC) $(RESFLAGS1) $(name).rc + +$(LNK) : makefile.wat + %create $(LNK) + @%append $(LNK) debug all + @%append $(LNK) system $(LINKOPTION) + @%append $(LNK) $(MINDATA) + @%append $(LNK) $(MAXDATA) + @%append $(LNK) $(STACK) + @%append $(LNK) name $(name) + @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib + @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i + @for %i in ($(OBJS)) do @%append $(LNK) file %i + +thing: .SYMBOLIC + echo $(WATLIBDIR) + +clean: .SYMBOLIC + -erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex + diff --git a/samples/docview/notepad.ico b/samples/docview/notepad.ico new file mode 100644 index 0000000000000000000000000000000000000000..5d07bf79a3816057ef95a18fb91f23871092fc31 GIT binary patch literal 766 zcmbVKF^j7-RFR+mfB7od;Od^;vO}ZfBQ&LJ2V?-jCDLL~C#NZagM;I%j zcDqx>sM_S|{9If6_#*$<|E|8A!Y23~4O?_U-zu)WBy=!zs+|>dTJJ4Cpn>GLVSetTitle("DrawingView"); + + canvas = GetMainFrame()->CreateCanvas(this, frame); +#ifdef __X__ + // X seems to require a forced resize + int x, y; + frame->GetSize(&x, &y); + frame->SetSize(x, y); +#endif + frame->Show(TRUE); + } + else + { + // Single-window mode + frame = GetMainFrame(); + canvas = GetMainFrame()->canvas; + canvas->view = this; + + // Associate the appropriate frame with this view. + SetFrame(frame); + + // Make sure the document manager knows that this is the + // current view. + Activate(TRUE); + + // Initialize the edit menu Undo and Redo items + doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu); + doc->GetCommandProcessor()->Initialize(); + } + + return TRUE; +} + +// Sneakily gets used for default print/preview +// as well as drawing on the screen. +void DrawingView::OnDraw(wxDC *dc) +{ + dc->SetFont(*wxNORMAL_FONT); + dc->SetPen(*wxBLACK_PEN); + + wxNode *node = ((DrawingDocument *)GetDocument())->GetDoodleSegments().First(); + while (node) + { + DoodleSegment *seg = (DoodleSegment *)node->Data(); + seg->Draw(dc); + node = node->Next(); + } +} + +void DrawingView::OnUpdate(wxView *sender, wxObject *hint) +{ + if (canvas) + canvas->Refresh(); + +/* Is the following necessary? +#ifdef __WINDOWS__ + if (canvas) + canvas->Refresh(); +#else + if (canvas) + { + wxClientDC dc(canvas); + dc.Clear(); + OnDraw(& dc); + } +#endif +*/ +} + +// Clean up windows used for displaying the view. +bool DrawingView::OnClose(bool deleteWindow) +{ + if (!GetDocument()->Close()) + return FALSE; + + // Clear the canvas in case we're in single-window mode, + // and the canvas stays. + canvas->Clear(); + canvas->view = NULL; + canvas = NULL; + + wxString s(wxTheApp->GetAppName()); + if (frame) + frame->SetTitle(s); + + SetFrame(NULL); + + Activate(FALSE); + + if (deleteWindow && !singleWindowMode) + { + delete frame; + return TRUE; + } + return TRUE; +} + +void DrawingView::OnCut(wxCommandEvent& event) +{ + DrawingDocument *doc = (DrawingDocument *)GetDocument(); + doc->GetCommandProcessor()->Submit(new DrawingCommand("Cut Last Segment", DOODLE_CUT, doc, NULL)); +} + +IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView) + +bool TextEditView::OnCreate(wxDocument *doc, long flags) +{ + frame = wxGetApp().CreateChildFrame(doc, this, FALSE); + + int width, height; + frame->GetClientSize(&width, &height); + textsw = new MyTextWindow(this, frame, wxPoint(0, 0), wxSize(width, height), wxTE_MULTILINE); + frame->SetTitle("TextEditView"); + +#ifdef __X__ + // X seems to require a forced resize + int x, y; + frame->GetSize(&x, &y); + frame->SetSize(x, y); +#endif + + frame->Show(TRUE); + Activate(TRUE); + + return TRUE; +} + +// Handled by wxTextWindow +void TextEditView::OnDraw(wxDC *dc) +{ +} + +void TextEditView::OnUpdate(wxView *sender, wxObject *hint) +{ +} + +bool TextEditView::OnClose(bool deleteWindow) +{ + if (!GetDocument()->Close()) + return FALSE; + + Activate(FALSE); + + if (deleteWindow) + { + delete frame; + return TRUE; + } + return TRUE; +} + +/* + * Window implementations + */ + +BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) + EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent) +END_EVENT_TABLE() + +// Define a constructor for my canvas +MyCanvas::MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style): + wxScrolledWindow(frame, -1, pos, size, style) +{ + view = v; +} + +// Define the repainting behaviour +void MyCanvas::OnDraw(wxDC& dc) +{ + if (view) + view->OnDraw(& dc); +} + +// This implements a tiny doodling program. Drag the mouse using +// the left button. +void MyCanvas::OnMouseEvent(wxMouseEvent& event) +{ + if (!view) + return; + + static DoodleSegment *currentSegment = NULL; + + wxClientDC dc(this); + PrepareDC(dc); + + dc.SetPen(*wxBLACK_PEN); + + wxPoint pt(event.GetLogicalPosition(dc)); + + if (currentSegment && event.LeftUp()) + { + if (currentSegment->lines.Number() == 0) + { + delete currentSegment; + currentSegment = NULL; + } + else + { + // We've got a valid segment on mouse left up, so store it. + DrawingDocument *doc = (DrawingDocument *)view->GetDocument(); + + doc->GetCommandProcessor()->Submit(new DrawingCommand("Add Segment", DOODLE_ADD, doc, currentSegment)); + + view->GetDocument()->Modify(TRUE); + currentSegment = NULL; + } + } + + if (xpos > -1 && ypos > -1 && event.Dragging()) + { + if (!currentSegment) + currentSegment = new DoodleSegment; + + DoodleLine *newLine = new DoodleLine; + newLine->x1 = xpos; newLine->y1 = ypos; + newLine->x2 = pt.x; newLine->y2 = pt.y; + currentSegment->lines.Append(newLine); + + dc.DrawLine(xpos, ypos, pt.x, pt.y); + } + xpos = pt.x; + ypos = pt.y; +} + +// Define a constructor for my text subwindow +MyTextWindow::MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style): + wxTextCtrl(frame, -1, "", pos, size, style) +{ + view = v; +} + + diff --git a/samples/docview/view.h b/samples/docview/view.h new file mode 100644 index 0000000000..074d940f0a --- /dev/null +++ b/samples/docview/view.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: view.h +// Purpose: View classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma interface +#endif + +#ifndef __VIEWSAMPLEH__ +#define __VIEWSAMPLEH__ + +#include "wx/docview.h" + +class MyCanvas: public wxScrolledWindow +{ + public: + wxView *view; + + MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style); + virtual void OnDraw(wxDC& dc); + void OnMouseEvent(wxMouseEvent& event); + +DECLARE_EVENT_TABLE() +}; + +class MyTextWindow: public wxTextCtrl +{ + public: + wxView *view; + + MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style); +}; + +class DrawingView: public wxView +{ + DECLARE_DYNAMIC_CLASS(DrawingView) + private: + public: + wxFrame *frame; + MyCanvas *canvas; + + DrawingView(void) { canvas = NULL; frame = NULL; }; + ~DrawingView(void) {}; + + bool OnCreate(wxDocument *doc, long flags); + void OnDraw(wxDC *dc); + void OnUpdate(wxView *sender, wxObject *hint = NULL); + bool OnClose(bool deleteWindow = TRUE); + + void OnCut(wxCommandEvent& event); + +DECLARE_EVENT_TABLE() +}; + +class TextEditView: public wxView +{ + DECLARE_DYNAMIC_CLASS(TextEditView) + private: + public: + wxFrame *frame; + MyTextWindow *textsw; + + TextEditView(wxDocument *doc = NULL): wxView(doc) { frame = NULL; textsw = NULL; } + ~TextEditView(void) {} + + bool OnCreate(wxDocument *doc, long flags); + void OnDraw(wxDC *dc); + void OnUpdate(wxView *sender, wxObject *hint = NULL); + bool OnClose(bool deleteWindow = TRUE); +}; + +#endif diff --git a/samples/listctrl/aiai.ico b/samples/listctrl/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3db6563cc0b9f4588e1e994fe54b90a3cb1d6c1 GIT binary patch literal 766 zcmc(bJ930T3`Bcft}@v=+L+MC@X_W5#I6lE$3$=(hlEfB4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8=4!cqpF2v^8Mt1|ir$7{^7}%g)qZ@;N8cK=G4dK> a`b|sMn@jkrjqLUsGxeE!@)y=UJ%u~E!}Ey% literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/toolbrai.ico b/samples/listctrl/bitmaps/toolbrai.ico new file mode 100644 index 0000000000000000000000000000000000000000..99069f7c67320fd7e1cf63f6ee9c0c2888e7069d GIT binary patch literal 766 zcma)4y-ve05WbK~*%Bt!WaKTH!3ztIMEnq4{3Hw@;s-$@Lk9*VvQepNj_-VqTdE>B z=R4oscR#ijq718Pu1Vzmis%OWEzkfhkkJYn0`9U{B79`6ZqP8vdyicR4j(a#1z<@? z)GuPp4`St9s{s?3mHZPJ9~9{Ez^()zK6ZN>s#Fp?9fe zQYs0?+^ZRMX`I`%$ACXEe`J0|%}@aO5hMJM hn)&UMx&LDB_Pkpkc&z7YsHS49r((CBkTj!Mgz}rHxAeBL12A1hx8wdNzED%9JWo7^Y`-NeVsyue8_f>~eJg z9k0GWK=StieA6GPJ@rKG@JUNy?X?7eH$ren%Md9gdKI$W$XOAUmmry!5-Dq8r!>Z? zBAzxzO$%UbpmkU$zHE6l(2OW(RYUe1r&$ z)Fj+QvAFmA=iIxDWqcdyW1sT2rPo)xMz%;3e5eO~rChb~`%^9A_*2Ywb{KLcM0*hm9^!K!#8l_#G{|IAsMso6S1XX#9x FeFHZg6}12W literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/toolchec.ico b/samples/listctrl/bitmaps/toolchec.ico new file mode 100644 index 0000000000000000000000000000000000000000..d64e0105a221a5ef0d109485c3c1d7377678d263 GIT binary patch literal 766 zcmeIwu?@mN429trL`gwKg_J9qf-o6(8)PJ|V+@dJ=m1d=M2Pbn5HxH6@9wj$SV|E^ zDmWpG<=GFU34Mlu1quzRgx&WfiK~>JjmoH;Gu;>VxH9tz9Dn5HpP&8$`~#od8Lv2E ri;NV_M$x)yW$nDOW?5QeC5!rHP2b^+6Z{1&x=3*=Y;eE@H@wpWy>5zR literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/tooldata.ico b/samples/listctrl/bitmaps/tooldata.ico new file mode 100644 index 0000000000000000000000000000000000000000..4cdd40a5d08f08fda9155fde61acea05b4eba67c GIT binary patch literal 766 zcmah{F>ZuF3^ciuRusrrr440%ad}cY=ysowHoxHs>7x5Ul9CRJQ=FOg!Xb20471+x z%o>9bsc^OJNf=A_iKK~$UKr`=SwzGR0lDENj47%T6(jw7r*s~ZlPrTp#61IalcLvfxC zXFd@14bMX^9C_8erehh+DUNPA=Dl%P*?Mi@+{UGO;S2pY4-#yUgC(f|VWS9~fhRzL m033FxX8e{{c<$hQMK9tPeNCc$9it@z`-HzPRRE-KyvZN@WZ_2u literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/toolgame.ico b/samples/listctrl/bitmaps/toolgame.ico new file mode 100644 index 0000000000000000000000000000000000000000..3174273bee5d3fcc4515b353756de0e14cc562b0 GIT binary patch literal 766 zcmbtSF>-@25L`lL7+0i93uS)c{LCs{xb>!5Tlv`4qyYy)HNCVi}Wc4`T=hlt!&xy6+b~hKhse`hZt~RmZ!9~6SPxL zrX(II$tMVKYMadp79S75lg4LZBfJO>kLnfDevbg?LkQPFy{3pUYBYiQ18Fls%~IC= z5wW@vqEB&_5cM;I(KH#1vL6kZlA|H3=Z2%flcJ+RYeoCrXvperZZMVoWS}Syc?Z>u z@+>t7zN)Uj=@~q`V@g#lYMqzhe0Nm+Rn*Bke+SWUkZv>qOQ|WLS{bj=Y7vu{Kl8Hi zGJ^pyp>7*p0G9cRlqic-%KRNnZN7GyuTgqC;D-V2G__fIOaCd~ZFWbk8dAS}DOBHr zj4nTo3(yE#VJ-LpC{)DaJ;3dw-ekDh$mwl5Wi0*HY3+d5hUmz>wqKLOR!20XGCT>N Gg2fjcwd?5s literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/tooltime.ico b/samples/listctrl/bitmaps/tooltime.ico new file mode 100644 index 0000000000000000000000000000000000000000..b769904f4d4cd334ab4753238c057338fefa6189 GIT binary patch literal 766 zcmbV~J#vFE5QQJHXGrH%X-%11Bu7f8bf~2Bl{kvalys)ZWb>^-LS`~}#w$H(pWglm z4N}Eunisi!KS{6bZ=eAmpwgZdL;K&N#8iya#)_-H@7Z0j>y(*$fZ<2JJY-$h#jV7z zZT%3it^8H}z)g#WbqlvH7jW5Z%r|PCo-FZe__!q0W+9wNm}p287# c6I9tRzm4NZYQcMfHfcs&&Pg@awY?wq2bTB6kpKVy literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/tooltodo.ico b/samples/listctrl/bitmaps/tooltodo.ico new file mode 100644 index 0000000000000000000000000000000000000000..c6314c6baf7b058325e4cc51a94baeae43b4abe1 GIT binary patch literal 766 zcmbVKF>b>!3_LXfA|Qi1WsS!^qfg2Y$}Ivqt~pJJ^>rr7osL!35O*$h1|Rdzy*=sP;-l>X=shmyr613f}e$`dH zVZQ!)DS3da5c6dex$}1=kNxC`;&01`y@WSnORR_m;V#I}WyNL-!i_NM|M1qGzf=v~ Mx9U%&`ny&A1G3v5RsaA1 literal 0 HcmV?d00001 diff --git a/samples/listctrl/bitmaps/toolword.ico b/samples/listctrl/bitmaps/toolword.ico new file mode 100644 index 0000000000000000000000000000000000000000..a1a8838c276178deae7c6d9defd32b2909ace453 GIT binary patch literal 766 zcmcIiI}XAy41KMTItCUN1~PJt9)+6_!NqbEM#hc|2=nY#QQRUVBzWnIf3fwN7HGI) zTtjhdfi3NUjATzXSaBy@k`Jo!tW9YrqwP^K<2^$3M0Uh9MxO$Wba literal 0 HcmV?d00001 diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp new file mode 100644 index 0000000000..24ee28c00b --- /dev/null +++ b/samples/listctrl/listtest.cpp @@ -0,0 +1,480 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: listctrl.cpp +// Purpose: wxListCtrl sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation +#pragma interface +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include "wx/listctrl.h" +#include "listtest.h" + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(LIST_QUIT, MyFrame::OnQuit) + EVT_MENU(LIST_ABOUT, MyFrame::OnAbout) + EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView) + EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView) + EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView) + EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView) + EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView) + EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl) + EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag) + EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag) + EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnBeginLabelEdit) + EVT_LIST_END_LABEL_EDIT(LIST_CTRL, MyListCtrl::OnEndLabelEdit) + EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem) + EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo) + EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo) + EVT_LIST_ITEM_SELECTED(LIST_CTRL, MyListCtrl::OnSelected) + EVT_LIST_ITEM_DESELECTED(LIST_CTRL, MyListCtrl::OnDeselected) + EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnKeyDown) +END_EVENT_TABLE() + +IMPLEMENT_APP(MyApp) + +// `Main program' equivalent, creating windows and returning main app frame +bool MyApp::OnInit(void) +{ + // Create the main frame window + MyFrame *frame = new MyFrame(NULL, "wxListCtrl Test", 50, 50, 450, 340); + + // This reduces flicker effects - even better would be to define OnEraseBackground + // to do nothing. When the list control's scrollbars are show or hidden, the + // frame is sent a background erase event. + frame->SetBackgroundColour(wxColour(255, 255, 255)); + + // Give it an icon +#ifdef __WINDOWS__ + frame->SetIcon(wxIcon("mondrian")); +#endif +#ifdef __X__ + frame->SetIcon(wxIcon("aiai.xbm")); +#endif + + // Make an image list containing large icons + m_imageListNormal = new wxImageList(32, 32, TRUE); + m_imageListSmall = new wxImageList(16, 16, TRUE); + + wxIcon *icon = new wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + + icon = new wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListSmall->Add(*icon); + delete icon; + + // Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(LIST_LIST_VIEW, "&List view"); + file_menu->Append(LIST_REPORT_VIEW, "&Report view"); + file_menu->Append(LIST_ICON_VIEW, "&Icon view"); + file_menu->Append(LIST_ICON_TEXT_VIEW, "Icon view with &text"); + file_menu->Append(LIST_SMALL_ICON_VIEW, "&Small icon view"); + file_menu->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text"); + file_menu->AppendSeparator(); + file_menu->Append(LIST_ABOUT, "&About"); + file_menu->Append(LIST_QUIT, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + frame->SetMenuBar(menu_bar); + + // Make a panel with a message + frame->m_listCtrl = new MyListCtrl(frame, LIST_CTRL, wxPoint(0, 0), wxSize(400, 200), + wxLC_LIST|wxSUNKEN_BORDER); +// wxLC_LIST|wxLC_USER_TEXT|wxSUNKEN_BORDER); // wxLC_USER_TEXT requires app to supply all text on demand + frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), wxTE_MULTILINE|wxSUNKEN_BORDER); + + wxLayoutConstraints *c = new wxLayoutConstraints; + c->top.SameAs (frame, wxTop); + c->left.SameAs (frame, wxLeft); + c->right.SameAs (frame, wxRight); + c->height.PercentOf (frame, wxHeight, 66); + frame->m_listCtrl->SetConstraints(c); + + c = new wxLayoutConstraints; + c->top.Below (frame->m_listCtrl); + c->left.SameAs (frame, wxLeft); + c->right.SameAs (frame, wxRight); + c->bottom.SameAs (frame, wxBottom); + frame->m_logWindow->SetConstraints(c); + frame->SetAutoLayout(TRUE); + + for ( int i=0; i < 30; i++) + { + char buf[20]; + sprintf(buf, "Item %d", i); + long tmp = frame->m_listCtrl->InsertItem(i, buf); + } + + frame->CreateStatusBar(3); + frame->SetStatusText("", 0); + + // Show the frame + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +// My frame constructor +MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h): + wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) +{ + m_listCtrl = NULL; + m_logWindow = NULL; +} + +MyFrame::~MyFrame(void) +{ + delete wxGetApp().m_imageListNormal; + delete wxGetApp().m_imageListSmall; +} + +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyFrame::OnAbout(wxCommandEvent& event) +{ + wxMessageDialog dialog(this, "List test sample\nJulian Smart (c) 1997", + "About list test", wxOK|wxCANCEL); + + dialog.ShowModal(); +} + +void MyFrame::OnListView(wxCommandEvent& event) +{ + m_logWindow->Clear(); + m_listCtrl->DeleteAllItems(); + m_listCtrl->SetSingleStyle(wxLC_LIST); + m_listCtrl->SetImageList(NULL, wxIMAGE_LIST_NORMAL); + m_listCtrl->SetImageList(NULL, wxIMAGE_LIST_SMALL); + + for ( int i=0; i < 30; i++) + { + char buf[20]; + sprintf(buf, "Item %d", i); + long tmp = m_listCtrl->InsertItem(i, buf); + } +} + +void MyFrame::OnReportView(wxCommandEvent& event) +{ + m_logWindow->Clear(); + m_listCtrl->DeleteAllItems(); + m_listCtrl->SetSingleStyle(wxLC_REPORT); + m_listCtrl->SetImageList(NULL, wxIMAGE_LIST_NORMAL); + m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); + + m_listCtrl->InsertColumn(0, "Column 1", wxLIST_FORMAT_LEFT, 140); + m_listCtrl->InsertColumn(1, "Column 2", wxLIST_FORMAT_LEFT, 140); + + for ( int i=0; i < 30; i++) + { + char buf[20]; + sprintf(buf, "Item %d, col 1", i); + long tmp = m_listCtrl->InsertItem(i, buf, 0); + + sprintf(buf, "Item %d, col 2", i); + tmp = m_listCtrl->SetItem(i, 1, buf); + } +} + +void MyFrame::OnIconView(wxCommandEvent& event) +{ + m_logWindow->Clear(); + m_listCtrl->DeleteAllItems(); + m_listCtrl->SetSingleStyle(wxLC_ICON); + m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); + m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); + + for ( int i=0; i < 9; i++) + { + long tmp = m_listCtrl->InsertItem(i, i); + } +} + +void MyFrame::OnIconTextView(wxCommandEvent& event) +{ + m_logWindow->Clear(); + m_listCtrl->DeleteAllItems(); + m_listCtrl->SetSingleStyle(wxLC_ICON); + m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); + m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); + + for ( int i=0; i < 9; i++) + { + char buf[20]; + sprintf(buf, "Label %d", i); + long tmp = m_listCtrl->InsertItem(i, buf, i); + } +} + +void MyFrame::OnSmallIconView(wxCommandEvent& event) +{ + m_logWindow->Clear(); + m_listCtrl->DeleteAllItems(); + m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON); + m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); + m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); + + for ( int i=0; i < 9; i++) + { + long tmp = m_listCtrl->InsertItem(i, 0); + } +} + +void MyFrame::OnSmallIconTextView(wxCommandEvent& event) +{ + m_logWindow->Clear(); + m_listCtrl->DeleteAllItems(); + m_listCtrl->SetSingleStyle(wxLC_SMALL_ICON); + m_listCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); + m_listCtrl->SetImageList(wxGetApp().m_imageListSmall, wxIMAGE_LIST_SMALL); + + for ( int i=0; i < 9; i++) + { + long tmp = m_listCtrl->InsertItem(i, "Label", 0); + } +} + +// MyListCtrl + +void MyListCtrl::OnBeginDrag(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnBeginDrag\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnBeginRDrag(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnBeginRDrag\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnBeginLabelEdit(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnBeginLabelEdit\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnEndLabelEdit(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnEndLabelEdit\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnDeleteItem(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnDeleteItem\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnGetInfo(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnGetInfo (" << event.m_item.m_itemId << ", " << event.m_item.m_col << ")"; + if ( event.m_item.m_mask & wxLIST_MASK_STATE ) + str << " wxLIST_MASK_STATE"; + if ( event.m_item.m_mask & wxLIST_MASK_TEXT ) + str << " wxLIST_MASK_TEXT"; + if ( event.m_item.m_mask & wxLIST_MASK_IMAGE ) + str << " wxLIST_MASK_IMAGE"; + if ( event.m_item.m_mask & wxLIST_MASK_DATA ) + str << " wxLIST_MASK_DATA"; + if ( event.m_item.m_mask & wxLIST_SET_ITEM ) + str << " wxLIST_SET_ITEM"; + if ( event.m_item.m_mask & wxLIST_MASK_WIDTH ) + str << " wxLIST_MASK_WIDTH"; + if ( event.m_item.m_mask & wxLIST_MASK_FORMAT ) + str << " wxLIST_MASK_WIDTH"; + + if ( event.m_item.m_mask & wxLIST_MASK_TEXT ) + { + event.m_item.m_text = "My callback text"; + } + str << "\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnSetInfo(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnSetInfo\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnSelected(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnSelected\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnDeselected(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnDeselected\n"; + str.flush(); +#endif +} + +void MyListCtrl::OnKeyDown(wxListEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnKeyDown\n"; + str.flush(); +#endif +} + diff --git a/samples/listctrl/listtest.def b/samples/listctrl/listtest.def new file mode 100644 index 0000000000..2559d6f1bc --- /dev/null +++ b/samples/listctrl/listtest.def @@ -0,0 +1,8 @@ +NAME ListCtrl +DESCRIPTION 'ListCtrl wxWindows application' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h new file mode 100644 index 0000000000..4126bbbab2 --- /dev/null +++ b/samples/listctrl/listtest.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: listctrl.h +// Purpose: wxListCtrl sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +// Define a new application type +class MyApp: public wxApp +{ public: + bool OnInit(void); + + wxImageList *m_imageListNormal; + wxImageList *m_imageListSmall; +}; + +class MyListCtrl: public wxListCtrl +{ +public: + MyListCtrl(wxWindow *parent, const wxWindowID id, const wxPoint& pos, + const wxSize& size, long style): + wxListCtrl(parent, id, pos, size, style) + { + } + + void OnBeginDrag(wxListEvent& event); + void OnBeginRDrag(wxListEvent& event); + void OnBeginLabelEdit(wxListEvent& event); + void OnEndLabelEdit(wxListEvent& event); + void OnDeleteItem(wxListEvent& event); + void OnGetInfo(wxListEvent& event); + void OnSetInfo(wxListEvent& event); + void OnSelected(wxListEvent& event); + void OnDeselected(wxListEvent& event); + void OnKeyDown(wxListEvent& event); + + DECLARE_EVENT_TABLE() +}; + +// Define a new frame type +class MyFrame: public wxFrame +{ public: + MyListCtrl *m_listCtrl; + wxTextCtrl *m_logWindow; + + MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h); + ~MyFrame(void); + + public: + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnListView(wxCommandEvent& event); + void OnReportView(wxCommandEvent& event); + void OnIconView(wxCommandEvent& event); + void OnIconTextView(wxCommandEvent& event); + void OnSmallIconView(wxCommandEvent& event); + void OnSmallIconTextView(wxCommandEvent& event); + bool OnClose(void) { return TRUE; } + + DECLARE_EVENT_TABLE() +}; + + +// ID for the menu quit command +#define LIST_QUIT 1 +#define LIST_LIST_VIEW 2 +#define LIST_ICON_VIEW 3 +#define LIST_ICON_TEXT_VIEW 4 +#define LIST_SMALL_ICON_VIEW 5 +#define LIST_SMALL_ICON_TEXT_VIEW 6 +#define LIST_REPORT_VIEW 7 +#define LIST_ABOUT 102 + +#define LIST_CTRL 1000 + + diff --git a/samples/listctrl/listtest.rc b/samples/listctrl/listtest.rc new file mode 100644 index 0000000000..d40633cba9 --- /dev/null +++ b/samples/listctrl/listtest.rc @@ -0,0 +1,16 @@ +aaaa ICON "mondrian.ico" +mondrian ICON "mondrian.ico" +#include "wx/msw/wx.rc" + +icon1 ICON "bitmaps\\toolbrai.ico" +icon2 ICON "bitmaps\\toolchar.ico" +icon3 ICON "bitmaps\\toolchec.ico" +icon4 ICON "bitmaps\\tooldata.ico" +icon5 ICON "bitmaps\\toolgame.ico" +icon6 ICON "bitmaps\\toolnote.ico" +icon7 ICON "bitmaps\\tooltime.ico" +icon8 ICON "bitmaps\\tooltodo.ico" +icon9 ICON "bitmaps\\toolword.ico" + +iconsmall ICON "bitmaps\\small1.ico" + diff --git a/samples/listctrl/makefile.b32 b/samples/listctrl/makefile.b32 new file mode 100644 index 0000000000..2218343eb0 --- /dev/null +++ b/samples/listctrl/makefile.b32 @@ -0,0 +1,63 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds listtest example (DOS). + +# WXWIN and BCCDIR are set by parent make + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +WXLIBDIR = $(WXDIR)\lib +WXLIB = $(WXLIBDIR)\wx32.lib +LIBS=$(WXLIB) cw32 import32 + +TARGET=listtest + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = listtest.obj + +$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) +$(TARGET).def +! + brc32 -K $(TARGET).res + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +listtest.obj: listtest.$(SRCSUFF) + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws + diff --git a/samples/listctrl/makefile.bcc b/samples/listctrl/makefile.bcc new file mode 100644 index 0000000000..b68a9b6d21 --- /dev/null +++ b/samples/listctrl/makefile.bcc @@ -0,0 +1,73 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds minimal example (DOS). + +!if "$(BCCDIR)" == "" +!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 +!endif + +!if "$(WXWIN)" == "" +!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx +!endif + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makebcc.env + +THISDIR = $(WXDIR)\samples\minimal +WXLIB = $(WXDIR)\lib\wx.lib +LIBS=$(WXLIB) mathwl cwl import +INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw +CFG=$(WXDIR)\src\wxwin.cfg + +!ifndef FINAL +FINAL=0 +!endif + +!if "$(FINAL)" == "0" +LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -O2 +DEBUG_FLAGS= +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +OBJECTS = minimal.obj + +minimal: minimal.exe + +all: minimal.exe + +minimal.exe: $(WXLIB) minimal.obj minimal.def minimal.res + tlink $(LINKFLAGS) @&&! +c0wl.obj minimal.obj +minimal +nul +$(LIBS) +minimal.def +! + rc -31 -K minimal.res + +.$(SRCSUFF).obj: + bcc $(CPPFLAGS) -c {$< } + +minimal.obj: minimal.$(SRCSUFF) + +minimal.res : minimal.rc $(WXDIR)\include\msw\wx.rc + rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa minimal + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws diff --git a/samples/listctrl/makefile.dos b/samples/listctrl/makefile.dos new file mode 100644 index 0000000000..5b65a93c36 --- /dev/null +++ b/samples/listctrl/makefile.dos @@ -0,0 +1,81 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds minimal example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\samples\minimal +WXLIB = $(WXDIR)\lib\wx.lib +LIBS=$(WXLIB) oldnames libw llibcew commdlg shell ddeml + +!ifndef FINAL +FINAL=0 +!endif + +INC=/I$(WXDIR)\include\msw /I$(WXDIR)\include\base + +# Set this to nothing if using MS C++ 7 +ZOPTION=/Z7 + +!if "$(FINAL)" == "0" +CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od /YuWX_PREC.H /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch $(INC) +LINKFLAGS=/NOD /CO /ONERROR:NOEXE /SEG:512 +!else +CPPFLAGS=/AL /W3 /G2sw /Ox /YuWX_PREC.H /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch $(INC) +LINKFLAGS=/NOD /ONERROR:NOEXE /SEG:512 +!endif + +HEADERS = +SOURCES = minimal.$(SRCSUFF) +OBJECTS = minimal.obj + +all: minimal.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + + +minimal.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) minimal.obj minimal.def minimal.res + link $(LINKFLAGS) @<< +minimal.obj $(WXDIR)\src\msw\dummy.obj, +minimal, +NUL, +$(LIBS), +minimal.def +; +<< + rc -30 -K minimal.res + +minimal.obj: minimal.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +minimal.res : minimal.rc $(WXDIR)\include\msw\wx.rc + rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw minimal + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/listctrl/makefile.g95 b/samples/listctrl/makefile.g95 new file mode 100644 index 0000000000..92ff4c4c09 --- /dev/null +++ b/samples/listctrl/makefile.g95 @@ -0,0 +1,37 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for listtest example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/makeg95.env + +OBJECTS = $(OBJDIR)/listtest.$(OBJSUFF) $(OBJDIR)/listtest_resources.$(OBJSUFF) + +all: $(OBJDIR) listtest$(GUISUFFIX)$(EXESUFF) + +wx: + +$(OBJDIR): + mkdir $(OBJDIR) + +listtest$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o listtest$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS) + +$(OBJDIR)/listtest.$(OBJSUFF): listtest.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ listtest.$(SRCSUFF) + +$(OBJDIR)/listtest_resources.o: listtest.rc + $(RESCOMP) -i listtest.rc -o $(OBJDIR)/listtest_resources.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) listtest$(GUISUFFIX).exe core *.rsc *.res diff --git a/samples/listctrl/makefile.nt b/samples/listctrl/makefile.nt new file mode 100644 index 0000000000..20f661061c --- /dev/null +++ b/samples/listctrl/makefile.nt @@ -0,0 +1,64 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds wxListCtrl example (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +WXUSINGDLL=0 + +!include $(WXDIR)\src\ntwxwin.mak + +THISDIR = $(WXDIR)\samples\listctrl +PROGRAM=listtest + +OBJECTS = $(PROGRAM).obj + +$(PROGRAM): $(PROGRAM).exe + +all: wx $(PROGRAM).exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res +$(LIBS) +<< + + +$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(PROGRAM).h $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb diff --git a/samples/listctrl/makefile.sc b/samples/listctrl/makefile.sc new file mode 100644 index 0000000000..8709d2ca0f --- /dev/null +++ b/samples/listctrl/makefile.sc @@ -0,0 +1,35 @@ +# Symantec C++ makefile for minimal example +# NOTE that peripheral libraries are now dealt in main wxWindows makefile. + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makesc.env + +WXLIB = $(WXDIR)\lib\wx.lib +INCDIR = $(WXDIR)\include +MSWINC = $(INCDIR)\msw +BASEINC = $(INCDIR)\base + +CC=sc +RC=rc +CFLAGS = -o -ml -W -Dwx_msw +LDFLAGS = -ml -W + +INCLUDE=$(BASEINC);$(MSWINC) + +LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib + +.$(SRCSUFF).obj: + *$(CC) -c $(CFLAGS) -I$(INCLUDE) $< + +.rc.res: + *$(RC) -r -I$(INCLUDE) $< + +minimal.exe: minimal.obj minimal.def minimal.res + *$(CC) $(LDFLAGS) -o$@ $** $(LIBS) + +clean: + -del *.obj + -del *.exe + -del *.res + -del *.map + -del *.rws diff --git a/samples/listctrl/makefile.unx b/samples/listctrl/makefile.unx new file mode 100644 index 0000000000..9685d06789 --- /dev/null +++ b/samples/listctrl/makefile.unx @@ -0,0 +1,58 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for minimal example (UNIX). + +WXDIR = ../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/make.env + +OBJECTS = $(OBJDIR)/minimal.$(OBJSUFF) + +.SUFFIXES: + +all: $(OBJDIR) minimal$(GUISUFFIX) + +wx: + + +motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' WXLIB=$(WXDIR)/lib/libwx_motif.a OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK= + +xview: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview + $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' + +hp: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx hp + $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \ + XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)' + +$(OBJDIR): + mkdir $(OBJDIR) + +minimal$(GUISUFFIX): $(OBJDIR)/minimal.$(OBJSUFF) $(WXLIB) + $(CC) $(LDFLAGS) -o minimal$(GUISUFFIX) $(OBJDIR)/minimal.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/minimal.$(OBJSUFF): minimal.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ minimal.$(SRCSUFF) + +clean_motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany + +clean_ol: + $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany + +clean_hp: + $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany + +cleanany: + rm -f $(OBJECTS) minimal$(GUISUFFIX) core diff --git a/samples/listctrl/makefile.vms b/samples/listctrl/makefile.vms new file mode 100644 index 0000000000..9b76b144f3 --- /dev/null +++ b/samples/listctrl/makefile.vms @@ -0,0 +1,38 @@ +#************************************************************************ +# Makefile for MINIMAL under VMS +# by Stefan Hammes +# (incomplete) update history: +# 11.04.95 +#************************************************************************ + +#************************************************************************ +# Definition section +# (cave: definitions and includes must begin with ',') +#************************************************************************ + +APPOPTS = +APPDEFS = +APPINCS = + +#************************************************************************ +# Module section +#************************************************************************ + +# Name of main module +MAIN = minimal + +# Object modules of the application. +OBJS = minimal.obj +OBJLIST =minimal.obj + +.include [--.src]makevms.env + +# main dependency +$(MAIN).exe : $(OBJS) + $(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option + - purge *.exe + +#************************************************************************ +# Header file depedencies following +#************************************************************************ + diff --git a/samples/listctrl/makefile.wat b/samples/listctrl/makefile.wat new file mode 100644 index 0000000000..21219d7a0e --- /dev/null +++ b/samples/listctrl/makefile.wat @@ -0,0 +1,43 @@ +# +# Makefile for WATCOM +# +# Created by D.Chubraev, chubraev@iem.ee.ethz.ch +# 8 Nov 1994 +# + +WXDIR = ..\.. + +!include $(WXDIR)\src\makewat.env + +WXLIB = $(WXDIR)\lib +NAME = minimal +LNK = $(name).lnk +OBJS = $(name).obj + +all: $(name).exe + +$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib + wlink @$(LNK) + $(BINDCOMMAND) $(name).res + +$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc + $(RC) $(RESFLAGS1) $(name).rc + +$(LNK) : makefile.wat + %create $(LNK) + @%append $(LNK) debug all + @%append $(LNK) system $(LINKOPTION) + @%append $(LNK) $(MINDATA) + @%append $(LNK) $(MAXDATA) + @%append $(LNK) $(STACK) + @%append $(LNK) name $(name) + @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib + @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i + @for %i in ($(OBJS)) do @%append $(LNK) file %i + +thing: .SYMBOLIC + echo $(WATLIBDIR) + +clean: .SYMBOLIC + -erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe + diff --git a/samples/listctrl/mondrian.ico b/samples/listctrl/mondrian.ico new file mode 100644 index 0000000000000000000000000000000000000000..2310c5d275a87af295d5ea8dc79ea417a5e74c53 GIT binary patch literal 766 zcmZQzU<5)11px*Sc)`TLAO@s0fLH;D9e|jTfdxnc0ZO6W@ofKUk}K3 z-t>1`AFU80`ZO1G@idHT`*9+?;@lqSnbMrh^UQ~^T?s)m8b58(^`1O5d^&+GHCsD> zE`x8yL=2`j962u60pn4ZoR1pn1$EL7SP(E`F&Wwn?2k~N&1o|9KgNn&+*-m_k*myD zEa#Ic(W&ZGrOl9LQ&?r#T^%PR=wEd>xyQz1qSm-ct%!7X`xmjYN#!cO+yYj{;tLK_ BeP#dv literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/aiai.xbm b/samples/mdi/bitmaps/aiai.xbm new file mode 100644 index 0000000000..1a6f0a31b1 --- /dev/null +++ b/samples/mdi/bitmaps/aiai.xbm @@ -0,0 +1,38 @@ +#define aiai_width 64 +#define aiai_height 64 +static char aiai_bits[] = { + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44,0x44,0x44,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x44,0x44,0x44,0x42,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x47,0x44,0x44,0x44,0x44,0x11,0x11,0x11,0x17,0x11,0x11,0x11,0x11,0x11, + 0x11,0x91,0x1f,0x11,0x11,0x11,0x11,0x44,0x44,0xc4,0x4f,0x44,0x44,0x44,0x44, + 0x44,0x44,0xc4,0x5f,0x44,0xf4,0x45,0x44,0x11,0x11,0xf1,0x1f,0x11,0xf9,0x13, + 0x11,0x11,0x11,0xf1,0x3f,0x11,0xfd,0x13,0x11,0x44,0x44,0xf4,0x7f,0x44,0xfc, + 0x47,0x44,0x44,0x44,0xf4,0x7f,0x44,0xfc,0x47,0x44,0x11,0x11,0xf9,0x7f,0x11, + 0xf9,0x13,0x11,0x11,0x11,0xfd,0xff,0x11,0xf1,0x11,0x11,0x44,0x44,0xfc,0xff, + 0x44,0x44,0x44,0x44,0x44,0x44,0xfe,0xff,0x45,0x44,0x44,0x44,0x11,0x11,0xff, + 0xff,0x11,0xfd,0x13,0x11,0x11,0x11,0xff,0xff,0x13,0xfd,0x13,0x11,0x44,0xc4, + 0xff,0xff,0x07,0xfc,0x43,0x44,0x44,0xff,0xff,0xf9,0xff,0xfd,0xfb,0xff,0x11, + 0xc0,0xff,0x00,0x00,0xfc,0x03,0x00,0x11,0xc0,0x7f,0x00,0x00,0xfc,0x03,0x00, + 0x04,0xe0,0x7f,0x00,0x00,0xfc,0x03,0x00,0xf4,0xf7,0xbf,0xff,0xff,0xfd,0xfb, + 0x7f,0x01,0xf0,0x1f,0x00,0x00,0xfc,0x03,0x00,0x01,0xf8,0x1f,0x00,0x00,0xfc, + 0x03,0x00,0x00,0xfc,0x0f,0x00,0x00,0xfc,0x03,0x40,0xfe,0xfd,0xef,0xff,0xff, + 0xfd,0xfb,0x4f,0x00,0xfe,0x07,0x00,0x00,0xfc,0x03,0x10,0x00,0xfe,0x03,0x00, + 0x00,0xfc,0x03,0x10,0x00,0xff,0x03,0x00,0x00,0xfc,0x03,0x44,0x7f,0xff,0x01, + 0x00,0x00,0xfc,0xfb,0x44,0x91,0xff,0xff,0xff,0xff,0xff,0x13,0x11,0xd1,0xff, + 0xff,0xff,0xff,0xff,0x13,0x11,0xe4,0xff,0xff,0xff,0xff,0xff,0x47,0x44,0xe4, + 0xff,0xff,0xff,0xff,0xff,0x47,0x44,0xf1,0xff,0xff,0xff,0xff,0xff,0x13,0x11, + 0xf1,0xff,0xff,0xff,0xff,0xff,0x13,0x11,0xfc,0xff,0xff,0xff,0xff,0xff,0x47, + 0x44,0xfc,0xff,0xff,0xff,0xff,0xff,0x47,0x44,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x10,0x11,0x44,0x44,0xc4,0x44,0x44, + 0xc4,0x44,0x44,0x44,0x4e,0xc4,0x44,0x4e,0xc4,0x44,0x44,0x11,0x1f,0xd1,0x11, + 0x1f,0xd1,0x11,0x11,0x91,0x31,0xd1,0x91,0x31,0xd1,0x11,0x11,0xc4,0x64,0xcc, + 0xcc,0x64,0xcc,0x44,0x44,0x64,0xc4,0xcc,0x6c,0xc4,0xcc,0x44,0x44,0xf1,0xff, + 0xd1,0xf1,0xff,0xd1,0x11,0x11,0xf9,0xff,0xd3,0xf9,0xff,0xd3,0x11,0x11,0x4c, + 0x44,0xc6,0x4c,0x44,0xc6,0x44,0x44,0x4c,0x44,0xc6,0x4c,0x44,0xc6,0x44,0x44, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, + 0x44,0x44}; diff --git a/samples/mdi/bitmaps/bitmap1.bmp b/samples/mdi/bitmaps/bitmap1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..13e2170b7369879a97bdd01c57b42af6f4126264 GIT binary patch literal 238 zcmZup$qj%o3^Ni^o-hV;@Mo922+wZTPQ(hutwBPF)JM*)+X=-^TgaK5$N?i2IJ*8x z1_Y+Pr$L8wG(}1gYeu+p9^X1)J~P=@jSHSMY)3;sNkY2 zEPWRLqal$RV;7jK=A7!i)5w*|^bK%qLGNEQTGkCeTtf<*)|jz0bZVCKqs&^|_qZ0` QxOhk{d)WGeIhJR90ll(R-T(jq literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/brush.bmp b/samples/mdi/bitmaps/brush.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0bf4ac5527d98d88440001b5f300b04db96644d2 GIT binary patch literal 740 zcmZWnF>b>!3{(gq76PNqP-M>7cXaPpf=-P`ZPgIKU((pYKt9n2WJ?AE${nrRQevAl zb;lz`TOXf)V)Xike~0a}t&BCK4w*-2w%HgPH zf`&@>#Pv``DpAW<-8i*sz?Az7Ld_XFu6D=ibNz?@VEX(QuILXHeBL*zT;&KIGqCH5 v=_NrsX=cUCRLw7$+aO8*Qm(n22{65#&k9#id8a2QuUxV68!&IEh4<kc*i{+$mRB8 zir*dn3_B$&NRgzjDUXnvWD*mZ*vS})U}yrtjpGO;#7-ed1Va-D?qsnKj9o{pONo4E z=SW$8Ry{v3rW_(y(GKz2ve{!yz;yK6de4prWZZYnKX}+;&!|X|N~(EKex+yNkTX!S zC{hM1mzs$OSe-HOyvrWSe{huaqdx5G;~96=hail3mzCD(23HE&t@imYryJdJIIh98 l_{`r1+)_Gc{@aa(hUFE=46BTeZz9d~YGx{Aj)6VK;sXibpM3xT literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/chart.bmp b/samples/mdi/bitmaps/chart.bmp new file mode 100644 index 0000000000000000000000000000000000000000..54218089a907281b71a9a7c27a5ca1c6db619024 GIT binary patch literal 600 zcmb7BISzv`5L`xxAetZ)QB&p}>C@*WAsz1GjxX_+ynqfmXM89aBBW&TtoIx*_T_qm zIJr}wi6$VCRBY;%Pz5QuTX<0-T%wfUsA&>PhGAgBxFyC|i{NKNRE_321jbsBXV#i) z{hI|{Ng8_4S7xz6E=+|+zr<3rjqFur8c(cxeI?@~9$QYdwiX=@amIJJ`ic1w-Fgys z9Lc5AXu{B=G4Z4*zB_pvvwr>m$UE?mn5{CL=g*ri?L43Nu^u^8?p`Z+dE}{rnUlfH GJ$VC~I*RfD literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/colour.bmp b/samples/mdi/bitmaps/colour.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b4ffd72550eacbeb9cd2fc39564a1596a1d63e2f GIT binary patch literal 734 zcmZvau};H442G{(l%67lii9f0jywW0VqoDt7(0=UxAmA#9eIw9EEyU43_Jr83_(IV zK3^_LQ)u$L_W#>wpWEAqcQNVnguMo31FxzJn@gH1~=78 z)mm{9v6Cv>DcCahJ;~k{bv2w!yk;9Uxwe}&^=h$3HmD=pk~1F}CJEqKF35GV!RB1p z7JSQ#T*1!&QFfej%m;F~#VO0aCRt~vowRPRRY!B_R6$tjiv)Cz3AyzP{vxy7<$~OeTT!c7JQf6T89- z%?kmn<${;(P#uFN<0A#FuUo(qgT{&F@ekspii W=d@ZzPG(Cb=QBs}_=7thzxV(viB<;y literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/cut.bmp b/samples/mdi/bitmaps/cut.bmp new file mode 100644 index 0000000000000000000000000000000000000000..15554338a01bc4d8f0a501c32237e84200e64583 GIT binary patch literal 238 zcmZvU!3}^Q5Cqr6gr}Ba8OD(CvKJo2^+{<|WDB@(K8*2TclNjo+kV075Ef~cCTYMZ z2hQ$)mH}PlY>+FWlp?l4?H9GSB0Q*%#U4;mp5q^EgJ(ob=}d)_jSPO&g#1 zvOv^-F;$vbozVj|OGga#oZBUoZ>ZKfr3)i1x-M_h>zJv!%;@Q2uSd~ken+j(PpFp6 sRJaZ~$UwbCpVLK`hShMNOS;IvR4Utw(*&Pyy{!Cb6=pCiD)OG(0a}ZhAOHXW literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/flowchar.xbm b/samples/mdi/bitmaps/flowchar.xbm new file mode 100644 index 0000000000..d75217af18 --- /dev/null +++ b/samples/mdi/bitmaps/flowchar.xbm @@ -0,0 +1,14 @@ +#define flowchart_width 32 +#define flowchart_height 32 +static char flowchart_bits[] = { + 0x00, 0x80, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x20, 0x02, 0x00, + 0x00, 0x10, 0x04, 0x00, 0x00, 0x88, 0x08, 0x00, 0x00, 0x44, 0x11, 0x00, + 0x00, 0x22, 0x22, 0x00, 0x00, 0x11, 0x44, 0x00, 0x80, 0x08, 0x82, 0x00, + 0x40, 0x10, 0x01, 0x01, 0x20, 0xaa, 0x00, 0x02, 0x10, 0x45, 0x00, 0x04, + 0x88, 0x08, 0x00, 0x08, 0x44, 0x10, 0x00, 0x10, 0x22, 0x08, 0xfc, 0x20, + 0x41, 0x04, 0x02, 0x41, 0x82, 0x02, 0x01, 0x82, 0x04, 0x81, 0x0c, 0x44, + 0x08, 0x81, 0x13, 0x28, 0x10, 0x71, 0xfe, 0xf1, 0xa0, 0x4a, 0x0c, 0xe0, + 0x40, 0x9c, 0x00, 0xe0, 0x80, 0x20, 0x01, 0xe0, 0x00, 0x41, 0x06, 0xe0, + 0x00, 0x82, 0xf8, 0xe7, 0x00, 0x04, 0x41, 0xf8, 0x00, 0x08, 0x22, 0xe0, + 0x00, 0x10, 0x14, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x40, 0x04, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00}; diff --git a/samples/mdi/bitmaps/help.bmp b/samples/mdi/bitmaps/help.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2d9e6922cac0fb0aefa32fd5bae9d460e13484b9 GIT binary patch literal 238 zcmZuq!3}^g2t1P}{g~(&&f(u(`VyZVjR87~E7Sw@p^qTFi~p=nI%+}YJ={H-mN0|?29BK#fUL#erbtT(lh^R?4vYy(d-6AGn1|j$rr}v KbDqI%Xjd+{i$y;G literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/helpcs.bmp b/samples/mdi/bitmaps/helpcs.bmp new file mode 100644 index 0000000000000000000000000000000000000000..88373816814a283aa9ecca7899faf81ce7a15b4e GIT binary patch literal 238 zcmZvV!3{z&3`32Clp~D69NgKZC&ICtwG;gn%5(a;k=Ax%E6VeAXxAHgfIGN>i>|Qr zDgH-8;%kg8Fsb(=J`dZ5!;MsyQTV&Nwu@o7(Ri`byve-X0yz0?`b73&zHji5? LZQ&!hb;5&(M=()TVwy5gzrw_2qkEVq?z&WsAuYZfx(QTXAQlGm)37 Hw_&Gme(s@> literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/mike.bmp b/samples/mdi/bitmaps/mike.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0d736190e415fb1455dc5faf0e8c2d02ed419f95 GIT binary patch literal 708 zcmaJKDtAJ!pz9b0l4tjP;1(ew=nJ8j|<6WY3bU0`GK9aK^RUId`!4(ELX-1{H u>6c`QQqJ8_T9s0iQsQ8(Wab^@`3kuPA_p->w)Xt4Pkz>06 literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/open.bmp b/samples/mdi/bitmaps/open.bmp new file mode 100644 index 0000000000000000000000000000000000000000..bbf93fe03364e63f3e18a3507a0e85ab8ea2f87d GIT binary patch literal 238 zcmXv{u@M3>3=;=;U&0ua+_3>YyQsonW~6N3OvKTr2(k@|B{{YeKb~(CUb3rr5zpcQ zCn>O}mP9XDa6kd~GO1FGG0<95V`X5i$V8neN$dxz4&8XX3!AZr-;ApY^eS-9oTLj~ Y^Hcc9z2|$wrXTtLH=Rc2n(WoWFRhqJ00000 literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/page.bmp b/samples/mdi/bitmaps/page.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3dbd4b05b4c2d1a4f046141d450caf34c1a3d470 GIT binary patch literal 714 zcmaJk)fu{chJ-2TT-iZmtVS?uc5roS;-EuD8k*^vaH9hj_d6X ziQgC358^U$kRpEdIqzx8X~Jz0i&xCtBKWwA%eHOw^mwIrw+KG&;&N&1L*Q{1Xmx8p zxBo0O*pac2@{B`!>-fgLdSDP(C2}M>_DcBv60g*0UKyHhy!Oc8UYD-XBeIyOWTry_ zTA4Yuua#Ixm?vFMcI3@F*>XSp02Lyo AJ^%m! literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/paste.bmp b/samples/mdi/bitmaps/paste.bmp new file mode 100644 index 0000000000000000000000000000000000000000..564f514e0df7225f0a7adbe8457b41af537813bd GIT binary patch literal 238 zcmZvVF%Ci@5Jbns$83OZ*I;# co}I%%@f6>ra3+S=gC69}eM%GII+SAI4J;x>B>(^b literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/preview.bmp b/samples/mdi/bitmaps/preview.bmp new file mode 100644 index 0000000000000000000000000000000000000000..da1f4dbc4be6c2dd8fb9d7cb71cc48a4a7c139ca GIT binary patch literal 238 zcmZvVu?@p83pv2yNo4mlT?N_pr2ISnd1NHDM5O^cFcMc59&^> z)PfrwsOeYM05)2ipmU4fJIss+o(=cdQCu+!%TlZiKDH!a!aP2;C|UGpLD9M;zmsLJ XIp;lzIUm!ckI6HO{IjaYcZ_-fA4^nl literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/print.bmp b/samples/mdi/bitmaps/print.bmp new file mode 100644 index 0000000000000000000000000000000000000000..00319b55bb23c3c69cc051144d80e5275747c53e GIT binary patch literal 238 zcmZur!3_d23^Ni^o@EUFY`~vgA|YX<`*bfpod|VizM>j+f}Fx~Q7! zgtHKM7yg3|DAD^Sp<0YF#C}+nSj(MC$5#Ss27*aN<{l9dYV3`7rsq)3!X>4ws(){6V0MX5FKAjcylGXqN-n#XsS=YhW0WogZT{L^_i_GT%*k@+ph E1NJ~MtpET3 literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/screw.bmp b/samples/mdi/bitmaps/screw.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7625c4e6b60d916bf9a69f8ef8f9d365a252a211 GIT binary patch literal 636 zcmZ9JF>b>!3`H42NQI(kf}$ugbja9qbnjg}b?U$^+Il4)%bWX1Q;<{Jl*s>|EK~mc z`caANoAHCVW*nr5TgUWC<(%QUh{Ypjo)O$GG0gLfvc@Cp>KVc962p~Q>wD8*pS7u6 zdTx5t`W97jXWDY86BXX;AQzNTH;Cn~HWcf8X=?7jV7P5L{0XMvf)Bh+MnOJJRPni96GUA`+=0`4{f5xh{<#E6t0ri}z)qXGrtXwk;DWcS%Vj8b5{T zwt+e{oHqhzHR?8Dh#Vt$WN)sh4T!|L;zxWL@Md4J8>%@!TN&p)+r^yFj_8%G!dYD* zHjur-s2-_Nq1>JB@Y@_FGVj!mlbH*?vL~fn~bWI*AV$qt18~Q-i3GhZIyUYFjug(&isP;hlGyf>=(PwyuJVc literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/speaker.bmp b/samples/mdi/bitmaps/speaker.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a32ec48bba686dc9b86309d44714252ba05d790f GIT binary patch literal 648 zcmb_aOA5mv5Ssh+Xl{`|G?(BP3f@uS#(3sKp(NQP4-GfSb z9_X)#sYWMGXq~GMC_@cm5i75l5h2hhp^Gs>$>o)ti4bU%&`kmRAaof;eNU9e@GJ6I zaa>nzSs&C|w+{~csJV4MkZED93T4p~bMQ*6qE)=64MhO`G~QZ0~Cg$bo+bnR#b2R>8N-H_Q%jE?E=C?g{(PioyT@ literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/telephon.bmp b/samples/mdi/bitmaps/telephon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1788be8a72480caa1bdccd88501a9bd6ebf4c06a GIT binary patch literal 676 zcmb7>F%H5o3`LDql?Wl!0WmW&aR_#<1B@B7Vc)wQUQM@+&Esg>Vc)Z3A@>y=_EYZC1Al zpO%IOUSEvHCa53#*xB!OHRU>uL_GByJINH9MBGp*Xk3!J`X5Ppd%vX@4Yk!CWh3Ga znkx>`So0F=22=x^xDe}gG7Vz7nhu{+=qIVsaPD;98ETw=a+d4!o?%SH{-o&fR=`$i f==a+unRcWj*LP^1_3ZNIi|0n3U%;%{2;bQQmhMQ$ZK(H1lyu>fWIG8s@t@v%k}Uh> z_4!J?y)iz~PqiOp5M}*kLv2T9>(Pn`zmyUaBTIUb%jE*F_%F+1D>|Q<7*5QZu4iSu zpY_vr!>nb~&PeYvOFnV_KCB<0KP# z?BZeTweb%7 literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/tick.bmp b/samples/mdi/bitmaps/tick.bmp new file mode 100644 index 0000000000000000000000000000000000000000..c0d66c94601657fee33b923de9b1791844d7a331 GIT binary patch literal 220 zcmXv`!4bnS2vd9<&b6P6(K-6>8h!H$UytTNvWqL(DMm;L@cVON#YuV*&l?*Ih5AeU z{bqVO)bKZHuqJq2P$o+ Qrwbl?Kzn<_G@1WzKlk4xlmGw# literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/torch.bmp b/samples/mdi/bitmaps/torch.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f7f235c1716959dadb88a2fd7d6d4ee2bbcf1b56 GIT binary patch literal 706 zcmZ9Ju};J=42FGHl#9@bo){40jXVeQ@h+JtW431Fl`5Wyv0M4zxwmn=b!rz4Gl#m_}~*tbI#AMJHc#tAlEDnRIiNPSZG(vAb^3 z@-Lc)4mY7$E@-?l&k}df4Lj6Wqj&~Lcqge_^oQx&Ir31MnNZCrSo(Gr)z8w{q4F;# zx-rfv;^I}v*A)J0BPRRTL}TCMr*?uxN5rmIAbw^R_)H0(cc3S&A}>rSR5| literal 0 HcmV?d00001 diff --git a/samples/mdi/bitmaps/wrench.bmp b/samples/mdi/bitmaps/wrench.bmp new file mode 100644 index 0000000000000000000000000000000000000000..8062f7d0c351a267c4a4cafb1f5867351fb076b2 GIT binary patch literal 744 zcmZuvyH3PF4D?x6vOcd}DlvU8)vKdkb>4S&)%4nZ*v*=$c&ZqxrXrQ`F;GjvAvdBG6r9O25olnkMRmPZK6Exh zm4@caRa3H#HXl5HbPAs)#E&y#F1e^1hxvf-Dpaw15H}P&uXR4qonLA|7Q~D!H~}@d zJs`XRIe4H8^@<48gyI2;A=|{Nz;0N}LGCU16FY@_BXf%QMbmJ%6&^+=zoV7QTMuQ8 x;#%13NXOAZ)?K>S(HA0f)Pc;@2a-bPtoSVImJRSetIcon(wxIcon("mondrian")); +#endif +#ifdef wx_x + frame->SetIcon(wxIcon("mondrian.xbm")); +#endif + + // Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(wxID_EXIT, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "File"); + frame->SetMenuBar(menu_bar); + + // Make a panel with a message + wxPanel *panel = new wxPanel(frame); + + (void)new wxStaticText(panel, -1, "Hello, this is a minimal debugging wxWindows program!", wxPoint(10, 10)); + + // Show the frame + frame->Show(TRUE); + +// wxDebugContext::SetCheckpoint(); + wxDebugContext::SetFile("debug.log"); + + wxString *thing = new wxString; // WXDEBUG_NEW wxString; + wxDate* date = new wxDate; + + // Proves that defining 'new' to be 'WXDEBUG_NEW' doesn't mess up + // non-object allocation + char *ordinaryNonObject = new char[1000]; + + const char *data = (const char*) thing ; + + wxDebugContext::PrintClasses(); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + + // Don't delete these two objects, to force wxApp to flag a memory leak. +// delete thing; +// delete date; +// delete[] ordinaryNonObject; + + return TRUE; +} + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(wxID_EXIT, MyFrame::OnQuit) +END_EVENT_TABLE() + +// My frame constructor +MyFrame::MyFrame(wxFrame *parent): + wxFrame(parent, -1, "MemCheck wxWindows Sample", wxPoint(-1, -1), wxSize(400, 200)) +{} + +// Intercept menu commands +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + diff --git a/samples/memcheck/memcheck.def b/samples/memcheck/memcheck.def new file mode 100644 index 0000000000..4986704cdd --- /dev/null +++ b/samples/memcheck/memcheck.def @@ -0,0 +1,8 @@ +NAME Memcheck +DESCRIPTION 'Memcheck wxWindows application' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/samples/memcheck/memcheck.rc b/samples/memcheck/memcheck.rc new file mode 100644 index 0000000000..7655c62a4c --- /dev/null +++ b/samples/memcheck/memcheck.rc @@ -0,0 +1,3 @@ +mondrian ICON "mondrian.ico" +#include "wx/msw/wx.rc" + diff --git a/samples/memcheck/mondrian.ico b/samples/memcheck/mondrian.ico new file mode 100644 index 0000000000000000000000000000000000000000..2310c5d275a87af295d5ea8dc79ea417a5e74c53 GIT binary patch literal 766 zcmZQzU<5)11px*Sc)`TLAO@s0fLH;D9e|jTfdxnc0Z4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8= +#include "resource.h" + +// If we wanted to demonstrate total platform independence, +// then we'd use the dynamic file loading form for all platforms. +// But this shows how to embed the wxWindows resources +// in the program code/executable for UNIX and Windows +// platforms. + +// If you have a Windows compiler that can cope with long strings, +// then you can always use the #include form for simplicity. + +// NOTE: Borland's brc32.exe resource compiler doesn't recognize +// the TEXT resource, for some reason, so either run-time file loading +// or file inclusion should be used. + +#if defined(__WINDOWS__) && !defined(__BORLANDC__) && !defined(__GNUWIN32__) +// Under Windows, some compilers can't include +// a whole .wxr file. So we use a .rc user-defined resource +// instead. dialog1 will point to the whole .wxr 'file'. +static char *dialog1 = NULL; +static char *menu1 = NULL; +#else +// Other platforms should have sensible compilers that +// cope with long strings. +#include "dialog1.wxr" +#include "menu1.wxr" +#endif + +// Declare two frames +MyFrame *frame = NULL; + +IMPLEMENT_APP(MyApp) + +// Testing of ressources +MyApp::MyApp() +{ +} + +// The `main program' equivalent, creating the windows and returning the +// main frame +bool MyApp::OnInit(void) +{ +#if defined(__WINDOWS__) && !defined(__BORLANDC__) + // Load the .wxr 'file' from a .rc resource, under Windows. + dialog1 = wxLoadUserResource("dialog1"); + menu1 = wxLoadUserResource("menu1"); + // All resources in the file (only one in this case) get parsed + // by this call. + wxResourceParseString(dialog1); + wxResourceParseString(menu1); +#else + // Simply parse the data pointed to by the variable dialog1. + // If there were several resources, there would be several + // variables, and this would need to be called several times. + wxResourceParseData(dialog1); + wxResourceParseData(menu1); +#endif + + // Create the main frame window + frame = new MyFrame(NULL, -1, "wxWindows Resource Sample", wxPoint(0, 0), wxSize(300, 250)); + + // Give it a status line + frame->CreateStatusBar(2); + +/* + // Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(RESOURCE_TEST1, "&Dialog box test", "Test dialog box resource"); + file_menu->Append(RESOURCE_QUIT, "E&xit", "Quit program"); + + wxMenuBar *menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); +*/ + + wxMenuBar *menu_bar = wxResourceCreateMenuBar("menu1"); + + // Associate the menu bar with the frame + frame->SetMenuBar(menu_bar); + + // Make a panel + frame->panel = new wxWindow(frame, -1, wxPoint(0, 0), wxSize(400, 400), 0, "MyMainFrame"); + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit) + EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1) +END_EVENT_TABLE() + +// Define my frame constructor +MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size): + wxFrame(parent, id, title, pos, size) +{ + panel = NULL; +} + +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyFrame::OnTest1(wxCommandEvent& event) +{ + MyDialog *dialog = new MyDialog; + if (dialog->LoadFromResource(this, "dialog1")) + { + wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName("multitext3", dialog); + if (text) + text->SetValue("wxWindows resource demo"); + dialog->SetModal(TRUE); + dialog->ShowModal(); + } + dialog->Close(TRUE); +} + +bool MyFrame::OnClose(void) +{ + Show(FALSE); + + return TRUE; +} + +BEGIN_EVENT_TABLE(MyDialog, wxDialog) + EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk) + EVT_BUTTON(RESOURCE_CANCEL, MyDialog::OnCancel) +END_EVENT_TABLE() + + +void MyDialog::OnOk(wxCommandEvent& event) +{ + EndModal(RESOURCE_OK); +} + +void MyDialog::OnCancel(wxCommandEvent& event) +{ + EndModal(RESOURCE_CANCEL); +} + + diff --git a/samples/resource/resource.def b/samples/resource/resource.def new file mode 100644 index 0000000000..49791b5e6c --- /dev/null +++ b/samples/resource/resource.def @@ -0,0 +1,9 @@ +NAME Resource +DESCRIPTION 'Resource' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 16192 + diff --git a/samples/resource/resource.h b/samples/resource/resource.h new file mode 100644 index 0000000000..c30572165e --- /dev/null +++ b/samples/resource/resource.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: resource.h +// Purpose: Dialog resource sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma interface +#endif + +// Define a new application +class MyApp: public wxApp +{ + public: + MyApp(void) ; + bool OnInit(void); +}; + +class MyFrame: public wxFrame +{ + public: + wxWindow *panel; + MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size); + bool OnClose(void); + void OnQuit(wxCommandEvent& event); + void OnTest1(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() +}; + +class MyDialog : public wxDialog +{ + public: + void OnOk(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() +}; + +#define RESOURCE_QUIT 4 +#define RESOURCE_TEST1 2 + +#define RESOURCE_OK 1 +#define RESOURCE_CANCEL 2 diff --git a/samples/resource/resource.rc b/samples/resource/resource.rc new file mode 100644 index 0000000000..129260fd47 --- /dev/null +++ b/samples/resource/resource.rc @@ -0,0 +1,7 @@ +#include "wx/msw/wx.rc" + +/* Comment out these lines for Borland C++ or GNU-WIN32 */ +dialog1 TEXT "dialog1.wxr" +menu1 TEXT "menu1.wxr" + + diff --git a/samples/treectrl/aiai.ico b/samples/treectrl/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3db6563cc0b9f4588e1e994fe54b90a3cb1d6c1 GIT binary patch literal 766 zcmc(bJ930T3`Bcft}@v=+L+MC@X_W5#I6lE$3$=(hlEfB4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8=SetBackgroundColour(wxColour(255, 255, 255)); + + // Give it an icon +#ifdef __WINDOWS__ + frame->SetIcon(wxIcon("mondrian")); +#endif +#ifdef __X__ + frame->SetIcon(wxIcon("aiai.xbm")); +#endif + + // Make an image list containing large icons + m_imageListNormal = new wxImageList(16, 16, TRUE); + + wxIcon *icon = new wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + icon = new wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE); + m_imageListNormal->Add(*icon); + delete icon; + + // Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(TREE_ABOUT, "&About"); + file_menu->Append(TREE_QUIT, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + frame->SetMenuBar(menu_bar); + + // Make a panel with a message + frame->m_treeCtrl = new MyTreeCtrl(frame, TREE_CTRL, wxPoint(0, 0), wxSize(400, 200), + wxTR_HAS_BUTTONS|wxSUNKEN_BORDER); + frame->m_logWindow = new wxTextCtrl(frame, -1, "", wxPoint(0, 0), wxSize(400, 200), + wxTE_MULTILINE|wxSUNKEN_BORDER); + + wxLayoutConstraints *c = new wxLayoutConstraints; + c->top.SameAs (frame, wxTop); + c->left.SameAs (frame, wxLeft); + c->right.SameAs (frame, wxRight); + c->height.PercentOf (frame, wxHeight, 66); + frame->m_treeCtrl->SetConstraints(c); + + c = new wxLayoutConstraints; + c->top.Below (frame->m_treeCtrl); + c->left.SameAs (frame, wxLeft); + c->right.SameAs (frame, wxRight); + c->bottom.SameAs (frame, wxBottom); + frame->m_logWindow->SetConstraints(c); + frame->SetAutoLayout(TRUE); + + frame->m_treeCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL); + + long rootId = frame->m_treeCtrl->InsertItem(0, "Root", 0); + + char buf[20]; + int i; + wxString str; + + for ( i = 0; i < 10; i++) + { + sprintf(buf, "Folder child %d", i); + str = buf; + long id = frame->m_treeCtrl->InsertItem(rootId, str, 0); + int j; + for ( j = 0; j < 5; j++) + { + sprintf(buf, "File child %d", j); + str = buf; + frame->m_treeCtrl->InsertItem(id, str, 1); + } + } + for ( i = 0; i < 10; i++) + { + sprintf(buf, "File child %d", i); + str = buf; + frame->m_treeCtrl->InsertItem(rootId, str, 1); + } + + frame->CreateStatusBar(3); + frame->SetStatusText("", 0); + + // Show the frame + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +// My frame constructor +MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h): + wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) +{ + m_treeCtrl = NULL; + m_logWindow = NULL; +} + +MyFrame::~MyFrame(void) +{ + delete wxGetApp().m_imageListNormal; +} + +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyFrame::OnAbout(wxCommandEvent& event) +{ + wxMessageDialog dialog(this, "Tree test sample\nJulian Smart (c) 1997", + "About tree test", wxOK|wxCANCEL); + + dialog.ShowModal(); +} + +// MyTreeCtrl + +void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnBeginDrag\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnBeginRDrag(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnBeginRDrag\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnBeginLabelEdit(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnBeginLabelEdit\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnEndLabelEdit(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnEndLabelEdit\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnDeleteItem(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnDeleteItem\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnGetInfo(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnGetInfo\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnSetInfo(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnSetInfo\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnItemExpanded(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnItemExpanded\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnItemExpanding(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnItemExpanding\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnSelChanged(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnSelChanged\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnSelChanging(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnSelChanging\n"; + str.flush(); +#endif +} + +void MyTreeCtrl::OnKeyDown(wxTreeEvent& event) +{ + if ( !wxGetApp().GetTopWindow() ) + return; + + wxTextCtrl *text = ((MyFrame *)wxGetApp().GetTopWindow())->m_logWindow; + if ( !text ) + return; + +#ifndef __GNUWIN32__ + ostream str(text); + + str << "OnKeyDown\n"; + str.flush(); +#endif +} + diff --git a/samples/treectrl/treetest.def b/samples/treectrl/treetest.def new file mode 100644 index 0000000000..8c952e6f00 --- /dev/null +++ b/samples/treectrl/treetest.def @@ -0,0 +1,9 @@ + * Last change: JS 28 Apr 97 1:45 pm +NAME TreeCtrl +DESCRIPTION 'TreeCtrl wxWindows application' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/samples/treectrl/treetest.h b/samples/treectrl/treetest.h new file mode 100644 index 0000000000..515506b91e --- /dev/null +++ b/samples/treectrl/treetest.h @@ -0,0 +1,69 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: treetest.h +// Purpose: wxTreeCtrl sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +// Define a new application type +class MyApp: public wxApp +{ public: + bool OnInit(void); + + wxImageList *m_imageListNormal; +}; + +class MyTreeCtrl: public wxTreeCtrl +{ +public: + MyTreeCtrl(wxWindow *parent, const wxWindowID id, const wxPoint& pos, + const wxSize& size, long style): + wxTreeCtrl(parent, id, pos, size, style) + { + } + + void OnBeginDrag(wxTreeEvent& event); + void OnBeginRDrag(wxTreeEvent& event); + void OnBeginLabelEdit(wxTreeEvent& event); + void OnEndLabelEdit(wxTreeEvent& event); + void OnDeleteItem(wxTreeEvent& event); + void OnGetInfo(wxTreeEvent& event); + void OnSetInfo(wxTreeEvent& event); + void OnItemExpanded(wxTreeEvent& event); + void OnItemExpanding(wxTreeEvent& event); + void OnSelChanged(wxTreeEvent& event); + void OnSelChanging(wxTreeEvent& event); + void OnKeyDown(wxTreeEvent& event); + + DECLARE_EVENT_TABLE() +}; + +// Define a new frame type +class MyFrame: public wxFrame +{ public: + MyTreeCtrl *m_treeCtrl; + wxTextCtrl *m_logWindow; + + MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h); + ~MyFrame(void); + + public: + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + bool OnClose(void) { return TRUE; } + + DECLARE_EVENT_TABLE() +}; + + +// ID for the menu quit command +#define TREE_QUIT 1 +#define TREE_ABOUT 102 + +#define TREE_CTRL 1000 + + diff --git a/samples/treectrl/treetest.rc b/samples/treectrl/treetest.rc new file mode 100644 index 0000000000..9a8ec91188 --- /dev/null +++ b/samples/treectrl/treetest.rc @@ -0,0 +1,7 @@ +mondrian ICON "mondrian.ico" +aaaa ICON "mondrian.ico" +#include "wx/msw/wx.rc" + +icon1 ICON "bitmaps\\folder1.ico" +icon2 ICON "bitmaps\\file1.ico" + diff --git a/samples/validate/aiai.ico b/samples/validate/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3db6563cc0b9f4588e1e994fe54b90a3cb1d6c1 GIT binary patch literal 766 zcmc(bJ930T3`Bcft}@v=+L+MC@X_W5#I6lE$3$=(hlEfB4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8=SetIcon(wxIcon("mondrian")); +#endif +#ifdef __X__ + frame->SetIcon(wxIcon("aiai.xbm")); +#endif + + // Make a menubar + wxMenu *file_menu = new wxMenu; + + file_menu->Append(VALIDATE_TEST_DIALOG, "&Test dialog"); + file_menu->Append(wxID_EXIT, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "File"); + frame->SetMenuBar(menu_bar); + + frame->CreateStatusBar(1); + + // Show the frame + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +// My frame constructor +MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h): + wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) +{} + +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyFrame::OnTestDialog(wxCommandEvent& event) +{ + MyDialog dialog(this, "Validation test dialog", wxPoint(100, 100), wxSize(340, 200)); + + dialog.ShowModal(); +} + +MyDialog::MyDialog(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, + const long style): + wxDialog(parent, VALIDATE_DIALOG_ID, title, pos, size, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) +{ + wxButton *but1 = new wxButton(this, wxID_OK, "OK", wxPoint(250, 10), wxSize(80, 30)); + wxButton *but2 = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(250, 60), wxSize(80, 30)); + + wxTextCtrl *txt1 = new wxTextCtrl(this, VALIDATE_TEXT, "", + wxPoint(10, 10), wxSize(100, -1), 0, wxTextValidator(wxFILTER_ALPHA, &g_data.m_string)); + +// SetBackgroundColour(wxColour(0,0,255)); + + but1->SetFocus(); + but1->SetDefault(); +} + diff --git a/samples/validate/validate.def b/samples/validate/validate.def new file mode 100644 index 0000000000..f49fa9473e --- /dev/null +++ b/samples/validate/validate.def @@ -0,0 +1,9 @@ + * Last change: JS 13 Mar 97 5:02 pm +NAME Events +DESCRIPTION 'Event tester' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/samples/validate/validate.h b/samples/validate/validate.h new file mode 100644 index 0000000000..b4b9046561 --- /dev/null +++ b/samples/validate/validate.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: validate.h +// Purpose: wxWindows validation sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart and Markus Holzem +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +// #pragma interface +#endif + +// Define a new application type +class MyApp: public wxApp +{ public: + bool OnInit(void); +}; + +// Define a new frame type +class MyFrame: public wxFrame +{ public: + MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h); + + public: + void OnQuit(wxCommandEvent& event); + void OnTestDialog(wxCommandEvent& event); + bool OnClose(void) { return TRUE; } + + DECLARE_EVENT_TABLE() + +}; + +class MyDialog: public wxDialog +{ +public: + MyDialog(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, + const long style = wxDEFAULT_DIALOG_STYLE); +}; + +class MyData +{ + public: + wxString m_string; + + MyData() { m_string = "My string"; } +}; + +#define VALIDATE_DIALOG_ID 200 + +#define VALIDATE_TEST_DIALOG 2 +#define VALIDATE_TEXT 101 + diff --git a/samples/validate/validate.rc b/samples/validate/validate.rc new file mode 100644 index 0000000000..7655c62a4c --- /dev/null +++ b/samples/validate/validate.rc @@ -0,0 +1,3 @@ +mondrian ICON "mondrian.ico" +#include "wx/msw/wx.rc" + diff --git a/utils/dialoged/src/aiai.ico b/utils/dialoged/src/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..46afdd1b613ca56e26a556a75131b37d279acc5e GIT binary patch literal 766 zcmc(bF%H5o3`Ktt5=abTV(!Q>I1)$51`T)=nE#zbl@J?9IJKQ;J8^2D zWSK6O$$WkK1*bhnHY z*s>G=#Knp;%R_K0w9H3^YCRCd_4B}2CIj2qES>cN2{tKR=LZKJQ3^NiN1DwGf?EKP+GUlZ2U3w8O1iKLn5)y7~M{(M2`-Q+kTgio-$pIr3 yIJ<@@69WdYU=~JYi`E)lf%k&DI+8~tN`4^$nJY-OD*JU>wjJEKHuH!bxvFW literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/alignb.xbm b/utils/dialoged/src/bitmaps/alignb.xbm new file mode 100644 index 0000000000..6ffdcd94d9 --- /dev/null +++ b/utils/dialoged/src/bitmaps/alignb.xbm @@ -0,0 +1,9 @@ +#define alignb_width 24 +#define alignb_height 24 +static char alignb_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0x07, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, + 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0xf0, 0x09, 0x04, 0x10, 0x09, 0x04, + 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, 0xf0, 0xf9, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/alignl.bmp b/utils/dialoged/src/bitmaps/alignl.bmp new file mode 100644 index 0000000000000000000000000000000000000000..30471101b16de3328c3d7a9ddbb74c95669b30c1 GIT binary patch literal 238 zcmaKju@QhU3fPl58tp)=Q2Jo8bgU*r`XQ zqpFK#Mn{w=#ps68D(8$_P->|Z>mbio$leeL#26AdfBgB^?p|K+nFqW7@RnP41Lmtt AkpKVy literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/alignr.xbm b/utils/dialoged/src/bitmaps/alignr.xbm new file mode 100644 index 0000000000..337bbd762d --- /dev/null +++ b/utils/dialoged/src/bitmaps/alignr.xbm @@ -0,0 +1,9 @@ +#define alignr_width 24 +#define alignr_height 24 +static char alignr_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, 0x00, 0x08, 0x01, + 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, + 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, + 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/alignt.bmp b/utils/dialoged/src/bitmaps/alignt.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4505cbab566385942c0912c245668a2567a6e4a9 GIT binary patch literal 238 zcmaKkF%Ez*3|OdIzEIAs*ie($j$$j@{;1V~tY85%7&OAt xRk@Kpqg9j`#n=R9Rn8f;QR=7^Z-Dj*I)92ty-z9KwtE_g+7Cp#O78pXpD*v#PFw&0 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/alignt.xbm b/utils/dialoged/src/bitmaps/alignt.xbm new file mode 100644 index 0000000000..1cc90e390c --- /dev/null +++ b/utils/dialoged/src/bitmaps/alignt.xbm @@ -0,0 +1,9 @@ +#define alignt_width 24 +#define alignt_height 24 +static char alignt_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0xf9, 0x07, 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, + 0x10, 0x09, 0x04, 0xf0, 0x09, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, + 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0xf8, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/arrow.bmp b/utils/dialoged/src/bitmaps/arrow.bmp new file mode 100644 index 0000000000000000000000000000000000000000..d406ceb64f017d99bcc2d4913aef75135de357a0 GIT binary patch literal 382 zcmb7-I}UJZQ>1WPN=;5qEQ3zc?;o59U+Ka+r!5!mH1Gr)e_0X9zQo7Bn*m`tDP z>tSJ;fdXA9#W(4KsI?;JEJm}1)|8}VswC~|bu-BQ Vombvu=JhAub(#Nm-N`e*_yJ^>eVzaS literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/arrow.xbm b/utils/dialoged/src/bitmaps/arrow.xbm new file mode 100644 index 0000000000..17840c7aeb --- /dev/null +++ b/utils/dialoged/src/bitmaps/arrow.xbm @@ -0,0 +1,13 @@ +#define arrow_width 28 +#define arrow_height 28 +static char arrow_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, + 0x00, 0x7c, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, + 0x00, 0xfc, 0x03, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, + 0x00, 0xc4, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, + 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/bmpbuttn.bmp b/utils/dialoged/src/bitmaps/bmpbuttn.bmp new file mode 100644 index 0000000000000000000000000000000000000000..36278f425a3b6fc527ccde7cad6b27e55e190d71 GIT binary patch literal 382 zcmbVHxedcG3_Jq?m@-vn@Eq>F3#+ILw3)P-d`AklYxC3TC_dWu|ALSo<4XTdU+@b4 zJ@dMJrbhw|GPITlBO!Y4sI@XN!Z3yqohpiWgEAng0mNcZ%*en37UzJT+1jwLpbrQz<kjwKQTzxIPM3>KMjSFfke5s4*0jEOn1F|sVx cIiWIGV6fL+zn_EFG2egJ|IhOhtL9W*M>uDs-V%e=!r$T0<#?jcyCQD^Yy3#FQicGtYPkve*IU;AE^0f<*o9aaNC* j-sW5$dCu|q@!h0jECk8#&s{Jtan*Ao54U>ack_c!H9}t@ literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/choice.xbm b/utils/dialoged/src/bitmaps/choice.xbm new file mode 100644 index 0000000000..973f5c127d --- /dev/null +++ b/utils/dialoged/src/bitmaps/choice.xbm @@ -0,0 +1,13 @@ +#define choice_width 28 +#define choice_height 28 +static char choice_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x00, + 0x10, 0x00, 0xc6, 0x00, 0x10, 0x00, 0xee, 0x00, 0x10, 0x00, 0xfe, 0x00, + 0xf0, 0xff, 0xff, 0x00, 0x20, 0x00, 0x82, 0x00, 0x20, 0x00, 0x92, 0x00, + 0xa0, 0x3f, 0xba, 0x00, 0x20, 0x00, 0x82, 0x00, 0x20, 0x00, 0x82, 0x00, + 0xa0, 0xff, 0xfe, 0x00, 0x20, 0x00, 0x82, 0x00, 0x20, 0x00, 0x82, 0x00, + 0xa0, 0x7f, 0xba, 0x00, 0x20, 0x00, 0x92, 0x00, 0x20, 0x00, 0x82, 0x00, + 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/copysize.bmp b/utils/dialoged/src/bitmaps/copysize.bmp new file mode 100644 index 0000000000000000000000000000000000000000..36060ad72b54ea2be52e4a1ed7b4dda2ca3cf18f GIT binary patch literal 238 zcmY*SIS#`x3}b-;8ZxBM=sU9KFPf^3eo}TVeo?>RP?8g%v`FfLyzM^}KD0OaB3JT( zCl&anmc%SrXaEDPl~I|Z_fC(&$iNtpk$lmjm`TEJhyo%k)jjO4=f?j&&jF^kxcgy{ PbY7_X>Z|3R^1F!>`pH0Q literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/copysize.xbm b/utils/dialoged/src/bitmaps/copysize.xbm new file mode 100644 index 0000000000..6fcb9e6e95 --- /dev/null +++ b/utils/dialoged/src/bitmaps/copysize.xbm @@ -0,0 +1,8 @@ +#define copysize_width 24 +#define copysize_height 24 +static char copysize_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xf0,0xbf,0x03,0x10,0x20,0x02,0x10,0x20,0x02,0x10,0xa0,0x0f,0x10,0x20,0x07, + 0xf0,0x3f,0x02,0x00,0x00,0x00,0x00,0x55,0x05,0x00,0x00,0x00,0x00,0xf9,0x05, + 0x00,0x08,0x01,0x00,0xf9,0x05,0x00,0x00,0x00,0x00,0x55,0x05,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; diff --git a/utils/dialoged/src/bitmaps/cpp.xbm b/utils/dialoged/src/bitmaps/cpp.xbm new file mode 100644 index 0000000000..a05d1d1686 --- /dev/null +++ b/utils/dialoged/src/bitmaps/cpp.xbm @@ -0,0 +1,9 @@ +#define cpp_width 24 +#define cpp_height 24 +static char cpp_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x30, 0x34, 0x06, + 0x18, 0x30, 0x06, 0x18, 0x78, 0x0f, 0x18, 0x78, 0x0f, 0x18, 0x30, 0x06, + 0x30, 0x34, 0x06, 0xe0, 0x03, 0x00, 0x00, 0x40, 0x00, 0x00, 0xc0, 0x00, + 0x00, 0xff, 0x01, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/cross.bmp b/utils/dialoged/src/bitmaps/cross.bmp new file mode 100644 index 0000000000000000000000000000000000000000..079cb0dd58010154f6a791eead3a4cc19c02cf31 GIT binary patch literal 198 zcmZup$qm3D40EMQNS&l}^k1o?@M^wn1~1l1?Et?*e8`4ecgHv{Y0+9kDTRf{z+H~uRU|SqMnJMG$uK0U!a!ytzjWs7-TIffM+-jaAS7o1 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/dialog.bmp b/utils/dialoged/src/bitmaps/dialog.bmp new file mode 100644 index 0000000000000000000000000000000000000000..889d6ad216daf67bbd6c1f5de4edb3a41a357bdb GIT binary patch literal 566 zcma)3!4bkB5ZpM6>DunWswjvKh$uRACn z)C+m8?6BAU)amp?BEW$d%S7c8DJ6su7|1%1v#dydvPF^Tj2`Hx1p;tb*h#$q;JL}q z)m_PVR=_+HoX|X5aKeAS&2Q_i`LT55t^UY+$oaM1H~+7kHyG-9N5iSyhlPjgt(^B7 L*XF7Oe7)BjDUh8X literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/dialog.xbm b/utils/dialoged/src/bitmaps/dialog.xbm new file mode 100644 index 0000000000..409675024c --- /dev/null +++ b/utils/dialoged/src/bitmaps/dialog.xbm @@ -0,0 +1,13 @@ +#define dialog_width 28 +#define dialog_height 28 +static char dialog_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0x7f, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x90, 0xff, 0x4f, 0x00, + 0x90, 0x00, 0x48, 0x00, 0x90, 0x00, 0x48, 0x00, 0x90, 0x00, 0x48, 0x00, + 0x90, 0xff, 0x4f, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0xd0, 0xdf, 0x5f, 0x00, 0x50, 0x50, 0x50, 0x00, + 0x50, 0x50, 0x50, 0x00, 0xd0, 0xdf, 0x5f, 0x00, 0x10, 0x00, 0x40, 0x00, + 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/frame.xbm b/utils/dialoged/src/bitmaps/frame.xbm new file mode 100644 index 0000000000..f9d950c274 --- /dev/null +++ b/utils/dialoged/src/bitmaps/frame.xbm @@ -0,0 +1,13 @@ +#define frame_width 28 +#define frame_height 28 +static char frame_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0x40, 0x00, + 0xd0, 0x36, 0x40, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/gauge.bmp b/utils/dialoged/src/bitmaps/gauge.bmp new file mode 100644 index 0000000000000000000000000000000000000000..7803dd76c199551899407b65f10508a01c513997 GIT binary patch literal 382 zcmZ?rtz%>WgEAng0mNcZ%*en37UzJv7OgYjr3~!Jpk~)40^8NWPO6|lAe@$QX z$og~kBUz_sLrr07?f8hGdhe>W(imwPBM9e3iQt!RT$nrLD(6i3cQ#{1^VkzAZZ0`@ OLF5QF#7y#enCl0ENPMCI literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/group.xbm b/utils/dialoged/src/bitmaps/group.xbm new file mode 100644 index 0000000000..0dc97eace6 --- /dev/null +++ b/utils/dialoged/src/bitmaps/group.xbm @@ -0,0 +1,13 @@ +#define group_width 28 +#define group_height 28 +static char group_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0xaa, 0x03, 0x00, 0x00, 0x29, 0x01, 0x00, + 0x30, 0x91, 0x78, 0x00, 0x90, 0x92, 0x43, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, + 0x10, 0x00, 0x40, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/help.bmp b/utils/dialoged/src/bitmaps/help.bmp new file mode 100644 index 0000000000000000000000000000000000000000..54d5aa4b56a7613193cca03be224a2a2524c45dc GIT binary patch literal 238 zcmZuqF%p0v42yRjjQR}U;qD)pm^+ChPvb>?0n=6oJxh}m!lmnW!fU52#7s=YfRPLw z#(z`+HfnVtb3|*6sz$d)?>Z4Y`a~+Fh!QKL_)_s}36K9({}0KQlA;AjifpE4cworp Ka}Dl5-EslZsz8AN literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/help.xbm b/utils/dialoged/src/bitmaps/help.xbm new file mode 100644 index 0000000000..f382fd1f29 --- /dev/null +++ b/utils/dialoged/src/bitmaps/help.xbm @@ -0,0 +1,9 @@ +#define help_width 24 +#define help_height 24 +static char help_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0xe0, 0x07, 0x30, 0x30, 0x0f, 0x70, 0x38, 0x0e, 0xf0, 0x38, 0x0e, + 0xf0, 0x39, 0x0f, 0xf0, 0x03, 0x07, 0xf0, 0x87, 0x01, 0xf0, 0xcf, 0x01, + 0xf0, 0xc1, 0x01, 0xb0, 0x01, 0x00, 0x10, 0xc3, 0x01, 0x00, 0xc3, 0x01, + 0x00, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/horiz.bmp b/utils/dialoged/src/bitmaps/horiz.bmp new file mode 100644 index 0000000000000000000000000000000000000000..58af34a727e24407124fed67899ae2071dea12e9 GIT binary patch literal 238 zcmaKjF%Ez*3r)SF8kLTs=5{{JE?DUYEK&^#0pxo{w%L C5KP+u literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/horiz.xbm b/utils/dialoged/src/bitmaps/horiz.xbm new file mode 100644 index 0000000000..e4a0e385a8 --- /dev/null +++ b/utils/dialoged/src/bitmaps/horiz.xbm @@ -0,0 +1,9 @@ +#define horiz_width 24 +#define horiz_height 24 +static char horiz_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x22, 0x00, 0x00, 0x22, 0x00, + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, + 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, 0x40, 0x00, 0x01, + 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/listbox.bmp b/utils/dialoged/src/bitmaps/listbox.bmp new file mode 100644 index 0000000000000000000000000000000000000000..4d5fb34779927b41870954649505f116b69bd209 GIT binary patch literal 382 zcmb79Ne+M@3>*>@JbLmCzQenJ;UqW1&){b`Elt40gO<)PbOZL|a!@QN_TFVHvE)eH08ZrCQ{W?L=aStGNg%iTOA8O|3{UU~ zcRHZbGxVQiiBQhVP*Szl@Yxs<8e?XVGfPPN!qmmh`zzRz%k)d~SOwQraPKkc3JUWb WyzyG%ebUB{{{0*7WXGE5t%V;V>_w>n literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/load.xbm b/utils/dialoged/src/bitmaps/load.xbm new file mode 100644 index 0000000000..94c3ad5a9e --- /dev/null +++ b/utils/dialoged/src/bitmaps/load.xbm @@ -0,0 +1,9 @@ +#define load_width 24 +#define load_height 24 +static char load_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x06, 0xe0, 0x00, 0x07, + 0x10, 0x7f, 0x00, 0x10, 0x40, 0x00, 0x10, 0x40, 0x00, 0x10, 0xfe, 0x0f, + 0x10, 0x01, 0x04, 0x90, 0x00, 0x02, 0x50, 0x00, 0x01, 0x30, 0x80, 0x00, + 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/message.bmp b/utils/dialoged/src/bitmaps/message.bmp new file mode 100644 index 0000000000000000000000000000000000000000..fb682e89e6b1b6e8e5564c36b70799068098cf8f GIT binary patch literal 382 zcmb7;F%H8p3&InCD~$q;jo1M%kdkb>mb9216Te4?lF20 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/message.xbm b/utils/dialoged/src/bitmaps/message.xbm new file mode 100644 index 0000000000..f0f5385486 --- /dev/null +++ b/utils/dialoged/src/bitmaps/message.xbm @@ -0,0 +1,13 @@ +#define message_width 28 +#define message_height 28 +static char message_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, + 0x00, 0xe8, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xc4, 0x01, 0x00, + 0x00, 0xc4, 0x01, 0x00, 0x00, 0x82, 0x03, 0x00, 0x00, 0xfe, 0x03, 0x00, + 0x00, 0x01, 0x07, 0x00, 0x00, 0x01, 0x07, 0x00, 0x80, 0x00, 0x0e, 0x00, + 0xc0, 0x00, 0x1e, 0x00, 0xe0, 0x01, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/mtext.bmp b/utils/dialoged/src/bitmaps/mtext.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5ab765b69af6d6140bd3f0ee608c1efaf6fe2156 GIT binary patch literal 382 zcmZ`zF%HBa40ENE(($Hy!@Z+>|H9O4C&v2~{ERwjC|xil7(0ow?Y{+%gZaz&L@ao@ zzJ_m~cZ3@#u!~ZzhnW<$R^*&%G{0!g7=yb0l4tjP;1(ew=nJ8j|<6WY3bU0`GK9aK^RUId`!4(ELX-1{H u>6c`QQqJ8_T9s0iQsQ8(Wab^@`3kuPA_p->w)Xt4Pkz>06 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/new.xbm b/utils/dialoged/src/bitmaps/new.xbm new file mode 100644 index 0000000000..8b75207815 --- /dev/null +++ b/utils/dialoged/src/bitmaps/new.xbm @@ -0,0 +1,8 @@ +#define new_width 24 +#define new_height 24 +static char new_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x7f,0x00,0x80,0xc0,0x00,0x80,0x40,0x01,0x80,0xc0,0x03,0x80,0x00,0x02, + 0x80,0x00,0x02,0x80,0x00,0x02,0x80,0x00,0x02,0x80,0x00,0x02,0x80,0x00,0x02, + 0x80,0x00,0x02,0x80,0x00,0x02,0x80,0xff,0x03,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; diff --git a/utils/dialoged/src/bitmaps/open.bmp b/utils/dialoged/src/bitmaps/open.bmp new file mode 100644 index 0000000000000000000000000000000000000000..9d90ab6fd09eb672a19966282758642c6ec82cb4 GIT binary patch literal 238 zcmZuqu?@p83}b)-$=06HJF@2&PEkjV{>r|n@COPlx1CCxq%2v|e!MYp%AVpwyo(EN zQs9;PPb#2`TBk`BqO}HhS0VBuVnm|ONJ;DiDi6K56=5~@f>PWVGr{Pi;2e#DJfiFW U&wKV8R!!u0ZaR(3HCdYrFBZyA>Hq)$ literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/panel.xbm b/utils/dialoged/src/bitmaps/panel.xbm new file mode 100644 index 0000000000..db69e42fc3 --- /dev/null +++ b/utils/dialoged/src/bitmaps/panel.xbm @@ -0,0 +1,13 @@ +#define panel_width 28 +#define panel_height 28 +static char panel_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xff, 0x1f, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, 0xc0, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/picture.bmp b/utils/dialoged/src/bitmaps/picture.bmp new file mode 100644 index 0000000000000000000000000000000000000000..60dde983ad2e8b4dcb76ac1b3269b75f7a16bcbe GIT binary patch literal 382 zcma)%F%H5o3`Kt>q;zEB44i|VyLhTMl$#|t3;)}$fDJcxUcT+Pc|2bm!Vbne{Z_u= z68c_w9j@h(zSRIVXDWOsrT~OGM`;z$hMKQ6v3qu>Fn`a1EXH)KH+sxR!u~0eX(g@Do|H%l}Mge dzI4COX>HDH{_|h+QT>#^iXU0CppzCaeFLkpczOT; literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/radio.xbm b/utils/dialoged/src/bitmaps/radio.xbm new file mode 100644 index 0000000000..13c7c118b0 --- /dev/null +++ b/utils/dialoged/src/bitmaps/radio.xbm @@ -0,0 +1,13 @@ +#define radio_width 28 +#define radio_height 28 +static char radio_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x01, 0x04, 0x00, + 0x80, 0x00, 0x08, 0x00, 0x80, 0x70, 0x08, 0x00, 0x40, 0xf8, 0x10, 0x00, + 0x40, 0xfc, 0x11, 0x00, 0x40, 0xfc, 0x11, 0x00, 0x40, 0xfc, 0x11, 0x00, + 0x40, 0xf8, 0x10, 0x00, 0x80, 0x70, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00, + 0x00, 0x01, 0x04, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/report.xbm b/utils/dialoged/src/bitmaps/report.xbm new file mode 100644 index 0000000000..601853aecb --- /dev/null +++ b/utils/dialoged/src/bitmaps/report.xbm @@ -0,0 +1,9 @@ +#define report_width 24 +#define report_height 24 +static char report_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x03, + 0x10, 0x00, 0x02, 0x90, 0x77, 0x02, 0x90, 0x7d, 0x02, 0x10, 0x00, 0x02, + 0x10, 0x37, 0x02, 0x10, 0x00, 0x02, 0x10, 0x00, 0x02, 0xd0, 0x03, 0x02, + 0x10, 0x00, 0x02, 0xd0, 0xbc, 0x02, 0x10, 0x00, 0x02, 0xd0, 0xbb, 0x02, + 0x10, 0x00, 0x02, 0xf0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/save.bmp b/utils/dialoged/src/bitmaps/save.bmp new file mode 100644 index 0000000000000000000000000000000000000000..545671fa17b5663261c96e2845fb807df0bd9377 GIT binary patch literal 238 zcmaKlu?@p83fFkOK&AjlojM7)f##6|H&sLz0aQ}KG*?w_=1a8 zRQjeqNs}nGHVvg!?_KWBVq|HI=pZK|q%s357h1PxSLBJg*JZ^kAph&Un|rg8-^k)t F;0F1cIhX(d literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/save.xbm b/utils/dialoged/src/bitmaps/save.xbm new file mode 100644 index 0000000000..2f53311c36 --- /dev/null +++ b/utils/dialoged/src/bitmaps/save.xbm @@ -0,0 +1,9 @@ +#define save_width 24 +#define save_height 24 +static char save_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xe0, 0xff, 0x07, 0xa0, 0x00, 0x05, 0xa0, 0x00, 0x07, 0xa0, 0x00, 0x05, + 0xa0, 0x00, 0x05, 0xa0, 0x00, 0x05, 0xa0, 0x00, 0x05, 0x20, 0xff, 0x04, + 0x20, 0x00, 0x04, 0x20, 0xff, 0x05, 0x20, 0x3f, 0x05, 0x20, 0x3f, 0x05, + 0x20, 0x3f, 0x05, 0xc0, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/scroll.bmp b/utils/dialoged/src/bitmaps/scroll.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3f7896452526eaa96a31ecf4d2dbc3acc693e772 GIT binary patch literal 382 zcmbtOK@NZ*3@eGrJbLmCzQenJ;UqW1&){d+4T#ZrW2{~2mcf2p4i+bQBi06o$^5zX z^|CZr0|}Z)sTMLNa?Xe`vQaEiiYkIfEmC-5NONrqf#}XkAMMpwq7MY|tkk}08gJi5 O`~3gT{wg3t|GxngxNSB7 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/scroll.xbm b/utils/dialoged/src/bitmaps/scroll.xbm new file mode 100644 index 0000000000..68640bae6c --- /dev/null +++ b/utils/dialoged/src/bitmaps/scroll.xbm @@ -0,0 +1,11 @@ +#define scroll_width 28 +#define scroll_height 28 +static char scroll_bits[] = { + 0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00, + 0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, + 0x00,0xf0,0xf8,0xff,0xff,0xf0,0x08,0x20,0x80,0xf0,0x08,0x20,0x80,0xf0,0x08, + 0x21,0x84,0xf0,0x88,0x27,0x8f,0xf0,0xc8,0x27,0x9f,0xf0,0x88,0x27,0x8f,0xf0, + 0x08,0x21,0x84,0xf0,0x08,0x20,0x80,0xf0,0x08,0x20,0x80,0xf0,0xf8,0xff,0xff, + 0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00, + 0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00, + 0x00,0x00,0xf0,0x00,0x00,0x00,0xf0}; diff --git a/utils/dialoged/src/bitmaps/slider.bmp b/utils/dialoged/src/bitmaps/slider.bmp new file mode 100644 index 0000000000000000000000000000000000000000..59ce662e9bdc733f796a35383c55bb578f5da9eb GIT binary patch literal 382 zcmb78u?@p83}b)-%Gjwlo<@)^%ehqP2!n3L8Bgy^9!JDlx^hU3T7C&EOyX7n>L`dWhZJ5cuK1 gtcO$oSHtRfM}KLmeE)!@+ce_f4BN>1W!f&k0TQZYDF6Tf literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/text.xbm b/utils/dialoged/src/bitmaps/text.xbm new file mode 100644 index 0000000000..b823e479c5 --- /dev/null +++ b/utils/dialoged/src/bitmaps/text.xbm @@ -0,0 +1,13 @@ +#define text_width 28 +#define text_height 28 +static char text_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0xff, 0xff, 0x00, 0x10, 0x00, 0x80, 0x00, 0x10, 0x00, 0xa0, 0x00, + 0x10, 0x60, 0xa0, 0x00, 0x10, 0x60, 0xa0, 0x00, 0x10, 0x60, 0xa0, 0x00, + 0x90, 0xe7, 0xa3, 0x00, 0xd0, 0x6c, 0xa6, 0x00, 0x10, 0x6f, 0xa6, 0x00, + 0x90, 0x6d, 0xa6, 0x00, 0xd0, 0x6c, 0xa6, 0x00, 0xd0, 0x6c, 0xa6, 0x00, + 0x90, 0xef, 0xa3, 0x00, 0x10, 0x00, 0xa0, 0x00, 0x10, 0x00, 0x80, 0x00, + 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/textsw.xbm b/utils/dialoged/src/bitmaps/textsw.xbm new file mode 100644 index 0000000000..686131701c --- /dev/null +++ b/utils/dialoged/src/bitmaps/textsw.xbm @@ -0,0 +1,13 @@ +#define textsw_width 28 +#define textsw_height 28 +static char textsw_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xff, 0x1f, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0x9f, 0x11, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0x7f, 0x13, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0xeb, 0x13, 0x00, 0x40, 0x00, 0x10, 0x00, 0x40, 0x00, 0x10, 0x00, + 0x40, 0xdf, 0x11, 0x00, 0x40, 0x00, 0x10, 0x00, 0xc0, 0xff, 0x1f, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/tick.bmp b/utils/dialoged/src/bitmaps/tick.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3673eda5de62c1fc3db392cba62bc2e74ad51d90 GIT binary patch literal 198 zcmZvT!3}^g3_|a<9syhMs~1$ShPC0%zsoR vTD4Ar8P!@-DTScB)%%zLZ&*;|h`JQ3^NiE0|T7F9qjzl2^cf>9QF?FMZ8d)1PO#h65C0vwDWSpW2H>QNDM@S zmJIC1PUJQ30?Ld;pCXxv6~fs8i2~vH|E+&J(|oGdii}_YJ!sUz z((YWzGDEE-(MqWb%&45RLI?!KTcy|pcxFM{N3r657vo{E>4N2o^{e;ZbNANgU-K?u CAW)M4 literal 0 HcmV?d00001 diff --git a/utils/dialoged/src/bitmaps/vert.xbm b/utils/dialoged/src/bitmaps/vert.xbm new file mode 100644 index 0000000000..e8ac230c3b --- /dev/null +++ b/utils/dialoged/src/bitmaps/vert.xbm @@ -0,0 +1,9 @@ +#define vert_width 24 +#define vert_height 24 +static char vert_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xf8, 0x07, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0xf0, 0x09, 0x04, + 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, 0x10, 0x09, 0x04, + 0xf0, 0x09, 0x04, 0x00, 0x08, 0x04, 0x00, 0x08, 0x04, 0x00, 0xf8, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/wxbuild.xbm b/utils/dialoged/src/bitmaps/wxbuild.xbm new file mode 100644 index 0000000000..8038c9110f --- /dev/null +++ b/utils/dialoged/src/bitmaps/wxbuild.xbm @@ -0,0 +1,46 @@ +#define wxbuild_width 64 +#define wxbuild_height 64 +static char wxbuild_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x33, 0x0c, 0xf0, 0xff, 0xff, 0xff, 0x3f, + 0x03, 0x33, 0x0c, 0xf0, 0xff, 0xff, 0xff, 0x3f, 0x33, 0xc3, 0x03, 0x30, + 0x00, 0x00, 0x00, 0x30, 0x33, 0xc3, 0x03, 0x30, 0x00, 0x00, 0x00, 0x30, + 0x33, 0xc3, 0x03, 0x30, 0x3f, 0xcf, 0xcc, 0x33, 0x33, 0xc3, 0x03, 0x30, + 0x3f, 0xcf, 0xcc, 0x33, 0xcc, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x30, + 0xcc, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, + 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, + 0x00, 0xc0, 0xff, 0xff, 0xff, 0xf3, 0x33, 0x33, 0x00, 0xc0, 0xff, 0xff, + 0xff, 0xf3, 0x33, 0x33, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x30, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x30, 0x00, 0xc0, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x30, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x30, + 0x00, 0xc0, 0xfc, 0xf3, 0x0f, 0x33, 0xfc, 0x30, 0x00, 0xc0, 0xfc, 0xf3, + 0x0f, 0x33, 0xfc, 0x30, 0x00, 0xc0, 0x0c, 0x33, 0x0c, 0xf3, 0x00, 0x30, + 0x00, 0xc0, 0x0c, 0x33, 0x0c, 0xf3, 0x00, 0x30, 0x00, 0xc0, 0xfc, 0xf3, + 0x0f, 0xf3, 0x03, 0x30, 0x00, 0xc0, 0xfc, 0xf3, 0x0f, 0xf3, 0x03, 0x30, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0xf3, 0x0f, 0x30, 0x00, 0xc0, 0x00, 0x00, + 0x00, 0xf3, 0x0f, 0x30, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xf3, 0x3f, 0x30, + 0x00, 0xc0, 0x00, 0x00, 0x00, 0xf3, 0x3f, 0x30, 0xff, 0xff, 0x00, 0x00, + 0x00, 0xf3, 0xff, 0x30, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf3, 0xff, 0x30, + 0xff, 0xff, 0x00, 0x00, 0x00, 0xf3, 0xff, 0x33, 0xff, 0xff, 0x00, 0x00, + 0x00, 0xf3, 0xff, 0x33, 0x03, 0xc3, 0x00, 0x00, 0x00, 0xf3, 0xff, 0x3f, + 0x03, 0xc3, 0x00, 0x00, 0x00, 0xf3, 0xff, 0x3f, 0x03, 0xc3, 0x00, 0x00, + 0x00, 0xf3, 0x3f, 0x30, 0x03, 0xc3, 0x00, 0x00, 0x00, 0xf3, 0x3f, 0x30, + 0xff, 0xff, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x30, 0xff, 0xff, 0x00, 0x00, + 0x00, 0xf3, 0x3c, 0x30, 0x03, 0xc0, 0xff, 0xff, 0xff, 0x33, 0xf0, 0x30, + 0x03, 0xc0, 0xff, 0xff, 0xff, 0x33, 0xf0, 0x30, 0x03, 0x00, 0x00, 0x33, + 0x00, 0x00, 0xf0, 0x30, 0x03, 0x00, 0x00, 0x33, 0x00, 0x00, 0xf0, 0x30, + 0x03, 0x00, 0x00, 0xf3, 0xfc, 0x00, 0xc0, 0x33, 0x03, 0x00, 0x00, 0xf3, + 0xfc, 0x00, 0xc0, 0x33, 0x03, 0xc0, 0x0c, 0x33, 0x00, 0x00, 0xc0, 0x33, + 0x03, 0xc0, 0x0c, 0x33, 0x00, 0x00, 0xc0, 0x33, 0xf3, 0xf3, 0x3f, 0x33, + 0xfc, 0xcc, 0x0f, 0x30, 0xf3, 0xf3, 0x3f, 0x33, 0xfc, 0xcc, 0x0f, 0x30, + 0x33, 0xc0, 0x0c, 0x33, 0x00, 0x00, 0x00, 0x30, 0x33, 0xc0, 0x0c, 0x33, + 0x00, 0x00, 0x00, 0x30, 0x33, 0x00, 0x00, 0xf3, 0xff, 0xff, 0xff, 0x3f, + 0x33, 0x00, 0x00, 0xf3, 0xff, 0xff, 0xff, 0x3f, 0x33, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0xf3, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x03, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x03, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/utils/dialoged/src/bitmaps/wxwin.xbm b/utils/dialoged/src/bitmaps/wxwin.xbm new file mode 100644 index 0000000000..a0da1d2eea --- /dev/null +++ b/utils/dialoged/src/bitmaps/wxwin.xbm @@ -0,0 +1,12 @@ +#define wxwin_width 32 +#define wxwin_height 32 +static char wxwin_bits[] = { + 0x00,0x80,0x01,0x00,0x81,0x8f,0x1d,0xc0,0xc5,0x9a,0x25,0xa0,0x54,0x92,0x49, + 0x50,0x51,0x92,0x91,0x28,0xc5,0x9f,0x21,0x15,0xd4,0x9a,0x41,0x0a,0xd1,0x92, + 0x81,0x04,0x45,0x92,0x41,0x09,0x54,0x93,0xa1,0x12,0x51,0x9f,0x51,0x24,0xc5, + 0x99,0x29,0x48,0x54,0x80,0x15,0x90,0x10,0x80,0x0d,0xe0,0x00,0x80,0x01,0x00, + 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x80,0x01,0x00,0x00,0x83,0x01, + 0x00,0x80,0x81,0x01,0x08,0x80,0x80,0x01,0x18,0x38,0x87,0x31,0x30,0xfc,0x8f, + 0x31,0x20,0xfc,0x83,0x01,0x20,0xfc,0x83,0x81,0x23,0xfc,0x83,0x01,0x20,0xfc, + 0x8f,0x01,0x20,0xfc,0x8f,0x31,0x30,0xf8,0x8f,0x31,0x18,0x70,0x87,0x01,0x08, + 0x00,0x80,0x01,0x00,0x00,0x80,0x01,0x00}; diff --git a/utils/dialoged/src/dialoged.cpp b/utils/dialoged/src/dialoged.cpp new file mode 100644 index 0000000000..1abe2b507c --- /dev/null +++ b/utils/dialoged/src/dialoged.cpp @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dialoged.cpp +// Purpose: Main Dialog Editor implementation file +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "dialoged.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include "dialoged.h" + +// A macro needed for some compilers (AIX) that need 'main' to be defined +// in the application itself. +IMPLEMENT_WXWIN_MAIN + +IMPLEMENT_APP(MyApp) + +MyApp::MyApp(void) +{ +} + +wxResourceManager theResourceManager; + +bool MyApp::OnInit(void) +{ + theResourceManager.Initialize(); + theResourceManager.ShowResourceEditor(TRUE); + + if (argc > 1) + theResourceManager.Load(argv[1]); + + SetTopWindow(theResourceManager.GetEditorFrame()); + + return TRUE; +} + diff --git a/utils/dialoged/src/dialoged.def b/utils/dialoged/src/dialoged.def new file mode 100644 index 0000000000..a7c0fbbaa5 --- /dev/null +++ b/utils/dialoged/src/dialoged.def @@ -0,0 +1,8 @@ +NAME DialogEd +DESCRIPTION 'wxWindows Dialog Editor' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/utils/dialoged/src/dialoged.h b/utils/dialoged/src/dialoged.h new file mode 100644 index 0000000000..b7265ba164 --- /dev/null +++ b/utils/dialoged/src/dialoged.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dialoged.h +// Purpose: Dialog Editor application header file +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma interface "dialoged.h" +#endif + +#ifndef dialogedh +#define dialogedh + +#include "proplist.h" +#include "reseditr.h" + +class MyChild; + +// Define a new application +class MyApp: public wxApp +{ + public: + MyApp(void); + bool OnInit(void); +}; + +DECLARE_APP(MyApp) + +extern wxFrame *GetMainFrame(void); + +#endif diff --git a/utils/dialoged/src/dialoged.ico b/utils/dialoged/src/dialoged.ico new file mode 100644 index 0000000000000000000000000000000000000000..cec6bac64ecd29c4736882dc3976810ac1d87ce4 GIT binary patch literal 766 zcmcgpF%H5o47>tEH(+7T$S>eYWeOYF=r8z6p2N z1GQt9>PwC(lKGc9t$0B6(+ad_Yi;MUf8wKD=*76b_SZc2QwsiZ-sD&F*q`*;ui}Sw k5xn(JoWGT$3m +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#include "reseditr.h" +#include "winprop.h" +#include "editrpal.h" +#include "dlghndlr.h" + +extern void wxResourceEditWindow(wxWindow *win); + +IMPLEMENT_CLASS(wxResourceEditorDialogHandler, wxEvtHandler) +IMPLEMENT_CLASS(wxResourceEditorControlHandler, wxEvtHandler) + +BEGIN_EVENT_TABLE(wxResourceEditorDialogHandler, wxEvtHandler) + EVT_PAINT(wxResourceEditorDialogHandler::OnPaint) + EVT_MOUSE_EVENTS(wxResourceEditorDialogHandler::OnMouseEvent) +END_EVENT_TABLE() + +BEGIN_EVENT_TABLE(wxResourceEditorControlHandler, wxEvtHandler) + EVT_MOUSE_EVENTS(wxResourceEditorControlHandler::OnMouseEvent) +END_EVENT_TABLE() + +/* + * Dialog box event handler + */ + +wxResourceEditorDialogHandler::wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, + wxEvtHandler *oldHandler, wxResourceManager *manager) +{ + handlerDialog = dialog; + handlerResource = resource; + handlerOldHandler = oldHandler; + resourceManager = manager; + + dragMode = wxDRAG_MODE_NONE; + dragType = wxDRAG_TYPE_NONE; + dragItem = NULL; + firstDragX = 0; + firstDragY = 0; + oldDragX = 0; + oldDragY = 0; + dragTolerance = 3; + checkTolerance = TRUE; +} + +void wxResourceEditorDialogHandler::OnItemSelect(wxControl *item, bool select) +{ + if (select) + resourceManager->AddSelection(item); + else + resourceManager->RemoveSelection(item); +} + +bool wxResourceEditorDialogHandler::OnClose(void) +{ + handlerDialog->PopEventHandler(); + + // Now reset all child event handlers + wxNode *node = handlerDialog->GetChildren()->First(); + while ( node ) + { + wxWindow *child = (wxWindow *)node->Data(); + wxEvtHandler *childHandler = child->GetEventHandler(); + if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler != child ) + { + child->PopEventHandler(); + delete childHandler; + } + node = node->Next(); + } + + // Save the information before deleting the dialog. + resourceManager->InstantiateResourceFromWindow(handlerResource, handlerDialog, TRUE); + + resourceManager->DisassociateResource(handlerDialog, FALSE); + + handlerDialog->Show(FALSE); + delete this; + return TRUE; +} + +void wxResourceEditorDialogHandler::OnPaint(wxPaintEvent& event) +{ + wxPaintDC dc(handlerDialog); + + PaintSelectionHandles(dc); +} + +// Add event handlers for all children +void wxResourceEditorDialogHandler::AddChildHandlers(void) +{ + wxNode *node = handlerDialog->GetChildren()->First(); + while ( node ) + { + wxControl *child = (wxControl *)node->Data(); + wxEvtHandler *childHandler = child->GetEventHandler(); + if ( child->IsKindOf(CLASSINFO(wxControl)) && childHandler == child ) + child->PushEventHandler(new wxResourceEditorControlHandler(child, childHandler)); + node = node->Next(); + } +} + +void wxResourceEditorDialogHandler::OnLeftClick(int x, int y, int keys) +{ + if (keys & wxKEY_CTRL) + { + wxResourceEditWindow(handlerDialog); + return; + } + + // Deselect all items if click on panel + if (resourceManager->GetEditorPalette()->currentlySelected == PALETTE_ARROW) + { + int needsRefresh = 0; + wxNode *node = handlerDialog->GetChildren()->First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected()) + { + needsRefresh ++; + OnItemSelect(item, FALSE); + childHandler->SelectItem(FALSE); + } + node = node->Next(); + } + if (needsRefresh > 0) + { + wxClientDC dc(handlerDialog); + dc.Clear(); + handlerDialog->Refresh(); + } + return; + } + + switch (resourceManager->GetEditorPalette()->currentlySelected) + { + case PALETTE_FRAME: + break; + case PALETTE_DIALOG_BOX: + break; + case PALETTE_PANEL: + break; + case PALETTE_CANVAS: + break; + case PALETTE_TEXT_WINDOW: + break; + case PALETTE_BUTTON: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y); + break; + case PALETTE_BITMAP_BUTTON: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxButton", x, y, TRUE); + break; + case PALETTE_MESSAGE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y); + break; + case PALETTE_BITMAP_MESSAGE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMessage", x, y, TRUE); + break; + case PALETTE_TEXT: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxText", x, y); + break; + case PALETTE_MULTITEXT: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxMultiText", x, y); + break; + case PALETTE_CHOICE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxChoice", x, y); + break; + case PALETTE_CHECKBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxCheckBox", x, y); + break; + case PALETTE_RADIOBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxRadioBox", x, y); + break; + case PALETTE_LISTBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxListBox", x, y); + break; + case PALETTE_SLIDER: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxSlider", x, y); + break; + case PALETTE_GAUGE: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxGauge", x, y); + break; + case PALETTE_GROUPBOX: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxStaticBox", x, y); + break; + case PALETTE_SCROLLBAR: + resourceManager->CreatePanelItem(handlerResource, handlerDialog, "wxScrollBar", x, y); + break; + default: + break; + } + + // Now switch pointer on. + if (resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW) + { + resourceManager->GetEditorPalette()->ToggleTool(resourceManager->GetEditorPalette()->currentlySelected, FALSE); + resourceManager->GetEditorPalette()->ToggleTool(PALETTE_ARROW, TRUE); + resourceManager->GetEditorPalette()->currentlySelected = PALETTE_ARROW; + } +} + +void wxResourceEditorDialogHandler::OnRightClick(int x, int y, int keys) +{ + wxMenu *menu = resourceManager->GetPopupMenu(); + menu->SetClientData((char *)handlerDialog); +#ifdef __MOTIF__ + handlerDialog->FakePopupMenu(menu, x, y); +#else + handlerDialog->PopupMenu(menu, x, y); +#endif +} + +void wxResourceEditorDialogHandler::OnItemLeftClick(wxControl *item, int x, int y, int keys) +{ + if (keys & wxKEY_CTRL) + { + wxResourceEditWindow(item); + return; + } + + // If this is a wxStaticBox and the pointer isn't an arrow, chances + // are that we really meant to place an item on the panel. + // Fake this event. + if ((item->GetClassInfo() == CLASSINFO(wxStaticBox)) && resourceManager->GetEditorPalette()->currentlySelected != PALETTE_ARROW) + { + OnLeftClick(x, y, keys); + return; + } + + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + + if (childHandler->IsSelected()) + { + childHandler->SelectItem(FALSE); + OnItemSelect(item, FALSE); + + wxClientDC dc(handlerDialog); + dc.Clear(); + handlerDialog->Refresh(); + } + else + { + childHandler->SelectItem(TRUE); + OnItemSelect(item, TRUE); + + // Deselect other items if shift is not pressed + int needsRefresh = 0; + if (!(keys & wxKEY_SHIFT)) + { + wxNode *node = item->GetParent()->GetChildren()->First(); + while (node) + { + wxControl *child = (wxControl *)node->Data(); + wxResourceEditorControlHandler *childHandler2 = (wxResourceEditorControlHandler *)child->GetEventHandler(); + if (child->IsKindOf(CLASSINFO(wxControl)) && childHandler2->IsSelected() && child != item) + { + childHandler2->SelectItem(FALSE); + OnItemSelect(child, FALSE); + needsRefresh ++; + } + node = node->Next(); + } + } + + wxClientDC dc(handlerDialog); + childHandler->DrawSelectionHandles(dc); + + if (needsRefresh > 0) + { + dc.Clear(); + handlerDialog->Refresh(); + } + } +} + +void wxResourceEditorDialogHandler::OnItemRightClick(wxControl *item, int x, int y, int keys) +{ +/* + if (keys & wxKEY_CTRL) + { + wxDebugMsg("Item %s, selected = %d\n", item->GetName(), item->IsSelected()); + return; + } +*/ + + wxMenu *menu = resourceManager->GetPopupMenu(); + menu->SetClientData((char *)item); +#ifdef __MOTIF__ + handlerDialog->FakePopupMenu(menu, x, y); +#else + handlerDialog->PopupMenu(menu, x, y); +#endif +} + +// An event outside any items: may be a drag event. +void wxResourceEditorDialogHandler::OnMouseEvent(wxMouseEvent& event) +{ + if (GetEvtHandlerEnabled()) + { + // If we're dragging an item or selection handle, + // continue dragging. + if (dragMode != wxDRAG_MODE_NONE) + { + ProcessItemEvent(dragItem, event, dragType); + return; + } + + long x, y; + event.Position(&x, &y); + + // Find which selection handle we're on, if any + wxNode *node = handlerDialog->GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + int selHandle = childHandler->SelectionHandleHitTest(x, y); + if (selHandle > 0) + { + ProcessItemEvent(item, event, selHandle); + return; + } + } + node = node->Next(); + } + + // We're not on an item or selection handle. + // so... check for a left or right click event + // to send to the application. + int keys = 0; + if (event.ShiftDown()) keys = keys | wxKEY_SHIFT; + if (event.ControlDown()) keys = keys | wxKEY_CTRL; + + if (event.LeftUp()) + OnLeftClick(x, y, keys); + else if (event.RightUp()) + OnRightClick(x, y, keys); + } + else + event.Skip(); +} + +void wxResourceEditorDialogHandler::OnItemEvent(wxControl *item, wxMouseEvent& event) +{ + if (!GetEvtHandlerEnabled()) + return; + + // Not a selection handle event: just a normal item event. + // Transform to panel coordinates. + int x, y; + item->GetPosition(&x, &y); + + event.m_x = event.m_x + x; + event.m_y = event.m_y + y; + ProcessItemEvent(item, event, dragType); +} + +void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle) +{ + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + + long x, y; + event.Position(&x, &y); + int keys = 0; + if (event.ShiftDown()) keys = keys | wxKEY_SHIFT; + if (event.ControlDown()) keys = keys | wxKEY_CTRL; + bool dragging = event.Dragging(); + if (dragging) + { + int dx = (int)abs((x - firstDragX)); + int dy = (int)abs((y - firstDragY)); + if (checkTolerance && (dx <= dragTolerance) && (dy <= dragTolerance)) + { + return; + } + else + // If we've ignored the tolerance once, then ALWAYS ignore + // tolerance in this drag, even if we come back within + // the tolerance range. + { + checkTolerance = FALSE; + } + } + if (dragging && dragItem && dragMode == wxDRAG_MODE_START_LEFT) + { + dragMode = wxDRAG_MODE_CONTINUE_LEFT; + wxClientDC dc(handlerDialog); + childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); + oldDragX = x; oldDragY = y; + } + else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) + { + wxClientDC dc(handlerDialog); + childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); + childHandler->OnDragContinue(TRUE, x, y, keys, dc, selectionHandle); + oldDragX = x; oldDragY = y; + } + else if (event.LeftUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_LEFT) + { + wxClientDC dc(handlerDialog); + dragMode = wxDRAG_MODE_NONE; + checkTolerance = TRUE; + childHandler->OnDragContinue(FALSE, oldDragX, oldDragY, keys, dc, selectionHandle); + childHandler->OnDragEnd(x, y, keys, dc, selectionHandle); + dragItem = NULL; + dragType = wxDRAG_TYPE_NONE; + } + else if (dragging && dragItem && dragMode == wxDRAG_MODE_START_RIGHT) + { + wxClientDC dc(handlerDialog); + dragMode = wxDRAG_MODE_CONTINUE_RIGHT; + childHandler->OnDragBegin(x, y, keys, dc, selectionHandle); + oldDragX = x; oldDragY = y; + } + else if (dragging && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) + { + oldDragX = x; oldDragY = y; + } + else if (event.RightUp() && dragItem && dragMode == wxDRAG_MODE_CONTINUE_RIGHT) + { + dragMode = wxDRAG_MODE_NONE; + checkTolerance = TRUE; + dragItem = NULL; + dragType = wxDRAG_TYPE_NONE; + } + else if (event.IsButton()) + { + checkTolerance = TRUE; + + if (event.LeftDown()) + { + dragItem = item; + dragMode = wxDRAG_MODE_START_LEFT; + firstDragX = x; + firstDragY = y; + dragType = selectionHandle; + } + else if (event.RightDown()) + { + dragItem = item; + dragMode = wxDRAG_MODE_START_RIGHT; + firstDragX = x; + firstDragY = y; + dragType = selectionHandle; + } + else if (event.LeftUp()) + { + if (dragItem) + childHandler->OnLeftClick(x, y, keys); + else + OnLeftClick(x, y, keys); + + dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; + } + else if (event.RightUp()) + { + if (dragItem) + childHandler->OnRightClick(x, y, keys); + else + OnRightClick(x, y, keys); + + dragItem = NULL; dragMode = wxDRAG_MODE_NONE; dragType = wxDRAG_TYPE_NONE; + } + } +} + +// Calls DrawSelectionHandles for all items if +// edit mode is on. +void wxResourceEditorDialogHandler::PaintSelectionHandles(wxDC& dc) +{ + if (!GetEvtHandlerEnabled()) + return; + + dc.BeginDrawing(); + + wxNode *node = handlerDialog->GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + + // Don't draw handles for an item that's being moved: it'll + // smear. + if (childHandler->IsSelected() && (item != dragItem)) + childHandler->DrawSelectionHandles(dc); + } + node = node->Next(); + } + dc.EndDrawing(); +} + +/* + * Event handler for controls + */ + +int wxResourceEditorControlHandler::dragOffsetX = 0; +int wxResourceEditorControlHandler::dragOffsetY = 0; + +wxResourceEditorControlHandler::wxResourceEditorControlHandler(wxControl *control, + wxEvtHandler *oldHandler) +{ + handlerControl = control; + handlerOldHandler = oldHandler; + + handleSize = 6; + handleMargin = 1; + isSelected = FALSE; + dragOffsetX = 0; + dragOffsetY = 0; +} + +/* + * Manipulation and drawing of items in Edit Mode + */ + +void wxResourceEditorControlHandler::SelectItem(bool select) +{ + isSelected = select; +} + +// Returns TRUE or FALSE +bool wxResourceEditorControlHandler::HitTest(int x, int y) +{ + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + return ((x >= xpos) && (x <= (xpos + width)) && (y >= ypos) && (y <= (ypos + height))); +} + +// Calculate position of the 8 handles +void wxResourceEditorControlHandler::CalcSelectionHandles(int *hx, int *hy) +{ + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + int middleX = (xpos + (width/2)); + int middleY = (ypos + (height/2)); + + // Start from top middle, clockwise. +/* + 7 0 1 + + 6 2 + + 5 4 3 +*/ + + hx[0] = (int)(middleX - (handleSize/2)); + hy[0] = ypos - handleSize - handleMargin; + + hx[1] = xpos + width + handleMargin; + hy[1] = ypos - handleSize - handleMargin; + + hx[2] = xpos + width + handleMargin; + hy[2] = (int)(middleY - (handleSize/2)); + + hx[3] = xpos + width + handleMargin; + hy[3] = ypos + height + handleMargin; + + hx[4] = (int)(middleX - (handleSize/2)); + hy[4] = ypos + height + handleMargin; + + hx[5] = xpos - handleSize - handleMargin; + hy[5] = ypos + height + handleMargin; + + hx[6] = xpos - handleSize - handleMargin; + hy[6] = (int)(middleY - (handleSize/2)); + + hx[7] = xpos - handleSize - handleMargin; + hy[7] = ypos - handleSize - handleMargin; +} + +// Returns 0 (no hit), 1 - 8 for which selection handle +// (clockwise from top middle) +int wxResourceEditorControlHandler::SelectionHandleHitTest(int x, int y) +{ + // Handle positions + int hx[8]; + int hy[8]; + CalcSelectionHandles(hx, hy); + + int i; + for (i = 0; i < 8; i++) + { + if ((x >= hx[i]) && (x <= (hx[i] + handleSize)) && (y >= hy[i]) && (y <= (hy[i] + handleSize))) + return (i + 1); + } + return 0; +} + +void wxResourceEditorControlHandler::DrawSelectionHandles(wxDC& dc, bool WXUNUSED(erase)) +{ + dc.SetOptimization(FALSE); + + dc.SetLogicalFunction(wxCOPY); + dc.SetPen(wxBLACK_PEN); + dc.SetBrush(wxBLACK_BRUSH); + + dc.SetOptimization(TRUE); + + // Handle positions + int hx[8]; + int hy[8]; + CalcSelectionHandles(hx, hy); + + int i; + for (i = 0; i < 8; i++) + { + dc.DrawRectangle(hx[i], hy[i], handleSize, handleSize); + } +} + +void wxResourceEditorControlHandler::DrawBoundingBox(wxDC& dc, int x, int y, int w, int h) +{ + dc.DrawRectangle(x, y, w, h); +} + +// If selectionHandle is zero, not dragging the selection handle. +void wxResourceEditorControlHandler::OnDragBegin(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) +{ + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + dc.BeginDrawing(); + +// dc.DestroyClippingRegion(); + + wxPanel *panel = (wxPanel *)handlerControl->GetParent(); + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + + // Erase selection handles +// DrawSelectionHandles(dc, TRUE); + + dc.SetOptimization(FALSE); + + dc.SetLogicalFunction(wxXOR); + + dc.SetPen(wxBLACK_DASHED_PEN); + dc.SetBrush(wxTRANSPARENT_BRUSH); + + dc.SetOptimization(TRUE); + + if (selectionHandle > 0) + { + panel->Refresh(); + + DrawBoundingBox(dc, xpos, ypos, width, height); + } + else + { + panel->Refresh(); + + dragOffsetX = (x - xpos); + dragOffsetY = (y - ypos); + + DrawBoundingBox(dc, xpos, ypos, width, height); + + // Also draw bounding boxes for other selected items + wxNode *node = panel->GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if ((item != handlerControl) && handler->IsSelected()) + { + int x1, y1, w1, h1; + item->GetPosition(&x1, &y1); + item->GetSize(&w1, &h1); + handler->DrawBoundingBox(dc, x1, y1, w1, h1); + } + } + node = node->Next(); + } + } + dc.EndDrawing(); +} + +void wxResourceEditorControlHandler::OnDragContinue(bool paintIt, int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) +{ + wxPanel *panel = (wxPanel *)handlerControl->GetParent(); + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + if (selectionHandle > 0) + { +/* + 8 1 2 + + 7 3 + + 6 5 4 +*/ + + int x1, y1, width1, height1; + + switch (selectionHandle) + { + case 1: + x1 = xpos; + y1 = y; + width1 = width; + height1 = (ypos + height) - y; + break; + case 5: + x1 = xpos; + y1 = ypos; + width1 = width; + height1 = (y - ypos); + break; + case 3: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = height; + break; + case 7: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = height; + break; + case 2: + x1 = xpos; + y1 = y; + width1 = (x - xpos); + height1 = (ypos + height) - y; + break; + case 4: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = (y - ypos); + break; + case 6: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = y - ypos; + break; + case 8: + x1 = x; + y1 = y; + width1 = (xpos + width) - x; + height1 = (ypos + height) - y; + break; + } + dc.BeginDrawing(); + + dc.SetLogicalFunction(wxXOR); + dc.SetPen(wxBLACK_DASHED_PEN); + dc.SetBrush(wxTRANSPARENT_BRUSH); + + DrawBoundingBox(dc, x1, y1, width1, height1); + + dc.EndDrawing(); + } + else + { + dc.BeginDrawing(); + + dc.SetLogicalFunction(wxXOR); + dc.SetPen(wxBLACK_DASHED_PEN); + dc.SetBrush(wxTRANSPARENT_BRUSH); + + DrawBoundingBox(dc, (int)(x - dragOffsetX), (int)(y - dragOffsetY), width, height); + + // Also draw bounding boxes for other selected items + wxNode *node = panel->GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if ((item != handlerControl) && handler->IsSelected()) + { + int x1, y1, w1, h1; + item->GetPosition(&x1, &y1); + item->GetSize(&w1, &h1); + int x2 = (int)(x1 + (x - dragOffsetX) - xpos); + int y2 = (int)(y1 + (y - dragOffsetY) - ypos); + handler->DrawBoundingBox(dc, x2, y2, w1, h1); + } + } + node = node->Next(); + } + + dc.EndDrawing(); + } +} + +void wxResourceEditorControlHandler::OnDragEnd(int x, int y, int WXUNUSED(keys), wxDC& dc, int selectionHandle) +{ + wxPanel *panel = (wxPanel *)handlerControl->GetParent(); + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + + dc.BeginDrawing(); + + int xpos, ypos, width, height; + handlerControl->GetPosition(&xpos, &ypos); + handlerControl->GetSize(&width, &height); + + if (selectionHandle > 0) + { + int x1, y1, width1, height1; + + switch (selectionHandle) + { + case 1: + x1 = xpos; + y1 = y; + width1 = width; + height1 = (ypos + height) - y; + break; + case 5: + x1 = xpos; + y1 = ypos; + width1 = width; + height1 = (y - ypos); + break; + case 3: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = height; + break; + case 7: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = height; + break; + case 2: + x1 = xpos; + y1 = y; + width1 = (x - xpos); + height1 = (ypos + height) - y; + break; + case 4: + x1 = xpos; + y1 = ypos; + width1 = (x - xpos); + height1 = (y - ypos); + break; + case 6: + x1 = x; + y1 = ypos; + width1 = (xpos + width) - x; + height1 = y - ypos; + break; + case 8: + x1 = x; + y1 = y; + width1 = (xpos + width) - x; + height1 = (ypos + height) - y; + break; + } + handlerControl->SetSize(x1, y1, width1, height1); + } + else + { + handlerControl->Move((int)(x - dragOffsetX), (int)(y - dragOffsetY)); + OldOnMove((int)(x - dragOffsetX), (int)(y - dragOffsetY)); + + // Also move other selected items + wxNode *node = panel->GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->IsKindOf(CLASSINFO(wxControl))) + { + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *handler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if ((item != handlerControl) && handler->IsSelected()) + { + int x1, y1; + item->GetPosition(&x1, &y1); + int x2 = (int)(x1 + (x - dragOffsetX) - xpos); + int y2 = (int)(y1 + (y - dragOffsetY) - ypos); + item->Move(x2, y2); + ((wxResourceEditorControlHandler *)item->GetEventHandler())->OldOnMove(x2, y2); + ((wxResourceEditorControlHandler *)item->GetEventHandler())->DrawSelectionHandles(dc); + } + } + node = node->Next(); + } + } + + dc.SetOptimization(FALSE); + + dc.SetLogicalFunction(wxCOPY); + dc.SetPen(wxBLACK_PEN); + dc.SetBrush(wxBLACK_BRUSH); + + dc.SetOptimization(TRUE); + + // Force it to repaint the selection handles (if any) + // since the panel thinks we're still within a drag and + // won't paint the handles. + if (IsSelected()) + DrawSelectionHandles(dc); + + dc.EndDrawing(); + + panel->Refresh(); +} + +// These functions call OnItemEvent, OnItemMove and OnItemSize +// by default. +void wxResourceEditorControlHandler::OnMouseEvent(wxMouseEvent& event) +{ + if ((event.m_eventType == wxEVENT_TYPE_LEFT_DCLICK) || + (event.m_eventType == wxEVENT_TYPE_RIGHT_DCLICK)) + return; + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + if ( !panelHandler->GetEvtHandlerEnabled() ) + { + event.Skip(); + return; + } + + panelHandler->OnItemEvent(handlerControl, event); +} + +void wxResourceEditorControlHandler::OldOnMove(int x, int y) +{ + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemMove(handlerControl, x, y); +} + +void wxResourceEditorControlHandler::OldOnSize(int w, int h) +{ + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemSize(handlerControl, w, h); +} + +void wxResourceEditorControlHandler::OnSelect(bool select) +{ + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemSelect(handlerControl, select); +} + +void wxResourceEditorControlHandler::OnLeftClick(int x, int y, int keys) +{ + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemLeftClick(handlerControl, x, y, keys); +} + +void wxResourceEditorControlHandler::OnRightClick(int x, int y, int keys) +{ + wxWindow *panel = handlerControl->GetParent(); + if ( !panel->GetEventHandler()->IsKindOf(CLASSINFO(wxResourceEditorDialogHandler)) ) + return; + + wxResourceEditorDialogHandler *panelHandler = (wxResourceEditorDialogHandler *)panel->GetEventHandler(); + panelHandler->OnItemRightClick(handlerControl, x, y, keys); +} + + diff --git a/utils/dialoged/src/dlghndlr.h b/utils/dialoged/src/dlghndlr.h new file mode 100644 index 0000000000..aced1272c7 --- /dev/null +++ b/utils/dialoged/src/dlghndlr.h @@ -0,0 +1,123 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: dlghndlr.h +// Purpose: Dialog handler +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _DLGHNDLR_H_ +#define _DLGHNDLR_H_ + +#define wxDRAG_MODE_NONE 0 +#define wxDRAG_MODE_START_LEFT 1 +#define wxDRAG_MODE_CONTINUE_LEFT 2 +#define wxDRAG_MODE_START_RIGHT 3 +#define wxDRAG_MODE_CONTINUE_RIGHT 4 +#define wxDRAG_TYPE_NONE 0 +#define wxDRAG_TYPE_ITEM 100 + +#define wxKEY_SHIFT 1 +#define wxKEY_CTRL 2 + +class wxResourceEditorDialogHandler: public wxEvtHandler +{ +DECLARE_CLASS(wxResourceEditorDialogHandler) + public: + wxResourceManager *resourceManager; + wxPanel *handlerDialog; + wxItemResource *handlerResource; + wxEvtHandler *handlerOldHandler; + + wxControl *dragItem; + int dragMode; + int dragType; + int dragTolerance; + bool checkTolerance; + int firstDragX; + int firstDragY; + int oldDragX; + int oldDragY; + + wxResourceEditorDialogHandler(wxPanel *dialog, wxItemResource *resource, wxEvtHandler *oldHandler, + wxResourceManager *manager); + ~wxResourceEditorDialogHandler(void) {} + + bool OnClose(void); + + void OnPaint(wxPaintEvent& event); + void OnMouseEvent(wxMouseEvent& event); + + virtual void OnItemEvent(wxControl *win, wxMouseEvent& event); + virtual void OnLeftClick(int x, int y, int keys); + virtual void OnRightClick(int x, int y, int keys); + virtual void OnItemLeftClick(wxControl *item, int x, int y, int keys); + virtual void OnItemRightClick(wxControl *item, int x, int y, int keys); + virtual void OnItemSelect(wxControl *item, bool select); + virtual void OnItemMove(wxControl *item, int x, int y) {}; + virtual void OnItemSize(wxControl *item, int w, int h) {}; + + void AddChildHandlers(void); + void PaintSelectionHandles(wxDC& dc); + void ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle); + +DECLARE_EVENT_TABLE() +}; + +class wxResourceEditorControlHandler: public wxEvtHandler +{ +DECLARE_CLASS(wxResourceEditorControlHandler) + public: +// wxResourceManager *resourceManager; + wxControl *handlerControl; +// wxItemResource *handlerResource; + wxEvtHandler *handlerOldHandler; + + bool isSelected; + int handleSize; // selection handle size + int handleMargin; // Distance between item edge and handle edge + static int dragOffsetX; // Distance between pointer at start of drag and + static int dragOffsetY; // top-left of item + + wxResourceEditorControlHandler(wxControl *control, wxEvtHandler *oldHandler); + ~wxResourceEditorControlHandler(void) {} + + void OnMouseEvent(wxMouseEvent& event); + + // Manipulation and drawing of items in Edit Mode + + // Calculate position of the 8 handles + virtual void CalcSelectionHandles(int *hx, int *hy); + virtual void DrawSelectionHandles(wxDC& dc, bool erase = FALSE); + virtual void DrawBoundingBox(wxDC& dc, int x, int y, int w, int h); + virtual void SelectItem(bool select); + virtual inline bool IsSelected(void) { return isSelected; } + + // Returns TRUE or FALSE + virtual bool HitTest(int x, int y); + + // Returns 0 (no hit), 1 - 8 for which selection handle + // (clockwise from top middle) + virtual int SelectionHandleHitTest(int x, int y); + + // If selectionHandle is zero, not dragging the selection handle. + virtual void OnDragBegin(int x, int y, int keys, wxDC& dc, int selectionHandle); + virtual void OnDragContinue(bool paintIt, int x, int y, int keys, wxDC& dc, int selectionHandle); + virtual void OnDragEnd(int x, int y, int keys, wxDC& dc, int selectionHandle); + + // These functions call panel functions + // by default. + virtual void OldOnMove(int x, int y); + virtual void OldOnSize(int w, int h); + virtual void OnLeftClick(int x, int y, int keys); + virtual void OnRightClick(int x, int y, int keys); + virtual void OnSelect(bool select); + +DECLARE_EVENT_TABLE() +}; + +#endif + diff --git a/utils/dialoged/src/editrpal.cpp b/utils/dialoged/src/editrpal.cpp new file mode 100644 index 0000000000..c9e55e019d --- /dev/null +++ b/utils/dialoged/src/editrpal.cpp @@ -0,0 +1,309 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: editrpal.cpp +// Purpose: Editor tool palette +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "editrpal.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#include "reseditr.h" +#include "editrpal.h" + +// Bitmaps for palette +wxBitmap *PaletteFrameBitmap = NULL; +wxBitmap *PaletteDialogBoxBitmap = NULL; +wxBitmap *PalettePanelBitmap = NULL; +wxBitmap *PaletteCanvasBitmap = NULL; +wxBitmap *PaletteTextWindowBitmap = NULL; +wxBitmap *PaletteMessageBitmap = NULL; +wxBitmap *PaletteButtonBitmap = NULL; +wxBitmap *PaletteCheckBoxBitmap = NULL; +wxBitmap *PaletteListBoxBitmap = NULL; +wxBitmap *PaletteRadioBoxBitmap = NULL; +wxBitmap *PaletteChoiceBitmap = NULL; +wxBitmap *PaletteTextBitmap = NULL; +wxBitmap *PaletteMultiTextBitmap = NULL; +wxBitmap *PaletteSliderBitmap = NULL; +wxBitmap *PaletteArrowBitmap = NULL; +wxBitmap *PaletteGroupBitmap = NULL; +wxBitmap *PaletteGaugeBitmap = NULL; +wxBitmap *PalettePictureBitmap = NULL; +wxBitmap *PaletteBitmapButtonBitmap = NULL; +wxBitmap *PaletteScrollbarBitmap = NULL; + +#ifdef __X__ +#include "bitmaps/frame.xbm" +#include "bitmaps/dialog.xbm" +#include "bitmaps/panel.xbm" +#include "bitmaps/canvas.xbm" +#include "bitmaps/textsw.xbm" +#include "bitmaps/message.xbm" +#include "bitmaps/button.xbm" +#include "bitmaps/check.xbm" +#include "bitmaps/listbox.xbm" +#include "bitmaps/radio.xbm" +#include "bitmaps/choice.xbm" +#include "bitmaps/text.xbm" +#include "bitmaps/mtext.xbm" +#include "bitmaps/slider.xbm" +#include "bitmaps/arrow.xbm" +#include "bitmaps/group.xbm" +#include "bitmaps/gauge.xbm" +#include "bitmaps/scroll.xbm" +#include "bitmaps/picture.xbm" +#include "bitmaps/bmpbuttn.xbm" +#endif + +/* + * Object editor tool palette + * + */ + +BEGIN_EVENT_TABLE(EditorToolPalette, wxToolBarSimple) + EVT_PAINT(EditorToolPalette::OnPaint) +END_EVENT_TABLE() + +EditorToolPalette::EditorToolPalette(wxResourceManager *manager, wxFrame *frame, int x, int y, int w, int h, + long style, int direction, int RowsOrColumns): + TOOLPALETTECLASS(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns) +{ + currentlySelected = -1; + resourceManager = manager; +} + +bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled) +{ + // BEGIN mutual exclusivity code + if (toggled && (currentlySelected != -1) && (toolIndex != currentlySelected)) + ToggleTool(currentlySelected, FALSE); + + if (toggled) + currentlySelected = toolIndex; + else if (currentlySelected == toolIndex) + currentlySelected = -1; + // END mutual exclusivity code +/* + if (MainFrame) + { + if (toggled && (toolIndex != PALETTE_ARROW)) + MainFrame->canvas->SetCursor(crossCursor); + else + MainFrame->canvas->SetCursor(handCursor); + } +*/ + + return TRUE; +} + +void EditorToolPalette::OnMouseEnter(int toolIndex) +{ + if (!resourceManager) return; + wxFrame *managerFrame = resourceManager->GetEditorFrame(); + + if (toolIndex > -1) + { + switch (toolIndex) + { + case PALETTE_FRAME: + managerFrame->SetStatusText("wxFrame"); + break; + case PALETTE_DIALOG_BOX: + managerFrame->SetStatusText("wxDialog"); + break; + case PALETTE_PANEL: + managerFrame->SetStatusText("wxPanel"); + break; + case PALETTE_CANVAS: + managerFrame->SetStatusText("wxCanvas"); + break; + case PALETTE_TEXT_WINDOW: + managerFrame->SetStatusText("wxTextWindow"); + break; + case PALETTE_BUTTON: + managerFrame->SetStatusText("wxButton"); + break; + case PALETTE_MESSAGE: + managerFrame->SetStatusText("wxMessage"); + break; + case PALETTE_TEXT: + managerFrame->SetStatusText("wxText"); + break; + case PALETTE_MULTITEXT: + managerFrame->SetStatusText("wxMultiText"); + break; + case PALETTE_CHOICE: + managerFrame->SetStatusText("wxChoice"); + break; + case PALETTE_CHECKBOX: + managerFrame->SetStatusText("wxCheckBox"); + break; + case PALETTE_RADIOBOX: + managerFrame->SetStatusText("wxRadioBox"); + break; + case PALETTE_LISTBOX: + managerFrame->SetStatusText("wxListBox"); + break; + case PALETTE_SLIDER: + managerFrame->SetStatusText("wxSlider"); + break; + case PALETTE_GROUPBOX: + managerFrame->SetStatusText("wxGroupBox"); + break; + case PALETTE_GAUGE: + managerFrame->SetStatusText("wxGauge"); + break; + case PALETTE_BITMAP_MESSAGE: + managerFrame->SetStatusText("Bitmap wxMessage"); + break; + case PALETTE_BITMAP_BUTTON: + managerFrame->SetStatusText("Bitmap wxButton"); + break; + case PALETTE_SCROLLBAR: + managerFrame->SetStatusText("wxScrollBar"); + break; + case PALETTE_ARROW: + managerFrame->SetStatusText("Pointer"); + break; + } + } + else managerFrame->SetStatusText(""); +} + +void EditorToolPalette::OnPaint(wxPaintEvent& event) +{ + TOOLPALETTECLASS::OnPaint(event); + + wxPaintDC dc(this); + + int w, h; + GetSize(&w, &h); + dc.SetPen(wxBLACK_PEN); + dc.SetBrush(wxTRANSPARENT_BRUSH); + dc.DrawLine(0, h-1, w, h-1); +} + +bool wxResourceManager::InitializeTools(void) +{ + // Load palette bitmaps +#ifdef __WINDOWS__ + PaletteFrameBitmap = new wxBitmap("FRAMETOOL"); + PaletteDialogBoxBitmap = new wxBitmap("DIALOGBOXTOOL"); + PalettePanelBitmap = new wxBitmap("PANELTOOL"); + PaletteCanvasBitmap = new wxBitmap("CANVASTOOL"); + PaletteTextWindowBitmap = new wxBitmap("TEXTWINDOWTOOL"); + PaletteMessageBitmap = new wxBitmap("MESSAGETOOL"); + PaletteButtonBitmap = new wxBitmap("BUTTONTOOL"); + PaletteCheckBoxBitmap = new wxBitmap("CHECKBOXTOOL"); + PaletteListBoxBitmap = new wxBitmap("LISTBOXTOOL"); + PaletteRadioBoxBitmap = new wxBitmap("RADIOBOXTOOL"); + PaletteChoiceBitmap = new wxBitmap("CHOICETOOL"); + PaletteTextBitmap = new wxBitmap("TEXTTOOL"); + PaletteMultiTextBitmap = new wxBitmap("MULTITEXTTOOL"); + PaletteSliderBitmap = new wxBitmap("SLIDERTOOL"); + PaletteArrowBitmap = new wxBitmap("ARROWTOOL"); + PaletteGroupBitmap = new wxBitmap("GROUPTOOL"); + PaletteGaugeBitmap = new wxBitmap("GAUGETOOL"); + PalettePictureBitmap = new wxBitmap("PICTURETOOL"); + PaletteBitmapButtonBitmap = new wxBitmap("BMPBUTTONTOOL"); + PaletteScrollbarBitmap = new wxBitmap("SCROLLBARTOOL"); +#endif +#ifdef __X__ + PaletteFrameBitmap = new wxBitmap(frame_bits, frame_width, frame_height); + PaletteDialogBoxBitmap = new wxBitmap(dialog_bits, dialog_width, dialog_height); + PalettePanelBitmap = new wxBitmap(panel_bits, panel_width, panel_height); + PaletteCanvasBitmap = new wxBitmap(canvas_bits, canvas_width, canvas_height); + PaletteTextWindowBitmap = new wxBitmap(textsw_bits, textsw_width, textsw_height); + PaletteMessageBitmap = new wxBitmap(message_bits, message_width, message_height); + PaletteButtonBitmap = new wxBitmap(button_bits, button_width, button_height); + PaletteCheckBoxBitmap = new wxBitmap(check_bits, check_width, check_height); + PaletteListBoxBitmap = new wxBitmap(listbox_bits, listbox_width, listbox_height); + PaletteRadioBoxBitmap = new wxBitmap(radio_bits, radio_width, radio_height); + PaletteChoiceBitmap = new wxBitmap(choice_bits, choice_width, choice_height); + PaletteTextBitmap = new wxBitmap(text_bits, text_width, text_height); + PaletteMultiTextBitmap = new wxBitmap(mtext_bits, mtext_width, mtext_height); + PaletteSliderBitmap = new wxBitmap(slider_bits, slider_width, slider_height); + PaletteArrowBitmap = new wxBitmap(arrow_bits, arrow_width, arrow_height); + PaletteGroupBitmap = new wxBitmap(group_bits, group_width, group_height); + PaletteGaugeBitmap = new wxBitmap(gauge_bits, gauge_width, gauge_height); + PalettePictureBitmap = new wxBitmap(picture_bits, picture_width, picture_height); + PaletteBitmapButtonBitmap = new wxBitmap(bmpbuttn_bits, bmpbuttn_width, bmpbuttn_height); + PaletteScrollbarBitmap = new wxBitmap(scroll_bits, scroll_width, scroll_height); +#endif + return TRUE; +} + +EditorToolPalette *wxResourceManager::OnCreatePalette(wxFrame *parent) +{ + EditorToolPalette *palette = new EditorToolPalette(this, parent, 0, 0, -1, -1, wxNO_BORDER, // wxTB_3DBUTTONS, + wxVERTICAL, 1); + + palette->SetMargins(2, 2); +/* +#ifdef __WINDOWS__ + if (palette->IsKindOf(CLASSINFO(wxToolBarMSW))) + ((wxToolBarMSW *)palette)->SetDefaultSize(22, 22); +#endif +*/ + +// palette->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH); + palette->AddTool(PALETTE_ARROW, PaletteArrowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Pointer"); +/* + palette->AddTool(PALETTE_FRAME, PaletteFrameBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxFrame"); + palette->AddTool(PALETTE_DIALOG_BOX, PaletteDialogBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxDialog"); + palette->AddTool(PALETTE_PANEL, PalettePanelBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxPanel"); + palette->AddTool(PALETTE_CANVAS, PaletteCanvasBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCanvas"); + palette->AddTool(PALETTE_TEXT_WINDOW, PaletteTextWindowBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxTextWindow"); + +*/ + palette->AddTool(PALETTE_MESSAGE, PaletteMessageBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMessage"); + palette->AddTool(PALETTE_BITMAP_MESSAGE, PalettePictureBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Picture wxMessage"); + palette->AddTool(PALETTE_BUTTON, PaletteButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Button"); + palette->AddTool(PALETTE_BITMAP_BUTTON, PaletteBitmapButtonBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "Picture wxButton"); + palette->AddTool(PALETTE_CHECKBOX, PaletteCheckBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxCheckBox"); + palette->AddTool(PALETTE_RADIOBOX, PaletteRadioBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxRadioBox"); + palette->AddTool(PALETTE_LISTBOX, PaletteListBoxBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxListBox"); + palette->AddTool(PALETTE_CHOICE, PaletteChoiceBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxChoice"); + palette->AddTool(PALETTE_TEXT, PaletteTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxText"); + palette->AddTool(PALETTE_MULTITEXT, PaletteMultiTextBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxMultiText"); + palette->AddTool(PALETTE_SLIDER, PaletteSliderBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxSlider"); + palette->AddTool(PALETTE_GROUPBOX, PaletteGroupBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGroupBox"); + palette->AddTool(PALETTE_GAUGE, PaletteGaugeBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxGauge"); + palette->AddTool(PALETTE_SCROLLBAR, PaletteScrollbarBitmap, (wxBitmap *)NULL, TRUE, 0, -1, NULL, "wxScrollBar"); + + palette->Layout(); + palette->CreateTools(); + + palette->ToggleTool(PALETTE_ARROW, TRUE); + palette->currentlySelected = PALETTE_ARROW; + return palette; +} + diff --git a/utils/dialoged/src/editrpal.h b/utils/dialoged/src/editrpal.h new file mode 100644 index 0000000000..fb6f0d7341 --- /dev/null +++ b/utils/dialoged/src/editrpal.h @@ -0,0 +1,71 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: editrpal.h +// Purpose: Tool palette +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _EDITRPAL_H_ +#define _EDITRPAL_H_ + +#ifdef __GNUG__ +#pragma interface "editrpal.h" +#endif + +#include "wx/wx.h" +#include "wx/string.h" +#include "wx/layout.h" +#include "wx/resource.h" +#include "wx/tbarsmpl.h" + +#include "proplist.h" + +/* + * Object editor tool palette + * + */ + +// For some reason, wxButtonBar under Windows 95 cannot be moved to a non-0,0 position! +#define TOOLPALETTECLASS wxToolBarSimple + +class EditorToolPalette: public TOOLPALETTECLASS +{ + public: + int currentlySelected; + wxResourceManager *resourceManager; + + EditorToolPalette(wxResourceManager *manager, wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1, + long style = wxNO_BORDER, int direction = wxVERTICAL, int RowsOrColumns = 2); + bool OnLeftClick(int toolIndex, bool toggled); + void OnMouseEnter(int toolIndex); + void OnPaint(wxPaintEvent& event); + +DECLARE_EVENT_TABLE() +}; + +#define PALETTE_FRAME 1 +#define PALETTE_DIALOG_BOX 2 +#define PALETTE_PANEL 3 +#define PALETTE_CANVAS 4 +#define PALETTE_TEXT_WINDOW 5 +#define PALETTE_MESSAGE 6 +#define PALETTE_BUTTON 7 +#define PALETTE_CHECKBOX 8 +#define PALETTE_LISTBOX 9 +#define PALETTE_RADIOBOX 10 +#define PALETTE_CHOICE 11 +#define PALETTE_TEXT 12 +#define PALETTE_MULTITEXT 13 +#define PALETTE_SLIDER 14 +#define PALETTE_ARROW 15 +#define PALETTE_GAUGE 16 +#define PALETTE_GROUPBOX 17 +#define PALETTE_BITMAP_MESSAGE 18 +#define PALETTE_BITMAP_BUTTON 19 +#define PALETTE_SCROLLBAR 20 + +#endif diff --git a/utils/dialoged/src/makefile.b32 b/utils/dialoged/src/makefile.b32 new file mode 100644 index 0000000000..36ae0adc50 --- /dev/null +++ b/utils/dialoged/src/makefile.b32 @@ -0,0 +1,69 @@ +# +# File: makefile.b32 +# Author: Patrick Halke +# Created: 1995 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds Dialog Editor (32-bit Borland) + +# WXWIN and BCCDIR are set by parent make + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +WXLIBDIR = $(WXDIR)\lib +WXINC = $(WXDIR)\include\msw +WXBASESRC = $(WXDIR)\src\base +WXBASEINC = $(WXDIR)\include\base +WXLIB = $(WXLIBDIR)\wx32.lib +WXPROPDIR = $(WXDIR)\utils\wxprop +WXPROPINC = $(WXPROPDIR)\src +WXPROPLIB = $(WXDIR)\lib\wxprop.lib +LIBS=$(WXLIB) $(WXPROPLIB) cw32 import32 +INCFILE = includes.cfg + +TARGET=dialoged + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) @$(INCFILE) + +OBJECTS = wx_resed.obj wx_rdlg.obj wx_reswr.obj wx_repal.obj wx_rprop.obj dialoged.obj + +$(TARGET).exe: wxprop $(INCFILE) $(OBJECTS) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(OBJECTS) +$(TARGET) +nul +$(LIBS) +$(TARGET).def +! + brc32 -K $(TARGET).res + +$(INCFILE): $(MAKEFILENAME) + copy &&! +-I..\..\wxprop\src +! $(INCFILE) + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa $(TARGET) + +wxprop: + cd $(WXPROPDIR)\src + make -f makefile.b32 + cd $(WXDIR)\utils\dialoged\src + +clean: + -erase *.obj *.exe *.res *.map *.rws + + diff --git a/utils/dialoged/src/makefile.bcc b/utils/dialoged/src/makefile.bcc new file mode 100644 index 0000000000..0214c54986 --- /dev/null +++ b/utils/dialoged/src/makefile.bcc @@ -0,0 +1,87 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds Dialog Editor (Borland, 16-bit) + +!if "$(BCCDIR)" == "" +!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 +!endif + +!if "$(WXWIN)" == "" +!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx +!endif + +!ifndef FINAL +FINAL=0 +!endif + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makebcc.env + +THISDIR = $(WXDIR)\utils\dialoged\src +WXLIB = $(WXDIR)\lib\wx.lib +WXPROPDIR = $(WXDIR)\utils\wxprop +WXPROPINC = $(WXPROPDIR)\src +WXPROPLIB = $(WXPROPDIR)\lib\wxprop.lib + +LIBS=$(WXLIB) $(WXPROPLIB) mathwl cwl import +INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw +CFG=$(WXDIR)\src\wxwin.cfg +INCFILE = includes.cfg + + +!if "$(FINAL)" == "0" +LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -O2 +DEBUG_FLAGS = +!endif +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) @$(INCFILE) + +OBJECTS = wx_resed.obj wx_rdlg.obj wx_reswr.obj wx_repal.obj wx_rprop.obj dialoged.obj + +all: dialoged.exe + +dialoged.exe: $(INCFILE) $(WXLIB) $(OBJECTS) dialoged.def dialoged.res + tlink $(LINKFLAGS) @&&! +c0wl.obj $(OBJECTS) +dialoged +nul +$(LIBS) $(WXPROPLIB) +dialoged.def +! + rc -30 -K dialoged.res + +.$(SRCSUFF).obj: + bcc $(CPPFLAGS) -c {$< } + +dialoged.obj: dialoged.$(SRCSUFF) wx_resed.h +wx_resed.obj: wx_resed.$(SRCSUFF) wx_resed.h wx_rprop.h +wx_resed.obj: wx_rdlg.$(SRCSUFF) wx_resed.h wx_rprop.h +wx_rprop.obj: wx_rprop.$(SRCSUFF) wx_resed.h wx_rprop.h +wx_reswr.obj: wx_reswr.$(SRCSUFF) wx_resed.h +wx_repal.obj: wx_repal.$(SRCSUFF) wx_repal.h + +dialoged.res : dialoged.rc $(WXDIR)\include\msw\wx.rc + rc -r /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa dialoged + +$(INCFILE): $(MAKEFILENAME) + copy &&! +-I..\..\wxprop\src +! $(INCFILE) + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.rws diff --git a/utils/dialoged/src/makefile.dos b/utils/dialoged/src/makefile.dos new file mode 100644 index 0000000000..e32a94e8dd --- /dev/null +++ b/utils/dialoged/src/makefile.dos @@ -0,0 +1,193 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1995 +# Updated: +# Copyright: (c) 1995, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds docview example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\utils\dialoged\src +WXLIB = $(WXDIR)\lib\wx.lib + +DOCDIR = $(WXDIR)\utils\dialoged\docs + +PROPDIR = $(WXDIR)\utils\wxprop +PROPINC = $(PROPDIR)\src +PROPLIB = $(PROPDIR)\lib\wxprop.lib + +TREEDIR = $(WXDIR)\utils\wxtree +TREEINC = $(TREEDIR)\src +TREELIB = $(TREEDIR)\lib\wxtree.lib + +DIBDIR = $(WXDIR)\utils\dib +DIBLIB = $(DIBDIR)\dib.lib +DIBINC = $(DIBDIR) + +RCDIR = $(WXDIR)\utils\rcparser +RCLIB = $(RCDIR)\lib\rcparser.lib +RCINC = $(RCDIR)\src + +LIBS=$(WXLIB) $(PROPLIB) oldnames libw llibcew commdlg shell ddeml +INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw /I$(PROPINC) + +!ifndef FINAL +FINAL=0 +!endif + +# Default is to output RTF for WinHelp +!ifndef RTFSTYLE +RTFSTYLE=-winhelp +!endif + +# Set this to nothing if using MS C++ 7 +ZOPTION=/Z7 + +!if "$(FINAL)" == "0" +CPPFLAGS=/AL /W3 /Zi $(ZOPTION) /G2sw /Od /DDEBUG=$(DEBUG) /YuWX_PREC.H $(INC) /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch +LINKFLAGS=/NOD /CO /SEG:512 /ONERROR:NOEXE +!else +CPPFLAGS=/AL /W3 /G2sw /Ox /YuWX_PREC.H $(INC) /DDEBUG=$(DEBUG) /Dwx_msw /Fp$(WXDIR)\src\msw\wx.pch +LINKFLAGS=/NOD /SEG:512 /ONERROR:NOEXE +!endif + +OBJECTS = dialoged.obj wx_resed.obj wx_rdlg.obj wx_reswr.obj wx_repal.obj wx_rprop.obj + +all: prop dialoged.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + + +dialoged.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(OBJECTS) $(PROPLIB) dialoged.def dialoged.res + link $(LINKFLAGS) @<< +$(WXDIR)\src\msw\dummy.obj $(OBJECTS), +dialoged, +NUL, +$(LIBS), +dialoged.def +; +<< + rc -30 -K dialoged.res + +dialoged.obj: dialoged.h $(PROPINC)\wx_prop.h wx_resed.h wx_rprop.h dialoged.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +wx_resed.obj: wx_resed.h $(PROPINC)\wx_prop.h wx_resed.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +wx_rdlg.obj: wx_resed.h $(PROPINC)\wx_prop.h wx_rdlg.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +wx_reswr.obj: wx_resed.h wx_reswr.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +wx_rprop.obj: wx_resed.h $(PROPINC)\wx_prop.h wx_rprop.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +wx_repal.obj: wx_resed.h $(PROPINC)\wx_prop.h wx_repal.h wx_repal.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +dialoged.res : dialoged.rc $(WXDIR)\include\msw\wx.rc + rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw dialoged + +wxtree: + cd $(TREEDIR)\src + nmake -f makefile.dos FINAL="$(FINAL)" OPT="$(OPT)" + cd $(THISDIR) + +dib: + cd $(DIBDIR) + nmake -f makefile.dos FINAL="$(FINAL)" OPT="$(OPT)" + cd $(THISDIR) + +prop: + cd $(PROPDIR)\src + nmake -f makefile.dos FINAL="$(FINAL)" OPT="$(OPT)" + cd $(THISDIR) + +# Making documents +docs: hlp +hlp: $(DOCDIR)/dialoged.hlp +hlp32: $(DOCDIR)/hlp32/dialoged.hlp +rtf: $(DOCDIR)/dialoged.rtf + +$(DOCDIR)/dialoged.hlp: $(DOCDIR)/dialoged.rtf $(DOCDIR)/dialoged.hpj + cd $(DOCDIR) + -erase dialoged.ph + hc dialoged + cd $(THISDIR) + +$(DOCDIR)/hlp32/dialoged.hlp: $(DOCDIR)/hlp32/dialoged.rtf $(DOCDIR)/hlp32/dialoged.hpj + cd $(DOCDIR)/hlp32 + -erase dialoged.ph + -wx /W hcw /c /e clockwrk.hpj + cd $(THISDIR) + +$(DOCDIR)/dialoged.rtf: $(DOCDIR)/body.tex $(DOCDIR)/classes.tex $(DOCDIR)/tech.tex $(DOCDIR)/dialoged.tex + cd $(DOCDIR) + -wx /W tex2rtf $(DOCDIR)/dialoged.tex $(DOCDIR)/dialoged.rtf -twice $(RTFSTYLE) + cd $(THISDIR) + +$(DOCDIR)/hlp32/dialoged.rtf: $(DOCDIR)/body.tex $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/dialoged.tex + cd $(DOCDIR) + -wx /W tex2rtf $(DOCDIR)/dialoged.tex $(DOCDIR)/hlp32/dialoged.rtf -twice $(RTFSTYLE) -macros $(DOCDIR)/t2rtf32.ini + cd $(THISDIR) + +wordrtf: + cd $(DOCDIR) + -wx /W tex2rtf $(DOCDIR)/dialoged.tex $(DOCDIR)/dialoged.rtf -twice -rtf + cd $(THISDIR) + +cleanprop: + cd $(PROPDIR)\src + nmake -f makefile.dos clean + cd $(THISDIR) + +rcparser: + cd $(RCDIR)\src + nmake -f makefile.dos FINAL=$(FINAL) OPT=$(OPT) + cd $(THISDIR) + +cleanrtf: + cd $(DOCDIR) + -erase *.rtf + cd $(THISDIR) + +cleanutils: cleanprop + -erase *.obj + -erase *.sbr + -erase *.exe + -erase *.res + -erase *.map + -erase *.pdb + +clean: + -erase *.obj *.exe *.res *.map *.rws diff --git a/utils/dialoged/src/makefile.g95 b/utils/dialoged/src/makefile.g95 new file mode 100644 index 0000000000..22fba50951 --- /dev/null +++ b/utils/dialoged/src/makefile.g95 @@ -0,0 +1,61 @@ +# +# File: makefile.g95 +# Author: Julian Smart +# Created: 1996 +# Updated: +# +# "%W% %G%" +# +# Makefile for Dialog Editor (GNU-WIN32) + +WXDIR = ../../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/makeg95.env + +OBJECTS = $(OBJDIR)/dialoged.$(OBJSUFF) $(OBJDIR)/editrpal.$(OBJSUFF) $(OBJDIR)/reseditr.$(OBJSUFF)\ + $(OBJDIR)/dlghndlr.$(OBJSUFF) $(OBJDIR)/reswrite.$(OBJSUFF) $(OBJDIR)/winprop.$(OBJSUFF)\ + $(OBJDIR)/dialoged_resources.$(OBJSUFF) + +EXTRAINC = -I../../wxprop/src + +LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib -L../../wxprop/lib +LDLIBS=-lwxprop $(LIBS) + +CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DDEBUG='$(DEBUG)' $(WARN) $(OPT) $(EXTRAINC) + +all: $(OBJDIR) wxprop dialoged$(GUISUFFIX)$(EXESUFF) + +wxprop: + cd ../../wxprop/src; $(MAKE) -f makefile.g95 + +$(OBJDIR): + mkdir $(OBJDIR) + +dialoged$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o dialoged$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/dialoged.$(OBJSUFF): dialoged.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ dialoged.$(SRCSUFF) + +$(OBJDIR)/editrpal.$(OBJSUFF): winprop.h reseditr.h editrpal.h editrpal.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ editrpal.$(SRCSUFF) + +$(OBJDIR)/winprop.$(OBJSUFF): winprop.h reseditr.h editrpal.h winprop.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ winprop.$(SRCSUFF) + +$(OBJDIR)/reswrite.$(OBJSUFF): winprop.h reseditr.h editrpal.h reswrite.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ reswrite.$(SRCSUFF) + +$(OBJDIR)/reseditr.$(OBJSUFF): winprop.h reseditr.h editrpal.h reseditr.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ reseditr.$(SRCSUFF) + +$(OBJDIR)/dlghndlr.$(OBJSUFF): winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ dlghndlr.$(SRCSUFF) + +$(OBJDIR)/dialoged_resources.o: dialoged.rc + $(RESCOMP) -i dialoged.rc -o $(OBJDIR)/dialoged_resources.o $(RESFLAGS) + +clean: + rm -f $(OBJECTS) dialoged$(GUISUFFIX).exe core *.rsc *.res diff --git a/utils/dialoged/src/makefile.nt b/utils/dialoged/src/makefile.nt new file mode 100644 index 0000000000..e19a83668b --- /dev/null +++ b/utils/dialoged/src/makefile.nt @@ -0,0 +1,155 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds wxProperty classes library (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) +THISDIR = $(WXDIR)\utils\dialoged\src +PROPDIR = $(WXDIR)\utils\wxprop +PROPLIB=$(PROPDIR)\lib\wxprop.lib +EXTRALIBS=$(PROPDIR)\lib\wxprop.lib +EXTRAINC=/I$(PROPDIR)\src +DOCDIR=$(WXDIR)\docs +LOCALDOCDIR=$(WXDIR)\utils\dialoged\docs + +!include $(WXDIR)\src\ntwxwin.mak + +PROGRAM=dialoged + +OBJECTS = dialoged.obj editrpal.obj reseditr.obj dlghndlr.obj reswrite.obj winprop.obj + +all: wxprop dialoged.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROPLIB) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res +$(LIBS) +<< + +dialoged.obj: winprop.h reseditr.h editrpal.h dialoged.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +winprop.obj: winprop.h reseditr.h editrpal.h winprop.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +editrpal.obj: winprop.h reseditr.h editrpal.h editrpal.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +reswrite.obj: winprop.h reseditr.h editrpal.h reswrite.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +reseditr.obj: winprop.h reseditr.h editrpal.h reseditr.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +dlghndlr.obj: winprop.h reseditr.h editrpal.h dlghndlr.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + +wxprop: + cd $(PROPDIR)\src + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +clean_wxprop: + cd $(PROPDIR)\src + nmake -f makefile.nt clean + cd $(THISDIR) + +clean: + -erase *.obj + -erase *.sbr + -erase *.exe + -erase *.res + -erase *.map + -erase *.pdb + +cleanutils: clean clean_wxprop + +DOCSOURCES=$(LOCALDOCDIR)\dialoged.tex $(LOCALDOCDIR)\body.tex\ + $(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\ + $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\tech.tex + +html: $(DOCDIR)\html\dialoged\dlged.htm +hlp: $(DOCDIR)\winhelp\dialoged.hlp +pdfrtf: $(DOCDIR)\pdf\dialoged.rtf +ps: $(DOCDIR)\ps\dialoged.ps + +$(DOCDIR)\winhelp\dialoged.hlp: $(LOCALDOCDIR)\dialoged.rtf $(LOCALDOCDIR)\dialoged.hpj + cd $(LOCALDOCDIR) + -erase dialoged.ph + hc dialoged + move dialoged.hlp $(DOCDIR)\winhelp\dialoged.hlp + move dialoged.cnt $(DOCDIR)\winhelp\dialoged.cnt + cd $(THISDIR) + +$(LOCALDOCDIR)\dialoged.rtf: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -start /w tex2rtf $(LOCALDOCDIR)\dialoged.tex $(LOCALDOCDIR)\dialoged.rtf -twice -winhelp + cd $(THISDIR) + +$(DOCDIR)\pdf\dialoged.rtf: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -copy *.bmp *.wmf $(DOCDIR)\pdf + -start /w tex2rtf $(LOCALDOCDIR)\dialoged.tex $(DOCDIR)\pdf\dialoged.rtf -twice -rtf + cd $(THISDIR) + +$(DOCDIR)\html\dialoged\dlged.htm: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -mkdir $(DOCDIR)\html\dialoged + -start /w tex2rtf $(LOCALDOCDIR)\dialoged.tex $(DOCDIR)\html\dialoged\dlged.htm -twice -html + -erase $(DOCDIR)\html\dialoged\*.con + -erase $(DOCDIR)\html\dialoged\*.ref + cd $(THISDIR) + +$(LOCALDOCDIR)\dialoged.dvi: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -latex dialoged + -latex dialoged + -makeindx dialoged + -bibtex dialoged + -latex dialoged + -latex dialoged + cd $(THISDIR) + +$(WXDIR)\docs\ps\dialoged.ps: $(LOCALDOCDIR)\dialoged.dvi + cd $(LOCALDOCDIR) + -dvips32 -o dialoged.ps dialoged + move dialoged.ps $(WXDIR)\docs\ps\dialoged.ps + cd $(THISDIR) + + diff --git a/utils/dialoged/src/makefile.sc b/utils/dialoged/src/makefile.sc new file mode 100644 index 0000000000..5099033cae --- /dev/null +++ b/utils/dialoged/src/makefile.sc @@ -0,0 +1,36 @@ +# Symantec C++ makefile for Dialog Editor + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makesc.env + +WXLIB = $(WXDIR)\lib\wx.lib +INCDIR = $(WXDIR)\include +MSWINC = $(INCDIR)\msw +BASEINC = $(INCDIR)\base + +CC=sc +RC=rc +CFLAGS = -o -ml -W -Dwx_msw +LDFLAGS = -ml -W + +INCLUDE=$(BASEINC);$(MSWINC) +OBJECTS = wx_resed.obj wx_rdlg.obj wx_reswr.obj wx_repal.obj wx_rprop.obj dialoged.obj + +LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib + +.$(SRCSUFF).obj: + *$(CC) -c $(CFLAGS) -I$(INCLUDE) $< + +.rc.res: + *$(RC) -r -I$(INCLUDE) $< + +dialoged.exe: $(OBJECTS) dialoged.def dialoged.res + *$(CC) $(LDFLAGS) -o$@ $(OBJECTS) dialoged.def $(LIBS) + *$(RC) -k dialoged.res + +clean: + -del *.obj + -del *.exe + -del *.res + -del *.map + -del *.rws diff --git a/utils/dialoged/src/makefile.unx b/utils/dialoged/src/makefile.unx new file mode 100644 index 0000000000..f87d66aab0 --- /dev/null +++ b/utils/dialoged/src/makefile.unx @@ -0,0 +1,123 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for dialoged example (UNIX). + +WXDIR = ../../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/make.env + +WXPROPDIR = $(WXDIR)/utils/wxprop +WXPROPINC = $(WXDIR)/utils/wxprop/src +WXPROPLIB = $(WXDIR)/utils/wxprop/lib + +DIALOGEDDIR = $(WXDIR)/utils/dialoged + +OBJECTS = $(OBJDIR)/dialoged.o $(OBJDIR)/wx_repal.o $(OBJDIR)/wx_resed.o $(OBJDIR)/wx_rdlg.o $(OBJDIR)/wx_reswr.o $(OBJDIR)/wx_rprop.o + + +INC = $(COMPPATHS) -I$(WXDIR)/include/x -I$(WXDIR)/include/base -I$(WXPROPINC) + +XVIEWLDLIBS = -lwxprop_ol -lwx_ol -lxview -lolgx -lX11 -lm $(COMPLIBS) +MOTIFLDLIBS = -lwxprop_motif -lwx_motif -lXm -lXt -lX11 -lm $(COMPLIBS) +HPLDLIBS = -lwxprop_hp -lwx_hp -lXm -lXt -lX11 -lm $(HPCOMPLIBS) +# Default +LDLIBS=$(XVIEWLDLIBS) + +CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) -DDEBUG='$(DEBUG)' $(DEBUGFLAGS) $(WARN) $(OPT) +LDFLAGS = $(XLIB) -L$(WXDIR)/lib -L$(WXPROPLIB) + +.SUFFIXES: + +all: $(OBJDIR) dialoged$(GUISUFFIX) + +wx_ol: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview + +wx_motif: + cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif + +motif: + $(MAKE) -f makefile.unx dialoged_motif GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)'\ + OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK= + +xview: + $(MAKE) -f makefile.unx dialoged_ol GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)'\ + DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' + +hp: + $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='-w' \ + XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)' + +$(OBJDIR): + mkdir $(OBJDIR) + +dialoged$(GUISUFFIX): $(OBJECTS) $(WXLIB) + $(CC) $(LDFLAGS) -o dialoged$(GUISUFFIX) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/dialoged.o: dialoged.$(SRCSUFF) dialoged.h + $(CC) -c $(CPPFLAGS) -o $@ dialoged.$(SRCSUFF) + +$(OBJDIR)/wx_rprop.o: wx_rprop.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ wx_rprop.$(SRCSUFF) + +$(OBJDIR)/wx_resed.o: wx_resed.$(SRCSUFF) wx_resed.h + $(CC) -c $(CPPFLAGS) -o $@ wx_resed.$(SRCSUFF) + +$(OBJDIR)/wx_rdlg.o: wx_rdlg.$(SRCSUFF) wx_resed.h + $(CC) -c $(CPPFLAGS) -o $@ wx_rdlg.$(SRCSUFF) + +$(OBJDIR)/wx_repal.o: wx_repal.$(SRCSUFF) wx_repal.h + $(CC) -c $(CPPFLAGS) -o $@ wx_repal.$(SRCSUFF) + +$(OBJDIR)/wx_reswr.o: wx_reswr.$(SRCSUFF) wx_resed.h + $(CC) -c $(CPPFLAGS) -o $@ wx_reswr.$(SRCSUFF) + +wxprop_motif: + cd $(WXPROPDIR)/src; $(MAKE) -f makefile.unx motif OPT='$(OPT)' + +wxprop_ol: + cd $(WXPROPDIR)/src + $(MAKE) -f makefile.unx xview OPT='$(OPT)' + +clean_motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany + +clean_ol: + $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany + +clean_hp: + $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany + +cleanany: + rm -f $(OBJECTS) $(TESTOBJECTS) test$(GUISUFFIX) dialoged$(GUISUFFIX) core + +HTMLDIR=/home/hardy/html/wx/manuals +docs: ps xlp +ps: $(DIALOGEDDIR)/docs/dialoged.ps +xlp: $(DIALOGEDDIR)/docs/dialoged.xlp +html: $(HTMLDIR)/dialoged/dialoged_contents.html + +$(DIALOGEDDIR)/docs/dialoged.xlp: $(DIALOGEDDIR)/docs/dialoged.tex $(DIALOGEDDIR)/docs/classes.tex $(DIALOGEDDIR)/docs/body.tex $(DIALOGEDDIR)/docs/tech.tex + cd ../docs; tex2rtf dialoged.tex tmp.xlp -xlp -twice + sed -e "s/WXHELPCONTENTS/wxChart Manual/g" < $(DIALOGEDDIR)/docs/tmp.xlp > $(DIALOGEDDIR)/docs/dialoged.xlp + /bin/rm -f $(DIALOGEDDIR)/docs/tmp.xlp + +$(HTMLDIR)/dialoged/dialoged_contents.html: $(DIALOGEDDIR)/docs/dialoged.tex $(DIALOGEDDIR)/docs/body.tex $(DIALOGEDDIR)/docs/tech.tex + cd ../docs; tex2rtf dialoged.tex $(HTMLDIR)/dialoged/dialoged.html -html -twice + +$(DIALOGEDDIR)/docs/dialoged.dvi: $(DIALOGEDDIR)/docs/dialoged.tex $(DIALOGEDDIR)/docs/classes.tex + cd $(DIALOGEDDIR)/docs; latex dialoged; latex dialoged; makeindex dialoged; latex dialoged; latex dialoged + +# makeindex dialoged; bibtex dialoged; latex dialoged; latex dialoged + +$(DIALOGEDDIR)/docs/dialoged.ps: $(DIALOGEDDIR)/docs/dialoged.dvi + cd $(DIALOGEDDIR)/docs; dvips -f -r < dialoged.dvi > dialoged.ps diff --git a/utils/dialoged/src/makefile.wat b/utils/dialoged/src/makefile.wat new file mode 100644 index 0000000000..8aa0fcc046 --- /dev/null +++ b/utils/dialoged/src/makefile.wat @@ -0,0 +1,62 @@ +# Dialog Editor makefile for Watcom + +WXDIR = ..\..\.. + +# EXTRACPPFLAGS = $(CLIPSFLAGS) + +!include $(WXDIR)\src\makewat.env + +WXPROPDIR = $(WXDIR)\utils\wxprop +WXPROPLIB = $(WXPROPDIR)\lib\wxprop.lib +WXPROPINC = $(WXPROPDIR)\src + +THISDIR = $(WXDIR)\utils\dialoged\src + +NAME = dialoged +LNK = $(name).lnk + +IFLAGS = -i=$(WXINC) -i=$(WXBASEINC) -i=$(WXPROPINC) + +PROGOBJECTS = dialoged.obj wx_resed.obj wx_rdlg.obj wx_reswr.obj wx_repal.obj wx_rprop.obj + +all: wx wxprop erasepch $(PROGOBJECTS) dialoged.exe + +wx: .SYMBOLIC + cd $(WXDIR)\src\msw + wmake -f makefile.wat all + cd $(THISDIR) + +wxprop: .SYMBOLIC + cd $(WXPROPDIR)\src + wmake -f makefile.wat all + cd $(THISDIR) + +$(name).exe : $(PROGOBJECTS) $(name).res $(LNK) $(WXDIR)\lib\wx$(LEVEL).lib $(WXPROPLIB) + wlink @$(LNK) + $(BINDCOMMAND) $(name).res + +$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc + $(RC) $(RESFLAGS1) /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa $(name).rc + +$(LNK) : makefile.wat + %create $(LNK) + @%append $(LNK) $(DEBUGINFO) + @%append $(LNK) system $(LINKOPTION) + @%append $(LNK) $(MINDATA) + @%append $(LNK) $(MAXDATA) + @%append $(LNK) $(STACK) + @%append $(LNK) name $(name) + @%append $(LNK) file $(WXDIR)\lib\wx$(LEVEL).lib + @%append $(LNK) file $(WXPROPLIB) + @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i + @for %i in ($(PROGOBJECTS)) do @%append $(LNK) file %i + +cleanutils: .SYMBOLIC + cd $(WXPROPDIR)\src + wmake -f makefile.wat clean + cd $(THISDIR) + +clean: .SYMBOLIC + -erase *.obj *.bak *.err *.pch *.lbc *.res + + diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp new file mode 100644 index 0000000000..1aa9fea3ea --- /dev/null +++ b/utils/dialoged/src/reseditr.cpp @@ -0,0 +1,2114 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: reseditr.cpp +// Purpose: Resource editor class +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "reseditr.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" + +#include "wx/checkbox.h" +#include "wx/button.h" +#include "wx/choice.h" +#include "wx/listbox.h" +#include "wx/radiobox.h" +#include "wx/statbox.h" +#include "wx/gauge.h" +#include "wx/slider.h" +#include "wx/textctrl.h" +#endif + +#include "wx/scrolbar.h" + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#ifdef __WINDOWS__ +#include +#endif + +#include "wx/help.h" + +#include "reseditr.h" +#include "winprop.h" +#include "editrpal.h" +#include "dlghndlr.h" + +static void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event); +void wxResourceEditWindow(wxWindow *win); +wxWindowPropertyInfo *wxCreatePropertyInfoForWindow(wxWindow *win); +wxResourceManager *wxResourceManager::currentResourceManager = NULL; + +// Bitmaps for toolbar +wxBitmap *ToolbarLoadBitmap = NULL; +wxBitmap *ToolbarSaveBitmap = NULL; +wxBitmap *ToolbarNewBitmap = NULL; +wxBitmap *ToolbarVertBitmap = NULL; +wxBitmap *ToolbarAlignTBitmap = NULL; +wxBitmap *ToolbarAlignBBitmap = NULL; +wxBitmap *ToolbarHorizBitmap = NULL; +wxBitmap *ToolbarAlignLBitmap = NULL; +wxBitmap *ToolbarAlignRBitmap = NULL; +wxBitmap *ToolbarCopySizeBitmap = NULL; +wxBitmap *ToolbarToFrontBitmap = NULL; +wxBitmap *ToolbarToBackBitmap = NULL; +wxBitmap *ToolbarHelpBitmap = NULL; + +wxBitmap *wxWinBitmap = NULL; + +#ifdef __X__ +#include "bitmaps/load.xbm" +#include "bitmaps/save.xbm" +#include "bitmaps/new.xbm" +#include "bitmaps/vert.xbm" +#include "bitmaps/alignt.xbm" +#include "bitmaps/alignb.xbm" +#include "bitmaps/horiz.xbm" +#include "bitmaps/alignl.xbm" +#include "bitmaps/alignr.xbm" +#include "bitmaps/copysize.xbm" +#include "bitmaps/tofront.xbm" +#include "bitmaps/toback.xbm" +#include "bitmaps/help.xbm" +#include "bitmaps/wxwin.xbm" +#endif + +/* + * Resource manager + */ + + +wxResourceManager::wxResourceManager(void) +{ + currentResourceManager = this; + editorFrame = NULL; + editorPanel = NULL; + popupMenu = NULL; + editorResourceList = NULL; + editorPalette = NULL; + nameCounter = 1; + modified = FALSE; + currentFilename = ""; + editMode = TRUE; + editorToolBar = NULL; + + // Default window positions + resourceEditorWindowSize.width = 470; + resourceEditorWindowSize.height = 300; + + resourceEditorWindowSize.x = 0; + resourceEditorWindowSize.y = 0; + + propertyWindowSize.width = 300; + propertyWindowSize.height = 300; + + helpInstance = NULL; +} + +wxResourceManager::~wxResourceManager(void) +{ + currentResourceManager = NULL; + SaveOptions(); + + helpInstance->Quit(); + delete helpInstance; + helpInstance = NULL; +} + +bool wxResourceManager::Initialize(void) +{ + // Set up the resource filename for each platform. +#ifdef __WINDOWS__ + // dialoged.ini in the Windows directory + char buf[256]; + GetWindowsDirectory(buf, 256); + strcat(buf, "\\dialoged.ini"); + optionsResourceFilename = buf; +#elif defined(__X__) + char buf[500]; + (void)wxGetHomeDir(buf); + strcat(buf, "/.hardyrc"); + optionsResourceFilename = buf; +#else +#error "Unsupported platform." +#endif + + LoadOptions(); + + helpInstance = new wxHelpController; + helpInstance->Initialize("dialoged"); + + InitializeTools(); + popupMenu = new wxMenu("", (wxFunction)ObjectMenuProc); + popupMenu->Append(OBJECT_MENU_EDIT, "Edit properties"); + popupMenu->Append(OBJECT_MENU_DELETE, "Delete object"); + + if (!wxWinBitmap) + { +#ifdef __WINDOWS__ + wxWinBitmap = new wxBitmap("WXWINBMP", wxBITMAP_TYPE_BMP_RESOURCE); +#endif +#ifdef __X__ + wxWinBitmap = new wxBitmap(wxwin_bits, wxwin_width, wxwin_height); +#endif + } + return TRUE; +} + +bool wxResourceManager::LoadOptions(void) +{ + wxGetResource("DialogEd", "editorWindowX", &resourceEditorWindowSize.x, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "editorWindowY", &resourceEditorWindowSize.y, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "editorWindowWidth", &resourceEditorWindowSize.width, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "editorWindowHeight", &resourceEditorWindowSize.height, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "propertyWindowX", &propertyWindowSize.x, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "propertyWindowY", &propertyWindowSize.y, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "propertyWindowWidth", &propertyWindowSize.width, optionsResourceFilename.GetData()); + wxGetResource("DialogEd", "propertyWindowHeight", &propertyWindowSize.height, optionsResourceFilename.GetData()); + return TRUE; +} + +bool wxResourceManager::SaveOptions(void) +{ + wxWriteResource("DialogEd", "editorWindowX", resourceEditorWindowSize.x, optionsResourceFilename.GetData()); + wxWriteResource("DialogEd", "editorWindowY", resourceEditorWindowSize.y, optionsResourceFilename.GetData()); + wxWriteResource("DialogEd", "editorWindowWidth", resourceEditorWindowSize.width, optionsResourceFilename.GetData()); + wxWriteResource("DialogEd", "editorWindowHeight", resourceEditorWindowSize.height, optionsResourceFilename.GetData()); + + wxWriteResource("DialogEd", "propertyWindowX", propertyWindowSize.x, optionsResourceFilename.GetData()); + wxWriteResource("DialogEd", "propertyWindowY", propertyWindowSize.y, optionsResourceFilename.GetData()); + wxWriteResource("DialogEd", "propertyWindowWidth", propertyWindowSize.width, optionsResourceFilename.GetData()); + wxWriteResource("DialogEd", "propertyWindowHeight", propertyWindowSize.height, optionsResourceFilename.GetData()); + + return TRUE; +} + +// Show or hide the resource editor frame, which displays a list +// of resources with ability to edit them. +bool wxResourceManager::ShowResourceEditor(bool show, wxWindow *parent, const char *title) +{ + if (show) + { + if (editorFrame) + { + editorFrame->Iconize(FALSE); + editorFrame->Show(TRUE); + return TRUE; + } + editorFrame = OnCreateEditorFrame(title); + SetFrameTitle(""); + wxMenuBar *menuBar = OnCreateEditorMenuBar(editorFrame); + editorFrame->SetMenuBar(menuBar); + editorPanel = OnCreateEditorPanel(editorFrame); + editorToolBar = (EditorToolBar *)OnCreateToolBar(editorFrame); + editorPalette = OnCreatePalette(editorFrame); + + // Constraints for toolbar + wxLayoutConstraints *c = new wxLayoutConstraints; + c->left.SameAs (editorFrame, wxLeft, 0); + c->top.SameAs (editorFrame, wxTop, 0); + c->right.SameAs (editorFrame, wxRight, 0); + c->bottom.Unconstrained(); + c->width.Unconstrained(); + c->height.Absolute(28); + editorToolBar->SetConstraints(c); + + // Constraints for palette + c = new wxLayoutConstraints; + c->left.SameAs (editorFrame, wxLeft, 0); + c->top.SameAs (editorToolBar, wxBottom, 0); + c->right.SameAs (editorFrame, wxRight, 0); + c->bottom.Unconstrained(); + c->width.Unconstrained(); + c->height.Absolute(34); + editorPalette->SetConstraints(c); + + // Constraints for panel + c = new wxLayoutConstraints; + c->left.SameAs (editorFrame, wxLeft, 0); + c->top.SameAs (editorPalette, wxBottom, 0); + c->right.SameAs (editorFrame, wxRight, 0); + c->bottom.SameAs (editorFrame, wxBottom, 0); + c->width.Unconstrained(); + c->height.Unconstrained(); + editorPanel->SetConstraints(c); + + editorFrame->SetAutoLayout(TRUE); + + UpdateResourceList(); + editorFrame->Show(TRUE); + return TRUE; + } + else + { + wxFrame *fr = editorFrame; + if (editorFrame->OnClose()) + { + fr->Show(FALSE); + delete fr; + editorFrame = NULL; + editorPanel = NULL; + } + } + return TRUE; +} + +void wxResourceManager::SetFrameTitle(const wxString& filename) +{ + if (editorFrame) + { + if (filename == wxString("")) + editorFrame->SetTitle("wxWindows Dialog Editor - untitled"); + else + { + wxString str("wxWindows Dialog Editor - "); + wxString str2(wxFileNameFromPath(WXSTRINGCAST filename)); + str += str2; + editorFrame->SetTitle(str); + } + } +} + +bool wxResourceManager::Save(void) +{ + if (currentFilename == wxString("")) + return SaveAs(); + else + return Save(currentFilename); +} + +bool wxResourceManager::Save(const wxString& filename) +{ + // Ensure all visible windows are saved to their resources + currentFilename = filename; + SetFrameTitle(currentFilename); + InstantiateAllResourcesFromWindows(); + if (resourceTable.Save(filename)) + { + Modify(FALSE); + return TRUE; + } + else + return FALSE; +} + +bool wxResourceManager::SaveAs(void) +{ + wxString s(wxFileSelector("Save resource file", wxPathOnly(WXSTRINGCAST currentFilename), wxFileNameFromPath(WXSTRINGCAST currentFilename), + "wxr", "*.wxr", wxSAVE | wxOVERWRITE_PROMPT)); + + if (s.IsNull() || s == "") + return FALSE; + + currentFilename = s; + Save(currentFilename); + return TRUE; +} + +bool wxResourceManager::SaveIfModified(void) +{ + if (Modified()) + return Save(); + else return TRUE; +} + +bool wxResourceManager::Load(const wxString& filename) +{ + return New(TRUE, filename); +} + +bool wxResourceManager::New(bool loadFromFile, const wxString& filename) +{ + if (!Clear(TRUE, FALSE)) + return FALSE; + + if (loadFromFile) + { + wxString str = filename; + if (str == wxString("")) + { + wxString f(wxFileSelector("Open resource file", NULL, NULL, "wxr", "*.wxr", 0, NULL)); + if (!f.IsNull() && f != "") + str = f; + else + return FALSE; + } + + if (!resourceTable.ParseResourceFile(WXSTRINGCAST str)) + { + wxMessageBox("Could not read file.", "Resource file load error", wxOK | wxICON_EXCLAMATION); + return FALSE; + } + currentFilename = str; + + SetFrameTitle(currentFilename); + + UpdateResourceList(); + } + else + { + SetFrameTitle(""); + currentFilename = ""; + } + Modify(FALSE); + + return TRUE; +} + +bool wxResourceManager::Clear(bool deleteWindows, bool force) +{ + if (!force && Modified()) + { + int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL); + if (ans == wxCANCEL) + return FALSE; + if (ans == wxYES) + if (!SaveIfModified()) + return FALSE; + if (ans == wxNO) + Modify(FALSE); + } + + DisassociateWindows(deleteWindows); + + resourceTable.ClearTable(); + UpdateResourceList(); + + return TRUE; +} + +bool wxResourceManager::DisassociateWindows(bool deleteWindows) +{ + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *res = (wxItemResource *)node->Data(); + DisassociateResource(res, deleteWindows); + } + + return TRUE; +} + +void wxResourceManager::AssociateResource(wxItemResource *resource, wxWindow *win) +{ + if (!resourceAssociations.Get((long)resource)) + resourceAssociations.Put((long)resource, win); + + wxNode *node = resource->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + wxWindow *childWindow = (wxWindow *)resourceAssociations.Get((long)child); + if (!childWindow) + childWindow = win->FindWindow(child->GetName()); + if (childWindow) + AssociateResource(child, childWindow); + else + { + char buf[200]; + sprintf(buf, "AssociateResource: cannot find child window %s", child->GetName() ? child->GetName() : "(unnamed)"); + wxMessageBox(buf, "Dialog Editor problem", wxOK); + } + + node = node->Next(); + } +} + +bool wxResourceManager::DisassociateResource(wxItemResource *resource, bool deleteWindow) +{ + wxWindow *win = FindWindowForResource(resource); + if (!win) + return FALSE; + + // Disassociate children of window without deleting windows + // since they'll be deleted by parent. + if (win->GetChildren()) + { + wxNode *node = win->GetChildren()->First(); + while (node) + { + wxWindow *child = (wxWindow *)node->Data(); + if (child->IsKindOf(CLASSINFO(wxControl))) + DisassociateResource(child, FALSE); + node = node->Next(); + } + } + + if (deleteWindow) + { + if (win->IsKindOf(CLASSINFO(wxPanel)) && !win->IsKindOf(CLASSINFO(wxDialog))) + delete win->GetParent(); // Delete frame + else if ( win->IsKindOf(CLASSINFO(wxControl)) ) + { + wxEvtHandler *childHandler = win->GetEventHandler(); + if ( childHandler != win ) + { + win->PopEventHandler(); + delete childHandler; + } + delete win; + } + else + // Is this enough? What about event handler? TODO + delete win; + } + RemoveSelection(win); + resourceAssociations.Delete((long)resource); + return TRUE; +} + +bool wxResourceManager::DisassociateResource(wxWindow *win, bool deleteWindow) +{ + wxItemResource *res = FindResourceForWindow(win); + if (res) + return DisassociateResource(res, deleteWindow); + return FALSE; +} + +wxItemResource *wxResourceManager::FindResourceForWindow(wxWindow *win) +{ + resourceAssociations.BeginFind(); + wxNode *node; + while (node = resourceAssociations.Next()) + { + wxWindow *w = (wxWindow *)node->Data(); + if (w == win) + { + return (wxItemResource *)node->key.integer; + } + } + return NULL; +} + +wxWindow *wxResourceManager::FindWindowForResource(wxItemResource *resource) +{ + return (wxWindow *)resourceAssociations.Get((long)resource); +} + + +void wxResourceManager::MakeUniqueName(char *prefix, char *buf) +{ + while (TRUE) + { + sprintf(buf, "%s%d", prefix, nameCounter); + nameCounter ++; + + if (!resourceTable.FindResource(buf)) + return; + } +} + +wxFrame *wxResourceManager::OnCreateEditorFrame(const char *title) +{ + int frameWidth = 420; + int frameHeight = 300; + + wxResourceEditorFrame *frame = new wxResourceEditorFrame(this, NULL, (char *)title, + + resourceEditorWindowSize.x, resourceEditorWindowSize.y, + resourceEditorWindowSize.width, resourceEditorWindowSize.height, + + wxDEFAULT_FRAME); + + wxFrame::UseNativeStatusBar(FALSE); + + frame->CreateStatusBar(2); + + wxFrame::UseNativeStatusBar(TRUE); + + frame->SetStatusText(editMode ? "Edit mode" : "Test mode", 1); + frame->SetAutoLayout(TRUE); +#ifdef __WINDOWS__ + wxIcon *icon = new wxIcon("DIALOGEDICON"); + frame->SetIcon(icon); +#endif + return frame; +} + +wxMenuBar *wxResourceManager::OnCreateEditorMenuBar(wxFrame *parent) +{ + wxMenuBar *menuBar = new wxMenuBar; + + wxMenu *fileMenu = new wxMenu; + fileMenu->Append(RESED_NEW_DIALOG, "New &dialog", "Create a new dialog"); + fileMenu->Append(RESED_NEW_PANEL, "New &panel", "Create a new panel"); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_NEW, "&New project", "Clear the current project"); + fileMenu->Append(wxID_OPEN, "&Open...", "Load a resource file"); + fileMenu->Append(wxID_SAVE, "&Save", "Save a resource file"); + fileMenu->Append(wxID_SAVEAS, "Save &As...", "Save a resource file as..."); + fileMenu->Append(RESED_CLEAR, "&Clear", "Clear current resources"); + fileMenu->AppendSeparator(); + fileMenu->Append(wxID_EXIT, "E&xit", "Exit resource editor"); + + wxMenu *editMenu = new wxMenu; + editMenu->Append(RESED_RECREATE, "&Recreate", "Recreate the selected resource(s)"); + editMenu->Append(RESED_DELETE, "&Delete", "Delete the selected resource(s)"); + editMenu->AppendSeparator(); + editMenu->Append(RESED_TOGGLE_TEST_MODE, "&Toggle edit/test mode", "Toggle edit/test mode"); + + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(RESED_CONTENTS, "&Help topics", "Invokes the on-line help"); + helpMenu->AppendSeparator(); + helpMenu->Append(wxID_ABOUT, "&About", "About wxWindows Dialog Editor"); + + menuBar->Append(fileMenu, "&File"); + menuBar->Append(editMenu, "&Edit"); + menuBar->Append(helpMenu, "&Help"); + + return menuBar; +} + +wxPanel *wxResourceManager::OnCreateEditorPanel(wxFrame *parent) +{ + wxResourceEditorPanel *panel = new wxResourceEditorPanel(parent); + + editorResourceList = new wxListBox(panel, -1, wxPoint(0, 0), wxSize(-1, -1)); + + wxLayoutConstraints *c = new wxLayoutConstraints; + c->left.SameAs (panel, wxLeft, 5); + c->top.SameAs (panel, wxTop, 5); + c->right.SameAs (panel, wxRight, 5); + c->bottom.SameAs (panel, wxBottom, 5); + c->width.Unconstrained(); + c->height.Unconstrained(); + editorResourceList->SetConstraints(c); + + return panel; +} + +wxToolBarBase *wxResourceManager::OnCreateToolBar(wxFrame *parent) +{ + // Load palette bitmaps +#ifdef __WINDOWS__ + ToolbarLoadBitmap = new wxBitmap("LOADTOOL"); + ToolbarSaveBitmap = new wxBitmap("SAVETOOL"); + ToolbarNewBitmap = new wxBitmap("NEWTOOL"); + ToolbarVertBitmap = new wxBitmap("VERTTOOL"); + ToolbarAlignTBitmap = new wxBitmap("ALIGNTTOOL"); + ToolbarAlignBBitmap = new wxBitmap("ALIGNBTOOL"); + ToolbarHorizBitmap = new wxBitmap("HORIZTOOL"); + ToolbarAlignLBitmap = new wxBitmap("ALIGNLTOOL"); + ToolbarAlignRBitmap = new wxBitmap("ALIGNRTOOL"); + ToolbarCopySizeBitmap = new wxBitmap("COPYSIZETOOL"); + ToolbarToBackBitmap = new wxBitmap("TOBACKTOOL"); + ToolbarToFrontBitmap = new wxBitmap("TOFRONTTOOL"); + ToolbarHelpBitmap = new wxBitmap("HELPTOOL"); +#endif +#ifdef __X__ + ToolbarLoadBitmap = new wxBitmap(load_bits, load_width, load_height); + ToolbarSaveBitmap = new wxBitmap(save_bits, save_width, save_height); + ToolbarNewBitmap = new wxBitmap(new_bits, save_width, save_height); + ToolbarVertBitmap = new wxBitmap(vert_bits, vert_width, vert_height); + ToolbarAlignTBitmap = new wxBitmap(alignt_bits, alignt_width, alignt_height); + ToolbarAlignBBitmap = new wxBitmap(alignb_bits, alignb_width, alignb_height); + ToolbarHorizBitmap = new wxBitmap(horiz_bits, horiz_width, horiz_height); + ToolbarAlignLBitmap = new wxBitmap(alignl_bits, alignl_width, alignl_height); + ToolbarAlignRBitmap = new wxBitmap(alignr_bits, alignr_width, alignr_height); + ToolbarCopySizeBitmap = new wxBitmap(copysize_bits, copysize_width, copysize_height); + ToolbarToBackBitmap = new wxBitmap(toback_bits, toback_width, toback_height); + ToolbarToFrontBitmap = new wxBitmap(tofront_bits, tofront_width, tofront_height); +// ToolbarCPPBitmap = new wxBitmap(cpp_bits, cpp_width, cpp_height); +// ToolbarTreeBitmap = new wxBitmap(tree_bits, tree_width, tree_height); + ToolbarHelpBitmap = new wxBitmap(help_bits, help_width, help_height); +#endif + + // Create the toolbar + EditorToolBar *toolbar = new EditorToolBar(parent, 0, 0, -1, -1, wxNO_BORDER, + wxVERTICAL, 1); + toolbar->SetMargins(2, 2); +// toolbar->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH); + +#ifdef __WINDOWS__ + int width = 24; + int dx = 2; + int gap = 6; +#else + int width = ToolbarLoadBitmap->GetWidth(); + int dx = 2; + int gap = 6; +#endif + int currentX = gap; + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_NEW, ToolbarNewBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "New dialog"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_LOAD_FILE, ToolbarLoadBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Load"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_SAVE_FILE, ToolbarSaveBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Save"); + currentX += width + dx + gap; + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_FORMAT_HORIZ, ToolbarVertBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Horizontal align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_VERT_TOP_ALIGN, ToolbarAlignTBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Top align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_VERT_BOT_ALIGN, ToolbarAlignBBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Bottom align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_VERT, ToolbarHorizBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Vertical align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN, ToolbarAlignLBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Left align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN, ToolbarAlignRBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Right align"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_COPY_SIZE, ToolbarCopySizeBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Copy size"); + currentX += width + dx + gap; + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_TO_FRONT, ToolbarToFrontBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "To front"); + currentX += width + dx; + toolbar->AddTool(TOOLBAR_TO_BACK, ToolbarToBackBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "To back"); + currentX += width + dx + gap; +/* + toolbar->AddTool(TOOLBAR_GEN_CPP, ToolbarCPPBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL); + currentX += width + dx; + + toolbar->AddTool(TOOLBAR_TREE, ToolbarTreeBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL); + currentX += width + dx; +*/ + toolbar->AddSeparator(); + toolbar->AddTool(TOOLBAR_HELP, ToolbarHelpBitmap, (wxBitmap *)NULL, + FALSE, (float)currentX, -1, NULL, "Help"); + currentX += width + dx; + + toolbar->CreateTools(); + + return toolbar; + +// parent->OnSize(-1, -1); +} + +void wxResourceManager::UpdateResourceList(void) +{ + editorResourceList->Clear(); + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); +// if (res->GetType() == wxTYPE_DIALOG_BOX || res->GetType() == wxTYPE_FRAME || res->GetType() == wxTYPE_BITMAP) + if (resType == "wxDialog" || resType == "wxDialogBox" || resType == "wxPanel" || resType == "wxBitmap") + { + AddItemsRecursively(0, res); + } + } +} + +void wxResourceManager::AddItemsRecursively(int level, wxItemResource *resource) +{ + int padWidth = level*4; + + wxString theString(""); + theString.Append(' ', padWidth); + theString += resource->GetName(); + + editorResourceList->Append(theString.GetData(), (char *)resource); + + if (strcmp(resource->GetType(), "wxBitmap") != 0) + { + wxNode *node = resource->GetChildren().First(); + while (node) + { + wxItemResource *res = (wxItemResource *)node->Data(); + AddItemsRecursively(level+1, res); + node = node->Next(); + } + } +} + +bool wxResourceManager::EditSelectedResource(void) +{ + int sel = editorResourceList->GetSelection(); + if (sel > -1) + { + wxItemResource *res = (wxItemResource *)editorResourceList->wxListBox::GetClientData(sel); + return Edit(res); + } + return FALSE; +} + +bool wxResourceManager::Edit(wxItemResource *res) +{ + wxString resType(res->GetType()); + if (resType == "wxDialog" || resType == "wxDialogBox") + { + wxDialog *dialog = (wxDialog *)FindWindowForResource(res); + if (dialog) + dialog->Show(TRUE); + else + { + dialog = new wxDialog; + wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(dialog, res, dialog->GetEventHandler(), + this); + dialog->PushEventHandler(handler); + +// dialog->SetUserEditMode(TRUE); + + dialog->LoadFromResource(GetEditorFrame(), res->GetName(), &resourceTable); + handler->AddChildHandlers(); // Add event handlers for all controls + dialog->SetModal(FALSE); + AssociateResource(res, dialog); + dialog->Show(TRUE); + } + } + else if (resType == "wxPanel") + { + wxPanel *panel = (wxPanel *)FindWindowForResource(res); + if (panel) + panel->GetParent()->Show(TRUE); + else + { + DialogEditorPanelFrame *frame = new DialogEditorPanelFrame(GetEditorFrame(), res->GetName(), 10, 10, 400, 300, wxDEFAULT_FRAME_STYLE, res->GetName()); + panel = new wxPanel; + wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, res, panel->GetEventHandler(), + this); + panel->PushEventHandler(handler); +// panel->SetUserEditMode(TRUE); + + panel->LoadFromResource(frame, res->GetName(), &resourceTable); + handler->AddChildHandlers(); // Add event handlers for all controls + AssociateResource(res, panel); + frame->SetClientSize(res->GetWidth(), res->GetHeight()); + frame->Show(TRUE); + } + } + return FALSE; +} + +bool wxResourceManager::CreateNewDialog(void) +{ + char buf[256]; + MakeUniqueName("dialog", buf); + + wxItemResource *resource = new wxItemResource; +// resource->SetType(wxTYPE_DIALOG_BOX); + resource->SetType("wxDialog"); + resource->SetName(buf); + resource->SetTitle(buf); + resourceTable.AddResource(resource); + +#ifdef __MOTIF__ + wxDialog *dialog = new wxDialog(GetEditorFrame(), -1, buf, wxPoint(10, 10), wxSize(400, 300), wxDEFAULT_DIALOG_STYLE, buf); +/* + dialog->SetBackgroundColour(*wxLIGHT_GREY); + dialog->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH); + dialog->SetButtonColour(*wxBLACK); + dialog->SetLabelColour(*wxBLACK); +*/ +#else + wxDialog *dialog = new wxDialog(GetEditorFrame(), -1, buf, wxPoint(10, 10), wxSize(400, 300), wxDEFAULT_DIALOG_STYLE, buf); +#endif + + resource->SetValue1(FALSE); // Modeless to start with + resource->SetStyle(dialog->GetWindowStyleFlag()); + + // For editing in situ we will need to use the hash table to ensure + // we don't dereference invalid pointers. +// resourceWindowTable.Put((long)resource, dialog); + + wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(dialog, resource, dialog->GetEventHandler(), + this); + + dialog->PushEventHandler(handler); + + dialog->Centre(wxBOTH); +// dialog->SetUserEditMode(TRUE); + dialog->Show(TRUE); + + SetEditMode(TRUE, FALSE); + + AssociateResource(resource, dialog); +// SetCurrentResource(resource); +// SetCurrentResourceWindow(dialog); + UpdateResourceList(); + + Modify(TRUE); + + return TRUE; +} + +bool wxResourceManager::CreateNewPanel(void) +{ + char buf[256]; + MakeUniqueName("panel", buf); + + wxItemResource *resource = new wxItemResource; +// resource->SetType(wxTYPE_PANEL); + resource->SetType("wxPanel"); + resource->SetName(buf); + resource->SetTitle(buf); + resourceTable.AddResource(resource); + + DialogEditorPanelFrame *frame = new DialogEditorPanelFrame(GetEditorFrame(), buf, 10, 10, 400, 300, wxDEFAULT_FRAME_STYLE, buf); + +#ifdef __MOTIF__ + wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 300), 0, buf); +/* + panel->SetBackgroundColour(*wxLIGHT_GREY); + panel->GetDC()->SetBackground(wxLIGHT_GREY_BRUSH); + panel->SetButtonColour(*wxBLACK); + panel->SetLabelColour(*wxBLACK); +*/ + +#else + wxPanel *panel = new wxPanel(frame, -1, wxPoint(0, 0), wxSize(400, 300), 0, buf); +#endif + + resource->SetStyle(panel->GetWindowStyleFlag()); + + // For editing in situ we will need to use the hash table to ensure + // we don't dereference invalid pointers. +// resourceWindowTable.Put((long)resource, panel); + + wxResourceEditorDialogHandler *handler = new wxResourceEditorDialogHandler(panel, resource, panel->GetEventHandler(), + this); + panel->PushEventHandler(handler); + + panel->Centre(wxBOTH); +// panel->SetUserEditMode(TRUE); + frame->Show(TRUE); + + SetEditMode(TRUE, FALSE); + + AssociateResource(resource, panel); +// SetCurrentResource(resource); +// SetCurrentResourceWindow(panel); + UpdateResourceList(); + + Modify(TRUE); + + return TRUE; +} + +bool wxResourceManager::CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *iType, int x, int y, bool isBitmap) +{ + char buf[256]; + if (!panel->IsKindOf(CLASSINFO(wxPanel)) && !panel->IsKindOf(CLASSINFO(wxDialog))) + return FALSE; + + Modify(TRUE); + + wxItemResource *res = new wxItemResource; + wxControl *newItem = NULL; + res->SetSize(x, y, -1, -1); + res->SetType(iType); + + wxString itemType(iType); + + if (itemType == "wxButton") + { + MakeUniqueName("button", buf); + res->SetName(buf); + if (isBitmap) + newItem = new wxBitmapButton(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); + else + newItem = new wxButton(panel, -1, "Button", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); + } + if (itemType == "wxBitmapButton") + { + MakeUniqueName("button", buf); + res->SetName(buf); + newItem = new wxBitmapButton(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); + } + else if (itemType == "wxMessage" || itemType == "wxStaticText") + { + MakeUniqueName("message", buf); + res->SetName(buf); + if (isBitmap) + newItem = new wxStaticBitmap(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(0, 0), 0, buf); + else + newItem = new wxStaticText(panel, -1, "Message", wxPoint(x, y), wxSize(-1, -1), 0, buf); + } + else if (itemType == "wxStaticBitmap") + { + MakeUniqueName("message", buf); + res->SetName(buf); + newItem = new wxStaticBitmap(panel, -1, wxWinBitmap, wxPoint(x, y), wxSize(-1, -1), 0, buf); + } + else if (itemType == "wxCheckBox") + { + MakeUniqueName("checkbox", buf); + res->SetName(buf); + newItem = new wxCheckBox(panel, -1, "Checkbox", wxPoint(x, y), wxSize(-1, -1), 0, wxDefaultValidator, buf); + } + else if (itemType == "wxListBox") + { + MakeUniqueName("listbox", buf); + res->SetName(buf); + newItem = new wxListBox(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); + } + else if (itemType == "wxRadioBox") + { + MakeUniqueName("radiobox", buf); + res->SetName(buf); + wxString names[] = { "One", "Two" }; + newItem = new wxRadioBox(panel, -1, "Radiobox", wxPoint(x, y), wxSize(-1, -1), 2, names, 2, + wxHORIZONTAL, wxDefaultValidator, buf); + res->SetStringValues(new wxStringList("One", "Two", NULL)); + } + else if (itemType == "wxChoice") + { + MakeUniqueName("choice", buf); + res->SetName(buf); + newItem = new wxChoice(panel, -1, wxPoint(x, y), wxSize(-1, -1), 0, NULL, 0, wxDefaultValidator, buf); + } + else if (itemType == "wxGroupBox" || itemType == "wxStaticBox") + { + MakeUniqueName("group", buf); + res->SetName(buf); + newItem = new wxStaticBox(panel, -1, "Groupbox", wxPoint(x, y), wxSize(200, 200), 0, buf); + } + else if (itemType == "wxGauge") + { + MakeUniqueName("gauge", buf); + res->SetName(buf); + newItem = new wxGauge(panel, -1, 10, wxPoint(x, y), wxSize(80, 30), wxHORIZONTAL, wxDefaultValidator, buf); + } + else if (itemType == "wxSlider") + { + MakeUniqueName("slider", buf); + res->SetName(buf); + newItem = new wxSlider(panel, -1, 1, 1, 10, wxPoint(x, y), wxSize(120, -1), wxHORIZONTAL, wxDefaultValidator, buf); + } + else if (itemType == "wxText" || itemType == "wxTextCtrl") + { + MakeUniqueName("text", buf); + res->SetName(buf); + newItem = new wxTextCtrl(panel, -1, "", wxPoint(x, y), wxSize(120, -1), 0, wxDefaultValidator, buf); + } +/* + else if (itemType == "wxMultiText") + { + MakeUniqueName("multitext", buf); + res->SetName(buf); + newItem = new wxMultiText(panel, (wxFunction)NULL, "Multitext", "", x, y, -1, -1, 0, wxDefaultValidator, buf); + } +*/ + else if (itemType == "wxScrollBar") + { + MakeUniqueName("scrollbar", buf); + res->SetName(buf); + newItem = new wxScrollBar(panel, -1, wxPoint(x, y), wxSize(140, -1), wxHORIZONTAL, wxDefaultValidator, buf); + } + if (!newItem) + return FALSE; + + newItem->PushEventHandler(new wxResourceEditorControlHandler(newItem, newItem)); + + res->SetStyle(newItem->GetWindowStyleFlag()); + AssociateResource(res, newItem); + panelResource->GetChildren().Append(res); + + UpdateResourceList(); + + return TRUE; +} + +// Find the first dialog or panel for which +// there is a selected panel item. +wxWindow *wxResourceManager::FindParentOfSelection(void) +{ + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *res = (wxItemResource *)node->Data(); + wxWindow *win = FindWindowForResource(res); + if (win) + { + wxNode *node1 = win->GetChildren()->First(); + while (node1) + { + wxControl *item = (wxControl *)node1->Data(); + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if (item->IsKindOf(CLASSINFO(wxControl)) && childHandler->IsSelected()) + return win; + node1 = node1->Next(); + } + } + } + return NULL; +} + +// Format the panel items according to 'flag' +void wxResourceManager::AlignItems(int flag) +{ + wxWindow *win = FindParentOfSelection(); + if (!win) + return; + + wxNode *node = GetSelections().First(); + if (!node) + return; + + wxControl *firstSelection = (wxControl *)node->Data(); + if (firstSelection->GetParent() != win) + return; + + int firstX, firstY; + int firstW, firstH; + firstSelection->GetPosition(&firstX, &firstY); + firstSelection->GetSize(&firstW, &firstH); + int centreX = (int)(firstX + (firstW / 2)); + int centreY = (int)(firstY + (firstH / 2)); + + while (node = node->Next()) + { + wxControl *item = (wxControl *)node->Data(); + if (item->GetParent() == win) + { + int x, y, w, h; + item->GetPosition(&x, &y); + item->GetSize(&w, &h); + + int newX, newY; + + switch (flag) + { + case TOOLBAR_FORMAT_HORIZ: + { + newX = x; + newY = (int)(centreY - (h/2.0)); + break; + } + case TOOLBAR_FORMAT_VERT: + { + newX = (int)(centreX - (w/2.0)); + newY = y; + break; + } + case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: + { + newX = firstX; + newY = y; + break; + } + case TOOLBAR_FORMAT_VERT_TOP_ALIGN: + { + newX = x; + newY = firstY; + break; + } + case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: + { + newX = firstX + firstW - w; + newY = y; + break; + } + case TOOLBAR_FORMAT_VERT_BOT_ALIGN: + { + newX = x; + newY = firstY + firstH - h; + break; + } + default: + newX = x; newY = y; + break; + } + + item->SetSize(newX, newY, w, h); + } + } + win->Refresh(); +} + +// Copy the first image's size to subsequent images +void wxResourceManager::CopySize(void) +{ + wxWindow *win = FindParentOfSelection(); + if (!win) + return; + + wxNode *node = GetSelections().First(); + if (!node) + return; + + wxControl *firstSelection = (wxControl *)node->Data(); + if (firstSelection->GetParent() != win) + return; + + int firstX, firstY; + int firstW, firstH; + firstSelection->GetPosition(&firstX, &firstY); + firstSelection->GetSize(&firstW, &firstH); + int centreX = (int)(firstX + (firstW / 2)); + int centreY = (int)(firstY + (firstH / 2)); + + while (node = node->Next()) + { + wxControl *item = (wxControl *)node->Data(); + if (item->GetParent() == win) + item->SetSize(-1, -1, firstW, firstH); + } + win->Refresh(); +} + +void wxResourceManager::ToBackOrFront(bool toBack) +{ + wxWindow *win = FindParentOfSelection(); + if (!win) + return; + wxItemResource *winResource = FindResourceForWindow(win); + + wxNode *node = GetSelections().First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + wxItemResource *itemResource = FindResourceForWindow(item); + if (item->GetParent() == win) + { + win->GetChildren()->DeleteObject(item); + if (winResource) + winResource->GetChildren().DeleteObject(itemResource); + if (toBack) + { + win->GetChildren()->Insert(item); + if (winResource) + winResource->GetChildren().Insert(itemResource); + } + else + { + win->GetChildren()->Append(item); + if (winResource) + winResource->GetChildren().Append(itemResource); + } + } + node = node->Next(); + } +// win->Refresh(); +} + +void wxResourceManager::AddSelection(wxWindow *win) +{ + if (!selections.Member(win)) + selections.Append(win); +} + +void wxResourceManager::RemoveSelection(wxWindow *win) +{ + selections.DeleteObject(win); +} + +// Need to search through resource table removing this from +// any resource which has this as a parent. +bool wxResourceManager::RemoveResourceFromParent(wxItemResource *res) +{ + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *thisRes = (wxItemResource *)node->Data(); + if (thisRes->GetChildren().Member(res)) + { + thisRes->GetChildren().DeleteObject(res); + return TRUE; + } + } + return FALSE; +} + +bool wxResourceManager::DeleteResource(wxItemResource *res) +{ + if (!res) + return FALSE; + + RemoveResourceFromParent(res); + + wxNode *node = res->GetChildren().First(); + while (node) + { + wxNode *next = node->Next(); + wxItemResource *child = (wxItemResource *)node->Data(); + DeleteResource(child); + node = next; + } + + // If this is a button or message resource, delete the + // associate bitmap resource if not being used. + wxString resType(res->GetType()); + + if ((resType == "wxMessage" || resType == "wxButton") && res->GetValue4()) + { + PossiblyDeleteBitmapResource(res->GetValue4()); + } + + resourceTable.Delete(res->GetName()); + delete res; + Modify(TRUE); + return TRUE; +} + +bool wxResourceManager::DeleteResource(wxWindow *win, bool deleteWindow) +{ + if (win->IsKindOf(CLASSINFO(wxControl))) + { + // Deselect and refresh window in case we leave selection + // handles behind + wxControl *item = (wxControl *)win; + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + if (childHandler->IsSelected()) + { + RemoveSelection(item); + childHandler->SelectItem(FALSE); + item->GetParent()->Refresh(); + } + } + + wxItemResource *res = FindResourceForWindow(win); + + DisassociateResource(res, deleteWindow); + DeleteResource(res); + UpdateResourceList(); + + // What about associated event handler? Must clean up! BUGBUG +// if (win && deleteWindow) +// delete win; + return TRUE; +} + +// Will eventually have bitmap type information, for different +// kinds of bitmap. +char *wxResourceManager::AddBitmapResource(char *filename) +{ + wxItemResource *resource = FindBitmapResourceByFilename(filename); + if (!resource) + { + char buf[256]; + MakeUniqueName("bitmap", buf); + resource = new wxItemResource; + resource->SetType("wxBitmap"); + resource->SetName(buf); + + // A bitmap resource has one or more children, specifying + // alternative bitmaps. + wxItemResource *child = new wxItemResource; + child->SetType("wxBitmap"); + child->SetName(filename); + child->SetValue1(wxBITMAP_TYPE_BMP); + child->SetValue2(RESOURCE_PLATFORM_ANY); + child->SetValue3(0); // Depth + child->SetSize(0,0,0,0); + resource->GetChildren().Append(child); + + resourceTable.AddResource(resource); + + UpdateResourceList(); + } + if (resource) + return resource->GetName(); + else + return NULL; +} + + // Delete the bitmap resource if it isn't being used by another resource. +void wxResourceManager::PossiblyDeleteBitmapResource(char *resourceName) +{ + if (!IsBitmapResourceUsed(resourceName)) + { + wxItemResource *res = resourceTable.FindResource(resourceName); + DeleteResource(res); + UpdateResourceList(); + } +} + +bool wxResourceManager::IsBitmapResourceUsed(char *resourceName) +{ + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + if (resType == "wxDialog") + { + wxNode *node1 = res->GetChildren().First(); + while (node1) + { + wxItemResource *child = (wxItemResource *)node1->Data(); + wxString childResType(child->GetType()); + + if ((childResType == "wxMessage" || childResType == "wxButton") && + child->GetValue4() && + (strcmp(child->GetValue4(), resourceName) == 0)) + return TRUE; + node1 = node1->Next(); + } + } + } + return FALSE; +} + +// Given a wxButton or wxMessage, find the corresponding bitmap filename. +char *wxResourceManager::FindBitmapFilenameForResource(wxItemResource *resource) +{ + if (!resource || !resource->GetValue4()) + return NULL; + wxItemResource *bitmapResource = resourceTable.FindResource(resource->GetValue4()); + if (!bitmapResource) + return NULL; + + wxNode *node = bitmapResource->GetChildren().First(); + while (node) + { + // Eventually augment this to return a bitmap of the right kind or something... + // Maybe the root of the filename remains the same, so it doesn't matter which we + // pick up. Otherwise how do we specify multiple filenames... too boring... + wxItemResource *child = (wxItemResource *)node->Data(); + return child->GetName(); + + node = node->Next(); + } + return NULL; +} + +wxItemResource *wxResourceManager::FindBitmapResourceByFilename(char *filename) +{ + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + if (resType == "wxBitmap") + { + wxNode *node1 = res->GetChildren().First(); + while (node1) + { + wxItemResource *child = (wxItemResource *)node1->Data(); + if (child->GetName() && (strcmp(child->GetName(), filename) == 0)) + return res; + node1 = node1->Next(); + } + } + } + return NULL; +} + + // Deletes 'win' and creates a new window from the resource that + // was associated with it. E.g. if you can't change properties on the + // fly, you'll need to delete the window and create it again. +wxWindow *wxResourceManager::RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info) +{ + wxItemResource *resource = FindResourceForWindow(win); + + // Put the current window properties into the wxItemResource object + + wxWindowPropertyInfo *newInfo = NULL; + if (!info) + { + newInfo = wxCreatePropertyInfoForWindow(win); + info = newInfo; + } + + info->InstantiateResource(resource); + + wxWindow *newWin = NULL; + wxWindow *parent = win->GetParent(); + + if (win->IsKindOf(CLASSINFO(wxPanel))) + { + bool isDialog = win->IsKindOf(CLASSINFO(wxDialog)); + wxWindow *parent = win->GetParent(); + + win->GetEventHandler()->OnClose(); + + if (!isDialog && parent) + { + // Delete frame parent of panel if this is not a dialog box + parent->Close(TRUE); + } + + Edit(resource); + newWin = FindWindowForResource(resource); + } + else + { + DisassociateResource(resource, FALSE); + delete win; + newWin = resourceTable.CreateItem((wxPanel *)parent, resource); + AssociateResource(resource, newWin); + UpdateResourceList(); + } + + if (info) + info->SetPropertyWindow(newWin); + + if (newInfo) + delete newInfo; + + return newWin; +} + +// Delete resource highlighted in the listbox +bool wxResourceManager::DeleteSelection(bool deleteWindow) +{ + int sel = editorResourceList->GetSelection(); + if (sel > -1) + { + wxItemResource *res = (wxItemResource *)editorResourceList->wxListBox::GetClientData(sel); + wxWindow *win = FindWindowForResource(res); +/* + if (res == currentResource) + { + currentResource = NULL; + currentResourceWindow = NULL; + } +*/ + + DisassociateResource(res, deleteWindow); + DeleteResource(res); + UpdateResourceList(); + +/* + // What about associated event handler? Must clean up! BUGBUG + if (win && deleteWindow) + delete win; +*/ + + Modify(TRUE); + } + + return FALSE; +} + +// Delete resource highlighted in the listbox +bool wxResourceManager::RecreateSelection(void) +{ + wxNode *node = GetSelections().First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + wxNode *next = node->Next(); + childHandler->SelectItem(FALSE); + + RemoveSelection(item); + + RecreateWindowFromResource(item); + + node = next; + } + return TRUE; +} + +bool wxResourceManager::EditDialog(wxDialog *dialog, wxWindow *parent) +{ + return FALSE; +} + +void wxResourceManager::SetEditMode(bool flag, bool changeCurrentResource) +{ + editMode = flag; + if (editorFrame) + editorFrame->SetStatusText(editMode ? "Edit mode" : "Test mode", 1); + + // Switch mode for each dialog in the resource list + resourceTable.BeginFind(); + wxNode *node = resourceTable.Next(); + while (node) + { + wxItemResource *resource = (wxItemResource *)node->Data(); + wxWindow *currentResourceWindow = FindWindowForResource(resource); + + if (changeCurrentResource && currentResourceWindow && (currentResourceWindow->IsKindOf(CLASSINFO(wxPanel)))) + { + wxPanel *panel = (wxPanel *)currentResourceWindow; + if (editMode) + { + // If we have already installed our own handler, don't bother editing. + // This test will need to be changed eventually because for in-situ editing, + // the user might have installed a different one anyway. + wxEvtHandler *handler = panel->GetEventHandler(); + handler->SetEvtHandlerEnabled(TRUE); + // Enable all children + wxNode *node = panel->GetChildren()->First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + if ( item->IsKindOf(CLASSINFO(wxControl)) ) + { + wxEvtHandler *childHandler = item->GetEventHandler(); + childHandler->SetEvtHandlerEnabled(TRUE); + } + node = node->Next(); + } + } + else + { + wxEvtHandler *handler = panel->GetEventHandler(); + handler->SetEvtHandlerEnabled(FALSE); + // Deselect all items on the dialog and refresh. + wxNode *node = panel->GetChildren()->First(); + while (node) + { + wxControl *item = (wxControl *)node->Data(); + if (item->IsKindOf(CLASSINFO(wxControl))) + { + wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); + childHandler->SetEvtHandlerEnabled(FALSE); + childHandler->SelectItem(FALSE); + } + node = node->Next(); + } + panel->Refresh(); + } + } + node = resourceTable.Next(); + } +} + +// Ensures that all currently shown windows are saved to resources, +// e.g. just before writing to a .wxr file. +bool wxResourceManager::InstantiateAllResourcesFromWindows(void) +{ + resourceTable.BeginFind(); + wxNode *node; + while (node = resourceTable.Next()) + { + wxItemResource *res = (wxItemResource *)node->Data(); + wxString resType(res->GetType()); + + if (resType == "wxDialog") + { + wxWindow *win = (wxWindow *)FindWindowForResource(res); + if (win) + InstantiateResourceFromWindow(res, win, TRUE); + } + else if (resType == "wxPanel") + { + wxWindow *win = (wxWindow *)FindWindowForResource(res); + if (win) + InstantiateResourceFromWindow(res, win, TRUE); + } + } + return TRUE; +} + +bool wxResourceManager::InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse) +{ + wxWindowPropertyInfo *info = wxCreatePropertyInfoForWindow(window); + info->SetResource(resource); + info->InstantiateResource(resource); + delete info; + + if (recurse) + { + wxNode *node = resource->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + wxWindow *childWindow = FindWindowForResource(child); + + if (!childWindow) + { + char buf[200]; + sprintf(buf, "Could not find window %s", child->GetName()); + wxMessageBox(buf, "Dialog Editor problem", wxOK); + } + else + InstantiateResourceFromWindow(child, childWindow, recurse); + node = node->Next(); + } + } + + return TRUE; +} + + +/* + * Resource editor frame + */ + +wxResourceEditorFrame::wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, char *title, + int x, int y, int width, int height, long style, char *name): + wxFrame(parent, -1, title, wxPoint(x, y), wxSize(width, height), style, name) +{ + manager = resMan; +} + +wxResourceEditorFrame::~wxResourceEditorFrame(void) +{ +} + +void wxResourceEditorFrame::OldOnMenuCommand(int cmd) +{ + switch (cmd) + { + case wxID_NEW: + { + manager->New(FALSE); + break; + } + case RESED_NEW_DIALOG: + { + manager->CreateNewDialog(); + break; + } + case RESED_NEW_PANEL: + { + manager->CreateNewPanel(); + break; + } + case wxID_OPEN: + { + manager->New(TRUE); + break; + } + case RESED_CLEAR: + { + manager->Clear(TRUE, FALSE); + break; + } + case wxID_SAVE: + { + manager->Save(); + break; + } + case wxID_SAVEAS: + { + manager->SaveAs(); + break; + } + case wxID_EXIT: + { + manager->Clear(TRUE, FALSE) ; + this->Close(); + break; + } + case wxID_ABOUT: + { + char buf[300]; + sprintf(buf, "wxWindows Dialog Editor %.1f\nAuthor: Julian Smart J.Smart@ed.ac.uk\nJulian Smart (c) 1996", wxDIALOG_EDITOR_VERSION); + (void)wxMessageBox(buf, "About Dialog Editor", wxOK|wxCENTRE); + break; + } + case RESED_CONTENTS: + { + wxBeginBusyCursor(); + manager->GetHelpInstance()->LoadFile(); + manager->GetHelpInstance()->DisplayContents(); + wxEndBusyCursor(); + break; + } + case RESED_DELETE: + { + manager->DeleteSelection(); + break; + } + case RESED_RECREATE: + { + manager->RecreateSelection(); + break; + } + case RESED_TOGGLE_TEST_MODE: + { + manager->SetEditMode(!manager->GetEditMode()); + break; + } + default: + break; + } +} + +bool wxResourceEditorFrame::OnClose(void) +{ + if (manager->Modified()) + { +/* + int ans = wxMessageBox("Save modified resource file?", "Dialog Editor", wxYES_NO | wxCANCEL); + if (ans == wxCANCEL) + return FALSE; + if (ans == wxYES) + if (!manager->SaveIfModified()) + return FALSE; +*/ + if (!manager->Clear(TRUE, FALSE)) + return FALSE; + } + + if (!Iconized()) + { + int w, h; + GetSize(&w, &h); + manager->resourceEditorWindowSize.width = w; + manager->resourceEditorWindowSize.height = h; + + int x, y; + GetPosition(&x, &y); + + manager->resourceEditorWindowSize.x = x; + manager->resourceEditorWindowSize.y = y; + } + manager->SetEditorFrame(NULL); + manager->SetEditorToolBar(NULL); + manager->SetEditorPalette(NULL); + + return TRUE; +} + +/* + * Resource editor panel + */ + +wxResourceEditorPanel::wxResourceEditorPanel(wxWindow *parent, int x, int y, int width, int height, + long style, char *name): + wxPanel(parent, -1, wxPoint(x, y), wxSize(width, height), style, name) +{ +} + +wxResourceEditorPanel::~wxResourceEditorPanel(void) +{ +} + +void wxResourceEditorPanel::OnDefaultAction(wxControl *item) +{ + wxResourceEditorFrame *frame = (wxResourceEditorFrame *)GetParent(); + wxResourceManager *manager = frame->manager; + + if (item == manager->GetEditorResourceList()) + { + manager->EditSelectedResource(); + } +} + +// Popup menu callback +void ObjectMenuProc(wxMenu& menu, wxCommandEvent& event) +{ + wxWindow *data = (wxWindow *)menu.GetClientData(); + if (!data) + return; + + switch (event.GetInt()) + { + case OBJECT_MENU_EDIT: + { + wxResourceEditWindow(data); + break; + } + case OBJECT_MENU_DELETE: + { + wxResourceManager::currentResourceManager->DeleteResource(data); + break; + } + default: + break; + } +} + +wxWindowPropertyInfo *wxCreatePropertyInfoForWindow(wxWindow *win) +{ + wxWindowPropertyInfo *info = NULL; + if (win->IsKindOf(CLASSINFO(wxScrollBar))) + { + info = new wxScrollBarPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxStaticBox))) + { + info = new wxGroupBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxCheckBox))) + { + info = new wxCheckBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxSlider))) + { + info = new wxSliderPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxGauge))) + { + info = new wxGaugePropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxListBox))) + { + info = new wxListBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxRadioBox))) + { + info = new wxRadioBoxPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxChoice))) + { + info = new wxChoicePropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxButton))) + { + info = new wxButtonPropertyInfo(win); +/* + if (((wxButton *)win)->IsBitmap()) + ((wxButtonPropertyInfo *)info)->isBitmapButton = TRUE; +*/ + } + else if (win->IsKindOf(CLASSINFO(wxStaticText))) + { + info = new wxStaticTextPropertyInfo(win); +/* + if (((wxMessage *)win)->IsBitmap()) + ((wxMessagePropertyInfo *)info)->isBitmapMessage = TRUE; +*/ + } + else if (win->IsKindOf(CLASSINFO(wxTextCtrl))) + { + info = new wxTextPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxDialog))) + { + info = new wxDialogPropertyInfo(win); + } + else if (win->IsKindOf(CLASSINFO(wxPanel))) + { + info = new wxPanelPropertyInfo(win); + } + else + { + info = new wxWindowPropertyInfo(win); + } + return info; +} + +// Popup menu callback +void wxResourceEditWindow(wxWindow *win) +{ + wxWindowPropertyInfo *info = wxCreatePropertyInfoForWindow(win); + if (info) + { + info->SetResource(wxResourceManager::currentResourceManager->FindResourceForWindow(win)); + wxString str("Editing "); + str += win->GetClassInfo()->GetClassName(); + str += ": "; + if (win->GetName() != "") + str += win->GetName(); + else + str += "properties"; + info->Edit(NULL, WXSTRINGCAST str); + delete info; + } +} + +/* + * Main toolbar + * + */ + +#if defined(__WINDOWS__) && defined(__WIN95__) +BEGIN_EVENT_TABLE(EditorToolBar, wxToolBar95) +#elif defined(__WINDOWS__) +BEGIN_EVENT_TABLE(EditorToolBar, wxToolBarMSW) +#else +BEGIN_EVENT_TABLE(EditorToolBar, wxToolBarSimple) +#endif + EVT_PAINT(EditorToolBar::OnPaint) +END_EVENT_TABLE() + +EditorToolBar::EditorToolBar(wxFrame *frame, int x, int y, int w, int h, + long style, int direction, int RowsOrColumns): +#if defined(__WINDOWS__) && defined(__WIN95__) + wxToolBar95(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns) +#elif defined(__WINDOWS__) + wxToolBarMSW(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns) +#else + wxToolBarSimple(frame, -1, wxPoint(x, y), wxSize(w, h), style, direction, RowsOrColumns) +#endif +{ +} + +bool EditorToolBar::OnLeftClick(int toolIndex, bool toggled) +{ + wxResourceManager *manager = wxResourceManager::currentResourceManager; + + switch (toolIndex) + { + case TOOLBAR_LOAD_FILE: + { + manager->New(TRUE); + break; + } + case TOOLBAR_NEW: + { + manager->New(FALSE); + break; + } + case TOOLBAR_SAVE_FILE: + { + manager->Save(); + break; + } + case TOOLBAR_HELP: + { + wxBeginBusyCursor(); + manager->GetHelpInstance()->LoadFile(); + manager->GetHelpInstance()->DisplayContents(); + wxEndBusyCursor(); + break; + } + case TOOLBAR_FORMAT_HORIZ: + { + manager->AlignItems(TOOLBAR_FORMAT_HORIZ); + break; + } + case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: + { + manager->AlignItems(TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN); + break; + } + case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: + { + manager->AlignItems(TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN); + break; + } + case TOOLBAR_FORMAT_VERT: + { + manager->AlignItems(TOOLBAR_FORMAT_VERT); + break; + } + case TOOLBAR_FORMAT_VERT_TOP_ALIGN: + { + manager->AlignItems(TOOLBAR_FORMAT_VERT_TOP_ALIGN); + break; + } + case TOOLBAR_FORMAT_VERT_BOT_ALIGN: + { + manager->AlignItems(TOOLBAR_FORMAT_VERT_BOT_ALIGN); + break; + } + case TOOLBAR_COPY_SIZE: + { + manager->CopySize(); + break; + } + case TOOLBAR_TO_BACK: + { + manager->ToBackOrFront(TRUE); + break; + } + case TOOLBAR_TO_FRONT: + { + manager->ToBackOrFront(FALSE); + break; + } + default: + break; + } + return TRUE; +} + +void EditorToolBar::OnMouseEnter(int toolIndex) +{ + wxFrame *frame = (wxFrame *)GetParent(); + + if (!frame) return; + + if (toolIndex > -1) + { + switch (toolIndex) + { + case TOOLBAR_LOAD_FILE: + frame->SetStatusText("Load project file"); + break; + case TOOLBAR_SAVE_FILE: + frame->SetStatusText("Save project file"); + break; + case TOOLBAR_NEW: + frame->SetStatusText("Create a new resource"); + break; + case TOOLBAR_FORMAT_HORIZ: + frame->SetStatusText("Align items horizontally"); + break; + case TOOLBAR_FORMAT_VERT: + frame->SetStatusText("Align items vertically"); + break; + case TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN: + frame->SetStatusText("Left-align items"); + break; + case TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN: + frame->SetStatusText("Right-align items"); + break; + case TOOLBAR_FORMAT_VERT_TOP_ALIGN: + frame->SetStatusText("Top-align items"); + break; + case TOOLBAR_FORMAT_VERT_BOT_ALIGN: + frame->SetStatusText("Bottom-align items"); + break; + case TOOLBAR_COPY_SIZE: + frame->SetStatusText("Copy size from first selection"); + break; + case TOOLBAR_TO_FRONT: + frame->SetStatusText("Put image to front"); + break; + case TOOLBAR_TO_BACK: + frame->SetStatusText("Put image to back"); + break; + case TOOLBAR_HELP: + frame->SetStatusText("Display help contents"); + break; + default: + break; + } + } + else frame->SetStatusText(""); +} + +void EditorToolBar::OnPaint(wxPaintEvent& event) +{ +#if defined(__WINDOWS__) && defined(__WIN95__) + wxToolBar95::OnPaint(event); +#elif defined(__WINDOWS__) + wxToolBarMSW::OnPaint(event); +#else + wxToolBarSimple::OnPaint(event); +#endif + + wxPaintDC dc(this); + int w, h; + GetSize(&w, &h); + dc.SetPen(wxBLACK_PEN); + dc.SetBrush(wxTRANSPARENT_BRUSH); + dc.DrawLine(0, h-1, w, h-1); +} + +/* + * Frame for editing a panel in + */ + +bool DialogEditorPanelFrame::OnClose(void) +{ + wxWindow *child = (wxWindow *)GetChildren()->First()->Data(); + wxEvtHandler *handler = child->GetEventHandler(); + return handler->OnClose(); +} diff --git a/utils/dialoged/src/reseditr.h b/utils/dialoged/src/reseditr.h new file mode 100644 index 0000000000..ef629f21b3 --- /dev/null +++ b/utils/dialoged/src/reseditr.h @@ -0,0 +1,378 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: reseditr.h +// Purpose: Resource editor class +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _RESEDITR_H_ +#define _RESEDITR_H_ + +#define wxDIALOG_EDITOR_VERSION 1.6 + +#ifdef __GNUG__ +#pragma interface "reseditr.h" +#endif + +#include "wx/wx.h" +#include "wx/string.h" +#include "wx/layout.h" +#include "wx/resource.h" +#include "wx/tbarsmpl.h" + +#include "proplist.h" + +#if defined(__WINDOWS__) && defined(__WIN95__) +#include "wx/tbar95.h" +#elif defined(__WINDOWS__) +#include "wx/tbarmsw.h" +#endif + +#define RESED_DELETE 1 +#define RESED_TOGGLE_TEST_MODE 2 +#define RESED_RECREATE 3 +#define RESED_CLEAR 4 +#define RESED_NEW_DIALOG 5 +#define RESED_NEW_PANEL 6 + +#define RESED_CONTENTS 20 + +/* + * Controls loading, saving, user interface of resource editor(s). + */ + +class wxResourceEditorFrame; +class EditorToolPalette; +class EditorToolBar; +class wxWindowPropertyInfo; + +#ifdef __WINDOWS__ +#define wxHelpController wxWinHelpController +#else +#define wxHelpController wxXLPHelpController; +#endif + +class wxHelpController; + +/* + * The resourceTable contains a list of wxItemResources (which each may + * have further children, defining e.g. a dialog box with controls). + * + * We need to associate actual windows with each wxItemResource, + * instead of the current 'one current window' scheme. + * + * - We create a new dialog, create a wxItemResource, + * associate the dialog with wxItemResource via a hash table. + * Must be a hash table in case dialog is deleted without + * telling the resource manager. + * - When we save the resource after editing/closing the dialog, + * we check the wxItemResource/wxDialog and children for + * consistency (throw away items no longer in the wxDialog, + * create any new wxItemResources). + * - We save the wxItemResources via the wxPropertyInfo classes, + * so devolve the code to the appropriate class. + * This involves creating a new temporary wxPropertyInfo for + * the purpose. + * + * We currently assume we only create one instance of a window for + * each wxItemResource. We will need to relax this when we're editing + * in situ. + * + * + */ + +class wxResourceTableWithSaving: public wxResourceTable +{ + public: + wxResourceTableWithSaving(void):wxResourceTable() + { + } + virtual bool Save(const wxString& filename); + virtual bool SaveResource(ostream& stream, wxItemResource *item); + + void GenerateWindowStyleString(long windowStyle, char *buf); + void GeneratePanelStyleString(long windowStyle, char *buf); + void GenerateDialogStyleString(long windowStyle, char *buf); + + void GenerateRadioBoxStyleString(long windowStyle, char *buf); + void GenerateMessageStyleString(long windowStyle, char *buf); + void GenerateTextStyleString(long windowStyle, char *buf); + void GenerateButtonStyleString(long windowStyle, char *buf); + void GenerateCheckBoxStyleString(long windowStyle, char *buf); + void GenerateListBoxStyleString(long windowStyle, char *buf); + void GenerateSliderStyleString(long windowStyle, char *buf); + void GenerateGroupBoxStyleString(long windowStyle, char *buf); + void GenerateGaugeStyleString(long windowStyle, char *buf); + void GenerateChoiceStyleString(long windowStyle, char *buf); + void GenerateScrollBarStyleString(long windowStyle, char *buf); + void GenerateItemStyleString(long windowStyle, char *buf); + + bool GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle); + + void OutputFont(ostream& stream, wxFont *font); + wxControl *CreateItem(wxPanel *panel, wxItemResource *childResource); +}; + +class wxResourceManager: public wxObject +{ + protected: + wxHelpController *helpInstance; + wxResourceTableWithSaving resourceTable; + wxFrame *editorFrame; + wxPanel *editorPanel; + wxMenu *popupMenu; + wxListBox *editorResourceList; + EditorToolPalette *editorPalette; + EditorToolBar *editorToolBar; + int nameCounter; + bool modified; + bool editMode; + wxHashTable resourceAssociations; + wxList selections; + wxString currentFilename; + + public: + + // Options to be saved/restored + wxString optionsResourceFilename; // e.g. dialoged.ini, .dialogrc + wxRectangle propertyWindowSize; + wxRectangle resourceEditorWindowSize; + + public: + static wxResourceManager *currentResourceManager; + + wxResourceManager(void); + ~wxResourceManager(void); + + bool Initialize(void); + + bool LoadOptions(void); + bool SaveOptions(void); + + // Show or hide the resource editor frame, which displays a list + // of resources with ability to edit them. + virtual bool ShowResourceEditor(bool show, wxWindow *parent = NULL, const char *title = "wxWindows Dialog Editor"); + + virtual bool Save(void); + virtual bool SaveAs(void); + virtual bool Save(const wxString& filename); + virtual bool Load(const wxString& filename); + virtual bool Clear(bool deleteWindows = TRUE, bool force = TRUE); + virtual void SetFrameTitle(const wxString& filename); + virtual bool DisassociateWindows(bool deleteWindows = TRUE); + virtual bool New(bool loadFromFile = TRUE, const wxString& filename = ""); + virtual bool SaveIfModified(void); + virtual void AlignItems(int flag); + virtual void CopySize(void); + virtual void ToBackOrFront(bool toBack); + virtual wxWindow *FindParentOfSelection(void); + + virtual wxFrame *OnCreateEditorFrame(const char *title); + virtual wxMenuBar *OnCreateEditorMenuBar(wxFrame *parent); + virtual wxPanel *OnCreateEditorPanel(wxFrame *parent); + virtual wxToolBarBase *OnCreateToolBar(wxFrame *parent); + virtual EditorToolPalette *OnCreatePalette(wxFrame *parent); +// virtual bool DeletePalette(void); + virtual bool InitializeTools(void); + + virtual void UpdateResourceList(void); + virtual void AddItemsRecursively(int level, wxItemResource *resource); + virtual bool EditSelectedResource(void); + virtual bool Edit(wxItemResource *res); + virtual bool CreateNewDialog(void); + virtual bool CreateNewPanel(void); + virtual bool CreatePanelItem(wxItemResource *panelResource, wxPanel *panel, char *itemType, int x = 10, int y = 10, bool isBitmap = FALSE); + + virtual bool DeleteSelection(bool deleteWindow = TRUE); + + virtual bool DeleteResource(wxItemResource *res); + virtual bool DeleteResource(wxWindow *win, bool deleteWindow = TRUE); + + // Add bitmap resource if there isn't already one with this filename. + virtual char *AddBitmapResource(char *filename); + + // Delete the bitmap resource if it isn't being used by another resource. + virtual void PossiblyDeleteBitmapResource(char *resourceName); + + // Helper function for above + virtual bool IsBitmapResourceUsed(char *resourceName); + + wxItemResource *FindBitmapResourceByFilename(char *filename); + + char *FindBitmapFilenameForResource(wxItemResource *resource); + + // Deletes 'win' and creates a new window from the resource that + // was associated with it. E.g. if you can't change properties on the + // fly, you'll need to delete the window and create it again. + virtual wxWindow *RecreateWindowFromResource(wxWindow *win, wxWindowPropertyInfo *info = NULL); + + virtual bool RecreateSelection(void); + + // Need to search through resource table removing this from + // any resource which has this as a parent. + virtual bool RemoveResourceFromParent(wxItemResource *res); + + virtual bool EditDialog(wxDialog *dialog, wxWindow *parent); + + inline void SetEditorFrame(wxFrame *fr) { editorFrame = fr; } + inline void SetEditorToolBar(EditorToolBar *tb) { editorToolBar = tb; } + inline void SetEditorPalette(EditorToolPalette *pal) { editorPalette = pal; } + inline wxFrame *GetEditorFrame(void) { return editorFrame; } + inline wxListBox *GetEditorResourceList(void) { return editorResourceList; } + inline EditorToolPalette *GetEditorPalette(void) { return editorPalette; } + inline wxList& GetSelections(void) { return selections; } + + void AddSelection(wxWindow *win); + void RemoveSelection(wxWindow *win); + +// inline void SetCurrentResource(wxItemResource *item) { currentResource = item; } +// inline void SetCurrentResourceWindow(wxWindow *win) { currentResourceWindow = win; } +// inline wxItemResource *GetCurrentResource(void) { return currentResource; } +// inline wxWindow *GetCurrentResourceWindow(void) { return currentResourceWindow; } + inline wxMenu *GetPopupMenu(void) { return popupMenu; } + + inline wxHelpController *GetHelpInstance(void) { return helpInstance; } + + virtual void MakeUniqueName(char *prefix, char *buf); + + // (Dis)associate resource<->physical window + virtual void AssociateResource(wxItemResource *resource, wxWindow *win); + virtual bool DisassociateResource(wxItemResource *resource, bool deleteWindow = TRUE); + virtual bool DisassociateResource(wxWindow *win, bool deleteWindow = TRUE); + virtual wxItemResource *FindResourceForWindow(wxWindow *win); + virtual wxWindow *FindWindowForResource(wxItemResource *resource); + + virtual bool InstantiateAllResourcesFromWindows(void); + virtual bool InstantiateResourceFromWindow(wxItemResource *resource, wxWindow *window, bool recurse = FALSE); + + virtual void Modify(bool mod = TRUE) { modified = mod; } + virtual bool Modified(void) { return modified; } + + inline bool GetEditMode(void) { return editMode; } + void SetEditMode(bool flag, bool changeCurrentResource = TRUE); + + inline wxResourceTable& GetResourceTable(void) { return resourceTable; } + inline wxHashTable& GetResourceAssociations(void) { return resourceAssociations; } + + inline wxString& GetCurrentFilename(void) { return currentFilename; } + +// void UsePosition(bool usePos, wxItemResource *resource = NULL, int x = 0, int y = 0); +}; + +class wxResourceEditorFrame: public wxFrame +{ + public: + wxResourceManager *manager; + wxResourceEditorFrame(wxResourceManager *resMan, wxFrame *parent, char *title, int x = -1, int y = -1, int width = 600, int height = 400, + long style = 0, char *name = "frame"); + ~wxResourceEditorFrame(void); + void OldOnMenuCommand(int cmd); + bool OnClose(void); +}; + +class wxResourceEditorPanel: public wxPanel +{ + public: + wxResourceEditorPanel(wxWindow *parent, int x = -1, int y = -1, int width = 600, int height = 400, + long style = 0, char *name = "panel"); + ~wxResourceEditorPanel(void); + void OnDefaultAction(wxControl *item); +}; + +class DialogEditorPanelFrame: public wxFrame +{ + public: + DialogEditorPanelFrame(wxFrame *parent, char *title, int x, int y, int w, int h, long style, char *name): + wxFrame(parent, -1, title, wxPoint(x, y), wxSize(w, h), style, name) + { + } + bool OnClose(void); +}; + +// Edit menu +#define OBJECT_EDITOR_NEW_FRAME 220 +#define OBJECT_EDITOR_NEW_DIALOG 221 +#define OBJECT_EDITOR_NEW_PANEL 222 +#define OBJECT_EDITOR_NEW_CANVAS 223 +#define OBJECT_EDITOR_NEW_TEXT_WINDOW 224 +#define OBJECT_EDITOR_NEW_BUTTON 225 +#define OBJECT_EDITOR_NEW_CHECKBOX 226 +#define OBJECT_EDITOR_NEW_MESSAGE 227 +#define OBJECT_EDITOR_NEW_CHOICE 228 +#define OBJECT_EDITOR_NEW_LISTBOX 229 +#define OBJECT_EDITOR_NEW_RADIOBOX 230 +#define OBJECT_EDITOR_NEW_SLIDER 231 +#define OBJECT_EDITOR_NEW_TEXT 232 +#define OBJECT_EDITOR_NEW_MULTITEXT 233 +#define OBJECT_EDITOR_NEW_GAUGE 234 +#define OBJECT_EDITOR_NEW_GROUPBOX 235 + +#define OBJECT_EDITOR_NEW_ITEM 240 +#define OBJECT_EDITOR_NEW_SUBWINDOW 241 + +#define OBJECT_EDITOR_EDIT_MENU 250 +#define OBJECT_EDITOR_EDIT_ATTRIBUTES 251 +#define OBJECT_EDITOR_CLOSE_OBJECT 252 +#define OBJECT_EDITOR_DELETE_OBJECT 253 +#define OBJECT_EDITOR_EDIT_TOOLBAR 254 + +#define OBJECT_EDITOR_TOGGLE_TEST_MODE 255 + +#define OBJECT_EDITOR_RC_CONVERT 260 +#define OBJECT_EDITOR_RC_CONVERT_MENU 261 +#define OBJECT_EDITOR_RC_CONVERT_DIALOG 262 + +#define OBJECT_EDITOR_GRID 263 + +#define OBJECT_MENU_EDIT 1 +#define OBJECT_MENU_DELETE 2 + +/* + * Main toolbar + * + */ + +#if defined(__WINDOWS__) && defined(__WIN95__) +class EditorToolBar: public wxToolBar95 +#elif defined(__WINDOWS__) +class EditorToolBar: public wxToolBarMSW +#else +class EditorToolBar: public wxToolBarSimple +#endif +{ + public: + EditorToolBar(wxFrame *frame, int x = 0, int y = 0, int w = -1, int h = -1, + long style = 0, int direction = wxVERTICAL, int RowsOrColumns = 2); + bool OnLeftClick(int toolIndex, bool toggled); + void OnMouseEnter(int toolIndex); + void OnPaint(wxPaintEvent& event); + +DECLARE_EVENT_TABLE() +}; + +// Toolbar ids +#define TOOLBAR_LOAD_FILE 1 +#define TOOLBAR_SAVE_FILE 2 +#define TOOLBAR_NEW 3 +// #define TOOLBAR_GEN_CLIPS 4 +#define TOOLBAR_TREE 5 +#define TOOLBAR_HELP 6 + +// Formatting tools +#define TOOLBAR_FORMAT_HORIZ 10 +#define TOOLBAR_FORMAT_HORIZ_LEFT_ALIGN 11 +#define TOOLBAR_FORMAT_HORIZ_RIGHT_ALIGN 12 +#define TOOLBAR_FORMAT_VERT 13 +#define TOOLBAR_FORMAT_VERT_TOP_ALIGN 14 +#define TOOLBAR_FORMAT_VERT_BOT_ALIGN 15 + +#define TOOLBAR_TO_FRONT 16 +#define TOOLBAR_TO_BACK 17 +#define TOOLBAR_COPY_SIZE 18 + +#endif + diff --git a/utils/dialoged/src/reswrite.cpp b/utils/dialoged/src/reswrite.cpp new file mode 100644 index 0000000000..9d408c50f8 --- /dev/null +++ b/utils/dialoged/src/reswrite.cpp @@ -0,0 +1,726 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: reswrite.cpp +// Purpose: Resource writing functionality +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#include + +#include "wx/scrolbar.h" +#include "wx/string.h" + +#include "reseditr.h" + +char *SafeString(char *s); +char *SafeWord(char *s); + +// Save an association between the child resource and the panel item, to allow +// us not to require unique window names. +wxControl *wxResourceTableWithSaving::CreateItem(wxPanel *panel, wxItemResource *childResource) +{ + wxControl *item = wxResourceTable::CreateItem(panel, childResource); + if (item) + wxResourceManager::currentResourceManager->GetResourceAssociations().Put((long)childResource, item); + return item; +} + +void wxResourceTableWithSaving::OutputFont(ostream& stream, wxFont *font) +{ + stream << "[" << font->GetPointSize() << ", '"; + stream << font->GetFamilyString() << "', '"; + stream << font->GetStyleString() << "', '"; + stream << font->GetWeightString() << "', "; + stream << (int)font->GetUnderlined(); + if (font->GetFaceName() != "") + stream << ", '" << font->GetFaceName() << "'"; + stream << "]"; +} + +/* + * Resource table with saving (basic one only has loading) + */ + +bool wxResourceTableWithSaving::Save(const wxString& filename) +{ + ofstream stream(((wxString &) filename).GetData()); + if (stream.bad()) + return FALSE; + + BeginFind(); + wxNode *node = NULL; + while (node = Next()) + { + wxItemResource *item = (wxItemResource *)node->Data(); + wxString resType(item->GetType()); + + if (resType == "wxDialogBox" || resType == "wxDialog" || resType == "wxPanel" || resType == "wxBitmap") + { + if (!SaveResource(stream, item)) + return FALSE; + } + } + return TRUE; +} + +bool wxResourceTableWithSaving::SaveResource(ostream& stream, wxItemResource *item) +{ + char styleBuf[400]; + wxString itemType(item->GetType()); + + if (itemType == "wxDialogBox" || itemType == "wxDialog" || itemType == "wxPanel") + { + if (itemType == "wxDialogBox" || itemType == "wxDialog") + { + stream << "static char *" << item->GetName() << " = \"dialog(name = '" << item->GetName() << "',\\\n"; + GenerateDialogStyleString(item->GetStyle(), styleBuf); + } + else + { + stream << "static char *" << item->GetName() << " = \"panel(name = '" << item->GetName() << "',\\\n"; + GeneratePanelStyleString(item->GetStyle(), styleBuf); + } + stream << " style = '" << styleBuf << "',\\\n"; + stream << " title = '" << item->GetTitle() << "',\\\n"; + stream << " x = " << item->GetX() << ", y = " << item->GetY(); + stream << ", width = " << item->GetWidth() << ", height = " << item->GetHeight() << ",\\\n"; + stream << " modal = " << item->GetValue1(); + + if (item->GetStyle() & wxUSER_COLOURS) + { + if (item->GetBackgroundColour()) + { + char buf[7]; + wxDecToHex(item->GetBackgroundColour()->Red(), buf); + wxDecToHex(item->GetBackgroundColour()->Green(), buf+2); + wxDecToHex(item->GetBackgroundColour()->Blue(), buf+4); + buf[6] = 0; + + stream << ",\\\n " << "background_colour = '" << buf << "'"; + } + if (item->GetLabelColour()) + { + char buf[7]; + wxDecToHex(item->GetLabelColour()->Red(), buf); + wxDecToHex(item->GetLabelColour()->Green(), buf+2); + wxDecToHex(item->GetLabelColour()->Blue(), buf+4); + buf[6] = 0; + + stream << ",\\\n " << "label_colour = '" << buf << "'"; + } + if (item->GetButtonColour()) + { + char buf[7]; + wxDecToHex(item->GetButtonColour()->Red(), buf); + wxDecToHex(item->GetButtonColour()->Green(), buf+2); + wxDecToHex(item->GetButtonColour()->Blue(), buf+4); + buf[6] = 0; + + stream << ",\\\n " << "button_colour = '" << buf << "'"; + } + } + + if (item->GetFont()) + { + stream << ",\\\n font = "; + OutputFont(stream, item->GetFont()); + } +/* + if (item->GetButtonFont()) + { + stream << ",\\\n button_font = "; + OutputFont(stream, item->GetButtonFont()); + } +*/ + + if (item->GetChildren().Number() > 0) + stream << ",\\\n"; + else + stream << "\\\n"; + wxNode *node = item->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + + stream << " control = ["; + + SaveResource(stream, child); + + stream << "]"; + + if (node->Next()) + stream << ",\\\n"; + node = node->Next(); + } + stream << ").\";\n\n"; + } + else if (itemType == "wxButton") + { + GenerateButtonStyleString(item->GetStyle(), styleBuf); + stream << "wxButton, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + if (item->GetValue4()) + stream << ", '" << item->GetValue4() << "'"; + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxMessage") + { + GenerateMessageStyleString(item->GetStyle(), styleBuf); + stream << "wxMessage, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + if (item->GetValue4()) + stream << ", '" << item->GetValue4() << "'"; + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxCheckBox") + { + GenerateCheckBoxStyleString(item->GetStyle(), styleBuf); + stream << "wxCheckBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1(); + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxGroupBox") + { + GenerateGroupBoxStyleString(item->GetStyle(), styleBuf); + stream << "wxGroupBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxText" || itemType == "wxMultiText") + { + GenerateTextStyleString(item->GetStyle(), styleBuf); + stream << ((itemType == "wxText") ? "wxText, " : "wxMultiText, "); + stream << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << SafeWord(item->GetValue4()); + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxGauge") + { + GenerateGaugeStyleString(item->GetStyle(), styleBuf); + stream << "wxGauge, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1() << ", " << item->GetValue2(); + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxSlider") + { + GenerateSliderStyleString(item->GetStyle(), styleBuf); + stream << "wxSlider, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3(); + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxScrollBar") + { + GenerateScrollBarStyleString(item->GetStyle(), styleBuf); + stream << "wxScrollBar, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + stream << ", " << item->GetValue1() << ", " << item->GetValue2() << ", " << item->GetValue3() << ", "; + stream << item->GetValue5(); + } + else if (itemType == "wxListBox") + { + GenerateListBoxStyleString(item->GetStyle(), styleBuf); + stream << "wxListBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + + // Default list of values + + stream << ", ["; + if (item->GetStringValues()) + { + wxNode *node = item->GetStringValues()->First(); + while (node) + { + char *s = (char *)node->Data(); + stream << SafeWord(s); + if (node->Next()) + stream << ", "; + node = node->Next(); + } + } + stream << "], "; + switch (item->GetValue1()) + { + case wxLB_MULTIPLE: + { + stream << "'wxLB_MULTIPLE'"; + break; + } + case wxLB_EXTENDED: + { + stream << "'wxLB_EXTENDED'"; + break; + } + case wxLB_SINGLE: + default: + { + stream << "'wxLB_SINGLE'"; + break; + } + } + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxChoice") + { + GenerateChoiceStyleString(item->GetStyle(), styleBuf); + stream << "wxChoice, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + + // Default list of values + + stream << ", ["; + if (item->GetStringValues()) + { + wxNode *node = item->GetStringValues()->First(); + while (node) + { + char *s = (char *)node->Data(); + stream << SafeWord(s); + if (node->Next()) + stream << ", "; + node = node->Next(); + } + } + stream << "]"; + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxRadioBox") + { + // Must write out the orientation and number of rows/cols!! + GenerateRadioBoxStyleString(item->GetStyle(), styleBuf); + stream << "wxRadioBox, " << SafeWord(item->GetTitle()) << ", '" << styleBuf << "', "; + stream << SafeWord(item->GetName()) << ", " << item->GetX() << ", " << item->GetY() << ", "; + stream << item->GetWidth() << ", " << item->GetHeight(); + + // Default list of values + + stream << ", ["; + if (item->GetStringValues()) + { + wxNode *node = item->GetStringValues()->First(); + while (node) + { + char *s = (char *)node->Data(); + stream << SafeWord(s); + if (node->Next()) + stream << ", "; + node = node->Next(); + } + } + stream << "], " << item->GetValue1(); + if (item->GetFont()) + { + stream << ",\\\n "; + OutputFont(stream, item->GetFont()); + } + } + else if (itemType == "wxBitmap") + { + stream << "static char *" << item->GetName() << " = \"bitmap(name = '" << item->GetName() << "',\\\n"; + + wxNode *node = item->GetChildren().First(); + while (node) + { + wxItemResource *child = (wxItemResource *)node->Data(); + stream << " bitmap = ["; + + char buf[400]; + strcpy(buf, child->GetName()); +#ifdef __WINDOWS__ + wxDos2UnixFilename(buf); +#endif + + stream << "'" << buf << "', "; + + int bitmapType = (int)child->GetValue1(); + switch (bitmapType) + { + case wxBITMAP_TYPE_XBM_DATA: + { + stream << "wxBITMAP_TYPE_XBM_DATA"; + break; + } + case wxBITMAP_TYPE_XPM_DATA: + { + stream << "wxBITMAP_TYPE_XPM_DATA"; + break; + } + case wxBITMAP_TYPE_XBM: + { + stream << "wxBITMAP_TYPE_XBM"; + break; + } + case wxBITMAP_TYPE_XPM: + { + stream << "wxBITMAP_TYPE_XPM"; + break; + } + case wxBITMAP_TYPE_BMP: + { + stream << "wxBITMAP_TYPE_BMP"; + break; + } + case wxBITMAP_TYPE_BMP_RESOURCE: + { + stream << "wxBITMAP_TYPE_BMP_RESOURCE"; + break; + } + case wxBITMAP_TYPE_GIF: + { + stream << "wxBITMAP_TYPE_GIF"; + break; + } + case wxBITMAP_TYPE_TIF: + { + stream << "wxBITMAP_TYPE_TIF"; + break; + } + case wxBITMAP_TYPE_ICO: + { + stream << "wxBITMAP_TYPE_ICO"; + break; + } + case wxBITMAP_TYPE_ICO_RESOURCE: + { + stream << "wxBITMAP_TYPE_ICO_RESOURCE"; + break; + } + case wxBITMAP_TYPE_CUR: + { + stream << "wxBITMAP_TYPE_CUR"; + break; + } + case wxBITMAP_TYPE_CUR_RESOURCE: + { + stream << "wxBITMAP_TYPE_CUR_RESOURCE"; + break; + } + default: + case wxBITMAP_TYPE_ANY: + { + stream << "wxBITMAP_TYPE_ANY"; + break; + } + } + stream << ", "; + int platform = child->GetValue2(); + switch (platform) + { + case RESOURCE_PLATFORM_WINDOWS: + { + stream << "'WINDOWS'"; + break; + } + case RESOURCE_PLATFORM_X: + { + stream << "'X'"; + break; + } + case RESOURCE_PLATFORM_MAC: + { + stream << "'MAC'"; + break; + } + case RESOURCE_PLATFORM_ANY: + { + stream << "'ANY'"; + break; + } + } + int noColours = (int)child->GetValue3(); + if (noColours > 0) + stream << ", " << noColours; + + stream << "]"; + + if (node->Next()) + stream << ",\\\n"; + + node = node->Next(); + } + stream << ").\";\n\n"; + } + return TRUE; +} + +void wxResourceTableWithSaving::GenerateWindowStyleString(long windowStyle, char *buf) +{ + GenerateStyle(buf, windowStyle, wxUSER_COLOURS, "wxUSER_COLOURS"); + GenerateStyle(buf, windowStyle, wxVSCROLL, "wxVSCROLL"); + GenerateStyle(buf, windowStyle, wxHSCROLL, "wxHSCROLL"); + GenerateStyle(buf, windowStyle, wxBORDER, "wxBORDER"); +} + +void wxResourceTableWithSaving::GenerateDialogStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateWindowStyleString(windowStyle, buf); + +/* + GenerateStyle(buf, windowStyle, wxRETAINED, "wxRETAINED"); +*/ + if (!GenerateStyle(buf, windowStyle, wxDEFAULT_DIALOG_STYLE, "wxDEFAULT_DIALOG_STYLE")) + { + GenerateStyle(buf, windowStyle, wxCAPTION, "wxCAPTION"); + GenerateStyle(buf, windowStyle, wxTHICK_FRAME, "wxTHICK_FRAME"); + GenerateStyle(buf, windowStyle, wxRESIZE_BORDER, "wxRESIZE_BORDER"); + GenerateStyle(buf, windowStyle, wxSYSTEM_MENU, "wxSYSTEM_MENU"); + GenerateStyle(buf, windowStyle, wxMINIMIZE_BOX, "wxMINIMIZE_BOX"); + GenerateStyle(buf, windowStyle, wxMAXIMIZE_BOX, "wxMAXIMIZE_BOX"); + } + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GeneratePanelStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateWindowStyleString(windowStyle, buf); + +/* + GenerateStyle(buf, windowStyle, wxRETAINED, "wxRETAINED"); +*/ + if (strlen(buf) == 0) + strcat(buf, "0"); +} + + +void wxResourceTableWithSaving::GenerateItemStyleString(long windowStyle, char *buf) +{ + GenerateWindowStyleString(windowStyle, buf); + + GenerateStyle(buf, windowStyle, wxHORIZONTAL, "wxHORIZONTAL"); + GenerateStyle(buf, windowStyle, wxVERTICAL, "wxVERTICAL"); +} + +void wxResourceTableWithSaving::GenerateRadioBoxStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateMessageStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateTextStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + GenerateStyle(buf, windowStyle, wxTE_PROCESS_ENTER, "wxTE_PROCESS_ENTER"); + GenerateStyle(buf, windowStyle, wxTE_READONLY, "wxTE_READONLY"); + GenerateStyle(buf, windowStyle, wxTE_PASSWORD, "wxTE_PASSWORD"); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateButtonStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateCheckBoxStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateListBoxStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + GenerateStyle(buf, windowStyle, wxLB_ALWAYS_SB, "wxLB_ALWAYS_SB"); + GenerateStyle(buf, windowStyle, wxLB_SORT, "wxLB_SORT"); +// GenerateStyle(buf, windowStyle, wxLB_SINGLE, "wxLB_SINGLE"); // Done already + GenerateStyle(buf, windowStyle, wxLB_MULTIPLE, "wxLB_MULTIPLE"); + GenerateStyle(buf, windowStyle, wxLB_EXTENDED, "wxLB_EXTENDED"); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateSliderStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateGroupBoxStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateGaugeStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + GenerateStyle(buf, windowStyle, wxGA_PROGRESSBAR, "wxGA_PROGRESSBAR"); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateChoiceStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +void wxResourceTableWithSaving::GenerateScrollBarStyleString(long windowStyle, char *buf) +{ + buf[0] = 0; + GenerateItemStyleString(windowStyle, buf); + + if (strlen(buf) == 0) + strcat(buf, "0"); +} + +bool wxResourceTableWithSaving::GenerateStyle(char *buf, long windowStyle, long flag, char *strStyle) +{ + if ((windowStyle & flag) == flag) + { + if (strlen(buf) > 0) + strcat(buf, " | "); + strcat(buf, strStyle); + return TRUE; + } + else + return FALSE; +} + +// Returns quoted string or "NULL" +char *SafeString(char *s) +{ + if (!s) + return "NULL"; + else + { + strcpy(wxBuffer, "\""); + strcat(wxBuffer, s); + strcat(wxBuffer, "\""); + return wxBuffer; + } +} + +// Returns quoted string or '' +char *SafeWord(char *s) +{ + if (!s) + return "''"; + else + { + strcpy(wxBuffer, "'"); + strcat(wxBuffer, s); + strcat(wxBuffer, "'"); + return wxBuffer; + } +} + diff --git a/utils/dialoged/src/winprop.cpp b/utils/dialoged/src/winprop.cpp new file mode 100644 index 0000000000..c1a1c63d54 --- /dev/null +++ b/utils/dialoged/src/winprop.cpp @@ -0,0 +1,1578 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: winprop.cpp +// Purpose: Window properties +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "winprop.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#ifdef __WINDOWS__ +#include +#endif + +#include "reseditr.h" +#include "editrpal.h" +#include "winprop.h" + +// Causes immediate feedback. +void wxResourcePropertyListView::OnPropertyChanged(wxProperty *property) +{ + // Sets the value of the property back into the actual object, + // IF the property value was modified. + if (property->GetValue().GetModified()) + { + propertyInfo->SetProperty(property->GetName(), property); + property->GetValue().SetModified(FALSE); + } +} + +bool wxResourcePropertyListView::OnClose(void) +{ + int w, h, x, y; + GetManagedWindow()->GetSize(& w, & h); + GetManagedWindow()->GetPosition(& x, & y); + + wxResourceManager::currentResourceManager->propertyWindowSize.width = w; + wxResourceManager::currentResourceManager->propertyWindowSize.height = h; + wxResourceManager::currentResourceManager->propertyWindowSize.x = x; + wxResourceManager::currentResourceManager->propertyWindowSize.y = y; + + return wxPropertyListView::OnClose(); +} + +/* + * wxPropertyInfo + */ + +wxWindow *wxPropertyInfo::sm_propertyWindow; + +// Edit the information represented by this object, whatever that +// might be. +bool wxPropertyInfo::Edit(wxWindow *parent, char *title) +{ + int width = wxResourceManager::currentResourceManager->propertyWindowSize.width; + int height = wxResourceManager::currentResourceManager->propertyWindowSize.height; + int x = wxResourceManager::currentResourceManager->propertyWindowSize.x; + int y = wxResourceManager::currentResourceManager->propertyWindowSize.y; + + wxPropertySheet *propSheet = new wxPropertySheet; + + wxStringList propNames; + GetPropertyNames(propNames); + + wxNode *node = propNames.First(); + while (node) + { + wxString name((char *)node->Data()); + wxProperty *prop = GetProperty(name); + if (prop) + { + propSheet->AddProperty(prop); + } + node = node->Next(); + } + + // Reset 'modified' flags for all property values + propSheet->SetAllModified(FALSE); + + if (!title) + title = "Properties"; + wxResourcePropertyListView *view = new wxResourcePropertyListView(this, NULL, +#ifdef __XVIEW__ + wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | +#endif + wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); + + wxPropertyListDialog *propDialog = new wxPropertyListDialog(view, NULL, title, wxPoint(x, y), wxSize(width, height), wxDIALOG_MODAL|wxDEFAULT_DIALOG_STYLE); + sm_propertyWindow = propDialog; + + wxPropertyValidatorRegistry theValidatorRegistry; + theValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator); + theValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator); + theValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator); + theValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator); + theValidatorRegistry.RegisterValidator((wxString)"filename", new wxFilenameListValidator); + theValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator); + +// view->propertyWindow = propDialog; + view->AddRegistry(&theValidatorRegistry); + view->ShowView(propSheet, propDialog); + + int ret = propDialog->ShowModal(); + sm_propertyWindow = NULL; + delete propSheet; + + if ( ret == wxID_CANCEL ) + return FALSE; + else + return TRUE; +} + +/* + * wxWindowPropertyInfo + */ + +wxWindowPropertyInfo::wxWindowPropertyInfo(wxWindow *win, wxItemResource *res) +{ + propertyWindow = win; + propertyResource = res; +} + +wxWindowPropertyInfo::~wxWindowPropertyInfo(void) +{ +} + +wxProperty *wxWindowPropertyInfo::GetFontProperty(wxString& name, wxFont *font) +{ + if (!font) + return NULL; + + if (name.Contains("Points")) + return new wxProperty(name, (long)font->GetPointSize(), "integer", new wxIntegerListValidator(1, 100)); + else if (name.Contains("Family")) + return new wxProperty(name, font->GetFamilyString(), "string", + new wxStringListValidator(new wxStringList("wxDECORATIVE", "wxROMAN", "wxSCRIPT", "wxSWISS", "wxMODERN", + NULL))); + else if (name.Contains("Style")) + return new wxProperty(name, font->GetStyleString(), "string", + new wxStringListValidator(new wxStringList("wxNORMAL", "wxITALIC", "wxSLANT", NULL))); + else if (name.Contains("Weight")) + return new wxProperty(name, font->GetWeightString(), "string", + new wxStringListValidator(new wxStringList("wxNORMAL", "wxBOLD", "wxLIGHT", NULL))); + else if (name.Contains("Underlined")) + return new wxProperty(name, (bool)font->GetUnderlined(), "bool"); + else + return NULL; +} + +wxFont *wxWindowPropertyInfo::SetFontProperty(wxString& name, wxProperty *property, wxFont *font) +{ + int pointSize = 12; + int fontFamily = wxMODERN; + int fontStyle = wxNORMAL; + int fontWeight = wxNORMAL; + bool fontUnderlined = FALSE; + + if (name.Contains("Points")) + { + pointSize = (int)property->GetValue().IntegerValue(); + if (font && (pointSize == font->GetPointSize())) + return NULL; // No change + } + else if (font) pointSize = font->GetPointSize(); + + if (name.Contains("Family")) + { + wxString val = property->GetValue().StringValue(); + fontFamily = wxStringToFontFamily(val); + + if (font && (fontFamily == font->GetFamily())) + return NULL; // No change + } + else if (font) fontFamily = font->GetFamily(); + + if (name.Contains("Style")) + { + wxString val = property->GetValue().StringValue(); + fontStyle = wxStringToFontStyle(val); + + if (font && (fontStyle == font->GetStyle())) + return NULL; // No change + } + else if (font) fontStyle = font->GetStyle(); + if (name.Contains("Weight")) + { + wxString val = property->GetValue().StringValue(); + fontWeight = wxStringToFontWeight(val); + + if (font && (fontWeight == font->GetWeight())) + return NULL; // No change + } + else if (font) fontWeight = font->GetWeight(); + + if (name.Contains("Underlined")) + { + fontUnderlined = property->GetValue().BoolValue(); + + if (font && (fontUnderlined == font->GetUnderlined())) + return NULL; // No change + } + else if (font) fontUnderlined = font->GetUnderlined(); + + wxFont *newFont = wxTheFontList->FindOrCreateFont(pointSize, fontFamily, fontStyle, fontWeight, fontUnderlined); + if (newFont) + { + return newFont; + } + else + return NULL; +} + +wxProperty *wxWindowPropertyInfo::GetProperty(wxString& name) +{ + wxFont *font = propertyWindow->GetFont(); + if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || + name == "fontUnderlined") + return GetFontProperty(name, font); + else if (name == "name") + return new wxProperty("name", propertyWindow->GetName(), "string"); + else if (name == "title") + return new wxProperty("title", propertyWindow->GetTitle(), "string"); + else if (name == "x") + { + int x, y; + propertyWindow->GetPosition(&x, &y); + return new wxProperty("x", (long)x, "integer"); + } + else if (name == "y") + { + int x, y; + propertyWindow->GetPosition(&x, &y); + return new wxProperty("y", (long)y, "integer"); + } + else if (name == "width") + { + int width, height; + propertyWindow->GetSize(&width, &height); + return new wxProperty("width", (long)width, "integer"); + } + else if (name == "height") + { + int width, height; + propertyWindow->GetSize(&width, &height); + return new wxProperty("height", (long)height, "integer"); + } + else + return NULL; +} + +bool wxWindowPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxFont *font = propertyWindow->GetFont(); + if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, font); + if (newFont) + propertyWindow->SetFont(newFont); + return TRUE; + } + else if (name == "name") + { + // Remove old name from resource table, if it's there. + wxItemResource *oldResource = (wxItemResource *)wxResourceManager::currentResourceManager->GetResourceTable().Delete(propertyWindow->GetName()); + if (oldResource) + { + // It's a top-level resource + propertyWindow->SetName(property->GetValue().StringValue()); + oldResource->SetName(property->GetValue().StringValue()); + wxResourceManager::currentResourceManager->GetResourceTable().Put(propertyWindow->GetName(), oldResource); + } + else + { + // It's a child of something; just set the name of the resource and the window. + propertyWindow->SetName(property->GetValue().StringValue()); + propertyResource->SetName(property->GetValue().StringValue()); + } + // Refresh the resource manager list, because the name changed. + wxResourceManager::currentResourceManager->UpdateResourceList(); + return TRUE; + } + else if (name == "title") + { + propertyWindow->SetTitle(property->GetValue().StringValue()); + return TRUE; + } + else if (name == "x") + { + int x, y; + propertyWindow->GetPosition(&x, &y); + int newX = (int)property->GetValue().IntegerValue(); + if (x != newX) + propertyWindow->Move(newX, y); + return TRUE; + } + else if (name == "y") + { + int x, y; + propertyWindow->GetPosition(&x, &y); + int newY = (int)property->GetValue().IntegerValue(); + if (y != newY) + propertyWindow->Move(x, newY); + return TRUE; + } + else if (name == "width") + { + int width, height; + propertyWindow->GetSize(&width, &height); + int newWidth = (int)property->GetValue().IntegerValue(); + if (width != newWidth) + { + propertyWindow->SetSize(newWidth, height); + if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog))) + { + propertyWindow->GetParent()->SetClientSize(newWidth, height); + } + } + return TRUE; + } + else if (name == "height") + { + int width, height; + propertyWindow->GetSize(&width, &height); + int newHeight = (int)property->GetValue().IntegerValue(); + if (height != newHeight) + { + propertyWindow->SetSize(width, newHeight); + if (propertyWindow->IsKindOf(CLASSINFO(wxPanel)) && !propertyWindow->IsKindOf(CLASSINFO(wxDialog))) + { + propertyWindow->GetParent()->SetClientSize(width, newHeight); + } + } + return TRUE; + } + else + return FALSE; +} + +void wxWindowPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("name"); + names.Add("x"); + names.Add("y"); + names.Add("width"); + names.Add("height"); + if (!propertyWindow->IsKindOf(CLASSINFO(wxControl))) + { + names.Add("fontPoints"); + names.Add("fontFamily"); + names.Add("fontStyle"); + names.Add("fontWeight"); + names.Add("fontUnderlined"); + } +} + +// Fill in the wxItemResource members to mirror the current window settings +bool wxWindowPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + resource->SetType(propertyWindow->GetClassInfo()->GetClassName()); + +// resource->SetStyle(propertyWindow->GetWindowStyleFlag()); + wxString str(propertyWindow->GetName()); + resource->SetName(WXSTRINGCAST str); + int x, y, w, h; + propertyWindow->GetSize(&w, &h); + + propertyWindow->GetPosition(&x, &y); + resource->SetSize(x, y, w, h); + return TRUE; +} + + +/* + * Panel items + */ + +wxProperty *wxItemPropertyInfo::GetProperty(wxString& name) +{ + wxControl *itemWindow = (wxControl *)propertyWindow; + wxFont *font = itemWindow->GetFont(); + + if (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || + name == "fontUnderlined") + return GetFontProperty(name, font); + else if (name == "label" && itemWindow->GetLabel()) + return new wxProperty("label", propertyWindow->GetLabel(), "string"); + else + return wxWindowPropertyInfo::GetProperty(name); +} + +bool wxItemPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxControl *itemWindow = (wxControl *)propertyWindow; + wxFont *font = itemWindow->GetFont(); + + if (font && (name == "fontPoints" || name == "fontFamily" || name == "fontStyle" || name == "fontWeight" || name == "fontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, font); + if (newFont) + itemWindow->SetLabelFont(newFont); + return TRUE; + } + else if (name == "label") + { + itemWindow->SetLabel(property->GetValue().StringValue()); + return TRUE; + } + else + return wxWindowPropertyInfo::SetProperty(name, property); +} + +void wxItemPropertyInfo::GetPropertyNames(wxStringList& names) +{ + wxWindowPropertyInfo::GetPropertyNames(names); + + names.Add("fontPoints"); + names.Add("fontFamily"); + names.Add("fontStyle"); + names.Add("fontWeight"); + names.Add("fontUnderlined"); +} + +bool wxItemPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxWindowPropertyInfo::InstantiateResource(resource); + + wxControl *item = (wxControl *)propertyWindow; + wxString str(item->GetLabel()); + resource->SetTitle(WXSTRINGCAST str); + if (item->GetFont()) + resource->SetFont(wxTheFontList->FindOrCreateFont(item->GetFont()->GetPointSize(), + item->GetFont()->GetFamily(), item->GetFont()->GetStyle(), item->GetFont()->GetWeight(), + item->GetFont()->GetUnderlined(), item->GetFont()->GetFaceName())); + return TRUE; +} + +/* + * Button + */ + +wxProperty *wxButtonPropertyInfo::GetProperty(wxString& name) +{ + wxButton *button = (wxButton *)propertyWindow; +/* + if (name == "label" && isBitmapButton) + { + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(button); + wxString str("none.bmp"); + + if (resource) + { + char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(resource); + if (filename) + str = filename; + } + return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); + } + else +*/ + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxButtonPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxButton *button = (wxButton *)propertyWindow; +/* + if (name == "label" && isBitmapButton) + { + char *s = property->GetValue().StringValue(); + if (s && wxFileExists(s)) + { + s = copystring(s); + wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP); + if (!bitmap->Ok()) + { + delete bitmap; + delete[] s; + return FALSE; + } + else + { + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(button); + if (resource) + { + wxString oldResource(resource->GetValue4()); + char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s); + resource->SetValue4(resName); + + if (!oldResource.IsNull()) + wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource); + } + + button->SetLabel(bitmap); + delete[] s; + return TRUE; + } + } + return FALSE; + } + else +*/ + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxButtonPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("label"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxButtonPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Message + */ + +wxProperty *wxStaticTextPropertyInfo::GetProperty(wxString& name) +{ + wxStaticText *message = (wxStaticText *)propertyWindow; +/* + if (name == "label" && isBitmapMessage) + { + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message); + wxString str("none.bmp"); + + if (resource) + { + char *filename = wxResourceManager::currentResourceManager->FindBitmapFilenameForResource(resource); + if (filename) + str = filename; + } + return new wxProperty("label", str.GetData(), "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")); + } + else +*/ + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxStaticTextPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxStaticText *message = (wxStaticText *)propertyWindow; +/* + if (name == "label" && isBitmapMessage) + { + char *s = property->GetValue().StringValue(); + if (s && wxFileExists(s)) + { + s = copystring(s); + + wxBitmap *bitmap = new wxBitmap(s, wxBITMAP_TYPE_BMP); + if (!bitmap->Ok()) + { + delete bitmap; + delete[] s; + return FALSE; + } + else + { + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(message); + if (resource) + { + wxString oldResource(resource->GetValue4()); + char *resName = wxResourceManager::currentResourceManager->AddBitmapResource(s); + resource->SetValue4(resName); + + if (!oldResource.IsNull()) + wxResourceManager::currentResourceManager->PossiblyDeleteBitmapResource(WXSTRINGCAST oldResource); + } + + message->SetLabel(bitmap); + delete[] s; + return TRUE; + } + } + return FALSE; + } + else +*/ + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxStaticTextPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("label"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxStaticTextPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Text item + */ + +wxProperty *wxTextPropertyInfo::GetProperty(wxString& name) +{ + wxTextCtrl *text = (wxTextCtrl *)propertyWindow; + if (name == "value") + return new wxProperty("value", text->GetValue(), "string"); + else if (name == "password") + { + bool isPassword = ((text->GetWindowStyleFlag() & wxTE_PASSWORD) == wxTE_PASSWORD); + return new wxProperty("password", isPassword, "bool"); + } + else if (name == "readonly") + { + bool isReadOnly = ((text->GetWindowStyleFlag() & wxTE_READONLY) == wxTE_READONLY); + return new wxProperty("readonly", isReadOnly, "bool"); + } + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxTextPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxTextCtrl *text = (wxTextCtrl *)propertyWindow; + if (name == "value") + { + text->SetValue(property->GetValue().StringValue()); + return TRUE; + } + else if (name == "password") + { + long flag = text->GetWindowStyleFlag(); + if (property->GetValue().BoolValue()) + { + if ((flag & wxTE_PASSWORD) != wxTE_PASSWORD) + flag |= wxTE_PASSWORD; + } + else + { + if ((flag & wxTE_PASSWORD) == wxTE_PASSWORD) + flag -= wxTE_PASSWORD; + } + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text); + resource->SetStyle(flag); + + wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this); + return TRUE; + } + else if (name == "readonly") + { + long flag = text->GetWindowStyleFlag(); + if (property->GetValue().BoolValue()) + { + if ((flag & wxTE_READONLY) != wxTE_READONLY) + flag |= wxTE_READONLY; + } + else + { + if ((flag & wxTE_READONLY) == wxTE_READONLY) + flag -= wxTE_READONLY; + } + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(text); + resource->SetStyle(flag); + + wxResourceManager::currentResourceManager->RecreateWindowFromResource(text, this); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxTextPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("value"); + names.Add("readonly"); + names.Add("password"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxTextPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxTextCtrl *text = (wxTextCtrl *)propertyWindow; + wxString str(text->GetValue()); + resource->SetValue4(WXSTRINGCAST str); + + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Listbox item + */ + +wxProperty *wxListBoxPropertyInfo::GetProperty(wxString& name) +{ + wxListBox *listBox = (wxListBox *)propertyWindow; + if (name == "values") + { + wxStringList *stringList = new wxStringList; + int i; + for (i = 0; i < listBox->Number(); i++) + stringList->Add(listBox->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + else if (name == "multiple") + { + char *pos = NULL; + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox); + if (!resource) + return NULL; + + char *mult = "wxSINGLE"; + + switch (resource->GetValue1()) + { + case wxLB_MULTIPLE: + mult = "wxLB_MULTIPLE"; + break; + case wxLB_EXTENDED: + mult = "wxLB_EXTENDED"; + break; + default: + case wxLB_SINGLE: + mult = "wxLB_SINGLE"; + break; + } + return new wxProperty("multiple", mult, "string", + new wxStringListValidator(new wxStringList("wxLB_SINGLE", "wxLB_MULTIPLE", "wxLB_EXTENDED", + NULL))); + } + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxListBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxListBox *listBox = (wxListBox *)propertyWindow; + if (name == "values") + { + listBox->Clear(); + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + listBox->Append(s); + expr = expr->GetNext(); + } + return TRUE; + } + else if (name == "multiple") + { + int mult = wxLB_SINGLE; + wxString str(property->GetValue().StringValue()); + if (str == "wxLB_MULTIPLE") + mult = wxLB_MULTIPLE; + else if (str == "wxLB_EXTENDED") + mult = wxLB_EXTENDED; + else + mult = wxLB_SINGLE; + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(listBox); + if (resource) + resource->SetValue1(mult); + wxResourceManager::currentResourceManager->RecreateWindowFromResource(listBox, this); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxListBoxPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("values"); + names.Add("multiple"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxListBoxPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxListBox *lbox = (wxListBox *)propertyWindow; + // This will be set for the wxItemResource on reading or in SetProperty +// resource->SetValue1(lbox->GetSelectionMode()); + int i; + if (lbox->Number() == 0) + resource->SetStringValues(NULL); + else + { + wxStringList *slist = new wxStringList; + + for (i = 0; i < lbox->Number(); i++) + slist->Add(lbox->GetString(i)); + + resource->SetStringValues(slist); + } + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Choice item + */ + +wxProperty *wxChoicePropertyInfo::GetProperty(wxString& name) +{ + wxChoice *choice = (wxChoice *)propertyWindow; + if (name == "values") + { + wxStringList *stringList = new wxStringList; + int i; + for (i = 0; i < choice->Number(); i++) + stringList->Add(choice->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxChoicePropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxChoice *choice = (wxChoice *)propertyWindow; + if (name == "values") + { + choice->Clear(); + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + choice->Append(s); + expr = expr->GetNext(); + } + if (choice->Number() > 0) + choice->SetSelection(0); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxChoicePropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("values"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxChoicePropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxChoice *choice = (wxChoice *)propertyWindow; + int i; + if (choice->Number() == 0) + resource->SetStringValues(NULL); + else + { + wxStringList *slist = new wxStringList; + + for (i = 0; i < choice->Number(); i++) + slist->Add(choice->GetString(i)); + + resource->SetStringValues(slist); + } + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Radiobox item + */ + +wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name) +{ + wxRadioBox *radioBox = (wxRadioBox *)propertyWindow; + if (name == "numberRowsOrCols") + { + return new wxProperty("numberRowsOrCols", (long)radioBox->GetNumberOfRowsOrCols(), "integer"); + } + if (name == "orientation") + { + char *pos = NULL; + if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) + pos = "wxHORIZONTAL"; + else + pos = "wxVERTICAL"; + + return new wxProperty("orientation", pos, "string", + new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", + NULL))); + } + else if (name == "values") + { + wxStringList *stringList = new wxStringList; + int i; + for (i = 0; i < radioBox->Number(); i++) + stringList->Add(radioBox->GetString(i)); + + return new wxProperty(name, stringList, "stringlist"); + } + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxRadioBox *radioBox = (wxRadioBox *)propertyWindow; + if (name == "numberRowsOrCols") + { + radioBox->SetNumberOfRowsOrCols((int)property->GetValue().IntegerValue()); + wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this); + return TRUE; + } + else if (name == "orientation") + { + long windowStyle = radioBox->GetWindowStyleFlag(); + wxString val(property->GetValue().StringValue()); + if (val == "wxHORIZONTAL") + { + if (windowStyle & wxVERTICAL) + windowStyle -= wxVERTICAL; + windowStyle |= wxHORIZONTAL; + } + else + { + if (windowStyle & wxHORIZONTAL) + windowStyle -= wxHORIZONTAL; + windowStyle |= wxVERTICAL; + } + radioBox->SetWindowStyleFlag(windowStyle); + + wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this); + return TRUE; + } + else if (name == "values") + { + // Set property into *resource*, not wxRadioBox, and then recreate + // the wxRadioBox. This is because we can't dynamically set the strings + // of a wxRadioBox. + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(propertyWindow); + if (!resource) + return FALSE; + + wxStringList *stringList = resource->GetStringValues(); + if (!stringList) + { + stringList = new wxStringList; + resource->SetStringValues(stringList); + } + stringList->Clear(); + + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + stringList->Add(s); + expr = expr->GetNext(); + } + wxResourceManager::currentResourceManager->RecreateWindowFromResource(radioBox, this); + return TRUE; + } + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxRadioBoxPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("label"); + names.Add("values"); + names.Add("orientation"); + names.Add("numberRowsOrCols"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxRadioBoxPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxRadioBox *rbox = (wxRadioBox *)propertyWindow; + // Take strings from resource instead +/* + int i; + if (rbox->Number() == 0) + resource->SetStringValues(NULL); + else + { + wxStringList *slist = new wxStringList; + + for (i = 0; i < rbox->Number(); i++) + slist->Add(rbox->GetString(i)); + + resource->SetStringValues(slist); + } +*/ + resource->SetValue1(rbox->GetNumberOfRowsOrCols()); + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Groupbox item + */ + +wxProperty *wxGroupBoxPropertyInfo::GetProperty(wxString& name) +{ + wxStaticBox *groupBox = (wxStaticBox *)propertyWindow; + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxGroupBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxGroupBoxPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("label"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxGroupBoxPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxStaticBox *gbox = (wxStaticBox *)propertyWindow; + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Checkbox item + */ + +wxProperty *wxCheckBoxPropertyInfo::GetProperty(wxString& name) +{ + wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; + if (name == "value") + return new wxProperty("value", checkBox->GetValue(), "bool"); + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxCheckBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; + if (name == "value") + { + checkBox->SetValue((bool)property->GetValue().BoolValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxCheckBoxPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("label"); + names.Add("value"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxCheckBoxPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxCheckBox *cbox = (wxCheckBox *)propertyWindow; + resource->SetValue1(cbox->GetValue()); + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Slider item + */ + +wxProperty *wxSliderPropertyInfo::GetProperty(wxString& name) +{ + wxSlider *slider = (wxSlider *)propertyWindow; + if (name == "value") + return new wxProperty("value", (long)slider->GetValue(), "integer"); + else if (name == "orientation") + { + char *pos = NULL; + if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) + pos = "wxHORIZONTAL"; + else + pos = "wxVERTICAL"; + + return new wxProperty("orientation", pos, "string", + new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", + NULL))); + } + else if (name == "min_value") + return new wxProperty("min_value", (long)slider->GetMin(), "integer"); + else if (name == "max_value") + return new wxProperty("max_value", (long)slider->GetMax(), "integer"); + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxSliderPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxSlider *slider = (wxSlider *)propertyWindow; + if (name == "value") + { + slider->SetValue((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "orientation") + { + long windowStyle = slider->GetWindowStyleFlag(); + long oldWindowStyle = windowStyle; + wxString val(property->GetValue().StringValue()); + if (val == "wxHORIZONTAL") + { + if (windowStyle & wxVERTICAL) + windowStyle -= wxVERTICAL; + windowStyle |= wxHORIZONTAL; + } + else + { + if (windowStyle & wxHORIZONTAL) + windowStyle -= wxHORIZONTAL; + windowStyle |= wxVERTICAL; + } + + if (oldWindowStyle == windowStyle) + return TRUE; + + slider->SetWindowStyleFlag(windowStyle); + + // If the window style has changed, we swap the width and height parameters. + int w, h; + slider->GetSize(&w, &h); + + slider = (wxSlider *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(slider, this); + slider->SetSize(-1, -1, h, w); + + return TRUE; + } + else if (name == "min_value") + { + slider->SetRange((int)property->GetValue().IntegerValue(), slider->GetMax()); + return TRUE; + } + else if (name == "max_value") + { + slider->SetRange(slider->GetMin(), (int)property->GetValue().IntegerValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxSliderPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("value"); + names.Add("orientation"); + names.Add("min_value"); + names.Add("max_value"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxSliderPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxSlider *slider = (wxSlider *)propertyWindow; + resource->SetValue1(slider->GetValue()); + resource->SetValue2(slider->GetMin()); + resource->SetValue3(slider->GetMax()); + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Gauge item + */ + +wxProperty *wxGaugePropertyInfo::GetProperty(wxString& name) +{ + wxGauge *gauge = (wxGauge *)propertyWindow; + if (name == "value") + return new wxProperty("value", (long)gauge->GetValue(), "integer"); + else if (name == "max_value") + return new wxProperty("max_value", (long)gauge->GetRange(), "integer"); + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxGaugePropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxGauge *gauge = (wxGauge *)propertyWindow; + if (name == "value") + { + gauge->SetValue((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "max_value") + { + gauge->SetRange((int)property->GetValue().IntegerValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxGaugePropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("value"); + names.Add("max_value"); + wxItemPropertyInfo::GetPropertyNames(names); +} + +bool wxGaugePropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxGauge *gauge = (wxGauge *)propertyWindow; + resource->SetValue1(gauge->GetValue()); + resource->SetValue2(gauge->GetRange()); + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Scrollbar item + */ + +wxProperty *wxScrollBarPropertyInfo::GetProperty(wxString& name) +{ + wxScrollBar *scrollBar = (wxScrollBar *)propertyWindow; + if (name == "value") + return new wxProperty("value", (long)scrollBar->GetValue(), "integer"); + else if (name == "orientation") + { + char *pos = NULL; + if (propertyWindow->GetWindowStyleFlag() & wxHORIZONTAL) + pos = "wxHORIZONTAL"; + else + pos = "wxVERTICAL"; + + return new wxProperty("orientation", pos, "string", + new wxStringListValidator(new wxStringList("wxHORIZONTAL", "wxVERTICAL", + NULL))); + } + else if (name == "pageSize") + { + int viewStart, pageLength, objectLength, viewLength; + scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength); + + return new wxProperty("pageSize", (long)pageLength, "integer"); + } + else if (name == "viewLength") + { + int viewStart, pageLength, objectLength, viewLength; + scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength); + + return new wxProperty("viewLength", (long)viewLength, "integer"); + } + else if (name == "objectLength") + { + int viewStart, pageLength, objectLength, viewLength; + scrollBar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength); + + return new wxProperty("objectLength", (long)objectLength, "integer"); + } + else + return wxItemPropertyInfo::GetProperty(name); +} + +bool wxScrollBarPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxScrollBar *scrollBar = (wxScrollBar *)propertyWindow; + if (name == "value") + { + scrollBar->SetValue((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "orientation") + { + long windowStyle = scrollBar->GetWindowStyleFlag(); + long oldWindowStyle = windowStyle; + wxString val(property->GetValue().StringValue()); + if (val == "wxHORIZONTAL") + { + if (windowStyle & wxVERTICAL) + windowStyle -= wxVERTICAL; + windowStyle |= wxHORIZONTAL; + } + else + { + if (windowStyle & wxHORIZONTAL) + windowStyle -= wxHORIZONTAL; + windowStyle |= wxVERTICAL; + } + + if (oldWindowStyle == windowStyle) + return TRUE; + + scrollBar->SetWindowStyleFlag(windowStyle); + + // If the window style has changed, we swap the width and height parameters. + int w, h; + scrollBar->GetSize(&w, &h); + + scrollBar = (wxScrollBar *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(scrollBar, this); + scrollBar->SetSize(-1, -1, h, w); + + return TRUE; + } + else if (name == "pageSize") + { + scrollBar->SetPageSize((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "viewLength") + { + scrollBar->SetViewLength((int)property->GetValue().IntegerValue()); + return TRUE; + } + else if (name == "objectLength") + { + scrollBar->SetObjectLength((int)property->GetValue().IntegerValue()); + return TRUE; + } + else + return wxItemPropertyInfo::SetProperty(name, property); +} + +void wxScrollBarPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("orientation"); + names.Add("value"); + names.Add("pageSize"); + names.Add("viewLength"); + names.Add("objectLength"); + wxItemPropertyInfo::GetPropertyNames(names); + + // Remove some properties we don't inherit + names.Delete("fontPoints"); + names.Delete("fontFamily"); + names.Delete("fontStyle"); + names.Delete("fontWeight"); + names.Delete("fontUnderlined"); +} + +bool wxScrollBarPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxScrollBar *sbar = (wxScrollBar *)propertyWindow; + + resource->SetValue1(sbar->GetValue()); + + int viewStart, pageLength, objectLength, viewLength; + sbar->GetValues(&viewStart, &viewLength, &objectLength, &pageLength); + + resource->SetValue2(pageLength); + resource->SetValue3(objectLength); + resource->SetValue5(viewLength); + + return wxItemPropertyInfo::InstantiateResource(resource); +} + +/* + * Panels + */ + +wxProperty *wxPanelPropertyInfo::GetProperty(wxString& name) +{ + wxPanel *panelWindow = (wxPanel *)propertyWindow; + wxFont *labelFont = panelWindow->GetLabelFont(); + wxFont *buttonFont = panelWindow->GetButtonFont(); + + if (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || + name == "labelFontUnderlined") + return GetFontProperty(name, labelFont); + else if (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || + name == "buttonFontUnderlined") + return GetFontProperty(name, buttonFont); + else if (name == "userColours") + { + bool userColours; + if (panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) + userColours = TRUE; + else + userColours = FALSE; + + return new wxProperty(name, (bool)userColours, "bool"); + } + else if (name == "backgroundColour") + { + wxColour col(panelWindow->GetBackgroundColour()); + char buf[7]; + wxDecToHex(col.Red(), buf); + wxDecToHex(col.Green(), buf+2); + wxDecToHex(col.Blue(), buf+4); + + return new wxProperty(name, buf, "string", new wxColourListValidator); + } + else + return wxWindowPropertyInfo::GetProperty(name); +} + +bool wxPanelPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxPanel *panelWindow = (wxPanel *)propertyWindow; + wxFont *labelFont = panelWindow->GetLabelFont(); + wxFont *buttonFont = panelWindow->GetButtonFont(); + + if (labelFont && (name == "labelFontPoints" || name == "labelFontFamily" || name == "labelFontStyle" || name == "labelFontWeight" || name == "labelFontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, labelFont); + if (newFont) + panelWindow->SetLabelFont(newFont); + return TRUE; + } + else if (buttonFont && (name == "buttonFontPoints" || name == "buttonFontFamily" || name == "buttonFontStyle" || name == "buttonFontWeight" || name == "buttonFontUnderlined" )) + { + wxFont *newFont = SetFontProperty(name, property, buttonFont); + if (newFont) + panelWindow->SetButtonFont(newFont); + return TRUE; + } + else if (name == "userColours") + { + bool userColours = property->GetValue().BoolValue(); + long flag = panelWindow->GetWindowStyleFlag(); + + if (userColours) + { + if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) != wxUSER_COLOURS) + panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() | wxUSER_COLOURS); + } + else + { + if ((panelWindow->GetWindowStyleFlag() & wxUSER_COLOURS) == wxUSER_COLOURS) + panelWindow->SetWindowStyleFlag(panelWindow->GetWindowStyleFlag() - wxUSER_COLOURS); + } + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(panelWindow); + resource->SetStyle(panelWindow->GetWindowStyleFlag()); + + panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(panelWindow, this); +// panelWindow->SetUserEditMode(wxResourceManager::currentResourceManager->GetEditMode()); +#ifdef __WINDOWS__ + // This window should not be enabled by being recreated: we're in a modal dialog (property editor) + ::EnableWindow((HWND) panelWindow->GetHWND(), FALSE); + ::BringWindowToTop((HWND) sm_propertyWindow->GetHWND()); +#endif + return TRUE; + } + else if (name == "backgroundColour") + { + char *hex = property->GetValue().StringValue(); + int r = wxHexToDec(hex); + int g = wxHexToDec(hex+2); + int b = wxHexToDec(hex+4); + + wxColour col(r,g,b); + panelWindow->SetBackgroundColour(col); + panelWindow = (wxPanel *)wxResourceManager::currentResourceManager->RecreateWindowFromResource(panelWindow, this); +// panelWindow->SetUserEditMode(wxResourceManager::currentResourceManager->GetEditMode()); +#ifdef __WINDOWS__ + // This window should not be enabled by being recreated: we're in a modal dialog (property editor) + ::EnableWindow((HWND) panelWindow->GetHWND(), FALSE); + ::BringWindowToTop((HWND) sm_propertyWindow->GetHWND()); +#endif + return TRUE; + } + else + return wxWindowPropertyInfo::SetProperty(name, property); +} + +void wxPanelPropertyInfo::GetPropertyNames(wxStringList& names) +{ + wxWindowPropertyInfo::GetPropertyNames(names); + +// names.Add("orientation"); + names.Add("userColours"); + names.Add("backgroundColour"); +} + +bool wxPanelPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxPanel *panel = (wxPanel *)propertyWindow; + if (panel->GetFont()) + resource->SetFont(wxTheFontList->FindOrCreateFont(panel->GetFont()->GetPointSize(), + panel->GetFont()->GetFamily(), panel->GetFont()->GetStyle(), panel->GetFont()->GetWeight(), + panel->GetFont()->GetUnderlined(), panel->GetFont()->GetFaceName())); + + resource->SetBackgroundColour(new wxColour(panel->GetBackgroundColour())); + + return wxWindowPropertyInfo::InstantiateResource(resource); +} + +/* + * Dialog boxes + */ + +wxProperty *wxDialogPropertyInfo::GetProperty(wxString& name) +{ + wxDialog *dialogWindow = (wxDialog *)propertyWindow; + if (name == "modal") + { + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow); + if (!resource) + return NULL; + + bool modal = (resource->GetValue1() != 0); + return new wxProperty(name, modal, "bool"); + } + else + return wxPanelPropertyInfo::GetProperty(name); +} + +bool wxDialogPropertyInfo::SetProperty(wxString& name, wxProperty *property) +{ + wxDialog *dialogWindow = (wxDialog *)propertyWindow; + + if (name == "modal") + { + wxItemResource *resource = wxResourceManager::currentResourceManager->FindResourceForWindow(dialogWindow); + if (!resource) + return FALSE; + + resource->SetValue1(property->GetValue().BoolValue()); + return TRUE; + } + else + return wxPanelPropertyInfo::SetProperty(name, property); +} + +void wxDialogPropertyInfo::GetPropertyNames(wxStringList& names) +{ + names.Add("title"); + names.Add("modal"); + + wxPanelPropertyInfo::GetPropertyNames(names); +} + +bool wxDialogPropertyInfo::InstantiateResource(wxItemResource *resource) +{ + wxDialog *dialog = (wxDialog *)propertyWindow; + wxString str(dialog->GetTitle()); + resource->SetTitle(WXSTRINGCAST str); + + return wxPanelPropertyInfo::InstantiateResource(resource); +} + +/* + * Utilities + */ + +int wxStringToFontWeight(wxString& val) +{ + if (val == "wxBOLD") return wxBOLD; + else if (val == "wxLIGHT") return wxLIGHT; + else return wxNORMAL; +} + +int wxStringToFontStyle(wxString& val) +{ + if (val == "wxITALIC") return wxITALIC; + else if (val == "wxSLANT") return wxSLANT; + else return wxNORMAL; +} + +int wxStringToFontFamily(wxString& val) +{ + if (val == "wxDECORATIVE") return wxDECORATIVE; + else if (val == "wxROMAN") return wxROMAN; + else if (val == "wxSCRIPT") return wxSCRIPT; + else if (val == "wxMODERN") return wxMODERN; + else if (val == "wxTELETYPE") return wxTELETYPE; + else return wxSWISS; +} diff --git a/utils/dialoged/src/winprop.h b/utils/dialoged/src/winprop.h new file mode 100644 index 0000000000..a1420e63b5 --- /dev/null +++ b/utils/dialoged/src/winprop.h @@ -0,0 +1,293 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: winprop.h +// Purpose: Window properties +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WINPROP_H_ +#define _WINPROP_H_ + +#ifdef __GNUG__ +#pragma interface "winprop.h" +#endif + +#include "reseditr.h" + +class wxPropertyInfo; + +// A kind of property list view that intercepts OnPropertyChanged +// feedback. +class wxResourcePropertyListView: public wxPropertyListView +{ + public: + wxPropertyInfo *propertyInfo; + + wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT): + wxPropertyListView(propPanel, flags) + { + propertyInfo = info; + } + void OnPropertyChanged(wxProperty *property); + bool OnClose(void); +}; + +// Generic class for relating an object to a collection of properties. +// Instead of defining new functions like wxButton::GetProperty, wxButton::SetProperty, +// we take these functions out into of the wxWindows library and associate +// them with separate classes. +class wxPropertyInfo: public wxObject +{ + protected: + static wxWindow *sm_propertyWindow; + wxPropertyInfo(void) + { + } + ~wxPropertyInfo(void) + { + } + public: + virtual wxProperty *GetProperty(wxString& propName) = 0; + virtual bool SetProperty(wxString& propName, wxProperty *property) = 0; + virtual void GetPropertyNames(wxStringList& names) = 0; + virtual bool Edit(wxWindow *parent, char *title); +}; + +// For all windows +class wxWindowPropertyInfo: public wxPropertyInfo +{ + protected: + wxWindow *propertyWindow; + wxItemResource *propertyResource; + public: + wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL); + ~wxWindowPropertyInfo(void); + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + + inline void SetPropertyWindow(wxWindow *win) { propertyWindow = win; } + + inline void SetResource(wxItemResource *res) { propertyResource = res; } + + // Helper functions for font properties + + wxProperty *GetFontProperty(wxString& name, wxFont *font); + wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont); + + // Fill in the wxItemResource members to mirror the current window settings + virtual bool InstantiateResource(wxItemResource *resource); +}; + +// For panel items +class wxItemPropertyInfo: public wxWindowPropertyInfo +{ + protected: + public: + wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxWindowPropertyInfo(win, res) {} + ~wxItemPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For buttons +class wxButtonPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + bool isBitmapButton; + wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmButton = FALSE): + wxItemPropertyInfo(win, res) { isBitmapButton = bmButton; } + ~wxButtonPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); + + inline bool IsBitmapButton(void) { return isBitmapButton; } +}; + +// For messages +class wxStaticTextPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + bool isBitmapMessage; + wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmMessage = FALSE): + wxItemPropertyInfo(win, res) { isBitmapMessage = bmMessage; } + ~wxStaticTextPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); + + inline bool IsBitmapMessage(void) { return isBitmapMessage; } +}; + +// For text/multitext items +class wxTextPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxTextPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For list boxes +class wxListBoxPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxListBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For choice items +class wxChoicePropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxChoicePropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For radiobox items +class wxRadioBoxPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxRadioBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For groupbox items +class wxGroupBoxPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxGroupBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For checkbox items +class wxCheckBoxPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxCheckBoxPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For gauge items +class wxGaugePropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxGaugePropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For scrollbar items +class wxScrollBarPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxScrollBarPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For slider items +class wxSliderPropertyInfo: public wxItemPropertyInfo +{ + protected: + public: + wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxItemPropertyInfo(win, res) {} + ~wxSliderPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For panels +class wxPanelPropertyInfo: public wxWindowPropertyInfo +{ + protected: + public: + wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxWindowPropertyInfo(win, res) {} + ~wxPanelPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +// For dialogs +class wxDialogPropertyInfo: public wxPanelPropertyInfo +{ + protected: + public: + wxDialogPropertyInfo(wxWindow *win, wxItemResource *res = NULL): + wxPanelPropertyInfo(win, res) {} + ~wxDialogPropertyInfo(void) {} + wxProperty *GetProperty(wxString& name); + bool SetProperty(wxString& name, wxProperty *property); + void GetPropertyNames(wxStringList& names); + bool InstantiateResource(wxItemResource *resource); +}; + +int wxStringToFontWeight(wxString& val); +int wxStringToFontStyle(wxString& val); +int wxStringToFontFamily(wxString& val); + +#endif + diff --git a/utils/wxprop/src/aiai.ico b/utils/wxprop/src/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..46afdd1b613ca56e26a556a75131b37d279acc5e GIT binary patch literal 766 zcmc(bF%H5o3`Ktt5=abTV(!Q>I1)$51`T)=nE#zbl@J?9IJKQ;J8^2D zWSK6O$$WkK1*bhnHY z*s>G=#Knp;%R_K0w9H3^YCRCd_4B}2CIj2qES>cN2{tKR=LZKY0+9kDTRf{z+H~uRU|SqMnJMG$uK0U!a!ytzjWs7-TIffM+-jaAS7o1 literal 0 HcmV?d00001 diff --git a/utils/wxprop/src/makefile.b32 b/utils/wxprop/src/makefile.b32 new file mode 100644 index 0000000000..57b94770dd --- /dev/null +++ b/utils/wxprop/src/makefile.b32 @@ -0,0 +1,74 @@ +# +# File: makefile.b32 +# Author: Patrick Halke +# Created: 1995 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds 32bit wxProperty library for Windows +# and Borland C++ 4.x + +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makeb32.env + +WXINC = $(WXDIR)\include +TARGET=test +TESTOBJECTS=test.obj +LIBTARGET= $(WXLIBDIR)\wxprop.lib +LIBS=$(WXLIB)\wx32.lib $(LIBTARGET) cw32 import32 + +!ifndef DEBUG +DEBUG=0 +!endif + +!if "$(FINAL)" == "0" +LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v -DDEBUG=$(DEBUG) +!else +LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib +OPT = -O2 +DEBUG_FLAGS = -DDEBUG=$(DEBUG) +!endif + +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) + +.$(SRCSUFF).obj: + bcc32 $(CPPFLAGS) -c {$< } + +.c.obj: + bcc32 $(CPPFLAGS) -P- -c {$< } + +OBJECTS = prop.obj proplist.obj propform.obj + +all: $(LIBTARGET) + +$(LIBTARGET): $(OBJECTS) + erase $(LIBTARGET) + tlib $(LIBTARGET) /P32 @&&! ++$(OBJECTS:.obj =.obj +) +! + +prop.obj: prop.$(SRCSUFF) prop.h +proplist.obj: proplist.$(SRCSUFF) prop.h proplist.h +propform.obj: propform.$(SRCSUFF) prop.h propform.h + +$(TARGET).exe: $(TESTOBJECTS) $(LIBTARGET) $(TARGET).def $(TARGET).res + tlink32 $(LINKFLAGS) @&&! +c0w32.obj $(TESTOBJECTS) +$(TARGET) +nul +$(LIBS) $(LIBTARGET) +$(TARGET).def +! + brc32 -K $(TARGET).res + +$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc + brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) + +test.obj: test.$(SRCSUFF) test.h + +clean: + -erase *.obj $(LIBTARGET) *.exe *.res *.map *.rws diff --git a/utils/wxprop/src/makefile.bcc b/utils/wxprop/src/makefile.bcc new file mode 100644 index 0000000000..198eaec21c --- /dev/null +++ b/utils/wxprop/src/makefile.bcc @@ -0,0 +1,95 @@ +# +# File: makefile.bcc +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds wxProperty library + +# Change WXDIR to wherever wxWindows is found +WXDIR = $(WXWIN) +!include $(WXDIR)\src\makebcc.env + +WXLIB = $(WXDIR)\lib\wx.lib +WXINC = $(WXDIR)\include +CFG = $(WXWIN)\src\wxwin.cfg +BCCDIR = d:\bc4 + +WXPROPDIR = $(WXDIR)\utils\wxprop +WXPROPINC = $(WXPROPDIR)\src +WXPROPLIB = $(WXPROPDIR)\lib\wxprop.lib + +FAFALIB = $(WXDIR)\contrib\fafa\fafa.lib +ITSYLIB = $(WXDIR)\contrib\itsybits\itsy.lib + +DOCDIR = $(WXPROPDIR)\docs +DOCUTILSDIR = $(WXDIR)\utils\tex2rtf\src +THISDIR = $(WXPROPDIR)\src + +# Default is to output RTF for WinHelp +!ifndef WINHELP +WINHELP=-winhelp +!endif + +INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw + +LIBS=$(WXLIB) $(WXPROPLIB) mathwl cwl import + +!if "$(FINAL)" == "0" +LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -Od +DEBUG_FLAGS= -v +!else +LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib +OPT = -O2 +DEBUG_FLAGS= +!endif +CFLAGS=$(DEBUG_FLAGS) $(OPT) /DUSE_DEFINE @$(CFG) +CPPFLAGS=$(DEBUG_FLAGS) $(OPT) /DUSE_DEFINE @$(CFG) + +OBJECTS = wx_prop.obj wx_plist.obj wx_pform.obj + +all: $(WXPROPLIB) # test.exe + +.$(SRCSUFF).obj: + bcc $(CPPFLAGS) -c {$< } +.c.obj: + bcc $(CPPFLAGS) -P- -c {$< } + +$(WXPROPLIB): $(OBJECTS) + erase $(WXPROPLIB) + tlib /P128 @&&! +$(WXPROPLIB) & ++$(OBJECTS:.obj =.obj +) +! + +test.obj: test.h wx_prop.h test.$(SRCSUFF) + +wx_prop.obj: wx_prop.h wx_prop.$(SRCSUFF) + +wx_plist.obj: wx_prop.h wx_plist.h wx_plist.$(SRCSUFF) + +wx_pform.obj: wx_prop.h wx_pform.h wx_pform.$(SRCSUFF) + +test.res : test.rc $(WXDIR)\include\msw\wx.rc $(WXPROPLIB) + rc /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa -r test + +test.exe: test.obj test.def test.res $(WXPROPLIB) + tlink $(LINKFLAGS) @&&! +c0wl.obj test.obj +test +nul +$(LIBS) +test.def +! + rc -K test.res + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase ..\lib\*.lib + diff --git a/utils/wxprop/src/makefile.dos b/utils/wxprop/src/makefile.dos new file mode 100644 index 0000000000..61da857733 --- /dev/null +++ b/utils/wxprop/src/makefile.dos @@ -0,0 +1,138 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1995 +# Updated: +# Copyright: (c) 1995, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds wxPropertySheet library and example (DOS). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +!include $(WXDIR)\src\makemsc.env + +THISDIR = $(WXDIR)\utils\wxprop\src +WXLIB = $(WXDIR)\lib\wx.lib + +PROPLIB = $(WXDIR)\utils\wxprop\lib\wxprop.lib +DOCDIR = $(WXDIR)\utils\wxprop\docs + +LIBS=$(WXLIB) $(PROPLIB) oldnames libw llibcew commdlg shell ddeml +INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw + +# Default is to output RTF for WinHelp +!ifndef RTFSTYLE +RTFSTYLE=-winhelp +!endif + +OBJECTS = prop.obj proplist.obj propform.obj +TESTOBJECTS = test.obj + +all: $(PROPLIB) + +test: test.exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.dos + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.dos clean + cd $(THISDIR) + +$(PROPLIB): $(OBJECTS) + -erase $(PROPLIB) + lib /PAGESIZE:128 @<< +$(PROPLIB) +y +$(OBJECTS) +nul +; +<< + +test.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(PROPLIB) $(TESTOBJECTS) test.def test.res + link $(LINKFLAGS) @<< +$(WXDIR)\src\msw\dummy.obj $(TESTOBJECTS), +test, +NUL, +$(LIBS), +test.def +; +<< + rc -30 -K test.res + +test.obj: test.h wx_prop.h test.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +prop.obj: prop.h prop.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +proplist.obj: prop.h proplist.h proplist.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +propform.obj: prop.h propform.h propform.$(SRCSUFF) + cl @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +test.res : test.rc $(WXDIR)\include\wx\msw\wx.rc + rc -r /i$(WXDIR)\include\wx test + +# Making documents +docs: hlp +hlp: $(DOCDIR)/prop.hlp +hlp32: $(DOCDIR)/hlp32/prop.hlp +rtf: $(DOCDIR)/prop.rtf + +$(DOCDIR)/prop.hlp: $(DOCDIR)/prop.rtf $(DOCDIR)/prop.hpj + cd $(DOCDIR) + -erase prop.ph + hc prop + cd $(THISDIR) + +$(DOCDIR)/hlp32/prop.hlp: $(DOCDIR)/hlp32/prop.rtf $(DOCDIR)/hlp32/prop.hpj + cd $(DOCDIR)/hlp32 + -erase prop.ph + start /w hcw /c /e clockwrk.hpj + cd $(THISDIR) + +$(DOCDIR)/prop.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/prop.tex + cd $(DOCDIR) + -wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/prop.rtf -twice $(RTFSTYLE) + cd $(THISDIR) + +$(DOCDIR)/hlp32/prop.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/prop.tex + cd $(DOCDIR) + -wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/hlp32/prop.rtf -twice -winhelp -macros $(DOCDIR)/t2rtf32.ini + cd $(THISDIR) + +wordrtf: + cd $(DOCDIR) + -wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/prop.rtf -twice -rtf + cd $(THISDIR) + +cleanrtf: + cd $(DOCDIR) + -erase *.rtf + cd $(THISDIR) + +clean: + -erase *.obj + -erase *.sbr + -erase *.exe + -erase *.res + -erase *.map + -erase *.pdb + -erase $(PROPLIB) diff --git a/utils/wxprop/src/makefile.g95 b/utils/wxprop/src/makefile.g95 new file mode 100644 index 0000000000..c56fe98d2c --- /dev/null +++ b/utils/wxprop/src/makefile.g95 @@ -0,0 +1,54 @@ +# +# File: makefile.g95 +# Author: Julian Smart +# Created: 1996 +# +# "%W% %G%" +# +# Makefile : Builds wxProp library and example under GNU-WIN32 +# +WXDIR = ../../.. +include $(WXDIR)/src/makeg95.env + +PROPDIR = $(WXDIR)/utils/wxprop +PROPLIB = $(PROPDIR)/lib/$(LIBPREFIX)wxprop.$(LIBSUFF) +THISDIR = $(PROPDIR)/src + +OBJECTS = $(OBJDIR)/prop.$(OBJSUFF) $(OBJDIR)/proplist.$(OBJSUFF) $(OBJDIR)/propform.$(OBJSUFF) +TESTOBJECTS = $(OBJDIR)/test.$(OBJSUFF) $(OBJDIR)/test_resources.$(OBJSUFF) + +LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib -L../lib +LDLIBS=-lwxprop $(LIBS) + +all: $(OBJDIR) $(PROPLIB) + +test: $(OBJDIR) test.exe + +$(OBJDIR): + mkdir $(OBJDIR) + +$(PROPLIB): $(OBJECTS) + rm -f $@ + ar $(AROPTIONS) $@ $(OBJECTS) + $(RANLIB) $@ + +$(OBJDIR)/test.$(OBJSUFF): test.h test.$(SRCSUFF) $(PROPLIB) + $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF) + +test.exe: $(TESTOBJECTS) + $(CC) $(LDFLAGS) -o test$(GUISUFFIX)$(EXESUFF) $(TESTOBJECTS) $(LDLIBS) + +$(OBJDIR)/prop.$(OBJSUFF): prop.h prop.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ prop.$(SRCSUFF) + +$(OBJDIR)/proplist.$(OBJSUFF): proplist.h prop.h proplist.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ proplist.$(SRCSUFF) + +$(OBJDIR)/propform.$(OBJSUFF): propform.h prop.h propform.$(SRCSUFF) + $(CC) -c $(CPPFLAGS) -o $@ propform.$(SRCSUFF) + +$(OBJDIR)/test_resources.o: test.rc + $(RESCOMP) -i test.rc -o $(OBJDIR)/test_resources.o $(RESFLAGS) + +clean: + rm -f *.$(OBJSUFF) $(PROPLIB) objects/test.o *.exe *.res *.map *.rsc diff --git a/utils/wxprop/src/makefile.nt b/utils/wxprop/src/makefile.nt new file mode 100644 index 0000000000..4f67e6ac47 --- /dev/null +++ b/utils/wxprop/src/makefile.nt @@ -0,0 +1,143 @@ +# +# File: makefile.nt +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile : Builds wxProperty class library (MS VC++). +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +# Set WXDIR for your system +WXDIR = $(WXWIN) +PROPDIR = $(WXDIR)\utils\wxprop +THISDIR = $(WXDIR)\utils\wxprop\src +EXTRALIBS=$(PROPDIR)\lib\wxprop.lib +DOCDIR=$(WXDIR)\docs +LOCALDOCDIR=$(WXDIR)\utils\wxprop\docs + +!include $(WXDIR)\src\ntwxwin.mak + +PROGRAM=test + +OBJECTS = prop.obj proplist.obj propform.obj +PROGOBJECTS = $(PROGRAM).obj +LIBTARGET=$(PROPDIR)\lib\wxprop.lib + +all: $(LIBTARGET) + +$(PROGRAM): $(PROGRAM).exe + +wx: + cd $(WXDIR)\src\msw + nmake -f makefile.nt FINAL=$(FINAL) + cd $(THISDIR) + +wxclean: + cd $(WXDIR)\src\msw + nmake -f makefile.nt clean + cd $(THISDIR) + +$(LIBTARGET): $(OBJECTS) + -erase $(LIBTARGET) + $(implib) @<< +-out:$(LIBTARGET) +-machine:$(CPU) +$(OBJECTS) +<< + +$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(PROGOBJECTS) $(LIBTARGET) $(PROGRAM).res + $(link) @<< +-out:$(PROGRAM).exe +$(LINKFLAGS) +$(DUMMYOBJ) $(PROGOBJECTS) $(PROGRAM).res +$(LIBS) +<< + +prop.obj: prop.h prop.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +proplist.obj: prop.h proplist.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +propform.obj: propform.h propform.$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).obj: $(PROGRAM).h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ) + $(cc) @<< +$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) +<< + +$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc + $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc + + +clean: + -erase *.obj + -erase *.sbr + -erase *.exe + -erase *.res + -erase *.map + -erase *.pdb + -erase $(LIBTARGET) + +DOCSOURCES=$(LOCALDOCDIR)\prop.tex $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\body.tex $(LOCALDOCDIR)\changes.tex + +html: $(DOCDIR)\html\wxprop\prop.htm +hlp: $(DOCDIR)\winhelp\wxprop.hlp +pdfrtf: $(DOCDIR)\pdf\wxprop.rtf +ps: $(WXDIR)\docs\ps\wxprop.ps + +$(DOCDIR)\winhelp\wxprop.hlp: $(LOCALDOCDIR)\wxprop.rtf $(LOCALDOCDIR)\wxprop.hpj + cd $(LOCALDOCDIR) + -erase wxprop.ph + hc wxprop + move wxprop.hlp $(DOCDIR)\winhelp\wxprop.hlp + move wxprop.cnt $(DOCDIR)\winhelp\wxprop.cnt + cd $(THISDIR) + +$(LOCALDOCDIR)\wxprop.rtf: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(LOCALDOCDIR)\wxprop.rtf -twice -winhelp + cd $(THISDIR) + +$(DOCDIR)\pdf\wxprop.rtf: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -copy *.bmp *.wmf $(DOCDIR)\pdf + -start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(DOCDIR)\pdf\wxprop.rtf -twice -rtf + cd $(THISDIR) + +$(DOCDIR)\html\wxprop\prop.htm: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -mkdir $(DOCDIR)\html\wxprop + -start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(DOCDIR)\html\wxprop\prop.htm -twice -html + -erase $(DOCDIR)\html\wxprop\*.con + -erase $(DOCDIR)\html\wxprop\*.ref + cd $(THISDIR) + +$(LOCALDOCDIR)\prop.dvi: $(DOCSOURCES) + cd $(LOCALDOCDIR) + -latex prop + -latex prop + -makeindx prop + -bibtex prop + -latex prop + -latex prop + cd $(THISDIR) + +$(WXDIR)\docs\ps\wxprop.ps: $(LOCALDOCDIR)\prop.dvi + cd $(LOCALDOCDIR) + -dvips32 -o wxprop.ps prop + move wxprop.ps $(WXDIR)\docs\ps\wxprop.ps + cd $(THISDIR) + + diff --git a/utils/wxprop/src/makefile.unx b/utils/wxprop/src/makefile.unx new file mode 100644 index 0000000000..3d8d5f5423 --- /dev/null +++ b/utils/wxprop/src/makefile.unx @@ -0,0 +1,105 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1993 +# Updated: +# Copyright: (c) 1993, AIAI, University of Edinburgh +# +# "%W% %G%" +# +# Makefile for dialoged example (UNIX). + +WXDIR = ../../.. + +# All common UNIX compiler flags and options are now in +# this central makefile. +include $(WXDIR)/src/make.env + +PROPDIR = $(WXDIR)/utils/wxprop +PROPLIB = ../lib/libwxprop$(GUISUFFIX).a +XVIEWLDLIBS = -lwxprop_ol -lwx_ol -lxview -lolgx -lX11 -lm $(COMPLIBS) +MOTIFLDLIBS = -lwxprop_motif -lwx_motif -lXm -lXt -lX11 -lm $(COMPLIBS) +HPLDLIBS = -lwxprop_hp -lwx_hp -lXm -lXt -lX11 -lm $(COMPLIBS) +LDFLAGS = $(XLIB) -L$(WXDIR)/lib -L../lib + +OBJECTS = $(OBJDIR)/wx_prop.o $(OBJDIR)/wx_pform.o $(OBJDIR)/wx_plist.o +TESTOBJECTS = $(OBJDIR)/test.o + +.SUFFIXES: + +all: $(OBJDIR) $(PROPLIB) + +demo: test$(GUISUFFIX) + +motifdemo: + $(MAKE) -f makefile.unx all test_motif GUI=-Dwx_motif DEBUG='$(DEBUG)' GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' XVIEW_LINK= + +xviewdemo: + $(MAKE) -f makefile.unx all test_ol GUI=-Dwx_xview OPT='$(OPT)' DEBUG='$(DEBUG)' + +$(PROPLIB): $(OBJECTS) + rm -f $@ + ar $(AROPTIONS) $@ $(OBJECTS) + $(RANLIB) $@ + +motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)'\ + OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK= + +xview: + $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)'\ + DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' + +hp: + $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='-w' \ + XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)' + +$(OBJDIR): + mkdir $(OBJDIR) + +test$(GUISUFFIX): $(TESTOBJECTS) $(WXLIB) $(PROPLIB) + $(CC) $(LDFLAGS) -o test$(GUISUFFIX) $(TESTOBJECTS) $(XVIEW_LINK) $(LDLIBS) + +$(OBJDIR)/wx_prop.o: wx_prop.$(SRCSUFF) wx_prop.h + $(CC) -c $(CPPFLAGS) -o $@ wx_prop.$(SRCSUFF) + +$(OBJDIR)/wx_pform.o: wx_pform.$(SRCSUFF) wx_prop.h wx_pform.h wx_prop.h + $(CC) -c $(CPPFLAGS) -o $@ wx_pform.$(SRCSUFF) + +$(OBJDIR)/wx_plist.o: wx_plist.$(SRCSUFF) wx_plist.h wx_prop.h + $(CC) -c $(CPPFLAGS) -o $@ wx_plist.$(SRCSUFF) + +$(OBJDIR)/test.o: test.$(SRCSUFF) test.h + $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF) + +HTMLDIR=/home/hardy/html/wx/manuals +docs: ps xlp +ps: $(PROPDIR)/docs/prop.ps +xlp: $(PROPDIR)/docs/prop.xlp +html: $(HTMLDIR)/wxprop/prop_contents.html + +$(PROPDIR)/docs/prop.xlp: $(PROPDIR)/docs/prop.tex $(PROPDIR)/docs/classes.tex $(PROPDIR)/docs/body.tex + cd ../docs; tex2rtf prop.tex tmp.xlp -xlp -twice + sed -e "s/WXHELPCONTENTS/Property Classes Manual/g" < $(PROPDIR)/docs/tmp.xlp > $(PROPDIR)/docs/prop.xlp + /bin/rm -f $(PROPDIR)/docs/tmp.xlp + +$(HTMLDIR)/wxprop/prop_contents.html: $(PROPDIR)/docs/prop.tex $(PROPDIR)/docs/classes.tex $(PROPDIR)/docs/body.tex + cd ../docs; tex2rtf prop.tex $(HTMLDIR)/wxprop/prop.html -html -twice + +$(PROPDIR)/docs/prop.dvi: $(PROPDIR)/docs/prop.tex $(PROPDIR)/docs/classes.tex $(PROPDIR)/docs/body.tex + cd $(PROPDIR)/docs; latex prop; latex prop; makeindex prop; latex prop + +$(PROPDIR)/docs/prop.ps: $(PROPDIR)/docs/prop.dvi + cd $(PROPDIR)/docs; dvips -f -r < prop.dvi > prop.ps + +clean_motif: + $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany + +clean_ol: + $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany + +clean_hp: + $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany + +cleanany: + rm -f $(OBJECTS) $(TESTOBJECTS) test$(GUISUFFIX) core $(PROPLIB) diff --git a/utils/wxprop/src/makefile.wat b/utils/wxprop/src/makefile.wat new file mode 100644 index 0000000000..c1cd6a0e31 --- /dev/null +++ b/utils/wxprop/src/makefile.wat @@ -0,0 +1,47 @@ +WXDIR = ..\..\.. + +EXTRACPPFLAGS = /DUSE_DEFINE + +!include $(WXDIR)\src\makewat.env + +WXLIB = $(WXDIR)\lib +LIBTARGET = ..\lib\wxprop.lib + +OBJECTS = prop.obj proplist.obj propform.obj +TESTOBJECTS = test.obj +NAME = test +LNK = $(name).lnk + +all: erasepch $(OBJECTS) $(LIBTARGET) + +test: test.exe + +test.obj: test.$(SRCSUFF) + +$(LIBTARGET): $(OBJECTS) + wlib /b /c /n /P=256 $(LIBTARGET) $(OBJECTS) + +$(name).exe : $(TESTOBJECTS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib + wlink @$(LNK) + $(BINDCOMMAND) $(name).res + +$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc + $(RC) $(RESFLAGS1) $(name).rc + +$(LNK) : makefile.wat + %create $(LNK) + @%append $(LNK) debug all + @%append $(LNK) system $(LINKOPTION) + @%append $(LNK) $(MINDATA) + @%append $(LNK) $(MAXDATA) + @%append $(LNK) $(STACK) + @%append $(LNK) name $(name) + @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib + @%append $(LNK) file $(LIBTARGET) + @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i + @for %i in ($(TESTOBJECTS)) do @%append $(LNK) file %i + +clean: .SYMBOLIC + -erase *.obj *.bak *.err *.pch $(LIBTARGET) *.lbc + + diff --git a/utils/wxprop/src/prop.cpp b/utils/wxprop/src/prop.cpp new file mode 100644 index 0000000000..35bf277302 --- /dev/null +++ b/utils/wxprop/src/prop.cpp @@ -0,0 +1,1112 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: prop.cpp +// Purpose: Propert sheet classes implementation +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "prop.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#include "wx/window.h" +#include "wx/utils.h" +#include "wx/list.h" +#include "prop.h" + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) + +wxPropertyValue::wxPropertyValue(void) +{ + type = wxPropertyValueNull; + next = NULL; + last = NULL; + value.first = NULL; + client_data = NULL; + modifiedFlag = FALSE; +} + +wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) +{ + modifiedFlag = FALSE; + Copy((wxPropertyValue& )copyFrom); +} + +wxPropertyValue::wxPropertyValue(const char *val) +{ + modifiedFlag = FALSE; + type = wxPropertyValueString; + + value.string = copystring(val); + client_data = NULL; + next = NULL; + last = NULL; +} + +wxPropertyValue::wxPropertyValue(const wxString& val) +{ + modifiedFlag = FALSE; + type = wxPropertyValueString; + + value.string = copystring((const char *)val); + client_data = NULL; + next = NULL; + last = NULL; +} + +wxPropertyValue::wxPropertyValue(long the_integer) +{ + modifiedFlag = FALSE; + type = wxPropertyValueInteger; + value.integer = the_integer; + client_data = NULL; + next = NULL; +} + +wxPropertyValue::wxPropertyValue(bool val) +{ + modifiedFlag = FALSE; + type = wxPropertyValuebool; + value.integer = val; + client_data = NULL; + next = NULL; +} + +wxPropertyValue::wxPropertyValue(float the_real) +{ + modifiedFlag = FALSE; + type = wxPropertyValueReal; + value.real = the_real; + client_data = NULL; + next = NULL; +} + +wxPropertyValue::wxPropertyValue(double the_real) +{ + modifiedFlag = FALSE; + type = wxPropertyValueReal; + value.real = (float)the_real; + client_data = NULL; + next = NULL; +} + +// Pointer versions: we have a pointer to the real C++ value. +wxPropertyValue::wxPropertyValue(char **val) +{ + modifiedFlag = FALSE; + type = wxPropertyValueStringPtr; + + value.stringPtr = val; + client_data = NULL; + next = NULL; + last = NULL; +} + +wxPropertyValue::wxPropertyValue(long *val) +{ + modifiedFlag = FALSE; + type = wxPropertyValueIntegerPtr; + value.integerPtr = val; + client_data = NULL; + next = NULL; +} + +wxPropertyValue::wxPropertyValue(bool *val) +{ + modifiedFlag = FALSE; + type = wxPropertyValueboolPtr; + value.boolPtr = val; + client_data = NULL; + next = NULL; +} + +wxPropertyValue::wxPropertyValue(float *val) +{ + modifiedFlag = FALSE; + type = wxPropertyValueRealPtr; + value.realPtr = val; + client_data = NULL; + next = NULL; +} + +wxPropertyValue::wxPropertyValue(wxList *the_list) +{ + modifiedFlag = FALSE; + type = wxPropertyValueList; + client_data = NULL; + last = NULL; + value.first = NULL; + + wxNode *node = the_list->First(); + while (node) + { + wxPropertyValue *expr = (wxPropertyValue *)node->Data(); + Append(expr); + node = node->Next(); + } + + delete the_list; +} + +wxPropertyValue::wxPropertyValue(wxStringList *the_list) +{ + modifiedFlag = FALSE; + type = wxPropertyValueList; + client_data = NULL; + last = NULL; + value.first = NULL; + + wxNode *node = the_list->First(); + while (node) + { + char *s = (char *)node->Data(); + Append(new wxPropertyValue(s)); + node = node->Next(); + } + delete the_list; +} + +wxPropertyValue::~wxPropertyValue(void) +{ + switch (type) + { + case wxPropertyValueInteger: + case wxPropertyValuebool: + case wxPropertyValueReal: + { + break; + } + case wxPropertyValueString: + { + delete value.string; + break; + } + case wxPropertyValueList: + { + wxPropertyValue *expr = value.first; + while (expr) + { + wxPropertyValue *expr1 = expr->next; + + delete expr; + expr = expr1; + } + break; + } + default: + case wxPropertyValueNull: break; + } +} + +void wxPropertyValue::Append(wxPropertyValue *expr) +{ + modifiedFlag = TRUE; + if (!value.first) + value.first = expr; + + if (last) + last->next = expr; + last = expr; +} + +void wxPropertyValue::Insert(wxPropertyValue *expr) +{ + modifiedFlag = TRUE; + expr->next = value.first; + value.first = expr; + + if (!last) + last = expr; +} + +// Delete from list +void wxPropertyValue::Delete(wxPropertyValue *node) +{ + wxPropertyValue *expr = GetFirst(); + + wxPropertyValue *previous = NULL; + while (expr && (expr != node)) + { + previous = expr; + expr = expr->GetNext(); + } + + if (expr) + { + if (previous) + previous->next = expr->next; + + // If node was the first in the list, + // make the list point to the NEXT one. + if (GetFirst() == expr) + { + value.first = expr->next; + } + + // If node was the last in the list, + // make the list 'last' pointer point to the PREVIOUS one. + if (GetLast() == expr) + { + if (previous) + last = previous; + else + last = NULL; + } + modifiedFlag = TRUE; + delete expr; + } + +} + +void wxPropertyValue::ClearList(void) +{ + wxPropertyValue *val = GetFirst(); + if (val) + modifiedFlag = TRUE; + + while (val) + { + wxPropertyValue *next = val->GetNext(); + delete val; + val = next; + } + value.first = NULL; + last = NULL; +} + +wxPropertyValue *wxPropertyValue::NewCopy(void) +{ + switch (type) + { + case wxPropertyValueInteger: + return new wxPropertyValue(value.integer); + case wxPropertyValuebool: + return new wxPropertyValue((value.integer != 0)); + case wxPropertyValueReal: + return new wxPropertyValue(value.real); + case wxPropertyValueString: + return new wxPropertyValue(value.string); + case wxPropertyValueList: + { + wxPropertyValue *expr = value.first; + wxPropertyValue *new_list = new wxPropertyValue; + new_list->SetType(wxPropertyValueList); + while (expr) + { + wxPropertyValue *expr2 = expr->NewCopy(); + new_list->Append(expr2); + expr = expr->next; + } + return new_list; + } + case wxPropertyValueIntegerPtr: + return new wxPropertyValue(value.integerPtr); + case wxPropertyValueRealPtr: + return new wxPropertyValue(value.realPtr); + case wxPropertyValueboolPtr: + return new wxPropertyValue(value.boolPtr); + case wxPropertyValueStringPtr: + return new wxPropertyValue(value.stringPtr); + + case wxPropertyValueNull: +#ifdef __X__ + cerr << "Should never get here!\n"; +#endif + break; + } + return NULL; +} + +void wxPropertyValue::Copy(wxPropertyValue& copyFrom) +{ + type = copyFrom.Type(); + + switch (type) + { + case wxPropertyValueInteger: + (*this) = copyFrom.IntegerValue(); + return ; + + case wxPropertyValueReal: + (*this) = copyFrom.RealValue(); + return ; + + case wxPropertyValueString: + (*this) = wxString(copyFrom.StringValue()); + return ; + + case wxPropertyValuebool: + (*this) = copyFrom.BoolValue(); + return ; + + // Pointers + case wxPropertyValueboolPtr: + (*this) = copyFrom.BoolValuePtr(); + return ; + case wxPropertyValueRealPtr: + (*this) = copyFrom.RealValuePtr(); + return ; + case wxPropertyValueIntegerPtr: + (*this) = copyFrom.IntegerValuePtr(); + return ; + case wxPropertyValueStringPtr: + (*this) = copyFrom.StringValuePtr(); + return ; + + case wxPropertyValueList: + { + value.first = NULL; + next = NULL; + last = NULL; + wxPropertyValue *expr = copyFrom.value.first; + while (expr) + { + wxPropertyValue *expr2 = expr->NewCopy(); + Append(expr2); + expr = expr->next; + } + return; + } + case wxPropertyValueNull: +#ifdef __X__ + cerr << "Should never get here!\n"; +#endif + break; + } +} + +// Return nth argument of a clause (starting from 1) +wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg) +{ + wxPropertyValue *expr = value.first; + for (int i = 1; i < arg; i++) + if (expr) + expr = expr->next; + + if (expr && (expr->type == type)) + return expr; + else + return NULL; +} + +// Return nth argument of a list expression (starting from zero) +wxPropertyValue *wxPropertyValue::Nth(int arg) +{ + if (type != wxPropertyValueList) + return NULL; + + wxPropertyValue *expr = value.first; + for (int i = 0; i < arg; i++) + if (expr) + expr = expr->next; + else return NULL; + + if (expr) + return expr; + else + return NULL; +} + + // Returns the number of elements in a list expression +int wxPropertyValue::Number(void) +{ + if (type != wxPropertyValueList) + return 0; + + int i = 0; + wxPropertyValue *expr = value.first; + while (expr) + { + expr = expr->next; + i ++; + } + return i; +} + +void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause +{ + if (type != wxPropertyValueList) + return; + + wxPropertyValue *node = value.first; + if (node) + { + node->WritePropertyType(stream); + stream << "("; + node = node->next; + bool first = TRUE; + while (node) + { + if (!first) + stream << " "; + node->WritePropertyType(stream); + node = node->next; + if (node) stream << ",\n"; + first = FALSE; + } + stream << ").\n\n"; + } +} + +void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression +{ + switch (type) + { + case wxPropertyValueInteger: + { + stream << value.integer; + break; + } + case wxPropertyValueIntegerPtr: + { + stream << *value.integerPtr; + break; + } + case wxPropertyValuebool: + { + if (value.integer) + stream << "True"; + else + stream << "False"; + break; + } + case wxPropertyValueboolPtr: + { + if (*value.integerPtr) + stream << "True"; + else + stream << "False"; + break; + } + case wxPropertyValueReal: + { + float f = value.real; + sprintf(wxBuffer, "%.6g", (double)f); + stream << wxBuffer; + break; + } + case wxPropertyValueRealPtr: + { + float f = *value.realPtr; +/* Now the parser can cope with this. + // Prevent printing in 'e' notation. Any better way? + if (fabs(f) < 0.00001) + f = 0.0; +*/ + sprintf(wxBuffer, "%.6g", f); + stream << wxBuffer; + break; + } + case wxPropertyValueString: + { +// stream << "\""; + int i; + int len = strlen(value.string); + for (i = 0; i < len; i++) + { + char ch = value.string[i]; +// if (ch == '"' || ch == '\\') +// stream << "\\"; + stream << ch; + } + +// stream << "\""; + break; + } + case wxPropertyValueStringPtr: + { + int i; + int len = strlen(*(value.stringPtr)); + for (i = 0; i < len; i++) + { + char ch = *(value.stringPtr)[i]; + + } + break; + } + case wxPropertyValueList: + { + if (!value.first) + stream << "[]"; + else + { + wxPropertyValue *expr = value.first; + + stream << "["; + while (expr) + { + expr->WritePropertyType(stream); + expr = expr->next; + if (expr) stream << ", "; + } + stream << "]"; + } + break; + } + case wxPropertyValueNull: break; + } +} + +wxString wxPropertyValue::GetStringRepresentation(void) +{ + char buf[500]; + buf[0] = 0; + + ostrstream str((char *)buf, (int)500, ios::out); + WritePropertyType(str); + str << '\0'; + str.flush(); + + wxString theString(buf); + return theString; +} + +void wxPropertyValue::operator=(const wxPropertyValue& val) +{ + modifiedFlag = TRUE; + Copy((wxPropertyValue&)val); +} + +// void wxPropertyValue::operator=(const char *val) +void wxPropertyValue::operator=(const wxString& val1) +{ + const char *val = (const char *)val1; + + modifiedFlag = TRUE; + if (type == wxPropertyValueNull) + type = wxPropertyValueString; + + if (type == wxPropertyValueString) + { + if (val) + value.string = copystring(val); + else + value.string = NULL; + } + else if (type == wxPropertyValueStringPtr) + { + if (*value.stringPtr) + delete[] *value.stringPtr; + if (val) + *value.stringPtr = copystring(val); + else + *value.stringPtr = NULL; + } + + client_data = NULL; + next = NULL; + last = NULL; + +} + +void wxPropertyValue::operator=(const long val) +{ + modifiedFlag = TRUE; + if (type == wxPropertyValueNull) + type = wxPropertyValueInteger; + + if (type == wxPropertyValueInteger) + value.integer = val; + else if (type == wxPropertyValueIntegerPtr) + *value.integerPtr = val; + else if (type == wxPropertyValueReal) + value.real = (float)val; + else if (type == wxPropertyValueRealPtr) + *value.realPtr = (float)val; + + client_data = NULL; + next = NULL; +} + +void wxPropertyValue::operator=(const bool val) +{ + modifiedFlag = TRUE; + if (type == wxPropertyValueNull) + type = wxPropertyValuebool; + + if (type == wxPropertyValuebool) + value.integer = (long)val; + else if (type == wxPropertyValueboolPtr) + *value.boolPtr = val; + + client_data = NULL; + next = NULL; +} + +void wxPropertyValue::operator=(const float val) +{ + modifiedFlag = TRUE; + if (type == wxPropertyValueNull) + type = wxPropertyValueReal; + + if (type == wxPropertyValueInteger) + value.integer = (long)val; + else if (type == wxPropertyValueIntegerPtr) + *value.integerPtr = (long)val; + else if (type == wxPropertyValueReal) + value.real = val; + else if (type == wxPropertyValueRealPtr) + *value.realPtr = val; + + client_data = NULL; + next = NULL; +} + +void wxPropertyValue::operator=(const char **val) +{ + modifiedFlag = TRUE; + type = wxPropertyValueStringPtr; + + if (val) + value.stringPtr = (char **)val; + else + value.stringPtr = NULL; + client_data = NULL; + next = NULL; + last = NULL; + +} + +void wxPropertyValue::operator=(const long *val) +{ + modifiedFlag = TRUE; + type = wxPropertyValueIntegerPtr; + value.integerPtr = (long *)val; + client_data = NULL; + next = NULL; +} + +void wxPropertyValue::operator=(const bool *val) +{ + modifiedFlag = TRUE; + type = wxPropertyValueboolPtr; + value.boolPtr = (bool *)val; + client_data = NULL; + next = NULL; +} + +void wxPropertyValue::operator=(const float *val) +{ + modifiedFlag = TRUE; + type = wxPropertyValueRealPtr; + value.realPtr = (float *)val; + client_data = NULL; + next = NULL; +} + +long wxPropertyValue::IntegerValue(void) + { + if (type == wxPropertyValueInteger) + return value.integer; + else if (type == wxPropertyValueReal) + return (long)value.real; + else if (type == wxPropertyValueIntegerPtr) + return *value.integerPtr; + else if (type == wxPropertyValueRealPtr) + return (long)(*value.realPtr); + else return 0; + } + +long *wxPropertyValue::IntegerValuePtr(void) +{ + return value.integerPtr; +} + +float wxPropertyValue::RealValue(void) { + if (type == wxPropertyValueReal) + return value.real; + else if (type == wxPropertyValueRealPtr) + return *value.realPtr; + else if (type == wxPropertyValueInteger) + return (float)value.integer; + else if (type == wxPropertyValueIntegerPtr) + return (float)*(value.integerPtr); + else return 0.0; + } + +float *wxPropertyValue::RealValuePtr(void) +{ + return value.realPtr; +} + +bool wxPropertyValue::BoolValue(void) { + if (type == wxPropertyValueReal) + return (value.real != 0.0); + if (type == wxPropertyValueRealPtr) + return (*(value.realPtr) != 0.0); + else if (type == wxPropertyValueInteger) + return (value.integer != 0); + else if (type == wxPropertyValueIntegerPtr) + return (*(value.integerPtr) != 0); + else if (type == wxPropertyValuebool) + return (value.integer != 0); + else if (type == wxPropertyValueboolPtr) + return (*(value.boolPtr) != 0); + else return FALSE; + } + +bool *wxPropertyValue::BoolValuePtr(void) +{ + return value.boolPtr; +} + +char *wxPropertyValue::StringValue(void) { + if (type == wxPropertyValueString) + return value.string; + else if (type == wxPropertyValueStringPtr) + return *(value.stringPtr); + else return NULL; + } + +char **wxPropertyValue::StringValuePtr(void) +{ + return value.stringPtr; +} + +/* + * A property (name plus value) + */ + +IMPLEMENT_DYNAMIC_CLASS(wxProperty, wxObject) + +wxProperty::wxProperty(void) +{ + propertyRole = (char *)NULL; + propertyValidator = NULL; + propertyWindow = NULL; + enabled = TRUE; +} + +wxProperty::wxProperty(wxProperty& copyFrom) +{ + value = copyFrom.GetValue(); + name = copyFrom.GetName(); + propertyRole = copyFrom.GetRole(); + propertyValidator = copyFrom.GetValidator(); + enabled = copyFrom.IsEnabled(); + propertyWindow = NULL; +} + +wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):name(nm), propertyRole(role) +{ + propertyValidator = ed; + propertyWindow = NULL; + enabled = TRUE; +} + +wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed): + name(nm), value(val), propertyRole(role) +{ + propertyValidator = ed; + propertyWindow = NULL; + enabled = TRUE; +} + +wxProperty::~wxProperty(void) +{ + if (propertyValidator) + delete propertyValidator; +} + +wxPropertyValue& wxProperty::GetValue(void) +{ + return value; +} + +wxPropertyValidator *wxProperty::GetValidator(void) +{ + return propertyValidator; +} + +wxString& wxProperty::GetName(void) +{ + return name; +} + +wxString& wxProperty::GetRole(void) +{ + return propertyRole; +} + +void wxProperty::SetValue(const wxPropertyValue& val) +{ + value = val; +} + +void wxProperty::SetValidator(wxPropertyValidator *ed) +{ + propertyValidator = ed; +} + +void wxProperty::SetRole(wxString& role) +{ + propertyRole = role; +} + +void wxProperty::SetName(wxString& nm) +{ + name = nm; +} + +void wxProperty::operator=(const wxPropertyValue& val) +{ + value = val; +} + +/* + * Base property view class + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyView, wxEvtHandler) + +wxPropertyView::wxPropertyView(long flags) +{ + buttonFlags = flags; + propertySheet = NULL; + currentValidator = NULL; + currentProperty = NULL; +} + +wxPropertyView::~wxPropertyView(void) +{ +} + +void wxPropertyView::AddRegistry(wxPropertyValidatorRegistry *registry) +{ + validatorRegistryList.Append(registry); +} + +wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) +{ + if (property->GetValidator()) + return property->GetValidator(); + + wxNode *node = validatorRegistryList.First(); + while (node) + { + wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data(); + wxPropertyValidator *validator = registry->GetValidator(property->GetRole()); + if (validator) + return validator; + node = node->Next(); + } + return NULL; +/* + if (!wxDefaultPropertyValidator) + wxDefaultPropertyValidator = new wxPropertyListValidator; + return wxDefaultPropertyValidator; +*/ +} + +/* + * Property sheet + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject) + +wxPropertySheet::wxPropertySheet(void):properties(wxKEY_STRING) +{ +} + +wxPropertySheet::~wxPropertySheet(void) +{ + Clear(); +} + +bool wxPropertySheet::Save(ostream& str) +{ + return FALSE; +} + +bool wxPropertySheet::Load(ostream& str) +{ + return FALSE; +} + +void wxPropertySheet::UpdateAllViews(wxPropertyView *thisView) +{ +} + +// Add a property +void wxPropertySheet::AddProperty(wxProperty *property) +{ + properties.Append(property->GetName().GetData(), property); +} + +// Get property by name +wxProperty *wxPropertySheet::GetProperty(wxString name) +{ + wxNode *node = properties.Find(name.GetData()); + if (!node) + return NULL; + else + return (wxProperty *)node->Data(); +} + +// Clear all properties +void wxPropertySheet::Clear(void) +{ + wxNode *node = properties.First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + wxNode *next = node->Next(); + delete prop; + delete node; + node = next; + } +} + +// Sets/clears the modified flag for each property value +void wxPropertySheet::SetAllModified(bool flag) +{ + wxNode *node = properties.First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + prop->GetValue().SetModified(flag); + node = node->Next(); + } +} + +/* + * Property validator registry + * + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyValidatorRegistry, wxHashTable) + +wxPropertyValidatorRegistry::wxPropertyValidatorRegistry(void):wxHashTable(wxKEY_STRING) +{ +} + +wxPropertyValidatorRegistry::~wxPropertyValidatorRegistry(void) +{ + ClearRegistry(); +} + +void wxPropertyValidatorRegistry::RegisterValidator(wxString& typeName, wxPropertyValidator *validator) +{ + Put(typeName.GetData(), validator); +} + +wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(wxString& typeName) +{ + return (wxPropertyValidator *)Get(typeName.GetData()); +} + +void wxPropertyValidatorRegistry::ClearRegistry(void) +{ + BeginFind(); + wxNode *node; + while (node = Next()) + { + delete (wxPropertyValidator *)node->Data(); + } +} + + /* + * Property validator + */ + + +IMPLEMENT_ABSTRACT_CLASS(wxPropertyValidator, wxEvtHandler) + +wxPropertyValidator::wxPropertyValidator(long flags) +{ + validatorFlags = flags; + validatorProperty = NULL; +} + +wxPropertyValidator::~wxPropertyValidator(void) +{} + +bool wxPropertyValidator::StringToFloat (char *s, float *number) { + double num; + bool ok = StringToDouble (s, &num); + *number = (float) num; + return ok; +} + +bool wxPropertyValidator::StringToDouble (char *s, double *number) { + bool ok = TRUE; + char *value_ptr; + *number = strtod (s, &value_ptr); + if (value_ptr) { + int len = strlen (value_ptr); + for (int i = 0; i < len; i++) { + ok = (isspace (value_ptr[i]) != 0); + if (!ok) return FALSE; + } + } + return ok; +} + +bool wxPropertyValidator::StringToInt (char *s, int *number) { + long num; + bool ok = StringToLong (s, &num); + *number = (int) num; + return ok; +} + +bool wxPropertyValidator::StringToLong (char *s, long *number) { + bool ok = TRUE; + char *value_ptr; + *number = strtol (s, &value_ptr, 10); + if (value_ptr) { + int len = strlen (value_ptr); + for (int i = 0; i < len; i++) { + ok = (isspace (value_ptr[i]) != 0); + if (!ok) return FALSE; + } + } + return ok; +} + +char *wxPropertyValidator::FloatToString (float number) { + static char buf[20]; + sprintf (buf, "%.6g", number); + return buf; +} + +char *wxPropertyValidator::DoubleToString (double number) { + static char buf[20]; + sprintf (buf, "%.6g", number); + return buf; +} + +char *wxPropertyValidator::IntToString (int number) { + return ::IntToString (number); +} + +char *wxPropertyValidator::LongToString (long number) { + return ::LongToString (number); + } + + diff --git a/utils/wxprop/src/prop.h b/utils/wxprop/src/prop.h new file mode 100644 index 0000000000..e62e022ebb --- /dev/null +++ b/utils/wxprop/src/prop.h @@ -0,0 +1,317 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: prop.h +// Purpose: Property sheet classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _PROP_H_ +#define _PROP_H_ + +#ifdef __GNUG__ +#pragma interface "prop.h" +#endif + +#include "wx/defs.h" +#include "wx/string.h" +#include "wx/hash.h" +#include "wx/dialog.h" +#include "wx/frame.h" +#include "wx/button.h" +#include "wx/listbox.h" +#include "wx/textctrl.h" +#include "wx/gdicmn.h" +#include "wx/layout.h" + +class wxWindow; +class wxProperty; +class wxPropertyValue; +class wxPropertySheet; +class wxPropertyView; +class wxPropertyValidator; +class wxPropertyValidatorRegistry; + +#define wxPROPERTY_VERSION 2.0 + +// A storable sheet of values +class wxPropertySheet: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxPropertySheet) + protected: + wxObject *viewedObject; + wxList properties; + wxPropertyView *propertyView; + + public: + wxPropertySheet(void); + ~wxPropertySheet(void); + + // Add a property + virtual void AddProperty(wxProperty *property); + + // Get property by name + virtual wxProperty *GetProperty(wxString name); + + // Clear all properties + virtual void Clear(void); + + virtual bool Save(ostream& str); + virtual bool Load(ostream& str); + + virtual void UpdateAllViews(wxPropertyView *thisView = NULL); + inline virtual wxList& GetProperties(void) { return properties; } + + // Sets/clears the modified flag for each property value + virtual void SetAllModified(bool flag = TRUE); +}; + + +// Base class for property sheet views. There are currently two directly derived +// classes: wxPropertyListView, and wxPropertyFormView. +class wxPropertyView: public wxEvtHandler +{ + DECLARE_DYNAMIC_CLASS(wxPropertyView) + protected: + long buttonFlags; + wxPropertySheet *propertySheet; + wxProperty *currentProperty; + wxList validatorRegistryList; + wxPropertyValidator *currentValidator; + public: + wxPropertyView(long flags = 0); + ~wxPropertyView(void); + + // Associates and shows the view + virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel) {}; + + // Update this view of the viewed object, called e.g. by + // the object itself. + virtual bool OnUpdateView(void) {return FALSE;}; + + // Override this to do something as soon as the property changed, + // if the view and validators support it. + virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {} + + virtual void AddRegistry(wxPropertyValidatorRegistry *registry); + inline virtual wxList& GetRegistryList(void) + { return validatorRegistryList; } + + virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property); + inline virtual void SetPropertySheet(wxPropertySheet *sheet) { propertySheet = sheet; } + inline virtual wxPropertySheet *GetPropertySheet(void) { return propertySheet; } + + virtual void OnOk(void) {}; + virtual void OnCancel(void) {}; + virtual void OnHelp(void) {}; + + inline virtual bool OnClose(void) { return FALSE; } + inline long GetFlags(void) { return buttonFlags; } +}; + + +class wxPropertyValidator: public wxEvtHandler +{ + DECLARE_DYNAMIC_CLASS(wxPropertyValidator) + protected: + long validatorFlags; + wxProperty *validatorProperty; + public: + wxPropertyValidator(long flags = 0); + ~wxPropertyValidator(void); + + inline long GetFlags(void) { return validatorFlags; } + inline void SetValidatorProperty(wxProperty *prop) { validatorProperty = prop; } + inline wxProperty *GetValidatorProperty(void) { return validatorProperty; } + + virtual bool StringToFloat (char *s, float *number); + virtual bool StringToDouble (char *s, double *number); + virtual bool StringToInt (char *s, int *number); + virtual bool StringToLong (char *s, long *number); + virtual char *FloatToString (float number); + virtual char *DoubleToString (double number); + virtual char *IntToString (int number); + virtual char *LongToString (long number); +}; + + +// extern wxPropertyValidator *wxDefaultPropertyValidator; + +class wxPropertyValidatorRegistry: public wxHashTable +{ + DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry) + public: + wxPropertyValidatorRegistry(void); + ~wxPropertyValidatorRegistry(void); + + virtual void RegisterValidator(wxString& roleName, wxPropertyValidator *validator); + virtual wxPropertyValidator *GetValidator(wxString& roleName); + void ClearRegistry(void); +}; + +/* + * Property value class + */ + +typedef enum { + wxPropertyValueNull, + wxPropertyValueInteger, + wxPropertyValueReal, + wxPropertyValuebool, + wxPropertyValueString, + wxPropertyValueList, + wxPropertyValueIntegerPtr, + wxPropertyValueRealPtr, + wxPropertyValueboolPtr, + wxPropertyValueStringPtr +} wxPropertyValueType; + +class wxPropertyValue: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxPropertyValue) + public: + wxObject *client_data; + wxPropertyValueType type; + bool modifiedFlag; + + union { + long integer; // Also doubles as bool + char *string; + float real; + long *integerPtr; + bool *boolPtr; + char **stringPtr; + float *realPtr; + wxPropertyValue *first; // If is a list expr, points to the first node + } value; + + wxPropertyValue *next; // If this is a node in a list, points to the next node + wxPropertyValue *last; // If is a list expr, points to the last node + + wxPropertyValue(void); // Unknown type + wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor + wxPropertyValue(const char *val); + wxPropertyValue(const wxString& val); + wxPropertyValue(long val); + wxPropertyValue(bool val); + wxPropertyValue(float val); + wxPropertyValue(double the_real); + wxPropertyValue(wxList *val); + wxPropertyValue(wxStringList *val); + // Pointer versions + wxPropertyValue(char **val); + wxPropertyValue(long *val); + wxPropertyValue(bool *val); + wxPropertyValue(float *val); + + ~wxPropertyValue(void); + + virtual inline wxPropertyValueType Type(void) { return type; } + virtual inline void SetType(wxPropertyValueType typ) { type = typ; } + virtual long IntegerValue(void); + virtual float RealValue(void); + virtual bool BoolValue(void); + virtual char *StringValue(void); + virtual long *IntegerValuePtr(void); + virtual float *RealValuePtr(void); + virtual bool *BoolValuePtr(void); + virtual char **StringValuePtr(void); + + // Get nth arg of clause (starting from 1) + virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg); + + // Return nth argument of a list expression (starting from zero) + virtual wxPropertyValue *Nth(int arg); + // Returns the number of elements in a list expression + virtual int Number(void); + + virtual wxPropertyValue *NewCopy(void); + virtual void Copy(wxPropertyValue& copyFrom); + + virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause + virtual void WritePropertyType(ostream& stream); // Write as any other subexpression + + // Append an expression to a list + virtual void Append(wxPropertyValue *expr); + // Insert at beginning of list + virtual void Insert(wxPropertyValue *expr); + + // Get first expr in list + virtual inline wxPropertyValue *GetFirst(void) { return ((type == wxPropertyValueList) ? value.first : NULL); } + + // Get next expr if this is a node in a list + virtual inline wxPropertyValue *GetNext(void) { return next; } + + // Get last expr in list + virtual inline wxPropertyValue *GetLast(void) { return ((type == wxPropertyValueList) ? last : NULL); } + + // Delete this node from the list + virtual void Delete(wxPropertyValue *node); + + // Clear list + virtual void ClearList(void); + + virtual inline void SetClientData(wxObject *data) { client_data = data; } + virtual inline wxObject *GetClientData(void) { return client_data; } + + virtual wxString GetStringRepresentation(void); + + inline void SetModified(bool flag = TRUE) { modifiedFlag = flag; } + inline bool GetModified(void) { return modifiedFlag; } + + // Operators + void operator=(const wxPropertyValue& val); +// void operator=(const char *val); + void operator=(const wxString& val); + void operator=(const long val); + void operator=(const bool val); + void operator=(const float val); + void operator=(const char **val); + void operator=(const long *val); + void operator=(const bool *val); + void operator=(const float *val); +}; + +/* + * Property class: contains a name and a value. + */ + +class wxProperty: public wxObject +{ + DECLARE_DYNAMIC_CLASS(wxProperty) + protected: + bool enabled; + public: + wxPropertyValue value; + wxString name; + wxString propertyRole; + wxPropertyValidator *propertyValidator; + wxWindow *propertyWindow; // Usually a panel item, if anything + + wxProperty(void); + wxProperty(wxProperty& copyFrom); + wxProperty(wxString name, wxString role, wxPropertyValidator *ed = NULL); + wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL); + ~wxProperty(void); + + virtual wxPropertyValue& GetValue(void); + virtual wxPropertyValidator *GetValidator(void); + virtual wxString& GetName(void); + virtual wxString& GetRole(void); + virtual void SetValue(const wxPropertyValue& val); + virtual void SetValidator(wxPropertyValidator *v); + virtual void SetName(wxString& nm); + virtual void SetRole(wxString& role); + void operator=(const wxPropertyValue& val); + virtual inline void SetWindow(wxWindow *win) { propertyWindow = win; } + virtual inline wxWindow *GetWindow(void) { return propertyWindow; } + + inline void Enable(bool en) { enabled = en; } + inline bool IsEnabled(void) { return enabled; } +}; + +#endif + diff --git a/utils/wxprop/src/propform.cpp b/utils/wxprop/src/propform.cpp new file mode 100644 index 0000000000..e4ba770c2f --- /dev/null +++ b/utils/wxprop/src/propform.cpp @@ -0,0 +1,726 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: propform.cpp +// Purpose: Property form classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "propform.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#include "wx/window.h" +#include "wx/utils.h" +#include "wx/list.h" +#include "propform.h" + +/* + * Property view + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView) + +BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView) + EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk) + EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel) + EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp) + EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert) + EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate) +END_EVENT_TABLE() + +bool wxPropertyFormView::dialogCancelled = FALSE; + +wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags) +{ + propertyWindow = propPanel; + managedWindow = NULL; + + windowCloseButton = NULL; + windowCancelButton = NULL; + windowHelpButton = NULL; + + detailedEditing = FALSE; +} + +wxPropertyFormView::~wxPropertyFormView(void) +{ +} + +void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel) +{ + propertySheet = ps; + + AssociatePanel(panel); +// CreateControls(); +// UpdatePropertyList(); +} + +// Update this view of the viewed object, called e.g. by +// the object itself. +bool wxPropertyFormView::OnUpdateView(void) +{ + return TRUE; +} + +bool wxPropertyFormView::Check(void) +{ + if (!propertySheet) + return FALSE; + + wxNode *node = propertySheet->GetProperties().First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + if (!formValidator->OnCheckValue(prop, this, propertyWindow)) + return FALSE; + } + node = node->Next(); + } + return TRUE; +} + +bool wxPropertyFormView::TransferToPropertySheet(void) +{ + if (!propertySheet) + return FALSE; + + wxNode *node = propertySheet->GetProperties().First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnRetrieveValue(prop, this, propertyWindow); + } + node = node->Next(); + } + return TRUE; +} + +bool wxPropertyFormView::TransferToDialog(void) +{ + if (!propertySheet) + return FALSE; + + wxNode *node = propertySheet->GetProperties().First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnDisplayValue(prop, this, propertyWindow); + } + node = node->Next(); + } + return TRUE; +} + +bool wxPropertyFormView::AssociateNames(void) +{ + if (!propertySheet || !propertyWindow) + return FALSE; + + wxNode *node = propertyWindow->GetChildren()->First(); + while (node) + { + wxWindow *win = (wxWindow *)node->Data(); + if (win->GetName() != "") + { + wxProperty *prop = propertySheet->GetProperty(win->GetName()); + if (prop) + prop->SetWindow(win); + } + node = node->Next(); + } + return TRUE; +} + + +bool wxPropertyFormView::OnClose(void) +{ + delete this; + return TRUE; +} + +void wxPropertyFormView::OnOk(wxCommandEvent& event) +{ + // Retrieve the value if any + if (!Check()) + return; + + dialogCancelled = FALSE; + + managedWindow->Close(TRUE); +} + +void wxPropertyFormView::OnCancel(wxCommandEvent& event) +{ + dialogCancelled = TRUE; + + managedWindow->Close(TRUE); +} + +void wxPropertyFormView::OnHelp(wxCommandEvent& event) +{ +} + +void wxPropertyFormView::OnUpdate(wxCommandEvent& event) +{ + TransferToPropertySheet(); +} + +void wxPropertyFormView::OnRevert(wxCommandEvent& event) +{ + TransferToDialog(); +} + +void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event) +{ + if (!propertySheet) + return; + + if (win.GetName() == "") + return; + + if (strcmp(win.GetName(), "ok") == 0) + OnOk(event); + else if (strcmp(win.GetName(), "cancel") == 0) + OnCancel(event); + else if (strcmp(win.GetName(), "help") == 0) + OnHelp(event); + else if (strcmp(win.GetName(), "update") == 0) + OnUpdate(event); + else if (strcmp(win.GetName(), "revert") == 0) + OnRevert(event); + else + { + // Find a validator to route the command to. + wxNode *node = propertySheet->GetProperties().First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + if (prop->GetWindow() && (prop->GetWindow() == &win)) + { + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnCommand(prop, this, propertyWindow, event); + return; + } + } + node = node->Next(); + } + } +} + +void wxPropertyFormView::OnDoubleClick(wxControl *item) +{ + if (!propertySheet) + return; + + // Find a validator to route the command to. + wxNode *node = propertySheet->GetProperties().First(); + while (node) + { + wxProperty *prop = (wxProperty *)node->Data(); + if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item)) + { + wxPropertyValidator *validator = FindPropertyValidator(prop); + if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) + { + wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; + formValidator->OnDoubleClick(prop, this, propertyWindow); + return; + } + } + node = node->Next(); + } +} + +/* + * Property form dialog box + */ + +IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog) + +wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, + const wxPoint& pos, const wxSize& size, long style, const wxString& name): + wxDialog(parent, -1, title, pos, size, style, name) +{ + view = v; + view->AssociatePanel(this); + view->SetManagedWindow(this); +// SetAutoLayout(TRUE); +} + +bool wxPropertyFormDialog::OnClose(void) +{ + if (view) + { + view->OnClose(); + view = NULL; + return TRUE; + } + else + return FALSE; +} + +void wxPropertyFormDialog::OnDefaultAction(wxControl *item) +{ + view->OnDoubleClick(item); +} + +void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event) +{ + if ( view ) + view->OnCommand(win, event); +} + +// Extend event processing to search the view's event table +bool wxPropertyFormDialog::ProcessEvent(wxEvent& event) +{ + if ( !view || ! view->ProcessEvent(event) ) + return wxEvtHandler::ProcessEvent(event); + else + return TRUE; +} + + +/* + * Property form panel + */ + +IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel) + +void wxPropertyFormPanel::OnDefaultAction(wxControl *item) +{ + view->OnDoubleClick(item); +} + +void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event) +{ + view->OnCommand(win, event); +} + +// Extend event processing to search the view's event table +bool wxPropertyFormPanel::ProcessEvent(wxEvent& event) +{ + if ( !view || ! view->ProcessEvent(event) ) + return wxEvtHandler::ProcessEvent(event); + else + return TRUE; +} + +/* + * Property frame + */ + +IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame) + +bool wxPropertyFormFrame::OnClose(void) +{ + if (view) + return view->OnClose(); + else + return FALSE; +} + +wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v) +{ + return new wxPropertyFormPanel(v, parent); +} + +bool wxPropertyFormFrame::Initialize(void) +{ + propertyPanel = OnCreatePanel(this, view); + if (propertyPanel) + { + view->AssociatePanel(propertyPanel); + view->SetManagedWindow(this); +// propertyPanel->SetAutoLayout(TRUE); + return TRUE; + } + else + return FALSE; +} + + /* + * Property form specific validator + */ + +IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator) + + +/* + * Default validators + */ + +IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator) + +/// +/// Real number form validator +/// +bool wxRealFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + if (realMin == 0.0 && realMax == 0.0) + return TRUE; + + // The item used for viewing the real number: should be a text item. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + return FALSE; + + wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); + + float val = 0.0; + if (!StringToFloat(WXSTRINGCAST value, &val)) + { + char buf[200]; + sprintf(buf, "Value %s is not a valid real number!", (const char *)value); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + + if (val < realMin || val > realMax) + { + char buf[200]; + sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; +} + +bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the real number: should be a text item. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + return FALSE; + + wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); + + if (value.Length() == 0) + return FALSE; + + float f = (float)atof((const char *)value); + property->GetValue() = f; + return TRUE; +} + +bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the real number: should be a text item. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + return FALSE; + + wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow; + textItem->SetValue(FloatToString(property->GetValue().RealValue())); + return TRUE; +} + +/// +/// Integer validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator) + +bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + if (integerMin == 0.0 && integerMax == 0.0) + return TRUE; + + // The item used for viewing the real number: should be a text item or a slider + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow) + return FALSE; + + long val = 0; + + if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); + + if (!StringToLong(WXSTRINGCAST value, &val)) + { + char buf[200]; + sprintf(buf, "Value %s is not a valid integer!", (const char *)value); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + } + else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) + { + val = (long)((wxSlider *)propertyWindow)->GetValue(); + } + else + return FALSE; + + if (val < integerMin || val > integerMax) + { + char buf[200]; + sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; +} + +bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the real number: should be a text item or a slider + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow) + return FALSE; + + if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); + + if (value.Length() == 0) + return FALSE; + + long i = atol((const char *)value); + property->GetValue() = i; + } + else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) + { + property->GetValue() = (long)((wxSlider *)propertyWindow)->GetValue(); + } + else + return FALSE; + + return TRUE; +} + +bool wxIntegerFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the real number: should be a text item or a slider + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow) + return FALSE; + + if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow; + textItem->SetValue(LongToString(property->GetValue().IntegerValue())); + } + else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) + { + ((wxSlider *)propertyWindow)->SetValue((int)property->GetValue().IntegerValue()); + } + else + return FALSE; + return TRUE; +} + +/// +/// Boolean validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator) + +bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the boolean: should be a checkbox + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) + return FALSE; + + return TRUE; +} + +bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the boolean: should be a checkbox. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) + return FALSE; + + wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; + + property->GetValue() = (bool)checkBox->GetValue(); + return TRUE; +} + +bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the boolean: should be a checkbox. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) + return FALSE; + + wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; + checkBox->SetValue((bool)property->GetValue().BoolValue()); + return TRUE; +} + +/// +/// String validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator) + +wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags): + wxPropertyFormValidator(flags) +{ + strings = list; +} + +bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + if (!strings) + return TRUE; + + // The item used for viewing the string: should be a text item, choice item or listbox. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow) + return FALSE; + if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxTextCtrl *text = (wxTextCtrl *)propertyWindow; + if (!strings->Member(text->GetValue())) + { + wxString s("Value "); + s += text->GetValue(); + s += " is not valid."; + wxMessageBox(s, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + } + else + { + // Any other item constrains the string value, + // so we don't have to check it. + } + return TRUE; +} + +bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the string: should be a text item, choice item or listbox. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow) + return FALSE; + if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxTextCtrl *text = (wxTextCtrl *)propertyWindow; + property->GetValue() = text->GetValue(); + } + else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox))) + { + wxListBox *lbox = (wxListBox *)propertyWindow; + if (lbox->GetSelection() > -1) + property->GetValue() = lbox->GetStringSelection(); + } +/* + else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) + { + wxRadioBox *rbox = (wxRadioBox *)propertyWindow; + int n = 0; + if ((n = rbox->GetSelection()) > -1) + property->GetValue() = rbox->GetString(n); + } +*/ + else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice))) + { + wxChoice *choice = (wxChoice *)propertyWindow; + if (choice->GetSelection() > -1) + property->GetValue() = choice->GetStringSelection(); + } + else + return FALSE; + return TRUE; +} + +bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) +{ + // The item used for viewing the string: should be a text item, choice item or listbox. + wxWindow *propertyWindow = property->GetWindow(); + if (!propertyWindow) + return FALSE; + if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) + { + wxTextCtrl *text = (wxTextCtrl *)propertyWindow; + text->SetValue(property->GetValue().StringValue()); + } + else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox))) + { + wxListBox *lbox = (wxListBox *)propertyWindow; + if (lbox->Number() == 0 && strings) + { + // Try to initialize the listbox from 'strings' + wxNode *node = strings->First(); + while (node) + { + char *s = (char *)node->Data(); + lbox->Append(s); + node = node->Next(); + } + } + lbox->SetStringSelection(property->GetValue().StringValue()); + } +/* + else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) + { + wxRadioBox *rbox = (wxRadioBox *)propertyWindow; + rbox->SetStringSelection(property->GetValue().StringValue()); + } +*/ + else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice))) + { + wxChoice *choice = (wxChoice *)propertyWindow; +#ifndef __XVIEW__ + if (choice->Number() == 0 && strings) + { + // Try to initialize the choice item from 'strings' + // XView doesn't allow this kind of thing. + wxNode *node = strings->First(); + while (node) + { + char *s = (char *)node->Data(); + choice->Append(s); + node = node->Next(); + } + } +#endif + choice->SetStringSelection(property->GetValue().StringValue()); + } + else + return FALSE; + return TRUE; +} + diff --git a/utils/wxprop/src/propform.h b/utils/wxprop/src/propform.h new file mode 100644 index 0000000000..242204d7fa --- /dev/null +++ b/utils/wxprop/src/propform.h @@ -0,0 +1,286 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: propform.h +// Purpose: Property form classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifndef _PROPFORM_H_ +#define _PROPFORM_H_ + +#ifdef __GNUG__ +#pragma interface "propform.h" +#endif + +#include "prop.h" + +//// +//// Property form classes: for using an existing dialog or panel +//// + +#define wxID_PROP_REVERT 3100 +#define wxID_PROP_UPDATE 3101 + +// Mediates between a physical panel and the property sheet +class wxPropertyFormView: public wxPropertyView +{ + DECLARE_DYNAMIC_CLASS(wxPropertyFormView) + protected: + bool detailedEditing; // E.g. using listbox for choices + + wxWindow *propertyWindow; // Panel that the controls will appear on + wxWindow *managedWindow; // Frame or dialog + + wxButton *windowCloseButton; // Or OK + wxButton *windowCancelButton; + wxButton *windowHelpButton; + public: + static bool dialogCancelled; + + wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0); + ~wxPropertyFormView(void); + + // Associates and shows the view + virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel); + + // Update this view of the viewed object, called e.g. by + // the object itself. + virtual bool OnUpdateView(void); + + // Transfer values from property sheet to dialog + virtual bool TransferToDialog(void); + + // Transfer values from dialog to property sheet + virtual bool TransferToPropertySheet(void); + + // Check that all the values are valid + virtual bool Check(void); + + // Give each property in the sheet a panel item, by matching + // the name of the property to the name of the panel item. + // The user doesn't always want to call this; sometimes, it + // will have been done explicitly (e.g., no matching names). + virtual bool AssociateNames(void); + + void OnOk(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); + void OnUpdate(wxCommandEvent& event); + void OnRevert(wxCommandEvent& event); + + virtual bool OnClose(void); + virtual void OnDoubleClick(wxControl *item); + + // TODO: does OnCommand still get called...??? + virtual void OnCommand(wxWindow& win, wxCommandEvent& event); + + inline virtual void AssociatePanel(wxWindow *win) { propertyWindow = win; } + inline virtual wxWindow *GetPanel(void) { return propertyWindow; } + + inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; } + inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; } + + inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; } + inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; } + inline virtual wxButton *GetHelpButton() { return windowHelpButton; } + +DECLARE_EVENT_TABLE() + +}; + +/* + * The type of validator used for forms (wxForm style but using an existing panel + * or dialog box). + * Classes derived from this know how to map from whatever widget they + * find themselves paired with, to the wxProperty and vice versa. + * Should the widget pointer be stored with the validator, or + * the wxProperty? If with the property, we don't have to supply + * a validator for every property. Otherwise, there ALWAYS needs + * to be a validator. On the other hand, not storing a wxWindow pointer + * in the wxProperty is more elegant. Perhaps. + * I think on balance, should put wxWindow pointer into wxProperty. + * After all, wxProperty will often be used to represent the data + * assocated with a window. It's that kinda thing. + */ + +class wxPropertyFormValidator: public wxPropertyValidator +{ + DECLARE_DYNAMIC_CLASS(wxPropertyFormValidator) + protected: + public: + wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { } + ~wxPropertyFormValidator(void) {} + + // Called to check value is OK (e.g. when OK is pressed) + // Return FALSE if value didn't check out; signal to restore old value. + virtual bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) + { return TRUE; } + + // Does the transferance from the property editing area to the property itself. + // Called by the view, e.g. when closing the window. + virtual bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0; + + // Called by the view to transfer the property to the window. + virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0; + + virtual void OnDoubleClick(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) {}; + virtual void OnSetFocus(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) {}; + virtual void OnKillFocus(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) {}; + virtual void OnCommand(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow, wxCommandEvent& event) {}; + +}; + +/* + * Some default validators + */ + +class wxRealFormValidator: public wxPropertyFormValidator +{ + DECLARE_DYNAMIC_CLASS(wxRealFormValidator) + protected: + float realMin; + float realMax; + public: + // 0.0, 0.0 means no range + wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags) + { + realMin = min; realMax = max; + } + ~wxRealFormValidator(void) {} + + bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + // Called by the view to transfer the property to the window. + bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); +}; + +class wxIntegerFormValidator: public wxPropertyFormValidator +{ + DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator) + protected: + long integerMin; + long integerMax; + public: + // 0, 0 means no range + wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags) + { + integerMin = min; integerMax = max; + } + ~wxIntegerFormValidator(void) {} + + bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); +}; + +class wxBoolFormValidator: public wxPropertyFormValidator +{ + DECLARE_DYNAMIC_CLASS(wxBoolFormValidator) + protected: + public: + wxBoolFormValidator(long flags = 0):wxPropertyFormValidator(flags) + { + } + ~wxBoolFormValidator(void) {} + + bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); +}; + +class wxStringFormValidator: public wxPropertyFormValidator +{ + DECLARE_DYNAMIC_CLASS(wxStringFormValidator) + protected: + wxStringList *strings; + public: + wxStringFormValidator(wxStringList *list = NULL, long flags = 0); + + ~wxStringFormValidator(void) + { + if (strings) + delete strings; + } + + bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); +}; + +/* + * A default dialog box class to use. + */ + +class wxPropertyFormDialog: public wxDialog +{ + DECLARE_CLASS(wxPropertyFormDialog) + private: + wxPropertyFormView *view; + public: + wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); + bool OnClose(void); + void OnDefaultAction(wxControl *item); + void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); +}; + +/* + * A default panel class to use. + */ + +class wxPropertyFormPanel: public wxPanel +{ + DECLARE_CLASS(wxPropertyFormPanel) + private: + wxPropertyFormView *view; + public: + wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"): + wxPanel(parent, -1, pos, size, style, name) + { + view = v; + } + void OnDefaultAction(wxControl *item); + void OnCommand(wxWindow& win, wxCommandEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); +}; + +/* + * A default frame class to use. + */ + +class wxPropertyFormFrame: public wxFrame +{ + DECLARE_CLASS(wxPropertyFormFrame) + private: + wxPropertyFormView *view; + wxPanel *propertyPanel; + public: + wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME, const wxString& name = "frame"): + wxFrame(parent, -1, title, pos, size, style, name) + { + view = v; + propertyPanel = NULL; + } + bool OnClose(void); + + // Must call this to create panel and associate view + virtual bool Initialize(void); + virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); + inline virtual wxPanel *GetPropertyPanel(void) { return propertyPanel; } +}; + +#endif + diff --git a/utils/wxprop/src/proplist.cpp b/utils/wxprop/src/proplist.cpp new file mode 100644 index 0000000000..0690210c7a --- /dev/null +++ b/utils/wxprop/src/proplist.cpp @@ -0,0 +1,1849 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: proplist.cpp +// Purpose: Property list classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "proplist.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include +#include +#include +#include + +#if defined(__WINDOWS__) && !defined(__GNUWIN32__) +#include +#else +#include +#endif + +#include "wx/window.h" +#include "wx/utils.h" +#include "wx/list.h" +#include "wx/colordlg.h" +#include "proplist.h" + +/* + * Property text edit control + */ + +IMPLEMENT_CLASS(wxPropertyTextEdit, wxTextCtrl) + +wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, + const wxWindowID id, const wxString& value, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name): + wxTextCtrl(parent, id, value, pos, size, style, wxDefaultValidator, name) +{ + view = v; +} + +void wxPropertyTextEdit::OnSetFocus(void) +{ +} + +void wxPropertyTextEdit::OnKillFocus(void) +{ +} + +/* + * Property list view + */ + +IMPLEMENT_DYNAMIC_CLASS(wxPropertyListView, wxPropertyView) + +BEGIN_EVENT_TABLE(wxPropertyListView, wxPropertyView) + EVT_BUTTON(wxID_OK, wxPropertyListView::OnOk) + EVT_BUTTON(wxID_CANCEL, wxPropertyListView::OnCancel) + EVT_BUTTON(wxID_HELP, wxPropertyListView::OnHelp) + EVT_BUTTON(wxID_PROP_CROSS, wxPropertyListView::OnCross) + EVT_BUTTON(wxID_PROP_CHECK, wxPropertyListView::OnCheck) + EVT_BUTTON(wxID_PROP_EDIT, wxPropertyListView::OnEdit) + EVT_TEXT_ENTER(wxID_PROP_TEXT, wxPropertyListView::OnText) + EVT_LISTBOX(wxID_PROP_SELECT, wxPropertyListView::OnPropertySelect) + EVT_COMMAND(wxID_PROP_SELECT, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxPropertyListView::OnPropertyDoubleClick) + EVT_TEXT(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect) +END_EVENT_TABLE() + +bool wxPropertyListView::dialogCancelled = FALSE; +wxBitmap *wxPropertyListView::tickBitmap = NULL; +wxBitmap *wxPropertyListView::crossBitmap = NULL; + +wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropertyView(flags) +{ + propertyScrollingList = NULL; + valueList = NULL; + valueText = NULL; + editButton = NULL; + confirmButton = NULL; + cancelButton = NULL; + propertyWindow = propPanel; + managedWindow = NULL; + + windowCloseButton = NULL; + windowCancelButton = NULL; + windowHelpButton = NULL; + + detailedEditing = FALSE; +} + +wxPropertyListView::~wxPropertyListView(void) +{ +/* + if (tickBitmap) + delete tickBitmap; + if (crossBitmap) + delete crossBitmap; +*/ +} + +void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel) +{ + propertySheet = ps; + + AssociatePanel(panel); + CreateControls(); + + UpdatePropertyList(); + panel->Layout(); +} + +// Update this view of the viewed object, called e.g. by +// the object itself. +bool wxPropertyListView::OnUpdateView(void) +{ + return TRUE; +} + +bool wxPropertyListView::UpdatePropertyList(bool clearEditArea) +{ + if (!propertyScrollingList || !propertySheet) + return FALSE; + + propertyScrollingList->Clear(); + if (clearEditArea) + { + valueList->Clear(); + valueText->SetValue(""); + } + wxNode *node = propertySheet->GetProperties().First(); + + // Should sort them... later... + while (node) + { + wxProperty *property = (wxProperty *)node->Data(); + wxString stringValueRepr(property->GetValue().GetStringRepresentation()); + wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr)); + + propertyScrollingList->Append(paddedString.GetData(), (char *)property); + node = node->Next(); + } + return TRUE; +} + +bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property) +{ + if (!propertyScrollingList || !propertySheet) + return FALSE; + + int currentlySelected = propertyScrollingList->GetSelection(); +// #ifdef __WINDOWS__ + wxString stringValueRepr(property->GetValue().GetStringRepresentation()); + wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr)); + int sel = FindListIndexForProperty(property); + + if (sel > -1) + { + // Don't update the listbox unnecessarily because it can cause + // ugly flashing. + + if (paddedString != propertyScrollingList->GetString(sel)) + propertyScrollingList->SetString(sel, paddedString.GetData()); + } +//#else +// UpdatePropertyList(FALSE); +//#endif + + if (currentlySelected > -1) + propertyScrollingList->SetSelection(currentlySelected); + + return TRUE; +} + +// Find the wxListBox index corresponding to this property +int wxPropertyListView::FindListIndexForProperty(wxProperty *property) +{ + int n = propertyScrollingList->Number(); + for (int i = 0; i < n; i++) + { + if (property == (wxProperty *)propertyScrollingList->wxListBox::GetClientData(i)) + return i; + } + return -1; +} + +wxString wxPropertyListView::MakeNameValueString(wxString name, wxString value) +{ + wxString theString(name); + + int nameWidth = 25; + int padWith = nameWidth - theString.Length(); + if (padWith < 0) + padWith = 0; + + if (GetFlags() & wxPROP_SHOWVALUES) + { + // Want to pad with spaces + theString.Append(' ', padWith); + theString += value; + } + + return theString; +} + +// Select and show string representation in validator the given +// property. NULL resets to show no property. +bool wxPropertyListView::ShowProperty(wxProperty *property, bool select) +{ + if (currentProperty) + { + EndShowingProperty(currentProperty); + currentProperty = NULL; + } + + valueList->Clear(); + valueText->SetValue(""); + + if (property) + { + currentProperty = property; + BeginShowingProperty(property); + } + if (select) + { + int sel = FindListIndexForProperty(property); + if (sel > -1) + propertyScrollingList->SetSelection(sel); + } + return TRUE; +} + +// Find appropriate validator and load property into value controls +bool wxPropertyListView::BeginShowingProperty(wxProperty *property) +{ + currentValidator = FindPropertyValidator(property); + if (!currentValidator) + return FALSE; + + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return FALSE; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + listValidator->OnPrepareControls(property, this, propertyWindow); + DisplayProperty(property); + return TRUE; +} + +// Find appropriate validator and unload property from value controls +bool wxPropertyListView::EndShowingProperty(wxProperty *property) +{ + if (!currentValidator) + return FALSE; + + RetrieveProperty(property); + + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return FALSE; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + listValidator->OnClearControls(property, this, propertyWindow); + if (detailedEditing) + { + listValidator->OnClearDetailControls(property, this, propertyWindow); + detailedEditing = FALSE; + } + return TRUE; +} + +void wxPropertyListView::BeginDetailedEditing(void) +{ + if (!currentValidator) + return; + if (!currentProperty) + return; + if (detailedEditing) + return; + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return; + if (!currentProperty->IsEnabled()) + return; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + if (listValidator->OnPrepareDetailControls(currentProperty, this, propertyWindow)) + detailedEditing = TRUE; +} + +void wxPropertyListView::EndDetailedEditing(void) +{ + if (!currentValidator) + return; + if (!currentProperty) + return; + + RetrieveProperty(currentProperty); + + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + if (detailedEditing) + { + listValidator->OnClearDetailControls(currentProperty, this, propertyWindow); + detailedEditing = FALSE; + } +} + +bool wxPropertyListView::DisplayProperty(wxProperty *property) +{ + if (!currentValidator) + return FALSE; + + if (((currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled()) + valueText->SetEditable(FALSE); + else + valueText->SetEditable(TRUE); + + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return FALSE; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + listValidator->OnDisplayValue(property, this, propertyWindow); + return TRUE; +} + +bool wxPropertyListView::RetrieveProperty(wxProperty *property) +{ + if (!currentValidator) + return FALSE; + if (!property->IsEnabled()) + return FALSE; + + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return FALSE; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + if (listValidator->OnCheckValue(property, this, propertyWindow)) + { + if (listValidator->OnRetrieveValue(property, this, propertyWindow)) + { + UpdatePropertyDisplayInList(property); + OnPropertyChanged(property); + } + } + else + { + // Revert to old value + listValidator->OnDisplayValue(property, this, propertyWindow); + } + return TRUE; +} + + +bool wxPropertyListView::EditProperty(wxProperty *property) +{ + return TRUE; +} + +// Called by the listbox callback +void wxPropertyListView::OnPropertySelect(wxCommandEvent& event) +{ + int sel = propertyScrollingList->GetSelection(); + if (sel > -1) + { + wxProperty *newSel = (wxProperty *)propertyScrollingList->wxListBox::GetClientData(sel); + if (newSel && newSel != currentProperty) + { + ShowProperty(newSel, FALSE); + } + } +} + +bool wxPropertyListView::CreateControls(void) +{ + wxPanel *panel = (wxPanel *)propertyWindow; + + int largeButtonWidth = 50; + int largeButtonHeight = 25; + + int smallButtonWidth = 25; + int smallButtonHeight = 20; + + // XView must be allowed to choose its own sized buttons +#ifdef __XVIEW__ + largeButtonWidth = -1; + largeButtonHeight = -1; + + smallButtonWidth = -1; + smallButtonHeight = -1; +#endif + + if (valueText) + return TRUE; + + if (!panel) + return FALSE; + + wxWindow *leftMostWindow = panel; + wxWindow *topMostWindow = panel; + wxWindow *rightMostWindow = panel; + + wxSystemSettings settings; + wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT); + + wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL); + + // May need to be changed in future to eliminate clashes with app. + panel->SetClientData((char *)this); + + if (buttonFlags & wxPROP_BUTTON_OK) + { + windowCloseButton = new wxButton(panel, wxID_OK, "OK", + wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); + windowCloseButton->SetDefault(); + windowCloseButton->SetFocus(); + } + if (buttonFlags & wxPROP_BUTTON_CLOSE) + { + windowCloseButton = new wxButton(panel, wxID_OK, "Close", + wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); + } + if (buttonFlags & wxPROP_BUTTON_CANCEL) + { + windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", + wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); + } + if (buttonFlags & wxPROP_BUTTON_HELP) + { + windowHelpButton = new wxButton(panel, wxID_HELP, "Help", + wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); + } + + if (windowCloseButton) + { + wxLayoutConstraints *c1 = new wxLayoutConstraints; + c1->left.SameAs (panel, wxLeft, 2); + c1->top.SameAs (panel, wxTop, 2); + c1->width.AsIs(); + c1->height.AsIs(); + windowCloseButton->SetConstraints(c1); + leftMostWindow = windowCloseButton; + } + if (windowCancelButton) + { + wxLayoutConstraints *c2 = new wxLayoutConstraints; + if (leftMostWindow == panel) + c2->left.SameAs (panel, wxLeft, 2); + else + c2->left.RightOf (leftMostWindow, 2); + + c2->top.SameAs (panel, wxTop, 2); + c2->width.AsIs(); + c2->height.AsIs(); + windowCancelButton->SetConstraints(c2); + leftMostWindow = windowCancelButton; + } + if (windowHelpButton) + { + wxLayoutConstraints *c2 = new wxLayoutConstraints; + if (leftMostWindow == panel) + c2->left.SameAs (panel, wxLeft, 2); + else + c2->left.RightOf (leftMostWindow, 2); + + c2->top.SameAs (panel, wxTop, 2); + c2->width.AsIs(); + c2->height.AsIs(); + windowHelpButton->SetConstraints(c2); + leftMostWindow = windowHelpButton; + } + + if (buttonFlags & wxPROP_BUTTON_CHECK_CROSS) + { +/* + if (!tickBitmap) + { +#ifdef __WINDOWS__ + tickBitmap = new wxBitmap("tick_bmp", wxBITMAP_TYPE_RESOURCE); + crossBitmap = new wxBitmap("cross_bmp", wxBITMAP_TYPE_RESOURCE); + if (!tickBitmap || !crossBitmap || !tickBitmap->Ok() || !crossBitmap->Ok()) + { + if (tickBitmap) + delete tickBitmap; + if (crossBitmap) + delete crossBitmap; + tickBitmap = NULL; + crossBitmap = NULL; + } +#endif + } +*/ +/* + if (tickBitmap && crossBitmap) + { + confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap, + wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5)); + cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap, + wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5)); + } + else +*/ + { + confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)", + wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight)); + cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X", + wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight)); + } + + wxLayoutConstraints *c = new wxLayoutConstraints; + c->left.SameAs (panel, wxLeft, 2); + if (windowCloseButton) + c->top.Below (windowCloseButton, 2); + else + c->top.SameAs (panel, wxTop, 2); + + c->width.AsIs(); + c->height.AsIs(); + + cancelButton->SetConstraints(c); + + c = new wxLayoutConstraints; + c->left.RightOf (cancelButton, 2); + c->top.SameAs (cancelButton, wxTop, 0); + c->width.AsIs(); + c->height.AsIs(); + + confirmButton->SetConstraints(c); + + cancelButton->Enable(FALSE); + confirmButton->Enable(FALSE); + } + + if (buttonFlags & wxPROP_PULLDOWN) + { + editButton = new wxButton(panel, wxID_PROP_EDIT, "...", + wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight)); + editButton->Enable(FALSE); + wxLayoutConstraints *c = new wxLayoutConstraints; + + if (windowCloseButton) + c->top.Below (windowCloseButton, 2); + else + c->top.SameAs (panel, wxTop, 2); + + c->right.SameAs (panel, wxRight, 2); + c->width.AsIs(); + c->height.AsIs(); + editButton->SetConstraints(c); + } + + valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER); + valueText->Enable(FALSE); + + wxLayoutConstraints *c = new wxLayoutConstraints; + + if (cancelButton) + c->left.RightOf (confirmButton, 2); + else + c->left.SameAs (panel, wxLeft, 2); + + if (windowCloseButton) + c->top.Below (windowCloseButton, 2); + else + c->top.SameAs (panel, wxTop, 2); + + if (editButton) + c->right.LeftOf (editButton, 2); + else + c->right.SameAs (panel, wxRight, 2); + c->height.AsIs(); + + valueText->SetConstraints(c); + + valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60)); + valueList->Show(FALSE); + + c = new wxLayoutConstraints; + + c->left.SameAs (panel, wxLeft, 2); + c->top.Below (valueText, 2); + c->right.SameAs (panel, wxRight, 2); + c->height.Absolute(60); + + valueList->SetConstraints(c); + + propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT, + wxPoint(-1, -1), wxSize(300, 300)); + propertyScrollingList->SetFont(boringFont); + + c = new wxLayoutConstraints; + + c->left.SameAs (panel, wxLeft, 2); + + if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD) + c->top.Below (valueText, 2); + else + c->top.Below (valueList, 2); + + c->right.SameAs (panel, wxRight, 2); + c->bottom.SameAs (panel, wxBottom, 2); + + propertyScrollingList->SetConstraints(c); + + // Note: if this is called now, it causes a GPF. + // Why? +// panel->Layout(); + + return TRUE; +} + +void wxPropertyListView::ShowTextControl(bool show) +{ + if (valueText) + valueText->Show(show); +} + +void wxPropertyListView::ShowListBoxControl(bool show) +{ + if (valueList) + { + valueList->Show(show); + if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD) + { + wxLayoutConstraints *constraints = propertyScrollingList->GetConstraints(); + if (constraints) + { + if (show) + constraints->top.Below(valueList, 2); + else + constraints->top.Below(valueText, 2); + propertyWindow->Layout(); + } + } + } +} + +void wxPropertyListView::EnableCheck(bool show) +{ + if (confirmButton) + confirmButton->Enable(show); +} + +void wxPropertyListView::EnableCross(bool show) +{ + if (cancelButton) + cancelButton->Enable(show); +} + +bool wxPropertyListView::OnClose(void) +{ + // Retrieve the value if any + wxCommandEvent event; + OnCheck(event); + + delete this; + return TRUE; +} + +void wxPropertyListView::OnValueListSelect(wxCommandEvent& event) +{ + if (currentProperty && currentValidator) + { + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + listValidator->OnValueListSelect(currentProperty, this, propertyWindow); + } +} + +void wxPropertyListView::OnOk(wxCommandEvent& event) +{ + // Retrieve the value if any + OnCheck(event); + + managedWindow->Close(TRUE); +} + +void wxPropertyListView::OnCancel(wxCommandEvent& event) +{ +// SetReturnCode(wxID_CANCEL); + managedWindow->Close(TRUE); + dialogCancelled = TRUE; +} + +void wxPropertyListView::OnHelp(wxCommandEvent& event) +{ +} + +void wxPropertyListView::OnCheck(wxCommandEvent& event) +{ + if (currentProperty) + { + RetrieveProperty(currentProperty); + } +} + +void wxPropertyListView::OnCross(wxCommandEvent& event) +{ + if (currentProperty && currentValidator) + { + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + // Revert to old value + listValidator->OnDisplayValue(currentProperty, this, propertyWindow); + } +} + +void wxPropertyListView::OnPropertyDoubleClick(wxCommandEvent& event) +{ + if (currentProperty && currentValidator) + { + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + // Revert to old value + listValidator->OnDoubleClick(currentProperty, this, propertyWindow); + } +} + +void wxPropertyListView::OnEdit(wxCommandEvent& event) +{ + if (currentProperty && currentValidator) + { + if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) + return; + + wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; + + listValidator->OnEdit(currentProperty, this, propertyWindow); + } +} + +void wxPropertyListView::OnText(wxCommandEvent& event) +{ + if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER) + { + OnCheck(event); + } +} + +/* + * Property dialog box + */ + +IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog) + +BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog) + EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel) +END_EVENT_TABLE() + +wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, + const wxString& title, const wxPoint& pos, + const wxSize& size, long style, const wxString& name): + wxDialog(parent, -1, title, pos, size, style, name) +{ + view = v; + view->AssociatePanel(this); + view->SetManagedWindow(this); + SetAutoLayout(TRUE); +} + +bool wxPropertyListDialog::OnClose(void) +{ + if (view) + { + SetReturnCode(wxID_CANCEL); + view->OnClose(); + view = NULL; + return TRUE; + } + else + return FALSE; +} + +void wxPropertyListDialog::OnCancel(wxCommandEvent& event) +{ + SetReturnCode(wxID_CANCEL); + this->Close(); +} + +void wxPropertyListDialog::OnDefaultAction(wxControl *item) +{ +/* + if (item == view->GetPropertyScrollingList()) + view->OnDoubleClick(); +*/ +} + +// Extend event processing to search the view's event table +bool wxPropertyListDialog::ProcessEvent(wxEvent& event) +{ + if ( !view || ! view->ProcessEvent(event) ) + return wxEvtHandler::ProcessEvent(event); + else + return TRUE; +} + +/* + * Property panel + */ + +IMPLEMENT_CLASS(wxPropertyListPanel, wxPanel) + +void wxPropertyListPanel::OnDefaultAction(wxControl *item) +{ +/* + if (item == view->GetPropertyScrollingList()) + view->OnDoubleClick(); +*/ +} + +// Extend event processing to search the view's event table +bool wxPropertyListPanel::ProcessEvent(wxEvent& event) +{ + if ( !view || ! view->ProcessEvent(event) ) + return wxEvtHandler::ProcessEvent(event); + else + return TRUE; +} + +/* + * Property frame + */ + +IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame) + +bool wxPropertyListFrame::OnClose(void) +{ + if (view) + return view->OnClose(); + else + return FALSE; +} + +wxPanel *wxPropertyListFrame::OnCreatePanel(wxFrame *parent, wxPropertyListView *v) +{ + return new wxPropertyListPanel(v, parent); +} + +bool wxPropertyListFrame::Initialize(void) +{ + propertyPanel = OnCreatePanel(this, view); + if (propertyPanel) + { + view->AssociatePanel(propertyPanel); + view->SetManagedWindow(this); + propertyPanel->SetAutoLayout(TRUE); + return TRUE; + } + else + return FALSE; +} + + /* + * Property list specific validator + */ + +IMPLEMENT_ABSTRACT_CLASS(wxPropertyListValidator, wxPropertyValidator) + +bool wxPropertyListValidator::OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ +// view->GetValueText()->Show(TRUE); + if (select) + OnDisplayValue(property, view, parentWindow); + + return TRUE; +} + +bool wxPropertyListValidator::OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + wxString s(view->GetValueList()->GetStringSelection()); + if (s != "") + { + view->GetValueText()->SetValue(s); + view->RetrieveProperty(property); + } + return TRUE; +} + +bool wxPropertyListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ +// view->GetValueText()->Show(TRUE); + wxString str(property->GetValue().GetStringRepresentation()); + + view->GetValueText()->SetValue(str.GetData()); + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxPropertyListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + return FALSE; +} + +void wxPropertyListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetDetailedEditing()) + view->EndDetailedEditing(); + else + view->BeginDetailedEditing(); +} + +bool wxPropertyListValidator::OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(FALSE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(FALSE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(FALSE); + return TRUE; +} + +/* + * Default validators + */ + +IMPLEMENT_DYNAMIC_CLASS(wxRealListValidator, wxPropertyListValidator) + +/// +/// Real number validator +/// +bool wxRealListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (realMin == 0.0 && realMax == 0.0) + return TRUE; + + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + + float val = 0.0; + if (!StringToFloat(WXSTRINGCAST value, &val)) + { + char buf[200]; + sprintf(buf, "Value %s is not a valid real number!", value.GetData()); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + + if (val < realMin || val > realMax) + { + char buf[200]; + sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxRealListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + + if (strlen(view->GetValueText()->GetValue()) == 0) + return FALSE; + + wxString value(view->GetValueText()->GetValue()); + float f = (float)atof(value.GetData()); + property->GetValue() = f; + return TRUE; +} + +bool wxRealListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(TRUE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(TRUE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(FALSE); + if (view->GetValueText()) + view->GetValueText()->Enable(TRUE); + return TRUE; +} + +/// +/// Integer validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxIntegerListValidator, wxPropertyListValidator) + +bool wxIntegerListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (integerMin == 0 && integerMax == 0) + return TRUE; + + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + + long val = 0; + if (!StringToLong(WXSTRINGCAST value, &val)) + { + char buf[200]; + sprintf(buf, "Value %s is not a valid integer!", value.GetData()); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + if (val < integerMin || val > integerMax) + { + char buf[200]; + sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax); + wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxIntegerListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + + if (strlen(view->GetValueText()->GetValue()) == 0) + return FALSE; + + wxString value(view->GetValueText()->GetValue()); + long val = (long)atoi(value.GetData()); + property->GetValue() = (long)val; + return TRUE; +} + +bool wxIntegerListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(TRUE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(TRUE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(FALSE); + if (view->GetValueText()) + view->GetValueText()->Enable(TRUE); + return TRUE; +} + +/// +/// boolean validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxBoolListValidator, wxPropertyListValidator) + +bool wxBoolListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + if (value != "True" && value != "False") + { + wxMessageBox("Value must be True or False!", "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxBoolListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + + if (strlen(view->GetValueText()->GetValue()) == 0) + return FALSE; + + wxString value(view->GetValueText()->GetValue()); + bool boolValue = FALSE; + if (value == "True") + boolValue = TRUE; + else + boolValue = FALSE; + property->GetValue() = (bool)boolValue; + return TRUE; +} + +bool wxBoolListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString str(property->GetValue().GetStringRepresentation()); + + view->GetValueText()->SetValue(str.GetData()); + view->GetValueList()->SetStringSelection(str.GetData()); + return TRUE; +} + +bool wxBoolListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(FALSE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(FALSE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(TRUE); + if (view->GetValueText()) + view->GetValueText()->Enable(FALSE); + return TRUE; +} + +bool wxBoolListValidator::OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetValueList()) + { + view->ShowListBoxControl(TRUE); + view->GetValueList()->Enable(TRUE); + + view->GetValueList()->Append("True"); + view->GetValueList()->Append("False"); + char *currentString = copystring(view->GetValueText()->GetValue()); + view->GetValueList()->SetStringSelection(currentString); + delete[] currentString; + } + return TRUE; +} + +bool wxBoolListValidator::OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetValueList()) + { + view->GetValueList()->Clear(); + view->ShowListBoxControl(FALSE); + view->GetValueList()->Enable(FALSE); + } + return TRUE; +} + +// Called when the property is double clicked. Extra functionality can be provided, +// cycling through possible values. +bool wxBoolListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + if (property->GetValue().BoolValue()) + property->GetValue() = (bool)FALSE; + else + property->GetValue() = (bool)TRUE; + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + return TRUE; +} + +/// +/// String validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxStringListValidator, wxPropertyListValidator) + +wxStringListValidator::wxStringListValidator(wxStringList *list, long flags): + wxPropertyListValidator(flags) +{ + strings = list; + // If no constraint, we just allow the string to be edited. + if (!strings && ((validatorFlags & wxPROP_ALLOW_TEXT_EDITING) == 0)) + validatorFlags |= wxPROP_ALLOW_TEXT_EDITING; +} + +bool wxStringListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!strings) + return TRUE; + + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + + if (!strings->Member(value.GetData())) + { + wxString s("Value "); + s += value.GetData(); + s += " is not valid."; + wxMessageBox(s.GetData(), "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); + return FALSE; + } + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxStringListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + property->GetValue() = value ; + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxStringListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString str(property->GetValue().GetStringRepresentation()); + view->GetValueText()->SetValue(str.GetData()); + if (strings) + { + view->GetValueList()->SetStringSelection(str.GetData()); + } + return TRUE; +} + +bool wxStringListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + // Unconstrained + if (!strings) + { + if (view->GetEditButton()) + view->GetEditButton()->Enable(FALSE); + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(TRUE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(TRUE); + if (view->GetValueText()) + view->GetValueText()->Enable(TRUE); + return TRUE; + } + + // Constrained + if (view->GetValueText()) + view->GetValueText()->Enable(FALSE); + + if (view->GetEditButton()) + view->GetEditButton()->Enable(TRUE); + + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(FALSE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(FALSE); + return TRUE; +} + +bool wxStringListValidator::OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetValueList()) + { + view->ShowListBoxControl(TRUE); + view->GetValueList()->Enable(TRUE); + wxNode *node = strings->First(); + while (node) + { + char *s = (char *)node->Data(); + view->GetValueList()->Append(s); + node = node->Next(); + } + char *currentString = property->GetValue().StringValue(); + view->GetValueList()->SetStringSelection(currentString); + } + return TRUE; +} + +bool wxStringListValidator::OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!strings) + { + return TRUE; + } + + if (view->GetValueList()) + { + view->GetValueList()->Clear(); + view->ShowListBoxControl(FALSE); + view->GetValueList()->Enable(FALSE); + } + return TRUE; +} + +// Called when the property is double clicked. Extra functionality can be provided, +// cycling through possible values. +bool wxStringListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + if (!strings) + return FALSE; + + wxNode *node = strings->First(); + char *currentString = property->GetValue().StringValue(); + while (node) + { + char *s = (char *)node->Data(); + if (strcmp(s, currentString) == 0) + { + char *nextString = NULL; + if (node->Next()) + nextString = (char *)node->Next()->Data(); + else + nextString = (char *)strings->First()->Data(); + property->GetValue() = wxString(nextString); + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + return TRUE; + } + else node = node->Next(); + } + return TRUE; +} + +/// +/// Filename validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxFilenameListValidator, wxPropertyListValidator) + +wxFilenameListValidator::wxFilenameListValidator(wxString message , wxString wildcard, long flags): + wxPropertyListValidator(flags), filenameWildCard(wildcard), filenameMessage(message) +{ +} + +wxFilenameListValidator::~wxFilenameListValidator(void) +{ +} + +bool wxFilenameListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxFilenameListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + property->GetValue() = value ; + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxFilenameListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString str(property->GetValue().GetStringRepresentation()); + view->GetValueText()->SetValue(str); + return TRUE; +} + +// Called when the property is double clicked. Extra functionality can be provided, +// cycling through possible values. +bool wxFilenameListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + OnEdit(property, view, parentWindow); + return TRUE; +} + +bool wxFilenameListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(TRUE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(TRUE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(TRUE); + if (view->GetValueText()) + view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); + return TRUE; +} + +void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return; + + char *s = wxFileSelector( + filenameMessage.GetData(), + wxPathOnly(property->GetValue().StringValue()), + wxFileNameFromPath(property->GetValue().StringValue()), + NULL, + filenameWildCard.GetData(), + 0, + parentWindow); + if (s) + { + property->GetValue() = wxString(s); + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + } +} + +/// +/// Colour validator +/// +IMPLEMENT_DYNAMIC_CLASS(wxColourListValidator, wxPropertyListValidator) + +wxColourListValidator::wxColourListValidator(long flags): + wxPropertyListValidator(flags) +{ +} + +wxColourListValidator::~wxColourListValidator(void) +{ +} + +bool wxColourListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxColourListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString value(view->GetValueText()->GetValue()); + + property->GetValue() = value ; + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself +bool wxColourListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString str(property->GetValue().GetStringRepresentation()); + view->GetValueText()->SetValue(str); + return TRUE; +} + +// Called when the property is double clicked. Extra functionality can be provided, +// cycling through possible values. +bool wxColourListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + OnEdit(property, view, parentWindow); + return TRUE; +} + +bool wxColourListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(TRUE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(TRUE); + if (view->GetEditButton()) + view->GetEditButton()->Enable(TRUE); + if (view->GetValueText()) + view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); + return TRUE; +} + +void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return; + + char *s = property->GetValue().StringValue(); + int r = 0; + int g = 0; + int b = 0; + if (s) + { + r = wxHexToDec(s); + g = wxHexToDec(s+2); + b = wxHexToDec(s+4); + } + + wxColour col(r,g,b); + + wxColourData data; + data.SetChooseFull(TRUE); + data.SetColour(col); + + for (int i = 0; i < 16; i++) + { + wxColour colour(i*16, i*16, i*16); + data.SetCustomColour(i, colour); + } + + wxColourDialog dialog(parentWindow, &data); + if (dialog.ShowModal() != wxID_CANCEL) + { + wxColourData retData = dialog.GetColourData(); + col = retData.GetColour(); + + char buf[7]; + wxDecToHex(col.Red(), buf); + wxDecToHex(col.Green(), buf+2); + wxDecToHex(col.Blue(), buf+4); + + property->GetValue() = wxString(buf); + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + } +} + +/// +/// List of strings validator. For this we need more user interface than +/// we get with a property list; so create a new dialog for editing the list. +/// +IMPLEMENT_DYNAMIC_CLASS(wxListOfStringsListValidator, wxPropertyListValidator) + +wxListOfStringsListValidator::wxListOfStringsListValidator(long flags): + wxPropertyListValidator(flags) +{ +} + +bool wxListOfStringsListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + // No constraints for an arbitrary, user-editable list of strings. + return TRUE; +} + +// Called when TICK is pressed or focus is lost or view wants to update +// the property list. +// Does the transferance from the property editing area to the property itself. +// In this case, the user cannot directly edit the string list. +bool wxListOfStringsListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + return TRUE; +} + +bool wxListOfStringsListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (!view->GetValueText()) + return FALSE; + wxString str(property->GetValue().GetStringRepresentation()); + view->GetValueText()->SetValue(str.GetData()); + return TRUE; +} + +bool wxListOfStringsListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + if (view->GetEditButton()) + view->GetEditButton()->Enable(TRUE); + if (view->GetValueText()) + view->GetValueText()->Enable(FALSE); + + if (view->GetConfirmButton()) + view->GetConfirmButton()->Enable(FALSE); + if (view->GetCancelButton()) + view->GetCancelButton()->Enable(FALSE); + return TRUE; +} + +// Called when the property is double clicked. Extra functionality can be provided, +// cycling through possible values. +bool wxListOfStringsListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + OnEdit(property, view, parentWindow); + return TRUE; +} + +void wxListOfStringsListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) +{ + // Convert property value to a list of strings for editing + wxStringList *stringList = new wxStringList; + + wxPropertyValue *expr = property->GetValue().GetFirst(); + while (expr) + { + char *s = expr->StringValue(); + if (s) + stringList->Add(s); + expr = expr->GetNext(); + } + + wxString title("Editing "); + title += property->GetName(); + + if (EditStringList(parentWindow, stringList, title.GetData())) + { + wxPropertyValue& oldValue = property->GetValue(); + oldValue.ClearList(); + wxNode *node = stringList->First(); + while (node) + { + char *s = (char *)node->Data(); + oldValue.Append(new wxPropertyValue(s)); + + node = node->Next(); + } + + view->DisplayProperty(property); + view->UpdatePropertyDisplayInList(property); + view->OnPropertyChanged(property); + } + delete stringList; +} + +class wxPropertyStringListEditorDialog: public wxDialog +{ + public: + wxStringList *stringList; + wxListBox *listBox; + wxTextCtrl *stringText; + static bool dialogCancelled; + int currentSelection; + wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = "stringEditorDialogBox"): + wxDialog(parent, -1, title, pos, size, windowStyle, name) + { + stringList = NULL; + stringText = NULL; + listBox = NULL; + dialogCancelled = FALSE; + currentSelection = -1; + } + ~wxPropertyStringListEditorDialog(void) {} + bool OnClose(void); + void SaveCurrentSelection(void); + void ShowCurrentSelection(void); + + void OnOK(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + void OnAdd(wxCommandEvent& event); + void OnDelete(wxCommandEvent& event); + void OnStrings(wxCommandEvent& event); + void OnText(wxCommandEvent& event); + +DECLARE_EVENT_TABLE() +}; + +#define wxID_PROP_SL_ADD 3000 +#define wxID_PROP_SL_DELETE 3001 +#define wxID_PROP_SL_STRINGS 3002 +#define wxID_PROP_SL_TEXT 3003 + +BEGIN_EVENT_TABLE(wxPropertyStringListEditorDialog, wxDialog) + EVT_BUTTON(wxID_OK, wxPropertyStringListEditorDialog::OnOK) + EVT_BUTTON(wxID_CANCEL, wxPropertyStringListEditorDialog::OnCancel) + EVT_BUTTON(wxID_PROP_SL_ADD, wxPropertyStringListEditorDialog::OnAdd) + EVT_BUTTON(wxID_PROP_SL_DELETE, wxPropertyStringListEditorDialog::OnDelete) + EVT_LISTBOX(wxID_PROP_SL_STRINGS, wxPropertyStringListEditorDialog::OnStrings) + EVT_TEXT(wxID_PROP_SL_TEXT, wxPropertyStringListEditorDialog::OnText) +END_EVENT_TABLE() + +class wxPropertyStringListEditorText: public wxTextCtrl +{ + public: + wxPropertyStringListEditorText(wxWindow *parent, wxWindowID id, const wxString& val, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long windowStyle = 0, const wxString& name = "text"): + wxTextCtrl(parent, id, val, pos, size, windowStyle, wxDefaultValidator, name) + { + } + void OnKillFocus(void) + { + wxPropertyStringListEditorDialog *dialog = (wxPropertyStringListEditorDialog *)GetParent(); + dialog->SaveCurrentSelection(); + } +}; + +bool wxPropertyStringListEditorDialog::dialogCancelled = FALSE; + +// Edit the string list. +bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const char *title) +{ + wxBeginBusyCursor(); + wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent, + title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); + + dialog->stringList = stringList; + + wxButton *okButton = new wxButton(dialog, wxID_OK, "OK", wxPoint(5, 5)); + wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, "Cancel", wxPoint(40, 5)); + +// wxButton *helpButton = new wxButton(dialog, (wxFunction)StringListEditorHelpProc, "Help"); +// helpButton->SetClientData((char *)this); + + dialog->listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS, + wxPoint(5, 30), wxSize(300, 200), 0, NULL, wxLB_SINGLE); + + dialog->stringText = new wxPropertyStringListEditorText(dialog, + wxID_PROP_SL_TEXT, "", wxPoint(5, 240), + wxSize(300, -1), wxPROCESS_ENTER); + dialog->stringText->Enable(FALSE); + + wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, "Add", wxPoint(5, 280)); + wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, "Delete", wxPoint(40, 280)); + + wxNode *node = stringList->First(); + while (node) + { + char *str = (char *)node->Data(); + // Save node as client data for each listbox item + dialog->listBox->Append(str, (char *)node); + node = node->Next(); + } + + dialog->SetClientSize(310, 305); + + dialog->Centre(wxBOTH); + wxEndBusyCursor(); + if (dialog->ShowModal() == wxID_CANCEL) + return FALSE; + else + return TRUE; +} + +/* + * String list editor callbacks + * + */ + +void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& event) +{ + int sel = listBox->GetSelection(); + if (sel > -1) + { + currentSelection = sel; + + ShowCurrentSelection(); + } +} + +void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& event) +{ + int sel = listBox->GetSelection(); + if (sel == -1) + return; + + wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(sel); + if (!node) + return; + + listBox->Delete(sel); + delete[] (char *)node->Data(); + delete node; + currentSelection = -1; + stringText->SetValue(""); +} + +void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& event) +{ + SaveCurrentSelection(); + + char *initialText = ""; + wxNode *node = stringList->Add(initialText); + listBox->Append(initialText, (char *)node); + currentSelection = stringList->Number() - 1; + listBox->SetSelection(currentSelection); + ShowCurrentSelection(); + stringText->SetFocus(); +} + +void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& event) +{ + SaveCurrentSelection(); + EndModal(wxID_OK); + Close(TRUE); +} + +void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& event) +{ + dialogCancelled = TRUE; + EndModal(wxID_CANCEL); + Close(TRUE); +} + +void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event) +{ + if (event.GetEventType() == wxEVENT_TYPE_TEXT_ENTER_COMMAND) + { + SaveCurrentSelection(); + } +} + +bool wxPropertyStringListEditorDialog::OnClose(void) +{ + SaveCurrentSelection(); + return TRUE; +} + +void wxPropertyStringListEditorDialog::SaveCurrentSelection(void) +{ + if (currentSelection == -1) + return; + + wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection); + if (!node) + return; + + wxString txt(stringText->GetValue()); + if (node->Data()) + delete[] (char *)node->Data(); + node->SetData((wxObject *)copystring(txt)); + + listBox->SetString(currentSelection, (char *)node->Data()); +} + +void wxPropertyStringListEditorDialog::ShowCurrentSelection(void) +{ + if (currentSelection == -1) + { + stringText->SetValue(""); + return; + } + wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection); + char *txt = (char *)node->Data(); + stringText->SetValue(txt); + stringText->Enable(TRUE); +} diff --git a/utils/wxprop/src/proplist.h b/utils/wxprop/src/proplist.h new file mode 100644 index 0000000000..15f1243458 --- /dev/null +++ b/utils/wxprop/src/proplist.h @@ -0,0 +1,539 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: proplist.h +// Purpose: Property list classes +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + + /* + + TO DO: + + (1) Optional popup-help for each item, and an optional Help button + for dialog. + + (2) Align Ok, Cancel, Help buttons properly. + + (3) Consider retrieving the rectangle on the panel that can be + drawn into (where the value listbox is) and giving an example + of editing graphically. May be too fancy. + + (4) Deriveable types for wxPropertyValue => may need to reorganise + wxPropertyValue to use inheritance rather than present all-types-in-one + scheme. + + (5) Optional popup panel for value list, perhaps. + + (6) Floating point checking routine still crashes with Floating + point error for zany input. + + (7) Property sheet with choice (or listbox) to select alternative + sheets... multiple views per panel, only one active. For this + we really need a wxChoice that can be dynamically set: XView + may be a problem; Motif? + + (8) More example validators, e.g. colour selector. + */ + +#ifndef _PROPLIST_H_ +#define _PROPLIST_H_ + +#ifdef __GNUG__ +#pragma interface "proplist.h" +#endif + +#include "prop.h" + +#define wxPROP_BUTTON_CLOSE 1 +#define wxPROP_BUTTON_OK 2 +#define wxPROP_BUTTON_CANCEL 4 +#define wxPROP_BUTTON_CHECK_CROSS 8 +#define wxPROP_BUTTON_HELP 16 +#define wxPROP_DYNAMIC_VALUE_FIELD 32 +#define wxPROP_PULLDOWN 64 +#define wxPROP_SHOWVALUES 128 + +#ifdef __XVIEW__ +#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN +#else +#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | wxPROP_SHOWVALUES +#endif + +#define wxID_PROP_CROSS 3000 +#define wxID_PROP_CHECK 3001 +#define wxID_PROP_EDIT 3002 +#define wxID_PROP_TEXT 3003 +#define wxID_PROP_SELECT 3004 +#define wxID_PROP_VALUE_SELECT 3005 + +// Mediates between a physical panel and the property sheet +class wxPropertyListView: public wxPropertyView +{ + DECLARE_DYNAMIC_CLASS(wxPropertyListView) + protected: + wxListBox *propertyScrollingList; + wxListBox *valueList; // Should really be a combobox, but we don't have one. + wxTextCtrl *valueText; + wxButton *confirmButton; // A tick, as in VB + wxButton *cancelButton; // A cross, as in VB + wxButton *editButton; // Invokes the custom validator, if any + + bool detailedEditing; // E.g. using listbox for choices + + static wxBitmap *tickBitmap; + static wxBitmap *crossBitmap; + + wxPanel *propertyWindow; // Panel that the controls will appear on + wxWindow *managedWindow; // Frame or dialog + + wxButton *windowCloseButton; // Or OK + wxButton *windowCancelButton; + wxButton *windowHelpButton; + public: + static bool dialogCancelled; + + wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT); + ~wxPropertyListView(void); + + // Associates and shows the view + virtual void ShowView(wxPropertySheet *propertySheet, wxPanel *panel); + + // Update this view of the viewed object, called e.g. by + // the object itself. + virtual bool OnUpdateView(void); + + wxString MakeNameValueString(wxString name, wxString value); + + // Update a single line in the list of properties + virtual bool UpdatePropertyDisplayInList(wxProperty *property); + + // Update the whole list + virtual bool UpdatePropertyList(bool clearEditArea = TRUE); + + // Find the wxListBox index corresponding to this property + virtual int FindListIndexForProperty(wxProperty *property); + + // Select and show string representation in editor the given + // property. NULL resets to show no property. + virtual bool ShowProperty(wxProperty *property, bool select = TRUE); + virtual bool EditProperty(wxProperty *property); + + // Update the display from the property + virtual bool DisplayProperty(wxProperty *property); + // Update the property from the display + virtual bool RetrieveProperty(wxProperty *property); + + // Find appropriate validator and load property into value controls + virtual bool BeginShowingProperty(wxProperty *property); + // Find appropriate validator and unload property from value controls + virtual bool EndShowingProperty(wxProperty *property); + + // Begin detailed editing (e.g. using value listbox) + virtual void BeginDetailedEditing(void); + + // End detailed editing (e.g. using value listbox) + virtual void EndDetailedEditing(void); + + // Called by the property listbox + void OnPropertySelect(wxCommandEvent& event); + + // Called by the value listbox + void OnValueListSelect(wxCommandEvent& event); + + virtual bool CreateControls(void); + virtual void ShowTextControl(bool show); + virtual void ShowListBoxControl(bool show); + virtual void EnableCheck(bool show); + virtual void EnableCross(bool show); + + void OnOk(wxCommandEvent& event); + void OnCancel(wxCommandEvent& event); + void OnHelp(wxCommandEvent& event); + void OnPropertyDoubleClick(wxCommandEvent& event); +// virtual void OnDoubleClick(void); + + void OnCheck(wxCommandEvent& event); + void OnCross(wxCommandEvent& event); + void OnEdit(wxCommandEvent& event); + void OnText(wxCommandEvent& event); + + inline virtual wxListBox *GetPropertyScrollingList() { return propertyScrollingList; } + inline virtual wxListBox *GetValueList() { return valueList; } + inline virtual wxTextCtrl *GetValueText() { return valueText; } + inline virtual wxButton *GetConfirmButton() { return confirmButton; } + inline virtual wxButton *GetCancelButton() { return cancelButton; } + inline virtual wxButton *GetEditButton() { return editButton; } + inline virtual bool GetDetailedEditing(void) { return detailedEditing; } + + inline virtual void AssociatePanel(wxPanel *win) { propertyWindow = win; } + inline virtual wxPanel *GetPanel(void) { return propertyWindow; } + + inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; } + inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; } + + inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; } + inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; } + inline virtual wxButton *GetHelpButton() { return windowHelpButton; } + + bool OnClose(void); + +DECLARE_EVENT_TABLE() +}; + +class wxPropertyTextEdit: public wxTextCtrl +{ + DECLARE_CLASS(wxPropertyTextEdit) + public: + wxPropertyListView *view; + wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id, + const wxString& value, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text"); + void OnSetFocus(void); + void OnKillFocus(void); +}; + +#define wxPROP_ALLOW_TEXT_EDITING 1 + +/* + * The type of validator used for property lists (Visual Basic style) + */ + +class wxPropertyListValidator: public wxPropertyValidator +{ + DECLARE_DYNAMIC_CLASS(wxPropertyListValidator) + protected: + public: + wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { } + ~wxPropertyListValidator(void) {} + + // Called when the property is selected or deselected: typically displays the value + // in the edit control (having chosen a suitable control to display: (non)editable text or listbox) + virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the property is double clicked. Extra functionality can be provided, such as + // cycling through possible values. + inline virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) + { return TRUE; } + + // Called when the value listbox is selected. Default behaviour is to copy + // string to text control, and retrieve the value into the property. + virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the property value is edited using standard text control + virtual bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) + { + return TRUE; + } + + virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the property is edited in detail + virtual bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) + { + return TRUE; + } + + // Called if focus lost, IF we're in a modeless property editing situation. + virtual bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) + { + return TRUE; + } + + // Called when the edit (...) button is pressed. The default implementation + // calls view->BeginDetailedEditing; the filename validator (for example) overrides + // this function to show the file selector. + virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + virtual bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) + { return TRUE; } + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transferance from the property editing area to the property itself + virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +/* + * A default dialog box class to use. + */ + +class wxPropertyListDialog: public wxDialog +{ + DECLARE_CLASS(wxPropertyListDialog) + private: + wxPropertyListView *view; + public: + wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); + bool OnClose(void); + void OnDefaultAction(wxControl *item); + void OnCancel(wxCommandEvent& event); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); + +DECLARE_EVENT_TABLE() +}; + +/* + * A default panel class to use. + */ + +class wxPropertyListPanel: public wxPanel +{ + DECLARE_CLASS(wxPropertyListPanel) + private: + wxPropertyListView *view; + public: + wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, const wxString& name = "panel"): + wxPanel(parent, -1, pos, size, style, name) + { + view = v; + } + void OnDefaultAction(wxControl *item); + + // Extend event processing to search the view's event table + virtual bool ProcessEvent(wxEvent& event); +}; + +/* + * A default frame class to use. + */ + +class wxPropertyListFrame: public wxFrame +{ + DECLARE_CLASS(wxPropertyListFrame) + private: + wxPropertyListView *view; + wxPanel *propertyPanel; + public: + wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME, const wxString& name = "frame"): + wxFrame(parent, -1, title, pos, size, style, name) + { + view = v; + propertyPanel = NULL; + } + bool OnClose(void); + + // Must call this to create panel and associate view + virtual bool Initialize(void); + virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); + inline virtual wxPanel *GetPropertyPanel(void) { return propertyPanel; } +}; + +/* + * Some default validators + */ + +class wxRealListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxRealListValidator) + protected: + float realMin; + float realMax; + public: + // 0.0, 0.0 means no range + wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) + { + realMin = min; realMax = max; + } + ~wxRealListValidator(void) {} + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transfer from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +class wxIntegerListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxIntegerListValidator) + protected: + long integerMin; + long integerMax; + public: + // 0, 0 means no range + wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) + { + integerMin = min; integerMax = max; + } + ~wxIntegerListValidator(void) {} + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transfer from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +class wxBoolListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxBoolListValidator) + protected: + public: + wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags) + { + } + ~wxBoolListValidator(void) {} + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transfer from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the property is double clicked. Extra functionality can be provided, + // cycling through possible values. + virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +class wxStringListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxStringListValidator) + protected: + wxStringList *strings; + public: + wxStringListValidator(wxStringList *list = NULL, long flags = 0); + + ~wxStringListValidator(void) + { + if (strings) + delete strings; + } + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transfer from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the property is double clicked. Extra functionality can be provided, + // cycling through possible values. + bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +class wxFilenameListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxFilenameListValidator) + protected: + wxString filenameWildCard; + wxString filenameMessage; + + public: + wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0); + + ~wxFilenameListValidator(void); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transferance from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the edit (...) button is pressed. + void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +class wxColourListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxColourListValidator) + protected: + public: + wxColourListValidator(long flags = 0); + + ~wxColourListValidator(void); + + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the edit (...) button is pressed. + void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +class wxListOfStringsListValidator: public wxPropertyListValidator +{ + DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator) + protected: + public: + wxListOfStringsListValidator(long flags = 0); + + ~wxListOfStringsListValidator(void) + { + } + + bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost. + // Return FALSE if value didn't check out; signal to restore old value. + bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when TICK is pressed or focus is lost or view wants to update + // the property list. + // Does the transfer from the property editing area to the property itself + bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + // Called when the property is double clicked. + bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); + + bool EditStringList(wxWindow *parent, wxStringList *stringList, const char *title = "String List Editor"); + + // Called when the edit (...) button is pressed. + void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); +}; + +#endif + diff --git a/utils/wxprop/src/test.cpp b/utils/wxprop/src/test.cpp new file mode 100644 index 0000000000..267dfdab74 --- /dev/null +++ b/utils/wxprop/src/test.cpp @@ -0,0 +1,321 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: test.cpp +// Purpose: Property sheet test implementation +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "test.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +#include "test.h" + +// A macro needed for some compilers (AIX) that need 'main' to be defined +// in the application itself. +IMPLEMENT_WXWIN_MAIN + +IMPLEMENT_APP(MyApp) + +wxPropertyValidatorRegistry myListValidatorRegistry; +wxPropertyValidatorRegistry myFormValidatorRegistry; + +MyApp::MyApp(void) +{ + m_childWindow = NULL; + m_mainFrame = NULL; +} + +bool MyApp::OnInit(void) +{ + RegisterValidators(); + + // Create the main frame window + m_mainFrame = new MyFrame(NULL, "wxPropertySheet Demo", wxPoint(0, 0), wxSize(300, 400), wxDEFAULT_FRAME); + + // Make a menubar + wxMenu *file_menu = new wxMenu; + file_menu->Append(PROPERTY_TEST_DIALOG_LIST, "Test property list &dialog..."); + file_menu->Append(PROPERTY_TEST_FRAME_LIST, "Test property list &frame..."); + file_menu->AppendSeparator(); + file_menu->Append(PROPERTY_TEST_DIALOG_FORM, "Test property form d&ialog..."); + file_menu->Append(PROPERTY_TEST_FRAME_FORM, "Test property form f&rame..."); + file_menu->AppendSeparator(); + file_menu->Append(PROPERTY_QUIT, "E&xit"); + + wxMenu *help_menu = new wxMenu; + help_menu->Append(PROPERTY_ABOUT, "&About"); + + wxMenuBar *menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); + menu_bar->Append(help_menu, "&Help"); + + // Associate the menu bar with the frame + m_mainFrame->SetMenuBar(menu_bar); + + m_mainFrame->Centre(wxBOTH); + m_mainFrame->Show(TRUE); + + SetTopWindow(m_mainFrame); + + return TRUE; +} + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_CLOSE(MyFrame::OnCloseWindow) + EVT_MENU(PROPERTY_QUIT, MyFrame::OnQuit) + EVT_MENU(PROPERTY_ABOUT, MyFrame::OnAbout) + EVT_MENU(PROPERTY_TEST_DIALOG_LIST, MyFrame::OnDialogList) + EVT_MENU(PROPERTY_TEST_FRAME_LIST, MyFrame::OnFrameList) + EVT_MENU(PROPERTY_TEST_DIALOG_FORM, MyFrame::OnDialogForm) + EVT_MENU(PROPERTY_TEST_FRAME_FORM, MyFrame::OnFrameForm) +END_EVENT_TABLE() + +// Define my frame constructor +MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type): + wxFrame(frame, -1, title, pos, size, type) +{ +} + +// Define the behaviour for the frame closing +// - must delete all frames except for the main one. +void MyFrame::OnCloseWindow(wxCloseEvent& event) +{ + if (wxGetApp().m_childWindow) + { + wxGetApp().m_childWindow->Close(TRUE); + } + + Destroy(); +} + +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyFrame::OnDialogList(wxCommandEvent& event) +{ + wxGetApp().PropertyListTest(TRUE); +} + +void MyFrame::OnFrameList(wxCommandEvent& event) +{ + wxGetApp().PropertyListTest(FALSE); +} + +void MyFrame::OnDialogForm(wxCommandEvent& event) +{ + wxGetApp().PropertyFormTest(TRUE); +} + +void MyFrame::OnFrameForm(wxCommandEvent& event) +{ + wxGetApp().PropertyFormTest(FALSE); +} + +void MyFrame::OnAbout(wxCommandEvent& event) +{ + (void)wxMessageBox("Property Classes Demo\nAuthor: Julian Smart", "About Property Classes Test"); +} + +void MyApp::RegisterValidators(void) +{ + myListValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator); + myListValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator); + myListValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator); + myListValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator); + myListValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator); + + myFormValidatorRegistry.RegisterValidator((wxString)"real", new wxRealFormValidator); + myFormValidatorRegistry.RegisterValidator((wxString)"string", new wxStringFormValidator); + myFormValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerFormValidator); + myFormValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolFormValidator); +} + +void MyApp::PropertyListTest(bool useDialog) +{ + if (m_childWindow) + return; + + wxPropertySheet *sheet = new wxPropertySheet; + + sheet->AddProperty(new wxProperty("fred", 1.0, "real")); + sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); + sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50))); + sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); + sheet->AddProperty(new wxProperty("julian", "one", "string")); + sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); + wxStringList *strings = new wxStringList("one", "two", "three", NULL); + sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); + + wxStringList *strings2 = new wxStringList("earth", "fire", "wind", "water", NULL); + sheet->AddProperty(new wxProperty("string list", strings2, "stringlist")); + + wxPropertyListView *view = + new wxPropertyListView(NULL, + wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); + + wxDialog *propDialog = NULL; + wxPropertyListFrame *propFrame = NULL; + if (useDialog) + { + propDialog = new PropListDialog(view, NULL, "Property Sheet Test", + wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS); + m_childWindow = propDialog; + } + else + { + propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500)); + m_childWindow = propFrame; + } + + view->AddRegistry(&myListValidatorRegistry); + + if (useDialog) + { + view->ShowView(sheet, propDialog); + propDialog->Centre(wxBOTH); + propDialog->Show(TRUE); + } + else + { + propFrame->Initialize(); + view->ShowView(sheet, propFrame->GetPropertyPanel()); + + propFrame->Centre(wxBOTH); + propFrame->Show(TRUE); + } +} + +void MyApp::PropertyFormTest(bool useDialog) +{ + if (m_childWindow) + return; + +#if 0 + wxPropertySheet *sheet = new wxPropertySheet; + + sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0))); + sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); + sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); + sheet->AddProperty(new wxProperty("julian", "one", "string")); + wxStringList *strings = new wxStringList("one", "two", "three", NULL); + sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); + + wxPropertyFormView *view = new wxPropertyFormView(NULL); + + wxDialogBox *propDialog = NULL; + wxPropertyFormFrame *propFrame = NULL; + if (useDialog) + { + propDialog = new PropFormDialog(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(380, 250), + wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); + m_childWindow = propDialog; + } + else + { + propFrame = new PropFormFrame(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(280, 250)); + propFrame->Initialize(); + m_childWindow = propFrame; + } + + wxPanel *panel = propDialog ? propDialog : propFrame->GetPropertyPanel(); + panel->SetLabelPosition(wxVERTICAL); + + // Add items to the panel + + (void) new wxButton(panel, -1, "OK", -1, -1, -1, -1, 0, "ok"); + (void) new wxButton(panel, -1, "Cancel", -1, -1, 80, -1, 0, "cancel"); + (void) new wxButton(panel, -1, "Update", -1, -1, 80, -1, 0, "update"); + (void) new wxButton(panel, -1, "Revert", -1, -1, -1, -1, 0, "revert"); + panel->NewLine(); + + // The name of this text item matches the "fred" property + (void) new wxText(panel, -1, "Fred", "", -1, -1, 90, -1, 0, "fred"); + (void) new wxCheckBox(panel, -1, "Yes or no", -1, -1, -1, -1, 0, "tough choice"); + (void) new wxSlider(panel, -1, "Scale", 0, -50, 50, 150, -1, -1, wxHORIZONTAL, "ian"); + panel->NewLine(); + (void) new wxListBox(panel, -1, "Constrained", wxSINGLE, -1, -1, 100, 90, 0, NULL, 0, "constrained"); + + view->AddRegistry(&myFormValidatorRegistry); + + if (useDialog) + { + view->ShowView(sheet, propDialog); + view->AssociateNames(); + view->TransferToDialog(); + propDialog->Centre(wxBOTH); + propDialog->Show(TRUE); + } + else + { + view->ShowView(sheet, propFrame->GetPropertyPanel()); + view->AssociateNames(); + view->TransferToDialog(); + propFrame->Centre(wxBOTH); + propFrame->Show(TRUE); + } +#endif +} + +BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame) + EVT_CLOSE(PropListFrame::OnCloseWindow) +END_EVENT_TABLE() + +void PropListFrame::OnCloseWindow(wxCloseEvent& event) +{ + wxGetApp().m_childWindow = NULL; + + wxPropertyListFrame::OnCloseWindow(event); +} + +BEGIN_EVENT_TABLE(PropListDialog, wxPropertyListDialog) + EVT_CLOSE(PropListDialog::OnCloseWindow) +END_EVENT_TABLE() + +void PropListDialog::OnCloseWindow(wxCloseEvent& event) +{ + wxGetApp().m_childWindow = NULL; + + wxPropertyListDialog::OnCloseWindow(event); +} + +BEGIN_EVENT_TABLE(PropFormFrame, wxPropertyFormFrame) + EVT_CLOSE(PropFormFrame::OnCloseWindow) +END_EVENT_TABLE() + +void PropFormFrame::OnCloseWindow(wxCloseEvent& event) +{ + wxGetApp().m_childWindow = NULL; + + wxPropertyFormFrame::OnCloseWindow(event); +} + +BEGIN_EVENT_TABLE(PropFormDialog, wxPropertyFormDialog) + EVT_CLOSE(PropFormDialog::OnCloseWindow) +END_EVENT_TABLE() + +void PropFormDialog::OnCloseWindow(wxCloseEvent& event) +{ + wxGetApp().m_childWindow = NULL; + + wxPropertyFormDialog::OnCloseWindow(event); +} + diff --git a/utils/wxprop/src/test.def b/utils/wxprop/src/test.def new file mode 100644 index 0000000000..d94e329083 --- /dev/null +++ b/utils/wxprop/src/test.def @@ -0,0 +1,8 @@ +NAME TEST +DESCRIPTION 'wxProperty test' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 8192 diff --git a/utils/wxprop/src/test.h b/utils/wxprop/src/test.h new file mode 100644 index 0000000000..3e8bd88df0 --- /dev/null +++ b/utils/wxprop/src/test.h @@ -0,0 +1,127 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: test.h +// Purpose: Property sheet sample +// Author: Julian Smart +// Modified by: +// Created: 04/01/98 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma interface "test.h" +#endif + +#ifndef _PROPTEST_H_ +#define _PROPTEST_H_ + +#include "proplist.h" +#include "propform.h" + +class MyChild; + +// Define a new application +class MyFrame; +class MyApp: public wxApp +{ +public: + MyApp(void); + bool OnInit(void); + + void RegisterValidators(void); + void PropertyListTest(bool useDialog); + void PropertyFormTest(bool useDialog); + + MyFrame* m_mainFrame; + wxWindow* m_childWindow; +}; + +DECLARE_APP(MyApp) + +// Define a new frame +class MyFrame: public wxFrame +{ + public: + MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type); + + void OnCloseWindow(wxCloseEvent& event); + void OnQuit(wxCommandEvent& event); + void OnDialogList(wxCommandEvent& event); + void OnFrameList(wxCommandEvent& event); + void OnDialogForm(wxCommandEvent& event); + void OnFrameForm(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + +DECLARE_EVENT_TABLE() +}; + +class PropListFrame: public wxPropertyListFrame +{ +public: + PropListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME, const wxString& name = "frame"): + wxPropertyListFrame(v, parent, title, pos, size, style, name) + { + } + + void OnCloseWindow(wxCloseEvent& event); + + DECLARE_EVENT_TABLE() +}; + +class PropListDialog: public wxPropertyListDialog +{ +public: + PropListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"): + wxPropertyListDialog(v, parent, title, pos, size, style, name) + { + } + + void OnCloseWindow(wxCloseEvent& event); + + DECLARE_EVENT_TABLE() +}; + +class PropFormFrame: public wxPropertyFormFrame +{ +public: + PropFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME, const wxString& name = "frame"): + wxPropertyFormFrame(v, parent, title, pos, size, style, name) + { + } + + void OnCloseWindow(wxCloseEvent& event); + + DECLARE_EVENT_TABLE() +}; + +class PropFormDialog: public wxPropertyFormDialog +{ +public: + PropFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, + const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"): + wxPropertyFormDialog(v, parent, title, pos, size, style, name) + { + } + + void OnCloseWindow(wxCloseEvent& event); + + DECLARE_EVENT_TABLE() +}; + +#define PROPERTY_QUIT 1 +#define PROPERTY_ABOUT 2 +#define PROPERTY_TEST_DIALOG_LIST 3 +#define PROPERTY_TEST_FRAME_LIST 4 +#define PROPERTY_TEST_DIALOG_FORM 5 +#define PROPERTY_TEST_FRAME_FORM 6 + +#endif + diff --git a/utils/wxprop/src/test.rc b/utils/wxprop/src/test.rc new file mode 100644 index 0000000000..80e490e9f1 --- /dev/null +++ b/utils/wxprop/src/test.rc @@ -0,0 +1,8 @@ +wxSTD_MDIPARENTFRAME ICON "aiai.ico" +aiai_icn ICON "aiai.ico" + +tick_bmp BITMAP "tick.bmp" +cross_bmp BITMAP "cross.bmp" + +#include "wx/msw/wx.rc" + diff --git a/utils/wxprop/src/tick.bmp b/utils/wxprop/src/tick.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3673eda5de62c1fc3db392cba62bc2e74ad51d90 GIT binary patch literal 198 zcmZvT!3}^g3_|a<9syhMs~1$ShPC0%zsoR vTD4Ar8P!@-DTScB)%%zLZ&*;|h`