19 |
#include "pgspinnerbox.h" |
#include "pgspinnerbox.h" |
20 |
#include "pglog.h" |
#include "pglog.h" |
21 |
#include "pgmenubar.h" |
#include "pgmenubar.h" |
22 |
|
#include "pgtheme.h" |
23 |
|
|
24 |
|
#include <iostream> |
25 |
|
|
26 |
#define RESX 800 |
#define RESX 800 |
27 |
#define RESY 600 |
#define RESY 600 |
31 |
PG_ThemeWidget splash1(&splash, PG_Rect(10,10,580,380)); |
PG_ThemeWidget splash1(&splash, PG_Rect(10,10,580,380)); |
32 |
PG_ThemeWidget splash2(&splash1, PG_Rect(10,10,560,340)); |
PG_ThemeWidget splash2(&splash1, PG_Rect(10,10,560,340)); |
33 |
PG_Label l(&splash2, PG_Rect(10,10,540,320), "I'm a splash screen"); |
PG_Label l(&splash2, PG_Rect(10,10,540,320), "I'm a splash screen"); |
34 |
l.SetAlignment(PG_TA_CENTER); |
l.SetAlignment(PG_Label::CENTER); |
35 |
|
|
36 |
splash.Show(); |
splash.Show(); |
37 |
SDL_Delay(5000); |
SDL_Delay(5000); |
107 |
|
|
108 |
|
|
109 |
TestWindow::TestWindow(PG_Widget* parent, const PG_Rect& r, char* windowtext) : |
TestWindow::TestWindow(PG_Widget* parent, const PG_Rect& r, char* windowtext) : |
110 |
PG_Window(parent, r, windowtext, WF_SHOW_CLOSE | WF_SHOW_MINIMIZE) |
PG_Window(parent, r, windowtext, DEFAULT) |
111 |
{ |
{ |
112 |
WidgetList = new PG_WidgetList(this, PG_Rect(30, 40, 220, 250)); |
WidgetList = new PG_WidgetList(this, PG_Rect(30, 40, 220, 250)); |
113 |
WidgetList->SetDirtyUpdate(false); |
WidgetList->SetDirtyUpdate(false); |
115 |
WidgetList->SetBackground("default/wnd_close.bmp", BKMODE_TILE, 0xFF); |
WidgetList->SetBackground("default/wnd_close.bmp", BKMODE_TILE, 0xFF); |
116 |
WidgetList->SetBackgroundBlend(0); |
WidgetList->SetBackgroundBlend(0); |
117 |
|
|
118 |
WidgetList->EnableScrollBar(true, PG_SB_VERTICAL); |
WidgetList->EnableScrollBar(true, PG_ScrollBar::VERTICAL); |
119 |
WidgetList->EnableScrollBar(true, PG_SB_HORIZONTAL); |
WidgetList->EnableScrollBar(true, PG_ScrollBar::HORIZONTAL); |
120 |
|
|
121 |
(new PG_Button(this, 100, PG_Rect(260,130,110,30), "<< ADD"))->sigClick.connect(slot(*this, &TestWindow::handleButtonClick)); |
(new PG_Button(this, 100, PG_Rect(260,130,110,30), "<< ADD"))->sigClick.connect(slot(*this, &TestWindow::handleButtonClick)); |
122 |
|
|
127 |
b->SetFontName("qnx/font.ttf"); |
b->SetFontName("qnx/font.ttf"); |
128 |
WidgetList->AddWidget(b); |
WidgetList->AddWidget(b); |
129 |
|
|
130 |
PG_Slider* s = new PG_Slider(NULL, 20, PG_Rect(0, 0, 200,20), PG_SB_HORIZONTAL); |
PG_Slider* s = new PG_Slider(NULL, 20, PG_Rect(0, 0, 200,20), PG_ScrollBar::HORIZONTAL); |
131 |
s->SetRange(0,255); |
s->SetRange(0,255); |
132 |
s->SetTransparency(200); |
s->SetTransparency(200); |
133 |
s->SetPosition(50); |
s->SetPosition(50); |
209 |
|
|
210 |
if(id == 100) { |
if(id == 100) { |
211 |
PG_Label* l = new PG_Label(NULL, PG_Rect(0,0,220,25), ""); |
PG_Label* l = new PG_Label(NULL, PG_Rect(0,0,220,25), ""); |
212 |
l->SetAlignment(PG_TA_CENTER); |
l->SetAlignment(PG_Label::CENTER); |
213 |
l->SetTextFormat("Label %i", ++label); |
l->SetTextFormat("Label %i", ++label); |
214 |
WidgetList->AddWidget(l); |
WidgetList->AddWidget(l); |
215 |
|
|
363 |
PG_RadioButton radio1(NULL, 1, PG_Rect(50,0,200,25), "RadioButton 1"); |
PG_RadioButton radio1(NULL, 1, PG_Rect(50,0,200,25), "RadioButton 1"); |
364 |
PG_RadioButton radio2(NULL, 2, PG_Rect(50,25,200,25), "RadioButton 2", &radio1); |
PG_RadioButton radio2(NULL, 2, PG_Rect(50,25,200,25), "RadioButton 2", &radio1); |
365 |
PG_RadioButton radio3(NULL, 3, PG_Rect(50,50,200,25), "RadioButton 3", &radio1); |
PG_RadioButton radio3(NULL, 3, PG_Rect(50,50,200,25), "RadioButton 3", &radio1); |
366 |
radio1.SetAlignment(PG_TA_RIGHT); |
radio1.SetAlignment(PG_Label::RIGHT); |
367 |
|
|
368 |
PG_RadioButton radio4(NULL, 4, PG_Rect(50,90,200,25), "RadioButton 4"); |
PG_RadioButton radio4(NULL, 4, PG_Rect(50,90,200,25), "RadioButton 4"); |
369 |
PG_RadioButton radio5(NULL, 5, PG_Rect(50,115,200,25), "RadioButton 5", &radio4); |
PG_RadioButton radio5(NULL, 5, PG_Rect(50,115,200,25), "RadioButton 5", &radio4); |
418 |
|
|
419 |
check1.Show(); |
check1.Show(); |
420 |
|
|
421 |
PG_ScrollBar scroll(NULL, 10, PG_Rect(50, 200, 300, 20), PG_SB_HORIZONTAL ); |
PG_ScrollBar scroll(NULL, 10, PG_Rect(50, 200, 300, 20), PG_ScrollBar::HORIZONTAL ); |
422 |
scroll.Show(); |
scroll.Show(); |
423 |
|
|
424 |
PG_MaskEdit edit(NULL, PG_Rect(260,0,200,25)); |
PG_MaskEdit edit(NULL, PG_Rect(260,0,200,25)); |
431 |
slider_label.Show(); |
slider_label.Show(); |
432 |
|
|
433 |
// create the slider |
// create the slider |
434 |
PG_Slider slider(NULL, 11, PG_Rect(50, 250, 300,20), PG_SB_HORIZONTAL); |
PG_Slider slider(NULL, 11, PG_Rect(50, 250, 300,20), PG_ScrollBar::HORIZONTAL); |
435 |
slider.SetRange(5,20); |
slider.SetRange(5,20); |
436 |
//slider.SetTransparency(128); |
//slider.SetTransparency(128); |
437 |
|
|
479 |
wnd1.Show(); |
wnd1.Show(); |
480 |
|
|
481 |
PG_LogMSG("app ready after %i ms", SDL_GetTicks() - start_ticks); |
PG_LogMSG("app ready after %i ms", SDL_GetTicks() - start_ticks); |
482 |
app.ShowCursor(PG_CURSOR_SOFTWARE); |
app.ShowCursor(PG_Application::SOFTWARE); |
483 |
|
|
484 |
PG_LogMSG("testing the widget finding methods"); |
PG_LogMSG("testing the widget finding methods"); |
485 |
PG_Widget *tmp; |
PG_Widget *tmp; |