13 #define LW_COLOUR(red, green, blue) (0x01000000 | (red<<16) | (blue<<8) | green)
23 static LWXPanelID
Create (
int type, LWXPanelControl *ctrlDesc = 0)
25 return globPtr->create(type, ctrlDesc);
29 if (lwxpanel)
globPtr->destroy(lwxpanel);
31 static void Describe(LWXPanelID lwxpanel, LWXPanelDataDesc *ddesc, LWXPanelGetFunc *getf = 0, LWXPanelSetFunc *setf = 0)
33 globPtr->describe(lwxpanel, ddesc, getf, setf);
35 static void Hint(LWXPanelID lwxpanel,LWXPanelHint *hint,
unsigned long ctl = 0)
37 globPtr->hint(lwxpanel, ctl, hint);
39 static int Post(LWXPanelID lwxpanel)
44 dout <<
"Opening XPanel: " << lwxpanel <<
" (Post)\n";
48 static int Open(LWXPanelID lwxpanel)
52 static void ViewInst(LWXPanelID lwxpanel,
void *inst)
54 globPtr->viewInst(lwxpanel, inst);
67 static void *
getUserData(LWXPanelID lwxpanel,
unsigned long id = 0)
69 return globPtr->getData(lwxpanel,
id);
77 static void setUserData(LWXPanelID lwxpanel,
void *data,
unsigned long id = 0)
79 globPtr->setData(lwxpanel,
id, data);
83 static void *
formGet(LWXPanelID lwxpanel,
unsigned long id)
85 return globPtr->formGet(lwxpanel,
id);
89 return (
char *)
formGet(lwxpanel,
id);
91 static int getFormInt (LWXPanelID lwxpanel,
unsigned long id)
93 return *((
int *)
formGet(lwxpanel,
id));
97 return *((
float *)
formGet(lwxpanel,
id));
99 static void formSet(LWXPanelID lwxpanel,
unsigned long id,
void* data)
101 globPtr->formSet(lwxpanel,
id, data);
103 static void setForm(LWXPanelID lwxpanel,
unsigned long id,
long data)
107 static void setForm(LWXPanelID lwxpanel,
unsigned long id,
float data)
111 static void setForm(LWXPanelID lwxpanel,
unsigned long id,
char *data)
113 formSet(lwxpanel,
id, (
void *)data);
115 static void setForm(LWXPanelID lwxpanel,
unsigned long id,
const char *data)
117 formSet(lwxpanel,
id, (
void *)data);
142 XPDrawArea(LWXPDrAreaID _id, LWXPDrawFuncs *_df,
int w,
int h)
155 void drawPixel (
int r,
int g,
int b,
int x,
int y )
const
159 void drawPixel (
float r,
float g,
float b,
int x,
int y )
const
161 mDrawFuncs->drawRGBPixel(
mAreaId, (
int)(r * 255.0f), (
int)(g * 255.0f), (
int)(b * 255.0f), x, y);
163 void drawLine (
int c,
int x,
int y,
int x2,
int y2 )
const
167 void drawBox (
int c,
int x,
int y,
int w,
int h )
const
171 void drawBox (
int r,
int g,
int b,
int x,
int y,
int w,
int h )
const
175 void clear (
int r,
int g,
int b)
const
183 void drawBorder (
int indent,
int x,
int y,
int w,
int h )
const
196 void drawText (
const char *s,
int c,
int x,
int y)
const
209 bool destroy_on_exit;
213 globPtr->formSet(lwxpanel,
id, data);
217 return globPtr->formGet(lwxpanel,
id);
220 void Create (
int type, LWXPanelControl *ctrlDesc =
NULL,
bool auto_close =
true)
222 lwxpanel =
globPtr->create(type, ctrlDesc);
223 destroy_on_exit = auto_close;
227 if (lwxpanel)
globPtr->destroy(lwxpanel);
234 XPanel(LWXPanelID panID = 0,
bool auto_close =
false) : lwxpanel(panID), destroy_on_exit(auto_close)
242 XPanel(
int type, LWXPanelControl *ctrlDesc,
bool auto_close =
true) : lwxpanel(0), destroy_on_exit(auto_close)
244 Create(type, ctrlDesc, auto_close);
248 if (destroy_on_exit)
Destroy();
252 destroy_on_exit = doIt;
256 return (lwxpanel != 0);
258 void Describe(LWXPanelDataDesc *ddesc, LWXPanelGetFunc *getf = 0, LWXPanelSetFunc *setf = 0)
260 if (lwxpanel)
globPtr->describe(lwxpanel, ddesc, getf, setf);
262 void Hint(LWXPanelHint *hint,
unsigned int ctl = 0)
264 if (lwxpanel)
globPtr->hint(lwxpanel, ctl, hint);
279 dout <<
"Opening XPanel: " << lwxpanel <<
" (Post)\n";
281 return globPtr->post(lwxpanel);
285 return globPtr->open(lwxpanel);
289 globPtr->viewInst(lwxpanel, inst);
293 globPtr->viewRefresh(lwxpanel);
301 destroy_on_exit = close;
306 return globPtr->getData(lwxpanel,
id);
308 template <
typename T>
311 return static_cast<T
>(
globPtr->getData(lwxpanel,
id));
316 globPtr->setData(lwxpanel,
id, data);
321 inline void getForm (
unsigned int id,
void *&d)
325 inline void getForm (
unsigned int id,
char *&d)
329 inline void getForm (
unsigned int id, std::string &d)
338 inline void getForm (
unsigned int id,
unsigned int &d)
340 d = *((
unsigned int *)
formGet(
id));
342 inline void getForm (
unsigned int id,
bool &d)
344 int l = *((
int *)
formGet(
id));
347 inline void getForm (
unsigned int id,
float &d)
351 inline void getForm (
unsigned int id,
double &d)
362 long l =
static_cast<long>(data);
369 void setForm(
unsigned long id,
unsigned int data)
385 void setForm(
unsigned long id,
const char *data)
389 void setForm(
unsigned long id, std::string data)
391 formSet(
id, (
void *)data.c_str());
409 virtual void *
DataGet(
unsigned int vid ) = 0;
411 virtual LWXPRefreshCode
DataSet(
unsigned int vid,
void *value) = 0;
416 template <
typename T>
421 return plugin->ButtonClick(cid);
424 #endif // LWPP_XPANEL_H