1 #ifndef _BASE_WIDGET_SERVICE_PROVIDER_ 2 #define _BASE_WIDGET_SERVICE_PROVIDER_ 3 4 #define GX_TYPE_TEMPLATE 200 5 6 class screen_generator; // forward reference 7 8 class template_service_provider : public widget_service_provider 9 { 10 public: 11 template_service_provider(); 12 virtual ~template_service_provider(); 13 GetType()14 virtual int GetType() 15 { 16 return GX_TYPE_TEMPLATE; 17 } GetTypeName(widget_info * info)18 virtual CString GetTypeName(widget_info *info) 19 { 20 return CString("GX_TYPE_TEMPLATE"); 21 } 22 GetShortName()23 virtual CString GetShortName() 24 { 25 return CString("TEMPLATE"); 26 } 27 28 virtual CString GetVarDeclaration(); GetControlBlockName()29 virtual CString GetControlBlockName() 30 { 31 /* the control block name for template derived is the template base 32 app name. Handled by screen_generator 33 */ 34 return CString(""); 35 } 36 37 virtual CString DeclarePropertiesStruct(); 38 virtual CString WriteExtendedProperties(screen_generator *gen, CString &scope, widget_info *info); 39 virtual CString GetCreateFromDefFunctionName(); 40 virtual CString GetCreateFromDefFunction(int version); 41 42 virtual widget_info *CreateNewInstance(GX_WIDGET *parent); 43 widget_info *CreateNewInstance(GX_WIDGET *parent, widget_info *base); 44 virtual GX_WIDGET *GenerateFromInfo(GX_WIDGET *parent, widget_info *info); 45 46 virtual void SaveToProject(xml_writer &, studiox_project *project, int display, widget_info *); 47 virtual void ReadFromProject(xml_reader &, studiox_project *project, int display, widget_info *info, ULONG valid_styles); 48 49 virtual void AssignPixelmap(widget_info *info, int index, GX_RESOURCE_ID pixmap_id); 50 virtual void Autosize(widget_info *info); 51 52 static widget_info *GetBaseInfo(widget_info *derived, studiox_project *project = NULL); 53 54 static void RebuildDerivedWidgets(widget_info *base_info); 55 static int CountDerivedWidgets(widget_info *base_info); 56 static BOOL CheckExternalTemplateDerivations(folder_info *folder); 57 static void CountDerivedWidgets(widget_info *start, widget_info *base_info, int &count); 58 static void CheckRenameTemplate(CString &old_name, CString *new_name); 59 static void CheckRenameTemplate(widget_info *start, CString &old_name, CString *new_name); 60 61 private: 62 widget_service_provider *GetBaseProvider(widget_info *derived); 63 GX_WIDGET *BuildBaseWidget(GX_WIDGET *parent, widget_info *base, GX_BOOL add_children = FALSE); 64 static void RebuildDerivedWidgets(widget_info *start, CString &base_name); 65 66 }; 67 68 #endif 69