provide SIZE_MAX
[AROS.git] / workbench / prefs / PSI / editwindow_class.c
blob3b24497c573ae153af57988d007f5421292ba275
1 /*
2 Copyright © 1995-1997 Stefan Stuntz.
3 Copyright © 2009-2011, The AROS Development Team.
4 All rights reserved.
6 $Id$
7 */
9 #include <proto/intuition.h>
10 #include <proto/muimaster.h>
11 #include <proto/utility.h>
13 #include <libraries/muiscreen.h>
15 #include <string.h>
17 #include "editpanel_class.h"
18 #include "editwindow_class.h"
19 #include "screenpanel_class.h"
21 /****************************************************************************************/
23 struct EditWindow_Data
25 Object *panel;
26 char wtitle[PSD_MAXLEN_TITLE + 20];
29 /****************************************************************************************/
31 IPTR EditWindow_New(struct IClass *cl, Object *obj, struct opSet *msg)
33 struct EditWindow_Data *data;
34 Object *ok;
35 Object *cancel;
36 Object *panel;
37 Object *originator;
38 /*Object *strip;*/
40 if ((obj = (Object *)DoSuperNewTags(cl, obj, NULL,
41 /*MUIA_Window_Menustrip, strip = MUI_MakeObject(MUIO_MenustripNM,EditMenu,0),*/
42 WindowContents, VGroup,
43 Child, panel = NewObject(CL_EditPanel->mcc_Class, NULL, TAG_DONE),
44 Child, HGroup, MUIA_Group_SameSize, TRUE,
45 Child, ok = MakeButton(MSG_BUTTON_OK),
46 Child, HSpace(0),
47 Child, HSpace(0),
48 Child, HSpace(0),
49 Child, cancel = MakeButton(MSG_BUTTON_CANCEL),
50 End,
51 End,
52 TAG_MORE, msg->ops_AttrList)))
54 data = INST_DATA(cl, obj);
56 data->panel = panel;
58 strcpy(data->wtitle, GetStr(MSG_TITLE_PUBSCREENWINDOW));
59 strcat(data->wtitle, " ");
60 strcat(data->wtitle, (char *)GetTagData(MUIA_EditWindow_Title, (IPTR)"", msg->ops_AttrList));
62 set(obj, MUIA_Window_Title, data->wtitle);
63 set(obj, MUIA_Window_ID , MAKE_ID('E','D','I','T'));
65 originator = (Object *)GetTagData(MUIA_EditWindow_Originator, 0, msg->ops_AttrList);
67 DoMethod
69 obj, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, MUIV_Notify_Application,
70 6, MUIM_Application_PushMethod, originator,
71 3, MUIM_ScreenPanel_Finish, obj, FALSE
73 DoMethod
75 cancel, MUIM_Notify, MUIA_Pressed, FALSE, MUIV_Notify_Application,
76 6, MUIM_Application_PushMethod, originator,
77 3, MUIM_ScreenPanel_Finish, obj, FALSE
79 DoMethod
81 ok, MUIM_Notify, MUIA_Pressed, FALSE, MUIV_Notify_Application, 6,
82 MUIM_Application_PushMethod, originator, 3, MUIM_ScreenPanel_Finish, obj, TRUE
86 DoMethod((Object *)DoMethod(strip,MUIM_FindUData,MEN_2COL),MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,panel,2,MUIM_EditPanel_DefColors,0);
87 DoMethod((Object *)DoMethod(strip,MUIM_FindUData,MEN_4COL),MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,panel,2,MUIM_EditPanel_DefColors,1);
88 DoMethod((Object *)DoMethod(strip,MUIM_FindUData,MEN_8COL),MUIM_Notify,MUIA_Menuitem_Trigger,MUIV_EveryTime,panel,2,MUIM_EditPanel_DefColors,2);
91 set(ok, MUIA_ShortHelp, GetStr(MSG_HELP_EDITOK));
92 set(cancel, MUIA_ShortHelp, GetStr(MSG_HELP_EDITCANCEL));
94 return (IPTR)obj;
96 return 0;
99 /****************************************************************************************/
101 BOOPSI_DISPATCHER(IPTR, EditWindow_Dispatcher, cl, obj, msg)
103 switch (msg->MethodID)
105 case OM_NEW: return EditWindow_New(cl, obj, (APTR)msg);
108 ** The next methods actually don't belong to the
109 ** edit window class. We just forward them here to
110 ** allow treating an edit window much like an edit
111 ** panel from outside.
114 case MUIM_EditPanel_SetScreen:
115 case MUIM_EditPanel_GetScreen:
117 struct EditWindow_Data *data = INST_DATA(cl, obj);
118 return DoMethodA(data->panel, msg);
122 return DoSuperMethodA(cl, obj, msg);
124 BOOPSI_DISPATCHER_END
126 /****************************************************************************************/
128 VOID EditWindow_Init(VOID)
130 CL_EditWindow = MUI_CreateCustomClass
132 NULL, MUIC_Window, NULL, sizeof(struct EditWindow_Data), EditWindow_Dispatcher
136 /****************************************************************************************/
138 VOID EditWindow_Exit(VOID)
140 if (CL_EditWindow)
141 MUI_DeleteCustomClass(CL_EditWindow);