1 
2 
3 #ifndef _WIDGET_FACTORY_
4 #define _WIDGET_FACTORY_
5 
6 class widget_factory {
7     public:
8         static BOOL GenerateWidgets(GX_WIDGET *parent, widget_info *start, BOOL save_ptrs = TRUE, BOOL do_siblings = TRUE);
9         //static BOOL GenerateWidgets(folder_info *start, BOOL save_ptrs = TRUE);
10         static GX_WIDGET *GenerateAppScreen(GX_WIDGET *root, widget_info *child);
11 
12         static void CleanupWidgets(widget_info *start, BOOL recursive = FALSE, BOOL do_siblings = FALSE);
13         static void CleanupWidgets(folder_info *folder);
14         static void DeleteWidgets(GX_WIDGET *widget);
15         static void DeleteOneWidget(GX_WIDGET *widget);
16 
17         //static void MoveWidget(GX_WIDGET *widget, GX_RECTANGLE &size);
18         static void MoveWidget(widget_info *info, GX_RECTANGLE &size);
19 
20         static void CreateUniqueAppNames(widget_info *start, widget_info *search_also = NULL, widget_info *search_start = NULL, BOOL is_top_level_widget = FALSE);
21         static BOOL FindAppName(widget_info *start, widget_info *find, BOOL search_child = TRUE);
22         static BOOL FindAppName(widget_info *start, CString &find_name, BOOL search_child = TRUE);
23         static BOOL FindAppName(folder_info *folder, CString &find_name, BOOL search_child = TRUE);
24         static BOOL FindAppName(folder_info *folder, widget_info *find, BOOL search_child = TRUE);
25         static BOOL FindBaseName(CString &find_name);
26 
27         static CString WidgetTypeToString(int type);
28         static int WidgetStringToType(CString &name);
29 
30         static void InitServiceProviders();     // called once at startup
31         static void DeleteServiceProviders();   // called once at shutdown
32         static void ResetServiceProviders(int provider_type = -1);        // called when project is closed
33 
34         static widget_service_provider *GetServiceProvider(int type);
35         static int GetWidgetType(int index);
36         static void ReplaceScrollbar(widget_info *info, GX_SCROLLBAR_APPEARANCE *appearance);
37         static void CheckReplaceSpritePixelmaps(widget_info *info, CArray<GX_RESOURCE_ID> &resource_id_array);
38 
39         static void UpdateSpriteFrameInfos(folder_info *folder, GX_RESOURCE_ID map_id);
40         static void UpdateSpriteFrameInfos(widget_info *info, GX_RESOURCE_ID map_id);
41         static int  CalculateResourceIdDecrementCount(CArray<GX_RESOURCE_ID>& resource_id_array, GX_RESOURCE_ID resource_id);
42         static void DecrementWidgetResourceIds(int res_type, widget_info *info, CArray<GX_RESOURCE_ID> &resource_id_array);
43         static void DecrementWidgetResourceIds(int res_type, folder_info *folder, GX_RESOURCE_ID resource_id);
44         static void DecrementWidgetResourceIds(int res_type, folder_info* folder, CArray<GX_RESOURCE_ID> &resource_id_array);
45         static int CountReferences(int res_type, widget_info *info, GX_RESOURCE_ID resource_id, int seed_count, bool skip_template = false);
46 
47         static int CountReferences(studiox_project *project, int res_type, GX_RESOURCE_ID resource_id);
48 
49         static void UpdateInputWidgetText(widget_info *info, GX_RESOURCE_ID resource_id);
50         static void UpdateInputWidgetText(studiox_project *project, GX_RESOURCE_ID resource_id = -1);
51         static void StringDeleted(studiox_project *project, GX_RESOURCE_ID string_id);
52 
53     private:
54         widget_factory();
55         static void UpdateWidgetInfoPositions(widget_info *info, int xshift,int yshift, BOOL do_next);
56         static void PositionPopupList(widget_info *info, GX_DROP_LIST *drop);
57 };
58 
59 #endif