mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-16 09:12:44 +03:00
Convert the rest of gui.c to use class pointers directly
Add missing button.gadget
This commit is contained in:
parent
01050b4415
commit
c8c806a0c2
44
amiga/gui.c
44
amiga/gui.c
@ -1517,7 +1517,7 @@ static bool ami_gui_hscroll_add(struct gui_window_2 *gwin)
|
||||
attrs[1].ti_Tag = TAG_DONE;
|
||||
attrs[1].ti_Data = 0;
|
||||
|
||||
gwin->objects[GID_HSCROLL] = ScrollerObject,
|
||||
gwin->objects[GID_HSCROLL] = ScrollerObj,
|
||||
GA_ID, GID_HSCROLL,
|
||||
GA_RelVerify, TRUE,
|
||||
SCROLLER_Orientation, SORIENT_HORIZ,
|
||||
@ -1559,7 +1559,7 @@ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin)
|
||||
attrs[1].ti_Tag = TAG_DONE;
|
||||
attrs[1].ti_Data = 0;
|
||||
|
||||
gwin->objects[GID_VSCROLL] = ScrollerObject,
|
||||
gwin->objects[GID_VSCROLL] = ScrollerObj,
|
||||
GA_ID, GID_VSCROLL,
|
||||
GA_RelVerify, TRUE,
|
||||
ICA_TARGET, ICTARGET_IDCMP,
|
||||
@ -3148,7 +3148,7 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
|
||||
|
||||
if(ami_gui_hotlist_scan(ami_tree_get_tree(hotlist_window), &gwin->hotlist_toolbar_list, gwin) > 0) {
|
||||
gwin->objects[GID_HOTLIST] =
|
||||
SpeedBarObject,
|
||||
SpeedBarObj,
|
||||
GA_ID, GID_HOTLIST,
|
||||
GA_RelVerify, TRUE,
|
||||
ICA_TARGET, ICTARGET_IDCMP,
|
||||
@ -3157,7 +3157,7 @@ static void ami_gui_hotlist_toolbar_add(struct gui_window_2 *gwin)
|
||||
SpeedBarEnd;
|
||||
|
||||
gwin->objects[GID_HOTLISTSEPBAR] =
|
||||
BevelObject,
|
||||
BevelObj,
|
||||
BEVEL_Style, BVS_SBAR_VERT,
|
||||
BevelEnd;
|
||||
|
||||
@ -3288,7 +3288,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
|
||||
attrs[2].ti_Tag = TAG_DONE;
|
||||
attrs[2].ti_Data = 0;
|
||||
|
||||
gwin->objects[GID_TABS] = ClickTabObject,
|
||||
gwin->objects[GID_TABS] = ClickTabObj,
|
||||
GA_ID, GID_TABS,
|
||||
GA_RelVerify, TRUE,
|
||||
GA_Underscore, 13, // disable kb shortcuts
|
||||
@ -3298,7 +3298,7 @@ static void ami_toggletabbar(struct gui_window_2 *gwin, bool show)
|
||||
CLICKTAB_FlagImage, gwin->objects[GID_TABS_FLAG],
|
||||
ClickTabEnd;
|
||||
|
||||
gwin->objects[GID_ADDTAB] = ButtonObject,
|
||||
gwin->objects[GID_ADDTAB] = ButtonObj,
|
||||
GA_ID, GID_ADDTAB,
|
||||
GA_RelVerify, TRUE,
|
||||
GA_HintInfo, gwin->helphints[GID_ADDTAB],
|
||||
@ -3674,13 +3674,13 @@ gui_window_create(struct browser_window *bw,
|
||||
if(ClickTabBase->lib_Version < 53)
|
||||
{
|
||||
addtabclosegadget = LAYOUT_AddChild;
|
||||
g->shared->objects[GID_CLOSETAB] = ButtonObject,
|
||||
g->shared->objects[GID_CLOSETAB] = ButtonObj,
|
||||
GA_ID, GID_CLOSETAB,
|
||||
GA_RelVerify, TRUE,
|
||||
BUTTON_RenderImage, g->shared->objects[GID_CLOSETAB_BM],
|
||||
ButtonEnd;
|
||||
|
||||
g->shared->objects[GID_TABS] = ClickTabObject,
|
||||
g->shared->objects[GID_TABS] = ClickTabObj,
|
||||
GA_ID,GID_TABS,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Underscore,13, // disable kb shortcuts
|
||||
@ -3688,7 +3688,7 @@ gui_window_create(struct browser_window *bw,
|
||||
CLICKTAB_LabelTruncate,TRUE,
|
||||
ClickTabEnd;
|
||||
|
||||
g->shared->objects[GID_ADDTAB] = ButtonObject,
|
||||
g->shared->objects[GID_ADDTAB] = ButtonObj,
|
||||
GA_ID, GID_ADDTAB,
|
||||
GA_RelVerify, TRUE,
|
||||
GA_Text, "+",
|
||||
@ -3746,7 +3746,7 @@ gui_window_create(struct browser_window *bw,
|
||||
LAYOUT_SpaceOuter, TRUE,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_TOOLBARLAYOUT] = LayoutHObj,
|
||||
LAYOUT_VertAlignment, LALIGN_CENTER,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_BACK] = ButtonObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_BACK] = ButtonObj,
|
||||
GA_ID,GID_BACK,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Disabled,TRUE,
|
||||
@ -3761,7 +3761,7 @@ gui_window_create(struct browser_window *bw,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedWidth,0,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_FORWARD] = ButtonObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_FORWARD] = ButtonObj,
|
||||
GA_ID,GID_FORWARD,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_Disabled,TRUE,
|
||||
@ -3776,7 +3776,7 @@ gui_window_create(struct browser_window *bw,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedWidth,0,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_STOP] = ButtonObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_STOP] = ButtonObj,
|
||||
GA_ID,GID_STOP,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_HintInfo, g->shared->helphints[GID_STOP],
|
||||
@ -3790,7 +3790,7 @@ gui_window_create(struct browser_window *bw,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedWidth,0,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_RELOAD] = ButtonObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_RELOAD] = ButtonObj,
|
||||
GA_ID,GID_RELOAD,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_HintInfo, g->shared->helphints[GID_RELOAD],
|
||||
@ -3804,7 +3804,7 @@ gui_window_create(struct browser_window *bw,
|
||||
ButtonEnd,
|
||||
CHILD_WeightedWidth,0,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_HOME] = ButtonObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_HOME] = ButtonObj,
|
||||
GA_ID,GID_HOME,
|
||||
GA_RelVerify,TRUE,
|
||||
GA_HintInfo, g->shared->helphints[GID_HOME],
|
||||
@ -3820,7 +3820,7 @@ gui_window_create(struct browser_window *bw,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, LayoutHObj, // FavIcon, URL bar and hotlist star
|
||||
LAYOUT_VertAlignment, LALIGN_CENTER,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_ICON] = SpaceObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_ICON] = SpaceObj,
|
||||
GA_ID, GID_ICON,
|
||||
SPACE_MinWidth, 16,
|
||||
SPACE_MinHeight, 16,
|
||||
@ -3840,7 +3840,7 @@ gui_window_create(struct browser_window *bw,
|
||||
STRINGVIEW_Header, URLHistory_GetList(),
|
||||
TAG_DONE),
|
||||
|
||||
LAYOUT_AddChild, g->shared->objects[GID_FAVE] = ButtonObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_FAVE] = ButtonObj,
|
||||
GA_ID, GID_FAVE,
|
||||
GA_RelVerify, TRUE,
|
||||
// GA_HintInfo, g->shared->helphints[GID_FAVE],
|
||||
@ -3855,7 +3855,7 @@ gui_window_create(struct browser_window *bw,
|
||||
LAYOUT_WeightBar, TRUE,
|
||||
LAYOUT_AddChild, LayoutHObj,
|
||||
LAYOUT_VertAlignment, LALIGN_CENTER,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_SEARCH_ICON] = ChooserObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_SEARCH_ICON] = ChooserObj,
|
||||
GA_ID, GID_SEARCH_ICON,
|
||||
GA_RelVerify, TRUE,
|
||||
CHOOSER_DropDown, TRUE,
|
||||
@ -3864,7 +3864,7 @@ gui_window_create(struct browser_window *bw,
|
||||
ChooserEnd,
|
||||
CHILD_WeightedWidth,0,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_SEARCHSTRING] =StringObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_SEARCHSTRING] = StringObj,
|
||||
GA_ID,GID_SEARCHSTRING,
|
||||
STRINGA_TextVal, NULL,
|
||||
GA_RelVerify,TRUE,
|
||||
@ -3872,7 +3872,7 @@ gui_window_create(struct browser_window *bw,
|
||||
StringEnd,
|
||||
LayoutEnd,
|
||||
CHILD_WeightedWidth, nsoption_int(web_search_width),
|
||||
LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_THROBBER] = SpaceObj,
|
||||
GA_ID,GID_THROBBER,
|
||||
SPACE_MinWidth,throbber_width,
|
||||
SPACE_MinHeight,throbber_height,
|
||||
@ -3883,7 +3883,7 @@ gui_window_create(struct browser_window *bw,
|
||||
CHILD_WeightedHeight,0,
|
||||
LayoutEnd,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddImage, BevelObject,
|
||||
LAYOUT_AddImage, BevelObj,
|
||||
BEVEL_Style, BVS_SBAR_VERT,
|
||||
BevelEnd,
|
||||
CHILD_WeightedHeight, 0,
|
||||
@ -3907,7 +3907,7 @@ gui_window_create(struct browser_window *bw,
|
||||
CHILD_WeightedHeight,0,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = LayoutHObj,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = LayoutVObj,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObj,
|
||||
GA_ID,GID_BROWSER,
|
||||
SPACE_Transparent,TRUE,
|
||||
SpaceEnd,
|
||||
@ -3954,7 +3954,7 @@ gui_window_create(struct browser_window *bw,
|
||||
LAYOUT_SpaceOuter, TRUE,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_VSCROLLLAYOUT] = LayoutHObj,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_HSCROLLLAYOUT] = LayoutVObj,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObject,
|
||||
LAYOUT_AddChild, g->shared->objects[GID_BROWSER] = SpaceObj,
|
||||
GA_ID,GID_BROWSER,
|
||||
SPACE_Transparent,TRUE,
|
||||
SpaceEnd,
|
||||
|
15
amiga/libs.c
15
amiga/libs.c
@ -81,6 +81,7 @@
|
||||
LOG(("Opening %s v%d", CLASS, CLASSVER)); \
|
||||
if((PREFIX##Base = OpenClass(CLASS, CLASSVER, &PREFIX##Class))) { \
|
||||
if(NEEDINTERFACE == true) { \
|
||||
LOG((" + interface")); \
|
||||
I##PREFIX = (struct PREFIX##IFace *)GetInterface((struct Library *)PREFIX##Base, "main", 1, NULL); \
|
||||
if(I##PREFIX == NULL) { \
|
||||
LOG(("Failed to get main interface v1 of %s", CLASS)); \
|
||||
@ -99,9 +100,9 @@
|
||||
if(PREFIX##Base) CloseClass(PREFIX##Base);
|
||||
|
||||
#define AMINS_CLASS_STRUCT(PREFIX) \
|
||||
struct ClassLibrary *PREFIX##Base; \
|
||||
struct PREFIX##IFace *I##PREFIX; \
|
||||
Class *PREFIX##Class;
|
||||
struct ClassLibrary *PREFIX##Base = NULL; \
|
||||
struct PREFIX##IFace *I##PREFIX = NULL; \
|
||||
Class *PREFIX##Class = NULL;
|
||||
|
||||
#else
|
||||
#define AMINS_LIB_OPEN(LIB, LIBVER, PREFIX, INTERFACE, INTVER, FAIL) \
|
||||
@ -168,6 +169,7 @@ AMINS_LIB_STRUCT(Workbench);
|
||||
AMINS_CLASS_STRUCT(ARexx);
|
||||
AMINS_CLASS_STRUCT(Bevel);
|
||||
AMINS_CLASS_STRUCT(BitMap);
|
||||
AMINS_CLASS_STRUCT(Button);
|
||||
AMINS_CLASS_STRUCT(Chooser);
|
||||
AMINS_CLASS_STRUCT(CheckBox);
|
||||
AMINS_CLASS_STRUCT(ClickTab);
|
||||
@ -230,11 +232,13 @@ bool ami_libs_open(void)
|
||||
* We get the class pointer once and used our stored copy.
|
||||
* NB: the last argument needs to be "true" whilst we still have old macros
|
||||
* lying around, and then "false" unless the class also has library functions.
|
||||
* On OS4 these must be opened *after* intuition.library.
|
||||
*/
|
||||
|
||||
AMINS_CLASS_OPEN("arexx.class", 44, ARexx, AREXX, true)
|
||||
AMINS_CLASS_OPEN("images/bevel.image", 44, Bevel, BEVEL, true)
|
||||
AMINS_CLASS_OPEN("images/bitmap.image", 44, BitMap, BITMAP, true)
|
||||
AMINS_CLASS_OPEN("gadgets/button.gadget", 44, Button, BUTTON, true)
|
||||
AMINS_CLASS_OPEN("gadgets/checkbox.gadget", 44, CheckBox, CHECKBOX, true)
|
||||
AMINS_CLASS_OPEN("gadgets/chooser.gadget", 44, Chooser, CHOOSER, true)
|
||||
AMINS_CLASS_OPEN("gadgets/clicktab.gadget", 44, ClickTab, CLICKTAB, true)
|
||||
@ -258,9 +262,13 @@ bool ami_libs_open(void)
|
||||
|
||||
void ami_libs_close(void)
|
||||
{
|
||||
/* BOOPSI Classes.
|
||||
* On OS4 these must be closed *before* intuition.library
|
||||
*/
|
||||
AMINS_CLASS_CLOSE(ARexx)
|
||||
AMINS_CLASS_CLOSE(Bevel)
|
||||
AMINS_CLASS_CLOSE(BitMap)
|
||||
AMINS_CLASS_CLOSE(Button)
|
||||
AMINS_CLASS_CLOSE(CheckBox)
|
||||
AMINS_CLASS_CLOSE(Chooser)
|
||||
AMINS_CLASS_CLOSE(ClickTab)
|
||||
@ -279,6 +287,7 @@ void ami_libs_close(void)
|
||||
AMINS_CLASS_CLOSE(String)
|
||||
AMINS_CLASS_CLOSE(Window)
|
||||
|
||||
/* Libraries */
|
||||
AMINS_LIB_CLOSE(Asl)
|
||||
AMINS_LIB_CLOSE(DataTypes)
|
||||
AMINS_LIB_CLOSE(Diskfont)
|
||||
|
16
amiga/libs.h
16
amiga/libs.h
@ -21,15 +21,31 @@
|
||||
#include <intuition/classes.h>
|
||||
|
||||
/* BOOPSI classes */
|
||||
extern Class *BevelClass;
|
||||
extern Class *BitMapClass;
|
||||
extern Class *ButtonClass;
|
||||
extern Class *ChooserClass;
|
||||
extern Class *ClickTabClass;
|
||||
extern Class *LayoutClass;
|
||||
extern Class *ListBrowserClass;
|
||||
extern Class *ScrollerClass;
|
||||
extern Class *SpaceClass;
|
||||
extern Class *SpeedBarClass;
|
||||
extern Class *StringClass;
|
||||
extern Class *WindowClass;
|
||||
|
||||
/* New improved ReAction macros! */
|
||||
#define BevelObj NewObject(BevelClass, NULL
|
||||
#define BitMapObj NewObject(BitMapClass, NULL
|
||||
#define ButtonObj NewObject(ButtonClass, NULL
|
||||
#define ChooserObj NewObject(ChooserClass, NULL
|
||||
#define ClickTabObj NewObject(ClickTabClass, NULL
|
||||
#define LayoutHObj NewObject(LayoutClass, NULL, LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ
|
||||
#define LayoutVObj NewObject(LayoutClass, NULL, LAYOUT_Orientation, LAYOUT_ORIENT_VERT
|
||||
#define ScrollerObj NewObject(ScrollerClass, NULL
|
||||
#define SpaceObj NewObject(SpaceClass, NULL
|
||||
#define SpeedBarObj NewObject(ScrollerClass, NULL
|
||||
#define StringObj NewObject(StringClass, NULL
|
||||
#define WindowObj NewObject(WindowClass, NULL
|
||||
|
||||
/* Functions */
|
||||
|
Loading…
Reference in New Issue
Block a user