Applied [ 594925 ] Implement wxArtProvider and XRC together
authorJulian Smart <julian@anthemion.co.uk>
Fri, 16 Aug 2002 11:24:46 +0000 (11:24 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 16 Aug 2002 11:24:46 +0000 (11:24 +0000)
commitaf1337b041be734b7e64bcf7a06086268ae6895e
tree38b94173fcd6cceeda2a4ec1b73c80bc720d7e48
parentcff81649d666f1160f2aff42a94aa96ca0806e06
Applied [ 594925 ] Implement wxArtProvider and XRC together
By Robert O'Connor (robertoconnor)

This patch is a draft which successfully allows a wxArtProvider to serve out icons to bitmaps for XRC files.

The syntax to use a wxArtProvider bitmap is:
<bitmap stock_id="wxART_INFORMATION" stock_client="wxART_TOOLBAR">somefallbackicon.png</bitmap>

The bitmap is optional, and will only be used as a fallback image, if the wxArtProvider returned a wxNullBitmap for some reason.

The client attribute, if not specified, currently will be wxART_OTHER. Perhaps there should be a guessing heuristic of it being in a menu node to call wxART_MENU.

Usage of XRC resouces and wxArtProvider together can be seen in an updated /contrib/samples/xrc demo, which is a separate patch.

Search the wx-dev mailing lists for "wxArtProvider" and "XRC" for the full discussions on this feature's API design.

Applied patch [ 594932 ] Extended XRC XML resources sample
By Robert O'Connor (robertoconnor)

This is a more comprehensive introduction to how to get up and running using XRC in your new wxWindows project.

It describes both the basics (for new users) and advanced features. It consists of a demo of dialogs and frames loaded from XRC. Each dialog has a textctrl at the top of the dialog, which walks the new user through that feature.

There are 8 demos:

The 4 basic ones:
-A non-derived dialog, as typically used for an about dialog.
-A derived dialog that loads its resources from an XRC (a frequently-asked question on the mailing lists), and responds to some simple events, including the disable-another-control-via-EVT_UPDATE_UI that is another FAQ, and powerful and simple-to-use feature.
-A XRC reference "Controls" dialog, using a notebook. Each tab has a single control. All XRC handled widgets can be seen at a glance, and how to use them under XRC.
-An uncentered dialog, to demonstrate the easy use of <centered>1</centered> to automatically place a Dialog centered on its parent..

The 4 advanced ones:
-Embedding a custom class into an XRC dialog, by using the "unknown" class.
-Using wxArtProvider to use stock icons from within your your XRC resources.
-Using the platform attribute to selectively show a part of XRC based on the current OS.
-Runtime variable expansion (demo only. Not implemented at this time).

Also:
-The main frame is now demonstrated as being loaded as an XRC.
- The toolbar has longhelp tag demonstrated, and are hooked up to the same events as the menu to show how XRCID() works on the same tool and menuitem XRCID.
-Some custom icons for the demonstration were created, and put into the toolbar and menubar. A custom icon also for the demonstration.
-The example code has been put in 1 class per file (both .cpp and a matching .xrc), to make it much less confusing for a newcomer to figure out what class is what, expecially with all the wx macros for declaration and implementation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
74 files changed:
contrib/include/wx/xrc/xmlres.h
contrib/samples/xrc/Makefile.in [copied from samples/xrc/Makefile.in with 56% similarity]
contrib/samples/xrc/XrcDemoVC.dsp
contrib/samples/xrc/custclas.cpp [new file with mode: 0644]
contrib/samples/xrc/custclas.h [new file with mode: 0644]
contrib/samples/xrc/derivdlg.cpp [new file with mode: 0644]
contrib/samples/xrc/derivdlg.h [new file with mode: 0644]
contrib/samples/xrc/makefile.b32
contrib/samples/xrc/makefile.g95
contrib/samples/xrc/makefile.vc
contrib/samples/xrc/myframe.cpp [new file with mode: 0644]
contrib/samples/xrc/myframe.h [new file with mode: 0644]
contrib/samples/xrc/rc/appicon.ico
contrib/samples/xrc/rc/appicon.xpm
contrib/samples/xrc/rc/artprov.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/artprov.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/basicdlg.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/basicdlg.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/controls.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/controls.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/custclas.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/custclas.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/derivdlg.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/derivdlg.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/frame.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/menu.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/platform.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/platform.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/sppicon.ico [new file with mode: 0644]
contrib/samples/xrc/rc/toolbar.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/uncenter.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/uncenter.xrc [new file with mode: 0644]
contrib/samples/xrc/rc/variable.xpm [new file with mode: 0644]
contrib/samples/xrc/rc/variable.xrc [new file with mode: 0644]
contrib/samples/xrc/xrcdemo.cpp
contrib/samples/xrc/xrcdemo.h [new file with mode: 0644]
contrib/src/xrc/xmlres.cpp
include/wx/xrc/xmlres.h
samples/xrc/Makefile.in
samples/xrc/XrcDemoVC.dsp
samples/xrc/custclas.cpp [new file with mode: 0644]
samples/xrc/custclas.h [new file with mode: 0644]
samples/xrc/derivdlg.cpp [new file with mode: 0644]
samples/xrc/derivdlg.h [new file with mode: 0644]
samples/xrc/makefile.b32
samples/xrc/makefile.g95
samples/xrc/makefile.vc
samples/xrc/myframe.cpp [new file with mode: 0644]
samples/xrc/myframe.h [new file with mode: 0644]
samples/xrc/rc/appicon.ico
samples/xrc/rc/appicon.xpm
samples/xrc/rc/artprov.xpm [new file with mode: 0644]
samples/xrc/rc/artprov.xrc [new file with mode: 0644]
samples/xrc/rc/basicdlg.xpm [new file with mode: 0644]
samples/xrc/rc/basicdlg.xrc [new file with mode: 0644]
samples/xrc/rc/controls.xpm [new file with mode: 0644]
samples/xrc/rc/controls.xrc [new file with mode: 0644]
samples/xrc/rc/custclas.xpm [new file with mode: 0644]
samples/xrc/rc/custclas.xrc [new file with mode: 0644]
samples/xrc/rc/derivdlg.xpm [new file with mode: 0644]
samples/xrc/rc/derivdlg.xrc [new file with mode: 0644]
samples/xrc/rc/frame.xrc [new file with mode: 0644]
samples/xrc/rc/menu.xrc [new file with mode: 0644]
samples/xrc/rc/platform.xpm [new file with mode: 0644]
samples/xrc/rc/platform.xrc [new file with mode: 0644]
samples/xrc/rc/sppicon.ico [new file with mode: 0644]
samples/xrc/rc/toolbar.xrc [new file with mode: 0644]
samples/xrc/rc/uncenter.xpm [new file with mode: 0644]
samples/xrc/rc/uncenter.xrc [new file with mode: 0644]
samples/xrc/rc/variable.xpm [new file with mode: 0644]
samples/xrc/rc/variable.xrc [new file with mode: 0644]
samples/xrc/xrcdemo.cpp
samples/xrc/xrcdemo.h [new file with mode: 0644]
src/xrc/xmlres.cpp