1
2 #include "studiox_includes.h"
3
4 #ifdef _DEBUG
5 #define new DEBUG_NEW
6 #endif
7
button_service_provider()8 button_service_provider::button_service_provider()
9 {
10 }
11
GetVarDeclaration()12 CString button_service_provider::GetVarDeclaration()
13 {
14 return CString("GX_BUTTON_MEMBERS_DECLARE");
15 }
16
GetCreateFromDefFunctionName()17 CString button_service_provider::GetCreateFromDefFunctionName()
18 {
19 return CString("gx_studio_button_create");
20 }
21
GetCreateFromDefFunction(int version)22 CString button_service_provider::GetCreateFromDefFunction(int version)
23 {
24 CString out;
25 MakeCreatePreamble("button", version, out);
26
27 out += "{\n"
28 " UINT status;\n"
29 " GX_BUTTON *button = (GX_BUTTON *) control_block;\n"
30 " status = gx_button_create(button, info->widget_name, parent, info->style, info->widget_id, &info->size);\n"
31 " return status;\n"
32 "}\n";
33 return out;
34 }
35
CreateNewInstance(GX_WIDGET * parent)36 widget_info *button_service_provider::CreateNewInstance(GX_WIDGET *parent)
37 {
38 GX_RECTANGLE size;
39 gx_utility_rectangle_define(&size, 0, 0, 79, 23);
40 gx_utility_rectangle_center(&size, &parent->gx_widget_size);
41
42 GX_BUTTON *button = new GX_BUTTON;
43 gx_button_create(button, "button", parent,
44 GX_STYLE_ENABLED|GX_STYLE_BORDER_RAISED, 0, &size);
45 widget_info *info = InitWidgetInfo((GX_WIDGET *) button);
46 return info;
47 }
48
ReadFromProject(xml_reader & reader,studiox_project * project,int display,widget_info * info,ULONG valid_styles)49 void button_service_provider::ReadFromProject(xml_reader &reader, studiox_project *project, int display, widget_info *info, ULONG valid_styles)
50 {
51 valid_styles |= GX_STYLE_BUTTON_PUSHED|GX_STYLE_BUTTON_TOGGLE|GX_STYLE_BUTTON_RADIO|GX_STYLE_BUTTON_EVENT_ON_PUSH|GX_STYLE_BUTTON_REPEAT;
52 widget_service_provider::ReadFromProject(reader, project, display, info, valid_styles);
53 }
54
55
GenerateFromInfo(GX_WIDGET * parent,widget_info * info)56 GX_WIDGET *button_service_provider::GenerateFromInfo(GX_WIDGET *parent, widget_info *info)
57 {
58 GX_BUTTON *button = new GX_BUTTON;
59 gx_button_create(button,
60 (CHAR *) info->app_name.GetString(),
61 parent,
62 info->style,
63 0,
64 &info->size);
65
66 gx_widget_fill_color_set((GX_WIDGET *) button,
67 info->color_id[NORMAL_FILL_COLOR_INDEX], info->color_id[SELECTED_FILL_COLOR_INDEX], info->color_id[DISABLED_FILL_COLOR_INDEX]);
68 return ((GX_WIDGET *) button);
69 }
70
71