1
2 #include "studiox_includes.h"
3
4 #ifdef _DEBUG
5 #define new DEBUG_NEW
6 #endif
7
accordion_menu_service_provider()8 accordion_menu_service_provider::accordion_menu_service_provider()
9 {
10 }
11
GetCreateFromDefFunctionName()12 CString accordion_menu_service_provider::GetCreateFromDefFunctionName()
13 {
14 return CString("gx_studio_accordion_menu_create");
15 }
16
GetCreateFromDefFunction(int version)17 CString accordion_menu_service_provider::GetCreateFromDefFunction(int version)
18 {
19 CString out;
20 MakeCreatePreamble("accordion_menu", version, out);
21
22 out += "{\n"
23 " UINT status;\n"
24 " GX_ACCORDION_MENU *accordion = (GX_ACCORDION_MENU *) control_block;\n"
25 " status = gx_accordion_menu_create(accordion, info->widget_name,\n"
26 " parent, info->style, info->widget_id, &info->size);\n"
27 " return status;\n"
28 "}\n";
29 return out;
30 }
31
CreateNewInstance(GX_WIDGET * parent)32 widget_info *accordion_menu_service_provider::CreateNewInstance(GX_WIDGET *parent)
33 {
34 GX_RECTANGLE size;
35 int parent_size;
36
37 gx_utility_rectangle_define(&size, 0, 0, 79, 23);
38
39 parent_size = (parent->gx_widget_size.gx_rectangle_right -
40 parent->gx_widget_size.gx_rectangle_left) / 2;
41 size.gx_rectangle_right = size.gx_rectangle_left + parent_size;
42
43 parent_size = (parent->gx_widget_size.gx_rectangle_bottom -
44 parent->gx_widget_size.gx_rectangle_top) / 2;
45 size.gx_rectangle_bottom = size.gx_rectangle_top + parent_size;
46
47 gx_utility_rectangle_center(&size, &parent->gx_widget_size);
48
49 GX_ACCORDION_MENU *accordion = new GX_ACCORDION_MENU;
50
51 gx_accordion_menu_create(accordion, "accordion", parent, GX_STYLE_ENABLED | GX_STYLE_BORDER_THIN, 0, &size);
52 widget_info *info = InitWidgetInfo((GX_WIDGET *)accordion);
53
54 return info;
55 }
56
GenerateFromInfo(GX_WIDGET * parent,widget_info * info)57 GX_WIDGET *accordion_menu_service_provider::GenerateFromInfo(GX_WIDGET *parent, widget_info *info)
58 {
59 GX_ACCORDION_MENU *accordion = new GX_ACCORDION_MENU;
60 gx_accordion_menu_create(accordion,
61 (CHAR *)info->app_name.GetString(),
62 parent,
63 info->style, 0,
64 &info->size);
65
66 gx_widget_fill_color_set((GX_WIDGET *)accordion,
67 info->color_id[NORMAL_FILL_COLOR_INDEX], info->color_id[SELECTED_FILL_COLOR_INDEX], info->color_id[DISABLED_FILL_COLOR_INDEX]);
68
69 return (GX_WIDGET *)accordion;
70 }