NetSurf
Macros | Enumerations | Functions | Variables
menu.c File Reference
#include "amiga/os3support.h"
#include <string.h>
#include <stdlib.h>
#include <proto/gadtools.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <libraries/gadtools.h>
#include <classes/window.h>
#include <proto/label.h>
#include <images/label.h>
#include <proto/bitmap.h>
#include <images/bitmap.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
#include "utils/messages.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
#include "amiga/menu.h"
#include "amiga/utf8.h"
Include dependency graph for menu.c:

Go to the source code of this file.

Macros

#define NSA_MAX_HOTLIST_MENU_LEN   100
 

Enumerations

enum  {
  NSA_GLYPH_SUBMENU , NSA_GLYPH_AMIGAKEY , NSA_GLYPH_CHECKMARK , NSA_GLYPH_MX ,
  NSA_GLYPH_MAX
}
 

Functions

bool ami_menu_get_selected (struct Menu *menu, struct IntuiMessage *msg)
 Get the selected state of a menu item. More...
 
void ami_menu_free_lab_item (struct ami_menu_data **md, int i)
 
static void ami_menu_free_labs (struct ami_menu_data **md, int max)
 
void ami_menu_alloc_item (struct ami_menu_data **md, int num, UBYTE type, const char *restrict label, const char *restrict key, const char *restrict icon, void *restrict func, void *restrict hookdata, UWORD flags)
 
static void ami_menu_load_glyphs (struct DrawInfo *dri)
 
void ami_menu_free_glyphs (void)
 
static int ami_menu_calc_item_width (struct ami_menu_data **md, int j, struct RastPort *rp)
 
static struct Menu * ami_menu_layout_gt (struct ami_menu_data **md, int max)
 
struct Menu * ami_menu_layout (struct ami_menu_data **md, int max)
 
void ami_menu_free_menu (struct ami_menu_data **md, int max, struct Menu *imenu)
 
void ami_menu_refresh (struct Menu *menu, struct ami_menu_data **md, int menu_item, int max, nserror(*cb)(struct ami_menu_data **md))
 

Variables

static Object *restrict menu_glyph [NSA_GLYPH_MAX]
 
static int menu_glyph_width [NSA_GLYPH_MAX]
 
static bool menu_glyphs_loaded = false
 

Macro Definition Documentation

◆ NSA_MAX_HOTLIST_MENU_LEN

#define NSA_MAX_HOTLIST_MENU_LEN   100

Definition at line 57 of file menu.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NSA_GLYPH_SUBMENU 
NSA_GLYPH_AMIGAKEY 
NSA_GLYPH_CHECKMARK 
NSA_GLYPH_MX 
NSA_GLYPH_MAX 

Definition at line 49 of file menu.c.

Function Documentation

◆ ami_menu_alloc_item()

void ami_menu_alloc_item ( struct ami_menu_data **  md,
int  num,
UBYTE  type,
const char *restrict  label,
const char *restrict  key,
const char *restrict  icon,
void *restrict  func,
void *restrict  hookdata,
UWORD  flags 
)

Definition at line 115 of file menu.c.

References ami_locate_resource(), AMI_MENU_AREXX, AMI_MENU_AREXX_MAX, ami_utf8_easy(), ami_menu_data::flags, LIB_IS_AT_LEAST, ami_menu_data::menu_hook, ami_menu_data::menuicon, ami_menu_data::menukey, ami_menu_data::menulab, ami_menu_data::menutype, messages_get(), NSA_SPACE, and type.

Referenced by ami_cookies_menulabs(), ami_history_global_menulabs(), ami_hotlist_menulabs(), ami_init_menulabs(), ami_menu_arexx_scan(), ami_menu_hotlist_add(), and ami_menu_scan().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_calc_item_width()

static int ami_menu_calc_item_width ( struct ami_menu_data **  md,
int  j,
struct RastPort *  rp 
)
static

TODO: take account of the size of other imagery too

Definition at line 199 of file menu.c.

References menu_glyph_width, and NSA_GLYPH_AMIGAKEY.

Referenced by ami_menu_layout_gt().

Here is the caller graph for this function:

◆ ami_menu_free_glyphs()

void ami_menu_free_glyphs ( void  )

Definition at line 182 of file menu.c.

