00001 #include "paragui.h"
00002 #include "pglayout.h"
00003
00004 #include "pgwidget.h"
00005 #include "pgbutton.h"
00006 #include "pgdropdown.h"
00007 #include "pglabel.h"
00008 #include "pgthemewidget.h"
00009 #include "pgmaskedit.h"
00010 #include "pgprogressbar.h"
00011 #include "pgspinnerbox.h"
00012 #include "pgwindow.h"
00013 #include "pgwidgetlist.h"
00014 #include "pglistbox.h"
00015 #include "pglistboxitem.h"
00016 #include "pgcolumnitem.h"
00017 #include "pgmessagebox.h"
00018 #include "pgradiobutton.h"
00019 #include "pgcheckbutton.h"
00020 #include "pgscrollbar.h"
00021 #include "pgslider.h"
00022 #include "pgimage.h"
00023 #include "pgrichedit.h"
00024 #include "pglog.h"
00025 #include "pgpopupmenu.h"
00026 #include "pgmenubar.h"
00027 #include "pgscrollwidget.h"
00028
00029 #include <cstring>
00030 #include <stdarg.h>
00031 #include <sys/stat.h>
00032 #include <expat.h>
00033
00034
00035 #ifdef XML_UNICODE
00036 #ifndef XML_UNICODE_WCHAR_T
00037 #error UNICODE version requires a 16-bit Unicode-compatible wchar_t=20
00038 #endif
00039 #define T(x) L ## x
00040 #define tcscmp wcscmp
00041 #else
00042 #define T(x) x
00043 #define tcscmp strcmp
00044 #endif
00045
00046 #define IsTag(lx,sx,y) (((tcscmp(T(lx),T(name))==0)||(tcscmp(T(sx),T(name))==0))&&((XMLParser->Section & (y))!=0))
00047
00048 #define XML_BUFF_SIZE 1024
00049
00050 #define XML_SECTION_NONPAIR 0x00000000
00051 #define XML_SECTION_DOC 0x00000001
00052 #define XML_SECTION_LAYOUT 0x00000002
00053 #define XML_SECTION_HEAD 0x00000004
00054 #define XML_SECTION_BODY 0x00000008
00055 #define XML_SECTION_BUTTON 0x00000010
00056 #define XML_SECTION_COMWIDPARAMS 0x00000020
00057 #define XML_SECTION_DROPDOWN 0x00000040
00058 #define XML_SECTION_WIDGET 0x00000080
00059 #define XML_SECTION_LABEL 0x00000100
00060 #define XML_SECTION_GWIDGET 0x00000200
00061 #define XML_SECTION_SFRAME 0x00000400
00062 #define XML_SECTION_LINEEDIT 0x00000800
00063 #define XML_SECTION_MASKEDIT 0x00001000
00064 #define XML_SECTION_PROGRESSBAR 0x00002000
00065 #define XML_SECTION_SPINNERBOX 0x00004000
00066 #define XML_SECTION_WINDOW 0x00008000
00067 #define XML_SECTION_WIDGETLIST 0x00010000
00068 #define XML_SECTION_LISTBOX 0x00020000
00069 #define XML_SECTION_LISTBOXITEM 0x00040000
00070 #define XML_SECTION_COLUMNITEM 0x00080000
00071 #define XML_SECTION_MESSAGEBOX 0x00100000
00072 #define XML_SECTION_RADIOBUTTON 0x00200000
00073 #define XML_SECTION_CHECKBUTTON 0x00400000
00074 #define XML_SECTION_SCROLLBAR 0x00800000
00075 #define XML_SECTION_IMAGE 0x01000000
00076 #define XML_SECTION_RICHEDIT 0x02000000
00077 #define XML_SECTION_WIDGETLISTEX 0x04000000
00078 #define XML_SECTION_FONT 0x08000000
00079 #define XML_SECTION_POPUPMENU 0x10000000
00080 #define XML_SECTION_MENUBAR 0x20000000
00081 #define XML_SECTION_POPUPMENUITEM 0x40000000
00082
00083 typedef struct {
00084 XML_Parser Parser;
00085 int Section;
00086
00087 const char* FileName;
00088 int EndTagFlags;
00089 int InhTagFlags;
00090 int Height;
00091 int Width;
00092
00093 PG_Widget *ParentObject;
00094 void *PrevUserData;
00095 void *UserSpace;
00096
00097 }
00098 ParseUserData_t;
00099
00100
00101 #define ENDTAGFLAG_OBJECT 1
00102 #define ENDTAGFLAG_WIDGETLIST 2
00103 #define ENDTAGFLAG_SETSIZE 4
00104
00105 #define INHTAGFLAG_HIDE 1
00106 #define INHTAGFLAG_ADDWIDGET 2
00107
00108 static char Empty = 0;
00109
00110 char *PG_Layout::GetParamStr(const char **Source, const char *What) {
00111 char **c;
00112
00113 for (c = (char **)Source;*c; c += 2)
00114 if (tcscmp(T(*c),T(What)) == 0)
00115 return(*(c+1));
00116 return(&Empty);
00117 }
00118
00119 void PG_Layout::GetParamRect(const char **Source, const char *What, PG_Rect& Rect, PG_Widget* parent) {
00120 char *c = PG_Layout::GetParamStr(Source,What);
00121
00122 if(c == NULL) {
00123 return;
00124 }
00125
00126 if(strlen(c) == 0) {
00127 return;
00128 }
00129
00130 SDL_Surface *screen = PG_Application::GetScreen();
00131 char* parm;
00132 char *d;
00133 char tmp[16];
00134 int i=0;
00135 int mx;
00136 int r[4];
00137
00138 r[0] = r[1] = r[2] = r[3] = 0;
00139 parm = strdup(c);
00140
00141 for(d = strtok(parm,","); d != NULL; d = strtok(NULL,",")) {
00142 if(parent == NULL) {
00143 mx = ((i%2)==0) ? screen->w : screen->h;
00144 } else {
00145 mx = ((i%2)==0) ? parent->w : parent->h;
00146 }
00147
00148 if( sscanf(d, "%d%[%]", & r[i], tmp) == 2 )
00149 r[i] = (int) ((float)r[i]*mx/100);
00150
00151 if(r[i]<0)
00152 r[i] = mx+r[i];
00153
00154 i++;
00155 }
00156 Rect.SetRect(r[0], r[1], r[2], r[3]);
00157 free(parm);
00158 }
00159
00160 int PG_Layout::GetParamInt(const char **Source, const char *What) {
00161 char* p = PG_Layout::GetParamStr(Source, What);
00162
00163 if(p[0] == 0) {
00164 return -1;
00165 }
00166
00167 return atoi(p);
00168 }
00169
00170 PG_ScrollBar::ScrollDirection PG_Layout::GetParamScrollDirection(const char **Source, const char *What) {
00171 char* p = PG_Layout::GetParamStr(Source, What);
00172 PG_ScrollBar::ScrollDirection r = PG_ScrollBar::VERTICAL;
00173
00174 switch(atoi(p)) {
00175 case 0:
00176 r = PG_ScrollBar::VERTICAL;
00177 break;
00178
00179 case 1:
00180 r = PG_ScrollBar::HORIZONTAL;
00181 break;
00182 }
00183
00184 return r;
00185 }
00186 PG_Label::TextAlign PG_Layout::GetParamAlign(const char **Source, const char *What) {
00187 PG_Label::TextAlign ret = PG_Label::LEFT;
00188 char *c = PG_Layout::GetParamStr(Source,What);
00189
00190 if (c[0]==0)
00191 return PG_Label::LEFT;
00192
00193 if (tcscmp(T(c),T("left")) == 0)
00194 ret = PG_Label::LEFT;
00195 if (tcscmp(T(c),T("right")) == 0)
00196 ret = PG_Label::RIGHT;
00197 if (tcscmp(T(c),T("center")) == 0)
00198 ret = PG_Label::CENTER;
00199
00200 return ret;
00201 }
00202
00203 PG_Draw::BkMode PG_Layout::GetParamIMode(const char **Source, const char *What) {
00204 PG_Draw::BkMode ret = PG_Draw::TILE;
00205 char *c = PG_Layout::GetParamStr(Source,What);
00206
00207 if (tcscmp(T(c),T("tile")) == 0)
00208 ret = PG_Draw::TILE;
00209 if (tcscmp(T(c),T("stretch")) == 0)
00210 ret = PG_Draw::STRETCH;
00211 if (tcscmp(T(c),T("3tileh")) == 0)
00212 ret = PG_Draw::TILE3H;
00213 if (tcscmp(T(c),T("3tilev")) == 0)
00214 ret = PG_Draw::TILE3V;
00215 if (tcscmp(T(c),T("9tile")) == 0)
00216 ret = PG_Draw::TILE9;
00217
00218 return(ret);
00219 }
00220
00221 int PG_Layout::GetParamGrad(const char **Source, const char *What, PG_Gradient *grad) {
00222 char *c = PG_Layout::GetParamStr(Source,What);
00223 int r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4;
00224
00225 if (c[0] == 0)
00226 return(0);
00227
00228 sscanf(c,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",&r1,&g1,&b1,&r2,&g2,&b2,&r3,&g3,&b3,&r4,&g4,&b4);
00229
00230 grad->colors[0].r = r1;
00231 grad->colors[0].g = g1;
00232 grad->colors[0].b = b1;
00233
00234 grad->colors[1].r = r2;
00235 grad->colors[1].g = g2;
00236 grad->colors[1].b = b2;
00237
00238 grad->colors[2].r = r3;
00239 grad->colors[2].g = g3;
00240 grad->colors[2].b = b3;
00241
00242 grad->colors[3].r = r4;
00243 grad->colors[3].g = g4;
00244 grad->colors[3].b = b4;
00245
00246 return(1);
00247 }
00248
00249 static void SaveUserData(ParseUserData_t *XMLParser) {
00250 ParseUserData_t *OldUserData;
00251
00252 OldUserData = (ParseUserData_t *)malloc(sizeof(ParseUserData_t));
00253
00254 *OldUserData = *XMLParser;
00255
00256 XMLParser->PrevUserData = OldUserData;
00257 XMLParser->EndTagFlags = 0;
00258 return;
00259 }
00260
00261 static void RestoreUserData(ParseUserData_t *XMLParser) {
00262 ParseUserData_t *OldUserData = (ParseUserData_t *)XMLParser->PrevUserData;
00263
00264 *XMLParser = *OldUserData;
00265 free(OldUserData);
00266
00267 return;
00268 }
00269
00270
00271 void (* PG_LayoutWidgetParams)(PG_Widget *Widget, const char **atts) = NULL;
00272 void (* PG_LayoutProcessingInstruction)(const char* target, const char* data, const std::string& FileName, void *UserSpace) = NULL;
00273
00274
00275
00276
00277 static int SetWidgetAtts(PG_Widget *Widget, const char **atts, ParseUserData_t *XMLParser) {
00278 char *c;
00279 int i,ret = 0;
00280
00281 c = PG_Layout::GetParamStr(atts, "name");
00282 if (c[0] != 0)
00283 Widget->SetName(c);
00284
00285 i = PG_Layout::GetParamInt(atts, "id");
00286 if (i != -1) {
00287 Widget->SetID(i);
00288 }
00289
00290 c = PG_Layout::GetParamStr(atts, "fcolor");
00291 if (c[0] != 0) {
00292 int r,g,b;
00293
00294 sscanf(c,"%d,%d,%d",&r,&g,&b);
00295 Widget->SetFontColor(PG_Color(r,g,b));
00296 }
00297
00298 c = PG_Layout::GetParamStr(atts, "fname");
00299 if (c[0] != 0) {
00300 Widget->SetFontName(c);
00301 }
00302
00303 i = PG_Layout::GetParamInt(atts, "fsize");
00304 if (i != -1) {
00305 Widget->SetFontSize(i);
00306 }
00307
00308 i = PG_Layout::GetParamInt(atts, "fstyle");
00309 if (i != -1) {
00310 Widget->SetFontStyle((PG_Font::Style)i);
00311 }
00312
00313 i = PG_Layout::GetParamInt(atts, "findex");
00314 if (i != -1) {
00315 Widget->SetFontIndex(i);
00316 }
00317
00318 i = PG_Layout::GetParamInt(atts, "falpha");
00319 if (i != -1) {
00320 Widget->SetFontAlpha(i);
00321 }
00322
00323 c = PG_Layout::GetParamStr(atts, "data");
00324 if (c[0] != 0)
00325 Widget->SetUserData(c, strlen(c)+1);
00326
00327 if (PG_LayoutWidgetParams != NULL)
00328 PG_LayoutWidgetParams(Widget,atts);
00329
00330
00331 c = PG_Layout::GetParamStr(atts, "text");
00332 if (c[0] != 0) {
00333 Widget->SetText((const char*)c);
00334 }
00335
00336 i = PG_Layout::GetParamInt(atts, "hide");
00337 if (i == 1)
00338 ret |= INHTAGFLAG_HIDE;
00339
00340 c = PG_Layout::GetParamStr(atts, "sbt");
00341 if (c[0] != 0) {
00342 sscanf(c,"%d,%d", &XMLParser->Width, &XMLParser->Height);
00343 XMLParser->EndTagFlags |= ENDTAGFLAG_SETSIZE;
00344 }
00345
00346
00347 ret &= ~INHTAGFLAG_ADDWIDGET;
00348
00349 XMLParser->EndTagFlags |= ENDTAGFLAG_OBJECT;
00350 return(ret);
00351 }
00352
00353 static int SetDropDownAtts(PG_DropDown *Widget, const char **atts,ParseUserData_t *XMLParser) {
00354 int i;
00355
00356 i = PG_Layout::GetParamInt(atts, "indent");
00357 if (i > 0)
00358 Widget->SetIndent(i);
00359
00360 i = PG_Layout::GetParamInt(atts, "edit");
00361 Widget->SetEditable(i == 1);
00362
00363 return (SetWidgetAtts(Widget, atts, XMLParser));
00364 }
00365
00366 static int SetThemeWidgetAtts(PG_ThemeWidget *Widget, const char **atts, ParseUserData_t *XMLParser) {
00367 char *c;
00368 PG_Gradient grad;
00369
00370 c = PG_Layout::GetParamStr(atts, "image");
00371 if(c[0] != 0) {
00372 Widget->SetBackground(c,PG_Layout::GetParamIMode(atts, "imode"));
00373 }
00374
00375 int b = PG_Layout::GetParamInt(atts, "blend");
00376 if(b != -1) {
00377 Widget->SetBackgroundBlend(b);
00378 }
00379
00380 if (PG_Layout::GetParamGrad(atts, "gradient", &grad) != 0)
00381 Widget->SetGradient(grad);
00382
00383 c = PG_Layout::GetParamStr(atts, "bimage");
00384 if (c[0] != 0) {
00385 Widget->LoadImage(c);
00386 }
00387
00388 b = PG_Layout::GetParamInt(atts, "transparency");
00389
00390 if(b != -1) {
00391 Widget->SetTransparency(b);
00392 }
00393
00394 return SetWidgetAtts(Widget, atts, XMLParser);
00395 }
00396
00397 static int SetLabelAtts(PG_Label *Widget, const char **atts, ParseUserData_t *XMLParser) {
00398 PG_Label::TextAlign a;
00399 int i;
00400 char* c;
00401
00402 a = PG_Layout::GetParamAlign(atts, "align");
00403 Widget->SetAlignment(a);
00404
00405 i = PG_Layout::GetParamInt(atts, "indent");
00406 if (i != -1) {
00407 Widget->SetIndent(i);
00408 }
00409
00410 c = PG_Layout::GetParamStr(atts, "icon");
00411 if (c[0] != 0) {
00412 Widget->SetIcon((const char*)c);
00413 }
00414
00415 return(SetWidgetAtts(Widget, atts, XMLParser));
00416 }
00417
00418 static int SetUserButtonAtts(PG_Button *Widget, const char **atts, ParseUserData_t *XMLParser) {
00419 char *c,*c1,*c2;
00420 int i,j,k;
00421 int b;
00422
00423 c = PG_Layout::GetParamStr(atts, "upimage");
00424 c1 = PG_Layout::GetParamStr(atts, "downimage");
00425 c2 = PG_Layout::GetParamStr(atts, "overimage");
00426
00427
00428
00429
00430
00431
00432
00433
00434 if (c[0] != 0) {
00435 b = PG_Layout::GetParamInt(atts, "colorkey");
00436 if(b != -1) {
00437 Widget->SetIcon(c, c1, c2, b);
00438 } else {
00439 Widget->SetIcon(c, c1, c2);
00440 }
00441 }
00442
00443 i = PG_Layout::GetParamInt(atts, "toggle");
00444 Widget->SetToggle(i == 1);
00445
00446 i = PG_Layout::GetParamInt(atts, "pressed");
00447 Widget->SetPressed(i == 1);
00448
00449 c = PG_Layout::GetParamStr(atts, "shift");
00450 if (c[0] != 0) {
00451 sscanf(c,"%d",&i);
00452 Widget->SetShift(i);
00453 }
00454
00455 c = PG_Layout::GetParamStr(atts, "border");
00456 if (c[0] != 0) {
00457 sscanf(c,"%d,%d,%d",&i,&j,&k);
00458 Widget->SetBorderSize(i,j,k);
00459 }
00460
00461 c = PG_Layout::GetParamStr(atts, "transparency");
00462 if (c[0] != 0) {
00463 sscanf(c,"%d,%d,%d",&i,&j,&k);
00464 Widget->SetTransparency(i,j,k);
00465 }
00466
00467 return(SetWidgetAtts(Widget, atts, XMLParser));
00468 }
00469
00470 static int SetButtonAtts(PG_Button *Widget, const char **atts, ParseUserData_t *XMLParser) {
00471 PG_Gradient grad;
00472
00473 if (PG_Layout::GetParamGrad(atts, "upgrad", &grad) != 0)
00474 Widget->SetGradient(PG_Button::UNPRESSED, grad);
00475 if (PG_Layout::GetParamGrad(atts, "downgrad", &grad) != 0)
00476 Widget->SetGradient(PG_Button::PRESSED, grad);
00477 if (PG_Layout::GetParamGrad(atts, "selgrad", &grad) != 0)
00478 Widget->SetGradient(PG_Button::HIGHLITED, grad);
00479
00480
00481
00482 return(SetUserButtonAtts(Widget, atts, XMLParser));
00483 }
00484
00485 static int SetPopupMenuAtts(PG_PopupMenu *Widget, const char **atts, ParseUserData_t *XMLParser) {
00486
00487 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00488 }
00489
00490 static int SetLineEditAtts(PG_LineEdit *Widget, const char **atts, ParseUserData_t *XMLParser) {
00491 char *c;
00492
00493 if (PG_Layout::GetParamInt(atts, "readonly") == 1)
00494 Widget->SetEditable(0);
00495
00496 c = PG_Layout::GetParamStr(atts, "validkeys");
00497 if (c[0] != 0)
00498 Widget->SetValidKeys(c);
00499
00500 c = PG_Layout::GetParamStr(atts, "passchar");
00501 if (c[0] != 0)
00502 Widget->SetPassHidden(c[0]);
00503
00504 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00505 }
00506
00507 static int SetMaskEditAtts(PG_MaskEdit *Widget, const char **atts, ParseUserData_t *XMLParser) {
00508 char *c;
00509 Widget->SetMask(PG_Layout::GetParamStr(atts, "mask"));
00510
00511 c = PG_Layout::GetParamStr(atts, "spacer");
00512 if (c[0] != 0)
00513 Widget->SetSpacer(c[0]);
00514
00515 return(SetLineEditAtts(Widget, atts, XMLParser));
00516 }
00517
00518 static int SetWindowAtts(PG_Window *Widget, const char **atts, ParseUserData_t *XMLParser) {
00519 char *c;
00520
00521 c = PG_Layout::GetParamStr(atts, "titlecolor");
00522 if (c[0] != 0) {
00523 int r,g,b;
00524 sscanf(c,"%d,%d,%d",&r,&g,&b);
00525 Widget->SetTitlebarColor(((b & 0xff) << 16) | ((g & 0xff) << 8) | (r & 0xFF));
00526 }
00527
00528 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00529 }
00530
00531 static int SetProgressBarAtts(PG_ProgressBar *Widget, const char **atts, ParseUserData_t *XMLParser) {
00532 char *c;
00533 double p;
00534
00535 c = PG_Layout::GetParamStr(atts, "progress");
00536 if (c[0] != 0) {
00537 p = atof(c);
00538 Widget->SetProgress(p);
00539 }
00540
00541 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00542 }
00543
00544 static int SetSpinnerBoxAtts(PG_SpinnerBox *Widget, const char **atts, ParseUserData_t *XMLParser) {
00545 int i,j;
00546 char *c;
00547
00548 i = PG_Layout::GetParamInt(atts, "value");
00549 if(i != -1) {
00550 Widget->SetValue(i);
00551 }
00552
00553 i = PG_Layout::GetParamInt(atts, "min");
00554 if(i != -1) {
00555 Widget->SetMinValue(i);
00556 }
00557
00558 j = PG_Layout::GetParamInt(atts, "max");
00559 if (j > i)
00560 Widget->SetMaxValue(j);
00561
00562 c = PG_Layout::GetParamStr(atts, "mask");
00563 if (c[0] != 0)
00564 Widget->SetMask(c);
00565
00566 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00567 }
00568
00569 static int SetWidgetListAtts(PG_WidgetList *Widget, const char **atts, ParseUserData_t *XMLParser) {
00570 if (PG_Layout::GetParamInt(atts, "scrollbar") == 1)
00571 Widget->EnableScrollBar(1);
00572
00573 XMLParser->EndTagFlags |= ENDTAGFLAG_WIDGETLIST;
00574 return (INHTAGFLAG_ADDWIDGET | SetThemeWidgetAtts(Widget, atts, XMLParser));
00575 }
00576
00577 static int SetScrollWidgetAtts(PG_ScrollWidget*Widget, const char **atts, ParseUserData_t *XMLParser) {
00578 if (PG_Layout::GetParamInt(atts, "scrollbar") == 1)
00579 Widget->EnableScrollBar(1);
00580
00581 XMLParser->EndTagFlags |= ENDTAGFLAG_WIDGETLIST;
00582 return (INHTAGFLAG_ADDWIDGET | SetThemeWidgetAtts(Widget, atts, XMLParser));
00583 }
00584
00585 static int SetListBoxAtts(PG_ListBox *Widget, const char **atts, ParseUserData_t *XMLParser) {
00586 Widget->SetMultiSelect(PG_Layout::GetParamInt(atts, "multisel") == 1);
00587
00588 return(SetWidgetListAtts(Widget, atts, XMLParser));
00589 }
00590
00591 static int SetListBoxItemAtts(PG_ListBoxItem *Widget, const char **atts, ParseUserData_t *XMLParser) {
00592 if (PG_Layout::GetParamInt(atts, "select") == 1)
00593 Widget->Select(1);
00594
00595 return(SetLabelAtts(Widget, atts, XMLParser));
00596 }
00597
00598 static int SetRadioButtonAtts(PG_RadioButton *Widget, const char **atts, ParseUserData_t *XMLParser) {
00599 if (PG_Layout::GetParamInt(atts, "pressed") == 1)
00600 Widget->SetPressed();
00601
00602 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00603 }
00604
00605
00606 static int SetScrollBarAtts(PG_ScrollBar *Widget, const char **atts, ParseUserData_t *XMLParser) {
00607 int i,j;
00608
00609 i = PG_Layout::GetParamInt(atts, "value");
00610 if (i != -1) {
00611 Widget->SetPosition(i);
00612 }
00613
00614
00615
00616
00617
00618
00619 i = PG_Layout::GetParamInt(atts, "lsize");
00620 if (i != -1) {
00621 Widget->SetLineSize(i);
00622 }
00623
00624 i = PG_Layout::GetParamInt(atts, "psize");
00625 if (i != -1) {
00626 Widget->SetPageSize(i);
00627 }
00628
00629 i = PG_Layout::GetParamInt(atts, "min");
00630 j = PG_Layout::GetParamInt(atts, "max");
00631 if ((i < j) && (i != j)) {
00632 Widget->SetRange(i,j);
00633 }
00634
00635 return SetThemeWidgetAtts(Widget, atts, XMLParser);
00636 }
00637
00638 static void XMLStartDoc(void *userData, const char *name, const char **atts) {
00639 PG_Rect Rect;
00640 ParseUserData_t *XMLParser = (ParseUserData_t *)userData;
00641
00642 SaveUserData(XMLParser);
00643 PG_Widget* parent = XMLParser->ParentObject;
00644
00645
00646 if (IsTag("layout","LA",XML_SECTION_DOC)) {
00647 XMLParser->Section = XML_SECTION_LAYOUT;
00648 return;
00649 }
00650
00651
00652 if (IsTag("head","HD",XML_SECTION_LAYOUT)) {
00653 XMLParser->Section = XML_SECTION_HEAD;
00654 return;
00655 }
00656
00657
00658 if (IsTag("body","BD",XML_SECTION_LAYOUT)) {
00659 XMLParser->Section = XML_SECTION_BODY;
00660 return;
00661 }
00662
00663
00664 if (IsTag("widget","WD",XML_SECTION_BODY)) {
00665 XMLParser->Section = XML_SECTION_WIDGET | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00666 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00667
00668 PG_Widget *Widget = new PG_Widget(parent, Rect);
00669 XMLParser->ParentObject = Widget;
00670
00671 XMLParser->InhTagFlags |=SetWidgetAtts(Widget, atts, XMLParser);
00672 return;
00673 }
00674
00675
00676 if (IsTag("dropdown","DD",XML_SECTION_BODY)) {
00677 XMLParser->Section = XML_SECTION_DROPDOWN | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00678 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00679
00680 if (Rect.w < Rect.h) {
00681 PG_LogWRN("Width must be greater than height in <dropdown>");
00682 return;
00683 }
00684
00685 PG_DropDown *Widget = new PG_DropDown (parent, Rect);
00686 XMLParser->ParentObject = Widget;
00687
00688 XMLParser->InhTagFlags |=SetDropDownAtts(Widget, atts, XMLParser);
00689 return;
00690 }
00691
00692
00693 if (IsTag("dropdownitem","DI",XML_SECTION_DROPDOWN)) {
00694 XMLParser->Section = XML_SECTION_NONPAIR;
00695
00696 ((PG_DropDown *)(XMLParser->ParentObject))->AddItem(PG_Layout::GetParamStr(atts, "text"));
00697 return;
00698 }
00699
00700
00701 if (IsTag("button","BT",XML_SECTION_BODY)) {
00702 XMLParser->Section = XML_SECTION_BUTTON | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00703 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00704
00705 PG_LogDBG("layout: parent = %p", parent);
00706 PG_Button *Widget = new PG_Button(
00707 parent,
00708 Rect,
00709 PG_Layout::GetParamStr(atts, "text"),
00710 PG_Layout::GetParamInt(atts, "id"),
00711 PG_Layout::GetParamStr(atts, "style"));
00712
00713 XMLParser->ParentObject = Widget;
00714
00715 XMLParser->InhTagFlags |=SetButtonAtts(Widget, atts, XMLParser);
00716 return;
00717 }
00718
00719
00720 if (IsTag("label","LL",XML_SECTION_BODY)) {
00721 XMLParser->Section = XML_SECTION_LABEL | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00722 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00723
00724 PG_Label *Widget = new PG_Label(parent, Rect, "", PG_Layout::GetParamStr(atts, "style"));
00725 XMLParser->ParentObject = Widget;
00726
00727 XMLParser->InhTagFlags |=SetLabelAtts(Widget, atts, XMLParser);
00728 return;
00729 }
00730
00731
00732
00733
00734 if (IsTag("themewidget","GW",XML_SECTION_BODY) || IsTag("gradientwidget","GW",XML_SECTION_BODY) || IsTag("staticframe","SF",XML_SECTION_BODY)) {
00735 XMLParser->Section = XML_SECTION_GWIDGET | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00736 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00737
00738 PG_ThemeWidget* Widget = new PG_ThemeWidget(parent, Rect);
00739 XMLParser->ParentObject = Widget;
00740
00741 XMLParser->InhTagFlags |= SetThemeWidgetAtts(Widget, atts, XMLParser);
00742 return;
00743 }
00744
00745
00746 if (IsTag("lineedit","LE",XML_SECTION_BODY)) {
00747 int i;
00748 XMLParser->Section = XML_SECTION_LINEEDIT | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00749 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00750
00751 i = PG_Layout::GetParamInt(atts, "length");
00752 if (i == -1) {
00753 i = 1000000;
00754 }
00755
00756 PG_LineEdit* Widget = new PG_LineEdit(parent, Rect, "LineEdit", i);
00757 XMLParser->ParentObject = Widget;
00758
00759 XMLParser->InhTagFlags |=SetLineEditAtts(Widget, atts, XMLParser);
00760 return;
00761 }
00762
00763
00764 if (IsTag("maskedit","ME",XML_SECTION_BODY)) {
00765 XMLParser->Section = XML_SECTION_MASKEDIT | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00766 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00767
00768 PG_MaskEdit* Widget = new PG_MaskEdit(parent, Rect);
00769 XMLParser->ParentObject = Widget;
00770
00771 XMLParser->InhTagFlags |=SetMaskEditAtts(Widget, atts, XMLParser);
00772 return;
00773 }
00774
00775
00776 if (IsTag("progressbar","PB",XML_SECTION_BODY)) {
00777 XMLParser->Section = XML_SECTION_PROGRESSBAR | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00778 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00779
00780 PG_ProgressBar *Widget = new PG_ProgressBar(parent, Rect);
00781 XMLParser->ParentObject = Widget;
00782
00783 XMLParser->InhTagFlags |=SetProgressBarAtts(Widget, atts, XMLParser);
00784 return;
00785 }
00786
00787
00788 if (IsTag("spinnerbox","SB",XML_SECTION_BODY)) {
00789 XMLParser->Section = XML_SECTION_SPINNERBOX | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00790 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00791
00792 PG_SpinnerBox *Widget = new PG_SpinnerBox(parent, Rect);
00793 XMLParser->ParentObject = Widget;
00794
00795 XMLParser->InhTagFlags |=SetSpinnerBoxAtts(Widget, atts, XMLParser);
00796 return;
00797 }
00798
00799
00800 if (IsTag("window","WN",XML_SECTION_BODY)) {
00801 int i;
00802
00803 XMLParser->Section = XML_SECTION_WINDOW | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00804 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00805
00806 i = PG_Layout::GetParamInt(atts, "titleheight");
00807 if (i == -1) {
00808 i = 25;
00809 }
00810
00811 int flags = PG_Layout::GetParamInt(atts, "flags");
00812 if(flags == -1) {
00813 flags = 0;
00814 }
00815
00816 PG_Window *Widget = new PG_Window(parent, Rect, PG_Layout::GetParamStr(atts, "title"), (PG_Window::WindowFlags)flags, "Window", i);
00817 XMLParser->ParentObject = Widget;
00818
00819 XMLParser->InhTagFlags |=SetWindowAtts(Widget, atts, XMLParser);
00820 return;
00821 }
00822
00823
00824 if (IsTag("messagebox","MB",XML_SECTION_BODY)) {
00825 PG_Rect B1Rect,B2Rect;
00826 char* B1Text,*B2Text;
00827 PG_MessageBox *Widget;
00828
00829 XMLParser->Section = XML_SECTION_MESSAGEBOX | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00830 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00831
00832 B1Text = PG_Layout::GetParamStr(atts, "b1text");
00833 B2Text = PG_Layout::GetParamStr(atts, "b2text");
00834
00835 PG_Layout::GetParamRect(atts, "b1pos", B1Rect, parent);
00836 PG_Layout::GetParamRect(atts, "b2pos", B2Rect, parent);
00837
00838 if (B2Text[0] == 0) {
00839 Widget = new PG_MessageBox(parent, Rect, PG_Layout::GetParamStr(atts, "title"), "", B1Rect, B1Text, PG_Layout::GetParamAlign(atts, "talign"));
00840 } else {
00841 Widget = new PG_MessageBox(parent, Rect, PG_Layout::GetParamStr(atts, "title"), "", B1Rect, B1Text, B2Rect, B2Text, PG_Layout::GetParamAlign(atts, "talign"));
00842 }
00843
00844 XMLParser->ParentObject = Widget;
00845
00846 XMLParser->InhTagFlags |=SetWindowAtts(Widget, atts, XMLParser);
00847 return;
00848 }
00849
00850
00851 if (IsTag("widgetlist","WL",XML_SECTION_BODY)) {
00852 XMLParser->Section = XML_SECTION_WIDGETLIST | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00853 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00854
00855 PG_WidgetList *Widget = new PG_WidgetList(parent, Rect);
00856 XMLParser->ParentObject = Widget;
00857
00858 XMLParser->InhTagFlags |= SetWidgetListAtts(Widget, atts, XMLParser);
00859 return;
00860 }
00861
00862
00863 if (IsTag("listbox","LB",XML_SECTION_BODY)) {
00864 XMLParser->Section = XML_SECTION_LISTBOX | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00865 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00866
00867 PG_ListBox *Widget = new PG_ListBox(parent, Rect);
00868 XMLParser->ParentObject = Widget;
00869
00870 XMLParser->InhTagFlags |= SetListBoxAtts(Widget, atts, XMLParser) &~INHTAGFLAG_ADDWIDGET;
00871 return;
00872 }
00873
00874
00875 if (IsTag("listboxitem","LI",XML_SECTION_LISTBOX)) {
00876 XMLParser->Section = XML_SECTION_LISTBOXITEM | XML_SECTION_COMWIDPARAMS;
00877
00878 int h = PG_Layout::GetParamInt(atts, "height");
00879 if(h < 0) {
00880 h = 25;
00881 }
00882
00883
00884 PG_ListBoxItem *Widget = new PG_ListBoxItem(parent, h, PG_Layout::GetParamStr(atts, "ltext"));
00885
00886 XMLParser->ParentObject = Widget;
00887
00888 XMLParser->InhTagFlags |= SetListBoxItemAtts(Widget, atts, XMLParser);
00889 return;
00890 }
00891
00892
00893 if (IsTag("columnitem","CI",XML_SECTION_LISTBOX)) {
00894 XMLParser->Section = XML_SECTION_COLUMNITEM | XML_SECTION_COMWIDPARAMS;
00895
00896
00897 PG_ColumnItem *Widget = new PG_ColumnItem(parent, PG_Layout::GetParamInt(atts, "columns"),PG_Layout::GetParamInt(atts, "height"));
00898
00899 XMLParser->ParentObject = Widget;
00900
00901 XMLParser->InhTagFlags |= SetListBoxItemAtts(Widget, atts, XMLParser);
00902 return;
00903 }
00904
00905
00906 if (IsTag("column","CO",XML_SECTION_COLUMNITEM)) {
00907 int no,i;
00908 XMLParser->Section = XML_SECTION_COLUMNITEM | XML_SECTION_COMWIDPARAMS;
00909
00910 no = PG_Layout::GetParamInt(atts, "number");
00911 if(no == -1) {
00912 no = 0;
00913 }
00914
00915 if (no >= ((PG_ColumnItem *)XMLParser->ParentObject)->GetColumnCount ()) {
00916 PG_LogWRN("Column number error !!!");
00917 return;
00918 }
00919
00920 i = PG_Layout::GetParamInt(atts, "width");
00921 if (i != -1) {
00922 ((PG_ColumnItem *)XMLParser->ParentObject)->SetColumnWidth(no, i);
00923 }
00924
00925 ((PG_ColumnItem *)XMLParser->ParentObject)->SetColumnText(no, PG_Layout::GetParamStr(atts, "text"));
00926
00927 return;
00928 }
00929
00930
00931 if (IsTag("radiobutton","RB",XML_SECTION_BODY)) {
00932 XMLParser->Section = XML_SECTION_RADIOBUTTON | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00933 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00934
00935 PG_RadioButton *Widget = new PG_RadioButton(
00936 parent,
00937 Rect,
00938 (const char*)PG_Layout::GetParamStr(atts, "text"),
00939 (PG_RadioButton *)PG_Application::GetWidgetByName(PG_Layout::GetParamStr(atts, "group")),
00940 0);
00941
00942 XMLParser->ParentObject = Widget;
00943
00944 XMLParser->InhTagFlags |= SetRadioButtonAtts(Widget, atts, XMLParser);
00945 return;
00946 }
00947
00948
00949 if (IsTag("checkbutton","CB",XML_SECTION_BODY)) {
00950 XMLParser->Section = XML_SECTION_CHECKBUTTON | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00951 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00952
00953 PG_CheckButton *Widget = new PG_CheckButton(
00954 parent,
00955 Rect,
00956 PG_Layout::GetParamStr(atts, "text"),
00957 0);
00958
00959 XMLParser->ParentObject = Widget;
00960
00961 XMLParser->InhTagFlags |= SetRadioButtonAtts(Widget, atts, XMLParser);
00962 return;
00963 }
00964
00965
00966 if (IsTag("scrollbar","SB",XML_SECTION_BODY)) {
00967 XMLParser->Section = XML_SECTION_SCROLLBAR | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00968 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00969
00970 PG_ScrollBar::ScrollDirection d = PG_Layout::GetParamScrollDirection(atts, "dir");
00971 (d <= 0) ? d = PG_ScrollBar::HORIZONTAL : d = PG_ScrollBar::VERTICAL;
00972
00973 PG_ScrollBar *Widget = new PG_ScrollBar(parent, Rect, d);
00974 XMLParser->ParentObject = Widget;
00975
00976 XMLParser->InhTagFlags |= SetScrollBarAtts(Widget, atts, XMLParser);
00977 return;
00978 }
00979
00980
00981 if (IsTag("slider","SR",XML_SECTION_BODY)) {
00982 XMLParser->Section = XML_SECTION_SCROLLBAR | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00983 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00984
00985 PG_Slider *Widget = new PG_Slider(parent, Rect, PG_Layout::GetParamScrollDirection(atts, "dir"));
00986 XMLParser->ParentObject = Widget;
00987
00988 XMLParser->InhTagFlags |=SetScrollBarAtts(Widget, atts, XMLParser);
00989 return;
00990 }
00991
00992
00993 if (IsTag("image","IM",XML_SECTION_BODY)) {
00994 PG_Point Point;
00995 PG_Rect Rect;
00996
00997 XMLParser->Section = XML_SECTION_IMAGE | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
00998 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
00999
01000 Point.x=Rect.x;
01001 Point.y=Rect.y;
01002
01003 PG_Image *Widget = new PG_Image(parent, Point, PG_Layout::GetParamStr(atts, "iimage"));
01004 XMLParser->ParentObject = Widget;
01005
01006 XMLParser->InhTagFlags |= SetThemeWidgetAtts(Widget, atts, XMLParser);
01007 return;
01008 }
01009
01010
01011 if (IsTag("richedit","RE",XML_SECTION_BODY)) {
01012 XMLParser->Section = XML_SECTION_RICHEDIT | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
01013 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
01014
01015 PG_RichEdit *Widget = new PG_RichEdit(parent, Rect, PG_Layout::GetParamInt(atts, "vresize") == 1 , PG_Layout::GetParamInt(atts, "linewidth"));
01016 XMLParser->ParentObject = Widget;
01017
01018 XMLParser->InhTagFlags |= SetScrollWidgetAtts(Widget, atts, XMLParser);
01019 return;
01020 }
01021
01022
01023 if(IsTag("popupmenu", "PM", XML_SECTION_BODY)) {
01024 PG_Point Point;
01025 PG_Rect Rect;
01026
01027 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
01028
01029 Point.x=Rect.x;
01030 Point.y=Rect.y;
01031
01032 PG_PopupMenu* Widget = NULL;
01033
01034
01035 if(XMLParser->Section & XML_SECTION_POPUPMENU) {
01036 Widget = new PG_PopupMenu(NULL, 0, 0, PG_NULLSTR);
01037 PG_PopupMenu* menu = static_cast<PG_PopupMenu*>(XMLParser->ParentObject);
01038 menu->addMenuItem(PG_Layout::GetParamStr(atts, "caption"), Widget);
01039 } else {
01040
01041 if(XMLParser->Section & XML_SECTION_MENUBAR) {
01042 Widget = new PG_PopupMenu(NULL, Point.x, Point.y, PG_Layout::GetParamStr(atts, "caption"));
01043 static_cast<PG_MenuBar*>(XMLParser->ParentObject)->Add(PG_Layout::GetParamStr(atts, "text"), Widget);
01044 } else {
01045 Widget = new PG_PopupMenu(parent, Point.x, Point.y, PG_Layout::GetParamStr(atts, "caption"));
01046 }
01047 }
01048
01049
01050 XMLParser->Section = XML_SECTION_POPUPMENU | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
01051
01052 XMLParser->ParentObject = Widget;
01053
01054 XMLParser->InhTagFlags |= SetPopupMenuAtts(Widget, atts, XMLParser);
01055 XMLParser->InhTagFlags |= INHTAGFLAG_HIDE;
01056 return;
01057 }
01058
01059
01060 if(IsTag("popupmenuitem", "PI", XML_SECTION_BODY)) {
01061 if(!(XMLParser->Section & XML_SECTION_POPUPMENU)) {
01062 PG_LogERR("popupmenuitem can't be created in the current context!");
01063 return;
01064 }
01065 PG_PopupMenu* menu = static_cast<PG_PopupMenu*>(XMLParser->ParentObject);
01066 menu->addMenuItem(PG_Layout::GetParamStr(atts, "caption"), PG_Layout::GetParamInt(atts, "id"));
01067
01068 return;
01069 }
01070
01071
01072 if(IsTag("menubar", "MB", XML_SECTION_BODY)) {
01073 PG_Rect Rect;
01074
01075 XMLParser->Section = XML_SECTION_MENUBAR | XML_SECTION_BODY | XML_SECTION_COMWIDPARAMS;
01076 PG_Layout::GetParamRect(atts, "pos", Rect, parent);
01077
01078 PG_MenuBar* Widget = new PG_MenuBar(parent, Rect);
01079 XMLParser->ParentObject = Widget;
01080
01081 XMLParser->InhTagFlags |= SetThemeWidgetAtts(Widget, atts, XMLParser);
01082 return;
01083 }
01084
01085
01086 if (IsTag("style","ST",XML_SECTION_COMWIDPARAMS)) {
01087 char *widget;
01088 char *object;
01089
01090 XMLParser->Section = XML_SECTION_NONPAIR;
01091
01092 widget = PG_Layout::GetParamStr(atts, "widget");
01093 if (widget[0] == 0)
01094 return;
01095
01096 object = PG_Layout::GetParamStr(atts, "object");
01097
01098 if (object[0] == 0) {
01099 XMLParser->ParentObject->LoadThemeStyle(widget);
01100 } else {
01101 XMLParser->ParentObject->LoadThemeStyle(widget,object);
01102 }
01103 return;
01104 }
01105
01106
01107 if (IsTag("font","FT",XML_SECTION_COMWIDPARAMS)) {
01108 return;
01109 }
01110
01111 if(XMLParser->Section & XML_SECTION_HEAD) {
01112
01113 PG_XMLTag* n = new PG_XMLTag(name, atts);
01114 PG_Application::GetApp()->sigXMLTag(n);
01115 }
01116
01117 PG_LogWRN("Unknown tag `%s` in section %d !",name,XMLParser->Section);
01118 return;
01119 }
01120
01121 static void XMLEndDoc(void *userData, const char *name) {
01122 ParseUserData_t *XMLParser = (ParseUserData_t *)userData;
01123 PG_Widget *WidgetToAdd = NULL;
01124
01125
01126
01127
01128 if ((XMLParser->EndTagFlags & ENDTAGFLAG_SETSIZE) != 0) {
01129 XMLParser->ParentObject->SetSizeByText(XMLParser->Width,XMLParser->Height);
01130 }
01131
01132 if ((XMLParser->EndTagFlags & ENDTAGFLAG_OBJECT) != 0) {
01133 if (((XMLParser->InhTagFlags & INHTAGFLAG_ADDWIDGET) != 0) && ((XMLParser->EndTagFlags & ENDTAGFLAG_WIDGETLIST) == 0)) {
01134
01135
01136 }
01137
01138 if ((XMLParser->InhTagFlags & INHTAGFLAG_HIDE) == 0) {
01139 if(XMLParser->ParentObject->GetParent() == NULL) {
01140 XMLParser->ParentObject->Show();
01141 }
01142 } else {
01143 XMLParser->ParentObject->Hide();
01144 }
01145
01146
01147
01148 }
01149
01150 RestoreUserData(XMLParser);
01151
01152 if (WidgetToAdd == NULL) {
01153 return;
01154 }
01155
01156 ((PG_WidgetList *)(XMLParser->ParentObject))->AddChild(WidgetToAdd);
01157 }
01158
01159 static void XMLTextDoc(void *userData, const XML_Char *s, int len) {
01160 char* buffer = new char[len+1];
01161
01162 ParseUserData_t *XMLParser = (ParseUserData_t *)userData;
01163
01164 memcpy(buffer,s,len);
01165 buffer[len]=0;
01166
01167 if (XMLParser->ParentObject != NULL)
01168 XMLParser->ParentObject->AddText(buffer);
01169
01170 delete[] buffer;
01171 }
01172
01173 static void XMLProcInstr(void *userData, const XML_Char *target, const XML_Char *data) {
01174 ParseUserData_t *XMLParser = (ParseUserData_t *)userData;
01175
01176 if (PG_LayoutProcessingInstruction != NULL)
01177 PG_LayoutProcessingInstruction(target, data, XMLParser->FileName, XMLParser->UserSpace);
01178 }
01179
01180 bool PG_Layout::Load(PG_Widget* parent, const std::string& filename, void (* WorkCallback)(int now, int max), void *UserSpace) {
01181 ParseUserData_t XMLParser;
01182 bool status = true;
01183 int bytes_pos = 0;
01184
01185 XMLParser.Parser = XML_ParserCreate(NULL);
01186 XMLParser.Section = XML_SECTION_DOC;
01187 XMLParser.PrevUserData = NULL;
01188 XMLParser.ParentObject = parent;
01189 XMLParser.InhTagFlags = 0;
01190 XMLParser.UserSpace = UserSpace;
01191
01192 XML_SetUserData(XMLParser.Parser, &XMLParser);
01193 XML_SetElementHandler(XMLParser.Parser, XMLStartDoc, XMLEndDoc);
01194 XML_SetCharacterDataHandler(XMLParser.Parser, XMLTextDoc);
01195 XML_SetProcessingInstructionHandler(XMLParser.Parser, XMLProcInstr);
01196
01197 XMLParser.FileName = filename.c_str();
01198 PG_File* f = PG_Application::OpenFile(XMLParser.FileName);
01199 if (f == NULL) {
01200
01201 PG_LogWRN("Layout file %s not found !", filename.c_str());
01202 return <