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