2 Copyright © 2009, The AROS Development Team. All rights reserved.
6 #include <exec/memory.h>
7 #include <utility/tagitem.h>
9 #include <libraries/mui.h>
11 #include <proto/exec.h>
12 #include <proto/muimaster.h>
13 #include <proto/intuition.h>
14 #include <proto/utility.h>
15 #include <proto/dos.h>
16 #include <proto/alib.h>
17 #include <aros/debug.h>
18 #include <zune/customclasses.h>
20 #include "browsertab.h"
21 #include "browsertab_private.h"
25 struct MUI_CustomClass
*BrowserTabClass
;
28 /*** Methods ****************************************************************/
29 IPTR
BrowserTab__OM_NEW(Class
*CLASS
, Object
*self
, struct opSet
*message
)
31 struct BrowserTab_DATA
*data
= NULL
;
32 struct TagItem
*tag
= NULL
, *tstate
= message
->ops_AttrList
;
36 /* Parse initial attributes --------------------------------------------*/
37 while ((tag
= NextTagItem(&tstate
)) != NULL
)
41 case MUIA_BrowserTab_Title
:
42 title
= StrDup((STRPTR
) tag
->ti_Data
);
47 continue; /* Don't supress non-processed tags */
50 tag
->ti_Tag
= TAG_IGNORE
;
55 title
= StrDup(_(MSG_Untitled
));
60 self
= (Object
*) DoSuperNewTags
63 MUIA_Frame
, MUIV_Frame_None
,
68 MUIA_Group_Horiz
, TRUE
,
69 MUIA_Group_HorizSpacing
, 0,
70 MUIA_ShowSelState
, FALSE
,
71 Child
, (IPTR
)(titleObject
= TextObject
,
72 MUIA_Frame
, MUIV_Frame_None
,
73 MUIA_Text_SetMin
, FALSE
,
74 MUIA_Text_Contents
, (IPTR
)title
,
76 TAG_MORE
, (IPTR
) message
->ops_AttrList
82 data
= INST_DATA(CLASS
, self
);
84 data
->titleObject
= titleObject
;
89 IPTR
BrowserTab__OM_DISPOSE(Class
*CLASS
, Object
*self
, Msg message
)
91 struct BrowserTab_DATA
*data
= INST_DATA(CLASS
, self
);
93 ret
= DoSuperMethodA(CLASS
, self
, message
);
98 IPTR
BrowserTab__OM_SET(Class
*cl
, Object
*obj
, struct opSet
*msg
)
100 struct BrowserTab_DATA
*data
= INST_DATA(cl
, obj
);
101 struct TagItem
*tags
= msg
->ops_AttrList
;
104 while ((tag
= NextTagItem(&tags
)) != NULL
)
108 case MUIA_BrowserTab_Title
:
110 if(tag
->ti_Data
== (IPTR
) NULL
|| ((char*) tag
->ti_Data
)[0] == 0)
111 tag
->ti_Data
= (IPTR
) _(MSG_Untitled
);
112 STRPTR newtitle
= StrDup((STRPTR
) tag
->ti_Data
);
115 FreeVec(data
->title
);
116 data
->title
= newtitle
;
117 set(data
->titleObject
, MUIA_Text_Contents
, data
->title
);
125 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
128 IPTR
BrowserTab__OM_GET(Class
*cl
, Object
*obj
, struct opGet
*msg
)
130 struct BrowserTab_DATA
*data
= INST_DATA(cl
, obj
);
133 switch(msg
->opg_AttrID
)
135 case MUIA_BrowserTab_Title
:
136 *(STRPTR
*)msg
->opg_Storage
= data
->title
;
139 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
146 /*** Setup ******************************************************************/
149 BrowserTab
, NULL
, MUIC_Group
, NULL
,
150 OM_NEW
, struct opSet
*,
152 OM_SET
, struct opSet
*,
153 OM_GET
, struct opGet
*