]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/deprecated/resource.h
Applied patch [ 1117207 ] changed the test for SQL_C_WCHAR
[wxWidgets.git] / contrib / include / wx / deprecated / resource.h
CommitLineData
4a3bdee6
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: resource.h
3// Purpose: Resource processing
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_RESOURCEH__
13#define _WX_RESOURCEH__
14
15#if defined(__GNUG__) && !defined(__APPLE__)
16#pragma interface "resource.h"
17#endif
18
19#include "wx/setup.h"
20#include "wx/deprecated/setup.h"
21
22#if wxUSE_WX_RESOURCES
23
24#include "wx/bitmap.h"
25#include <stdio.h>
26
27// A few further types not in wx_types.h
28#define wxRESOURCE_TYPE_SEPARATOR 1000
29#define wxRESOURCE_TYPE_XBM_DATA 1001
30#define wxRESOURCE_TYPE_XPM_DATA 1002
31
32#define RESOURCE_PLATFORM_WINDOWS 1
33#define RESOURCE_PLATFORM_X 2
34#define RESOURCE_PLATFORM_MAC 3
35#define RESOURCE_PLATFORM_ANY 4
36
37// Extended styles: for resource usage only
38
39// Use dialog units instead of pixels
40#define wxRESOURCE_DIALOG_UNITS 0x0001
41// Use default system colour and font
42#define wxRESOURCE_USE_DEFAULTS 0x0002
43// Old-style vertical label
44#define wxRESOURCE_VERTICAL_LABEL 0x0004
45// Old-style horizontal label
46#define wxRESOURCE_HORIZONTAL_LABEL 0x0008
47
48// Macros to help use dialog units
49#define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y))
50#define wxDLG_SIZE(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxSize(x, y)) : wxSize(x, y))
51
52#ifdef FindResource
53#undef FindResource
54#endif
55
56class WXDLLEXPORT wxInputStream;
57
58/*
59 * Internal format for control/panel item
60 */
61
15e8daec 62class WXDLLIMPEXP_DEPRECATED wxItemResource: public wxObject
4a3bdee6
JS
63{
64 DECLARE_DYNAMIC_CLASS(wxItemResource)
65
66 public:
67
68 wxItemResource();
69 ~wxItemResource();
70
71 inline void SetType(const wxString& type) { m_itemType = type; }
72 inline void SetStyle(long styl) { m_windowStyle = styl; }
73 inline void SetId(int id) { m_windowId = id; }
74 inline void SetBitmap(const wxBitmap& bm) { m_bitmap = bm; }
75 inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
76 inline void SetFont(const wxFont& font) { m_windowFont = font; }
77 inline wxFont& GetFont() const { return (wxFont&) m_windowFont; }
78 inline void SetSize(int xx, int yy, int ww, int hh)
79 { m_x = xx; m_y = yy; m_width = ww; m_height = hh; }
80 inline void SetTitle(const wxString& title) { m_title = title; }
81 inline void SetName(const wxString& name) { m_name = name; }
82 inline void SetValue1(long v) { m_value1 = v; }
83 inline void SetValue2(long v) { m_value2 = v; }
84 inline void SetValue3(long v) { m_value3 = v; }
85 inline void SetValue5(long v) { m_value5 = v; }
86 inline void SetValue4(const wxString& v) { m_value4 = v; }
87 inline void SetStringValues(const wxStringList& svalues) { m_stringValues = svalues; }
88
89 inline const wxString& GetType() const { return m_itemType; }
90 inline int GetX() const { return m_x; }
91 inline int GetY() const { return m_y; }
92 inline int GetWidth() const { return m_width; }
93 inline int GetHeight() const { return m_height; }
94
95 inline const wxString& GetTitle() const { return m_title; }
96 inline const wxString& GetName() const { return m_name; }
97 inline long GetStyle() const { return m_windowStyle; }
98 inline int GetId() const { return m_windowId; }
99
100 inline wxInt32 GetValue1() const { return m_value1; }
101 inline wxInt32 GetValue2() const { return m_value2; }
102 inline wxInt32 GetValue3() const { return m_value3; }
103 inline wxInt32 GetValue5() const { return m_value5; }
104 inline wxString GetValue4() const { return m_value4; }
105 inline wxList& GetChildren() const { return (wxList&) m_children; }
106 inline wxStringList& GetStringValues() const { return (wxStringList&) m_stringValues; }
107
108 inline void SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; }
109 inline void SetLabelColour(const wxColour& col) { m_labelColour = col; }
110 inline void SetButtonColour(const wxColour& col) { m_buttonColour = col; }
318c5e9f 111
4a3bdee6
JS
112 inline wxColour& GetBackgroundColour() const { return (wxColour&) m_backgroundColour; }
113 inline wxColour& GetLabelColour() const { return (wxColour&) m_labelColour; }
114 inline wxColour& GetButtonColour() const { return (wxColour&) m_buttonColour; }
115
116 inline void SetResourceStyle(long style) { m_exStyle = style; }
117 inline wxInt32 GetResourceStyle() const { return m_exStyle; }
118
119 protected:
120 wxList m_children;
121 wxString m_itemType;
122 int m_x, m_y, m_width, m_height;
123 wxString m_title;
124 wxString m_name;
125 long m_windowStyle;
126 long m_value1, m_value2, m_value3, m_value5;
127 wxString m_value4;
128 int m_windowId;
129 wxStringList m_stringValues; // Optional string values
130 wxBitmap m_bitmap;
131 wxColour m_backgroundColour;
132 wxColour m_labelColour;
133 wxColour m_buttonColour;
134 wxFont m_windowFont;
135 long m_exStyle; // Extended, resource-specific styles
136};
137
138/*
139 * Resource table (normally only one of these)
140 */
318c5e9f 141
15e8daec 142class WXDLLIMPEXP_DEPRECATED wxResourceTable: public wxHashTable
4a3bdee6
JS
143{
144 DECLARE_DYNAMIC_CLASS(wxResourceTable)
145
146 protected:
318c5e9f 147
4a3bdee6
JS
148 public:
149 wxHashTable identifiers;
318c5e9f 150
4a3bdee6
JS
151 wxResourceTable();
152 ~wxResourceTable();
153
154 virtual wxItemResource *FindResource(const wxString& name) const;
155 virtual void AddResource(wxItemResource *item);
156 virtual bool DeleteResource(const wxString& name);
157
158 virtual bool ParseResourceFile(const wxString& filename);
159 virtual bool ParseResourceFile(wxInputStream *is);
160 virtual bool ParseResourceData(const wxString& data);
161 virtual bool SaveResource(const wxString& filename);
162
163 // Register XBM/XPM data
164 virtual bool RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height);
165 virtual bool RegisterResourceBitmapData(const wxString& name, char **data);
166
167 virtual wxControl *CreateItem(wxWindow *panel, const wxItemResource* childResource, const wxItemResource* parentResource) const;
168
169 virtual void ClearTable();
170};
171
15e8daec
VS
172WXDLLIMPEXP_DEPRECATED extern void wxInitializeResourceSystem();
173WXDLLIMPEXP_DEPRECATED extern void wxCleanUpResourceSystem();
4a3bdee6 174
15e8daec
VS
175WXDLLIMPEXP_DATA_DEPRECATED(extern wxResourceTable*) wxDefaultResourceTable;
176WXDLLIMPEXP_DEPRECATED extern long wxParseWindowStyle(const wxString& style);
4a3bdee6
JS
177
178class WXDLLEXPORT wxMenuBar;
179class WXDLLEXPORT wxMenu;
180class WXDLLEXPORT wxBitmap;
181class WXDLLEXPORT wxIcon;
15e8daec
VS
182WXDLLIMPEXP_DEPRECATED extern wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
183WXDLLIMPEXP_DEPRECATED extern wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
184WXDLLIMPEXP_DEPRECATED extern wxMenuBar* wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL);
185WXDLLIMPEXP_DEPRECATED extern wxMenu* wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
186WXDLLIMPEXP_DEPRECATED extern bool wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL);
187WXDLLIMPEXP_DEPRECATED extern bool wxResourceParseData(const char* resource, wxResourceTable *table = (wxResourceTable *) NULL);
188WXDLLIMPEXP_DEPRECATED extern bool wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL);
189WXDLLIMPEXP_DEPRECATED extern bool wxResourceParseString(char* s, wxResourceTable *table = (wxResourceTable *) NULL);
190WXDLLIMPEXP_DEPRECATED extern bool wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL);
191WXDLLIMPEXP_DEPRECATED extern void wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL);
4a3bdee6 192// Register XBM/XPM data
15e8daec
VS
193WXDLLIMPEXP_DEPRECATED extern bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL);
194WXDLLIMPEXP_DEPRECATED extern bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table = (wxResourceTable *) NULL);
4a3bdee6
JS
195#define wxResourceRegisterIconData wxResourceRegisterBitmapData
196
197/*
198 * Resource identifer code: #define storage
199 */
200
15e8daec
VS
201WXDLLIMPEXP_DEPRECATED extern bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table = (wxResourceTable *) NULL);
202WXDLLIMPEXP_DEPRECATED extern int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL);
4a3bdee6 203
c6dafd93 204// Used to be wxWindowBase::LoadFromResource
7c9955d1 205bool wxLoadFromResource(wxWindow* thisWindow, wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = (const wxResourceTable *) NULL);
c6dafd93
JS
206
207// Used to be wxWindowBase::CreateItem
7c9955d1 208wxControl *wxCreateItem(wxWindow* thisWindow, const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table = (const wxResourceTable *) NULL);
c6dafd93 209
4a3bdee6
JS
210#if defined(__WXPM__)
211#include "wx/os2/wxrsc.h"
212#endif
213#endif
214#endif
215 // _WX_RESOURCEH__