34 |
#include "pglog.h" |
#include "pglog.h" |
35 |
#include "pgdraw.h" |
#include "pgdraw.h" |
36 |
#include "pglayout.h" |
#include "pglayout.h" |
37 |
|
#include "pgtheme.h" |
38 |
|
|
39 |
bool PG_Widget::bBulkUpdate = false; |
bool PG_Widget::bBulkUpdate = false; |
40 |
PG_RectList PG_Widget::widgetList; |
PG_RectList PG_Widget::widgetList; |
307 |
|
|
308 |
/** */ |
/** */ |
309 |
PG_Point PG_Widget::ClientToScreen(int sx, int sy) { |
PG_Point PG_Widget::ClientToScreen(int sx, int sy) { |
310 |
PG_Point p; |
return PG_Point(sx + my_xpos, sy + my_ypos); |
|
|
|
|
p.x = sx + my_xpos; |
|
|
p.y = sy + my_ypos; |
|
|
|
|
|
return p; |
|
311 |
} |
} |
312 |
|
|
313 |
PG_Point PG_Widget::ScreenToClient(int x, int y) { |
PG_Point PG_Widget::ScreenToClient(int x, int y) { |
314 |
PG_Point p; |
return PG_Point(x - my_xpos, y - my_ypos); |
|
|
|
|
p.x = x - my_xpos; |
|
|
p.y = y - my_ypos; |
|
|
|
|
|
return p; |
|
315 |
} |
} |
316 |
|
|
317 |
void PG_Widget::AddChild(PG_Widget * child) { |
void PG_Widget::AddChild(PG_Widget * child) { |
1031 |
my_internaldata->fadeSteps = steps; |
my_internaldata->fadeSteps = steps; |
1032 |
} |
} |
1033 |
|
|
1034 |
bool PG_Widget::Action(PG_ACTION action) { |
bool PG_Widget::Action(KeyAction action) { |
1035 |
int x = my_xpos + my_width / 2; |
int x = my_xpos + my_width / 2; |
1036 |
int y = my_ypos + my_height / 2; |
int y = my_ypos + my_height / 2; |
1037 |
|
|
1038 |
switch(action) { |
switch(action) { |
1039 |
case PG_ACT_ACTIVATE: |
case ACT_ACTIVATE: |
1040 |
SDL_WarpMouse(x,y); |
SDL_WarpMouse(x,y); |
1041 |
eventMouseEnter(); |
eventMouseEnter(); |
1042 |
break; |
break; |
1043 |
|
|
1044 |
case PG_ACT_DEACTIVATE: |
case ACT_DEACTIVATE: |
1045 |
eventMouseLeave(); |
eventMouseLeave(); |
1046 |
break; |
break; |
1047 |
|
|
1048 |
case PG_ACT_OK: |
case ACT_OK: |
1049 |
SDL_MouseButtonEvent button; |
SDL_MouseButtonEvent button; |
1050 |
button.button = 1; |
button.button = 1; |
1051 |
button.x = x; |
button.x = x; |
1053 |
eventMouseButtonDown(&button); |
eventMouseButtonDown(&button); |
1054 |
SDL_Delay(200); |
SDL_Delay(200); |
1055 |
eventMouseButtonUp(&button); |
eventMouseButtonUp(&button); |
1056 |
Action(PG_ACT_ACTIVATE); |
Action(ACT_ACTIVATE); |
1057 |
break; |
break; |
1058 |
|
|
1059 |
default: |
default: |
1834 |
GetClipRects(src, dst, *this); |
GetClipRects(src, dst, *this); |
1835 |
} |
} |
1836 |
|
|
1837 |
bool PG_Widget::eventMessage(MSG_MESSAGE* msg) { |
/*bool PG_Widget::eventMessage(MSG_MESSAGE* msg) { |
1838 |
bool rc = false; |
bool rc = false; |
1839 |
|
|
1840 |
if (!msg) |
if (!msg) |
1855 |
} |
} |
1856 |
|
|
1857 |
return rc; |
return rc; |
1858 |
} |
}*/ |
1859 |
|
|
1860 |
void PG_Widget::SetID(int id) { |
void PG_Widget::SetID(int id) { |
1861 |
my_internaldata->id = id; |
my_internaldata->id = id; |