* widget.h (struct WButtonBar): Moved into widget.c.

* widget.c (struct WButtonBar): Moved from widget.h.
	* boxes.c: Don't dereference WButtonBar.
	* help.c: Likewise.
	* layout.c: Likewise.
	* view.c: Likewise.
This commit is contained in:
Roland Illig 2005-06-14 13:02:30 +00:00
parent 0ee0936513
commit 6bf747eccf
7 changed files with 41 additions and 25 deletions

View File

@ -9,6 +9,12 @@
* widget.c: Added code to handle multiple types of functions for
commands.
* widget.h: Likewise.
* widget.h (struct WButtonBar): Moved into widget.c.
* widget.c (struct WButtonBar): Moved from widget.h.
* boxes.c: Don't dereference WButtonBar.
* help.c: Likewise.
* layout.c: Likewise.
* view.c: Likewise.
2005-06-08 Roland Illig <roland.illig@gmx.de>

View File

@ -676,8 +676,8 @@ tree_box (const char *current_dir)
add_widget (dlg, mytree);
bar = buttonbar_new(1);
add_widget (dlg, bar);
bar->widget.x = 0;
bar->widget.y = LINES - 1;
((Widget *) bar)->x = 0;
((Widget *) bar)->y = LINES - 1;
run_dlg (dlg);
if (dlg->ret_value == B_ENTER)

View File

@ -837,8 +837,8 @@ interactive_display (const char *filename, const char *node)
}
help_bar = buttonbar_new (1);
help_bar->widget.y -= whelp->y;
help_bar->widget.x -= whelp->x;
((Widget *) help_bar)->y -= whelp->y;
((Widget *) help_bar)->x -= whelp->x;
md = mousedispatch_new (1, 1, help_lines, HELP_WINDOW_WIDTH - 2);

View File

@ -705,8 +705,8 @@ setup_panels (void)
widget_set_size (&the_prompt->widget, LINES, COLS, 0, 0);
}
widget_set_size (&the_bar->widget, LINES - 1, 0, keybar_visible, COLS);
the_bar->visible = keybar_visible;
widget_set_size ((Widget *) the_bar, LINES - 1, 0, keybar_visible, COLS);
buttonbar_set_visible (the_bar, keybar_visible);
/* Output window */
if (console_flag && output_lines) {

View File

@ -3118,7 +3118,7 @@ view_adjust_size (Dlg_head *h)
view = (WView *) find_widget_type (h, (callback_fn) view_callback);
bar = find_buttonbar (h);
widget_set_size (&view->widget, 0, 0, LINES - 1, COLS);
widget_set_size (&bar->widget, LINES - 1, 0, 1, COLS);
widget_set_size ((Widget *) bar, LINES - 1, 0, 1, COLS);
view_update_bytes_per_line (view);
}

View File

@ -48,6 +48,20 @@
#define HISTORY_FILE_NAME ".mc/history"
struct WButtonBar {
Widget widget;
int visible; /* Is it visible? */
struct {
char *text;
enum { BBFUNC_NONE, BBFUNC_VOID, BBFUNC_PTR } tag;
union {
voidfn fn_void;
buttonbarfn fn_ptr;
} u;
void *data;
} labels [10];
};
static int button_event (Gpm_Event *event, void *);
int quote = 0;
@ -2401,6 +2415,12 @@ buttonbar_set_label (Dlg_head *h, int idx, const char *text, void (*cback) (void
bb->labels[idx - 1].u.fn_void = cback;
}
void
buttonbar_set_visible (WButtonBar *bb, gboolean visible)
{
bb->visible = visible;
}
void
buttonbar_redraw (Dlg_head *h)
{

View File

@ -123,23 +123,6 @@ typedef struct WGroupbox {
char *title;
} WGroupbox;
typedef void (*voidfn)(void);
typedef void (*buttonbarfn)(void *);
typedef struct {
Widget widget;
int visible; /* Is it visible? */
struct {
char *text;
enum { BBFUNC_NONE, BBFUNC_VOID, BBFUNC_PTR } tag;
union {
voidfn fn_void;
buttonbarfn fn_ptr;
} u;
void *data;
} labels [10];
} WButtonBar;
/* Constructors */
WButton *button_new (int y, int x, int action, int flags, const char *text,
bcback callback);
@ -201,13 +184,20 @@ char *listbox_add_item (WListbox *l, enum append_pos pos, int
/* Hintbar routines */
/* Buttonbar routines */
/* Buttonbar */
typedef void (*voidfn)(void);
typedef void (*buttonbarfn)(void *);
typedef struct WButtonBar WButtonBar;
WButtonBar *buttonbar_new (int visible);
WButtonBar *find_buttonbar (Dlg_head *h);
void buttonbar_clear_label (Dlg_head *, int idx);
void buttonbar_set_label (Dlg_head *, int index, const char *text, voidfn);
void buttonbar_set_label_data (Dlg_head *h, int idx, const char *text,
buttonbarfn cback, void *data);
void buttonbar_set_visible (WButtonBar *, gboolean);
void buttonbar_redraw (Dlg_head *h);
#endif