References LIB_IS_AT_LEAST, menu_glyph, menu_glyphs_loaded, and NSA_GLYPH_MAX.

Referenced by gui_quit().

Here is the caller graph for this function:

◆ ami_menu_free_lab_item()

void ami_menu_free_lab_item ( struct ami_menu_data **  md,
int  i 
)

Definition at line 83 of file menu.c.

References ami_utf8_free(), ami_menu_data::menukey, ami_menu_data::menulab, ami_menu_data::menuobj, ami_menu_data::menutype, and ML_SEPARATOR.

Referenced by ami_menu_free_labs(), and ami_menu_refresh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_free_labs()

static void ami_menu_free_labs ( struct ami_menu_data **  md,
int  max 
)
static

Definition at line 106 of file menu.c.

References ami_menu_free_lab_item(), and max.

Referenced by ami_menu_free_menu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_free_menu()

void ami_menu_free_menu ( struct ami_menu_data **  md,
int  max,
struct Menu *  imenu 
)

Definition at line 430 of file menu.c.

References ami_menu_free_labs(), LIB_IS_AT_LEAST, and max.

Referenced by ami_cookies_menu_free(), ami_history_global_menu_free(), and ami_hotlist_menu_free().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_get_selected()

bool ami_menu_get_selected ( struct Menu *  menu,
struct IntuiMessage *  msg 
)

Get the selected state of a menu item.

Definition at line 63 of file menu.c.

References IDoMethod, and LIB_IS_AT_LEAST.

Referenced by HOOKF().

Here is the caller graph for this function:

◆ ami_menu_layout()

struct Menu * ami_menu_layout ( struct ami_menu_data **  md,
int  max 
)

Definition at line 419 of file menu.c.

References ami_menu_layout_gt(), LIB_IS_AT_LEAST, and max.

Referenced by ami_cookies_menu_create(), ami_gui_menu_create(), ami_history_global_menu_create(), and ami_hotlist_menu_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_layout_gt()

static struct Menu * ami_menu_layout_gt ( struct ami_menu_data **  md,
int  max 
)
static

Definition at line 293 of file menu.c.

References ami_gui_get_screen(), ami_menu_calc_item_width(), ami_menu_load_glyphs(), BitMapObj, ami_menu_data::flags, LabelObj, LIB_IS_AT_LEAST, max, menu_glyph_width, menu_glyphs_loaded, ami_menu_data::menu_hook, ami_menu_data::menuicon, ami_menu_data::menukey, ami_menu_data::menulab, ami_menu_data::menuobj, ami_menu_data::menutype, NewObject(), NSA_GLYPH_SUBMENU, and scrn.

Referenced by ami_menu_layout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_load_glyphs()

static void ami_menu_load_glyphs ( struct DrawInfo *  dri)
static

Definition at line 157 of file menu.c.

References LIB_IS_AT_LEAST, menu_glyph, menu_glyph_width, menu_glyphs_loaded, NewObject(), NSA_GLYPH_AMIGAKEY, NSA_GLYPH_MAX, and NSA_GLYPH_SUBMENU.

Referenced by ami_menu_layout_gt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ami_menu_refresh()

void ami_menu_refresh ( struct Menu *  menu,
struct ami_menu_data **  md,
int  menu_item,
int  max,
nserror(*)(struct ami_menu_data **md)  cb 
)

Definition at line 440 of file menu.c.

References ami_menu_free_lab_item(), IDoMethod, LIB_IS_AT_LEAST, and max.

Referenced by ami_gui_menu_refresh_hotlist().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ menu_glyph

Object* restrict menu_glyph[NSA_GLYPH_MAX]
static

Definition at line 59 of file menu.c.

Referenced by ami_menu_free_glyphs(), and ami_menu_load_glyphs().

◆ menu_glyph_width

int menu_glyph_width[NSA_GLYPH_MAX]
static

Definition at line 60 of file menu.c.

Referenced by ami_menu_calc_item_width(), ami_menu_layout_gt(), and ami_menu_load_glyphs().

◆ menu_glyphs_loaded

bool menu_glyphs_loaded = false
static

Definition at line 61 of file menu.c.

Referenced by ami_menu_free_glyphs(), ami_menu_layout_gt(), and ami_menu_load_glyphs().