File: menu.h

package info (click to toggle)
notion 4.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,656 kB
  • sloc: ansic: 47,365; sh: 2,093; makefile: 594; perl: 270
file content (96 lines) | stat: -rw-r--r-- 2,251 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * ion/mod_menu/menu.h
 *
 * Copyright (c) Tuomo Valkonen 1999-2007.
 *
 * See the included file LICENSE for details.
 */

#ifndef ION_MOD_MENU_MENU_H
#define ION_MOD_MENU_MENU_H

#include <ioncore/common.h>
#include <ioncore/window.h>
#include <ioncore/gr.h>
#include <ioncore/rectangle.h>
#include <ioncore/binding.h>

INTRCLASS(WMenu);
INTRSTRUCT(WMenuEntry);

#define WMENUENTRY_SUBMENU 0x0001

DECLSTRUCT(WMenuEntry){
    char *title;
    int flags;
    GrStyleSpec attr;
};

DECLCLASS(WMenu){
    WWindow win;
    GrBrush *brush;
    GrBrush *entry_brush;

    WFitParams last_fp;

    bool pmenu_mode;
    bool big_mode;
    int n_entries, selected_entry;
    int first_entry, vis_entries;
    int max_entry_w, entry_h, entry_spacing;
    WMenuEntry *entries;

    WMenu *submenu;

    ExtlTab tab;
    ExtlFn handler;

    char *typeahead;

    uint gm_kcb, gm_state;

    /*WBindmap *cycle_bindmap;*/
};


INTRSTRUCT(WMenuCreateParams);

DECLSTRUCT(WMenuCreateParams){
    ExtlFn handler;
    ExtlTab tab;
    bool pmenu_mode;
    bool submenu_mode;
    bool big_mode;
    int initial;
    WRectangle refg;
};


extern WMenu *create_menu(WWindow *par, const WFitParams *fp,
                          const WMenuCreateParams *params);
extern bool menu_init(WMenu *menu, WWindow *par, const WFitParams *fp,
                      const WMenuCreateParams *params);
extern void menu_deinit(WMenu *menu);

extern bool menu_fitrep(WMenu *menu, WWindow *par, const WFitParams *fp);

extern void menu_finish(WMenu *menu);
extern void menu_cancel(WMenu *menu);
extern bool menu_rqclose(WMenu *menu);
extern void menu_updategr(WMenu *menu);

extern int menu_entry_at_root(WMenu *menu, int root_x, int root_y);
extern void menu_release(WMenu *menu, XButtonEvent *ev);
extern void menu_motion(WMenu *menu, XMotionEvent *ev, int dx, int dy);
extern void menu_button(WMenu *menu, XButtonEvent *ev);
extern int menu_press(WMenu *menu, XButtonEvent *ev, WRegion **reg_ret);

extern void mod_menu_set_scroll_params(int delay, int amount);

extern void menu_typeahead_clear(WMenu *menu);

extern void menu_select_nth(WMenu *menu, int n);
extern void menu_select_prev(WMenu *menu);
extern void menu_select_next(WMenu *menu);

#endif /* ION_MOD_MENU_MENU_H */