Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.29 KB | None | 0 0
  1. /*
  2. Copyright © 2011, The AROS Development Team. All rights reserved.
  3. $Id$
  4. */
  5.  
  6. #define DEBUG 1
  7. #include <aros/debug.h>
  8.  
  9. #define ZCC_QUIET
  10.  
  11. #if defined(__AROS__)
  12. #define MUIMASTER_YES_INLINE_STDARG
  13. #endif
  14.  
  15. #include <proto/intuition.h>
  16. #include <proto/muimaster.h>
  17. #include <proto/utility.h>
  18.  
  19. #include <exec/types.h>
  20. #include <libraries/mui.h>
  21.  
  22. #include "iconwindow_panelgroup.h"
  23.  
  24. #define PANGVERS 0
  25. #define PANGREV 6
  26.  
  27. /// OM_NEW
  28. Object *PanelGroup__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
  29. {
  30. Object *_PanelGroup__RootGroupObj = NULL, *_PanelGroup__RootGroupSpacer = NULL;
  31. IPTR HorizWeight, VertWeight, PanelSize;
  32. BOOL HorizontalGroup, FloatSpacer;
  33.  
  34. D(bug("[IconWindow:PanelGroup]: %s()\n", __PRETTY_FUNCTION__));
  35.  
  36. HorizontalGroup = (BOOL)GetTagData(MUIA_Group_Horiz, FALSE, message->ops_AttrList);
  37. FloatSpacer = (BOOL)GetTagData(MUIA_PanelGroup_FloatSpacer, FALSE, message->ops_AttrList);
  38.  
  39. if (HorizontalGroup)
  40. {
  41. D(bug("[IconWindow:PanelGroup] %s: Horizontal PanelGroup\n", __PRETTY_FUNCTION__));
  42.  
  43. // if (!(FloatSpacer))
  44. // {
  45. // _PanelGroup__RootGroupSpacer = (Object *)HSpace(0);
  46. // }
  47. HorizWeight = 100;
  48. VertWeight = 0;
  49. }
  50. else
  51. {
  52. D(bug("[IconWindow:PanelGroup] %s: Vertical PanelGroup\n", __PRETTY_FUNCTION__));
  53.  
  54. // if (!(FloatSpacer))
  55. // {
  56. // _PanelGroup__RootGroupSpacer = (Object *)VSpace(0);
  57. // }
  58. HorizWeight = 0;
  59. VertWeight = 100;
  60. }
  61.  
  62. // if (_PanelGroup__RootGroupSpacer == NULL)
  63. // {
  64. // D(bug("[IconWindow:PanelGroup] %s: Floating Spacer\n", __PRETTY_FUNCTION__));
  65. _PanelGroup__RootGroupSpacer = (Object *)RectangleObject,
  66. MUIA_HorizWeight, 100,
  67. MUIA_VertWeight, 100,
  68. End;
  69. // }
  70.  
  71. HorizWeight = (IPTR)GetTagData(MUIA_HorizWeight, HorizWeight, message->ops_AttrList);
  72. VertWeight = (IPTR)GetTagData(MUIA_VertWeight, VertWeight, message->ops_AttrList);
  73. PanelSize = (IPTR)GetTagData(MUIA_PanelGroup_PanelSize, 0, message->ops_AttrList);
  74.  
  75. D(bug("[IconWindow:PanelGroup] %s: HorizWeight %d, VertWeight %d\n", __PRETTY_FUNCTION__, HorizWeight, VertWeight));
  76.  
  77. self = (Object *)DoSuperNewTags
  78. (
  79. CLASS, self, NULL,
  80. //MUIA_ShowMe, FALSE,
  81. InnerSpacing(0,0),
  82. MUIA_Group_Horiz, (HorizontalGroup) ? FALSE : TRUE,
  83. MUIA_HorizWeight, HorizWeight,
  84. MUIA_VertWeight, VertWeight,
  85. MUIA_Frame, MUIV_Frame_None,
  86. MUIA_Group_Spacing, 3,
  87. Child, (IPTR)(_PanelGroup__RootGroupObj = (Object *)MUI_NewObject(MUIC_Group,
  88. MUIA_Group_Horiz, (HorizontalGroup) ? TRUE : FALSE,
  89. MUIA_InnerLeft, (0),
  90. MUIA_InnerRight, (0),
  91. MUIA_InnerTop, (0),
  92. MUIA_InnerBottom, (0),
  93. MUIA_Frame, MUIV_Frame_None,
  94. MUIA_Group_Spacing, 0,
  95. (!(HorizontalGroup)) ? ((PanelSize) ? MUIA_Width : TAG_IGNORE) : TAG_IGNORE, PanelSize,
  96. (HorizontalGroup) ? ((PanelSize) ? MUIA_Height : TAG_IGNORE) : TAG_IGNORE, PanelSize,
  97. Child, (IPTR)(_PanelGroup__RootGroupSpacer),
  98. TAG_DONE)),
  99. TAG_DONE
  100. );
  101.  
  102. D(bug("[IconWindow:PanelGroup] %s: SELF @ 0x%p\n", __PRETTY_FUNCTION__, self));
  103.  
  104. if (self != NULL)
  105. {
  106. SETUP_PANELGROUP_INST_DATA;
  107.  
  108. data->pg_Flags = 0;
  109.  
  110. data->pg_RootGroupObj = _PanelGroup__RootGroupObj;
  111. data->pg_RootGroupSpacer = _PanelGroup__RootGroupSpacer;
  112.  
  113. data->pg_HorizWeight = (ULONG)HorizWeight;
  114. data->pg_VertWeight = (ULONG)VertWeight;
  115.  
  116. if (HorizontalGroup)
  117. data->pg_Flags |= pgFlag_Horizontal;
  118.  
  119. data->pg_Flags |= pgFlag_Setup;
  120.  
  121. D(bug("[IconWindow:PanelGroup] %s: RootGroupObj @ 0x%p, RootGroupSpacer @ 0x%p\n", __PRETTY_FUNCTION__, data->pg_RootGroupObj, data->pg_RootGroupSpacer));
  122. }
  123.  
  124. return self;
  125. }
  126. ///
  127.  
  128. /// OM_DISPOSE
  129. IPTR PanelGroup__OM_DISPOSE(Class *CLASS, Object *self, Msg message)
  130. {
  131. D(bug("[IconWindow:PanelGroup] %s()\n", __PRETTY_FUNCTION__));
  132.  
  133. return DoSuperMethodA(CLASS, self, message);
  134. }
  135. ///
  136.  
  137. /// OM_ADDMEMBER
  138. IPTR PanelGroup__MUIM_PanelGroup_AddPanel(Class *CLASS, Object *self, Msg message)
  139. {
  140. SETUP_PANELGROUP_INST_DATA;
  141.  
  142. IPTR rv;
  143.  
  144. D(bug("[IconWindow:PanelGroup]: %s()\n", __PRETTY_FUNCTION__));
  145.  
  146. if (data->pg_Flags & pgFlag_Setup)
  147. {
  148. D(bug("[IconWindow:PanelGroup] %s: Adding to RootGroupObj\n", __PRETTY_FUNCTION__));
  149. rv = DoMethodA(data->pg_RootGroupObj, message);
  150.  
  151. if (data->pg_RootGroupSpacer)
  152. {
  153. D(bug("[IconWindow:PanelGroup] %s: Removing spacer..\n", __PRETTY_FUNCTION__));
  154. DoMethod(data->pg_RootGroupObj, OM_REMMEMBER, (IPTR)data->pg_RootGroupSpacer);
  155. data->pg_RootGroupSpacer = NULL;
  156. }
  157.  
  158. SET(self, MUIA_HorizWeight, data->pg_HorizWeight);
  159. SET(self, MUIA_VertWeight, data->pg_VertWeight);
  160.  
  161. data->pg_Count++;
  162. }
  163.  
  164. return rv;
  165. }
  166. ///
  167.  
  168. /// MUIM_Group_InitChange
  169. IPTR PanelGroup__MUIM_PanelGroup_InitChange(Class *CLASS, Object *self, Msg message)
  170. {
  171. SETUP_PANELGROUP_INST_DATA;
  172.  
  173. D(bug("[IconWindow:PanelGroup]: %s()\n", __PRETTY_FUNCTION__));
  174.  
  175. return DoMethod(data->pg_RootGroupObj, MUIM_Group_InitChange);
  176. }
  177. ///
  178.  
  179. /// MUIM_Group_ExitChange
  180. IPTR PanelGroup__MUIM_PanelGroup_ExitChange(Class *CLASS, Object *self, Msg message)
  181. {
  182. SETUP_PANELGROUP_INST_DATA;
  183.  
  184. D(bug("[IconWindow:PanelGroup]: %s()\n", __PRETTY_FUNCTION__));
  185.  
  186. return DoMethod(data->pg_RootGroupObj, MUIM_Group_ExitChange);
  187. }
  188. ///
  189.  
  190.  
  191. /// OM_GET
  192. IPTR PanelGroup__OM_GET(Class *CLASS, Object *self, struct opGet *message)
  193. {
  194. SETUP_PANELGROUP_INST_DATA;
  195.  
  196. IPTR *store = message->opg_Storage;
  197. IPTR rv = TRUE;
  198.  
  199. switch (message->opg_AttrID)
  200. {
  201. case MUIA_PanelGroup_Panels:
  202. GET(data->pg_RootGroupObj, MUIA_Group_ChildList, store);
  203. break;
  204.  
  205. case MUIA_Version:
  206. *store = (IPTR)PANGVERS;
  207. break;
  208.  
  209. case MUIA_Revision:
  210. *store = (IPTR)PANGREV;
  211. break;
  212.  
  213. default:
  214. rv = FALSE;
  215. }
  216.  
  217. if (!rv)
  218. rv = DoSuperMethodA(CLASS, self, (Msg) message);
  219.  
  220. return rv;
  221. }
  222. ///
  223.  
  224.  
  225. /*** Setup ******************************************************************/
  226. PANELGROUP_CUSTOMCLASS
  227. (
  228. PanelGroup, NULL, MUIC_Group, NULL,
  229. OM_NEW, struct opSet *,
  230. OM_DISPOSE, Msg,
  231. MUIM_PanelGroup_AddPanel, Msg,
  232. OM_GET, struct opGet *,
  233. MUIM_PanelGroup_InitChange, Msg,
  234. MUIM_PanelGroup_ExitChange, Msg
  235. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement