mirror of https://github.com/MidnightCommander/mc
WDialog: use WBackground in frameless dialogs (screens).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
a87f1e7bf6
commit
d1f9e698ac
|
@ -507,11 +507,12 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flag
|
|||
frame_colors[FRAME_COLOR_TITLE] = new_d->color[DLG_COLOR_TITLE];
|
||||
}
|
||||
|
||||
new_d->frame =
|
||||
frame_new (0, 0, w->lines, w->cols, title,
|
||||
new_d->color != NULL ? frame_colors : NULL, FALSE, new_d->compact);
|
||||
group_add_widget (g, new_d->frame);
|
||||
frame_set_title (new_d->frame, title);
|
||||
new_d->bg =
|
||||
WIDGET (frame_new
|
||||
(0, 0, w->lines, w->cols, title, new_d->color != NULL ? frame_colors : NULL,
|
||||
FALSE, new_d->compact));
|
||||
group_add_widget (g, new_d->bg);
|
||||
frame_set_title (FRAME (new_d->bg), title);
|
||||
}
|
||||
|
||||
/* unique name of event group for this dialog */
|
||||
|
@ -546,17 +547,6 @@ dlg_set_default_colors (void)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
dlg_erase (WDialog * h)
|
||||
{
|
||||
Widget *wh = WIDGET (h);
|
||||
|
||||
if (wh != NULL && widget_get_state (wh, WST_ACTIVE))
|
||||
tty_fill_region (wh->y, wh->x, wh->lines, wh->cols, ' ');
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
do_refresh (void)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ struct WDialog
|
|||
/* Internal variables */
|
||||
void *data; /* Data can be passed to dialog */
|
||||
char *event_group; /* Name of event group for this dialog */
|
||||
WFrame *frame; /* Frame. Frame is used as background */
|
||||
Widget *bg; /* WFrame or WBackground */
|
||||
|
||||
dlg_shortcut_str get_shortcut; /* Shortcut string */
|
||||
dlg_title_str get_title; /* useless for modal dialogs */
|
||||
|
@ -124,7 +124,6 @@ void dlg_draw (WDialog * h);
|
|||
/* Default callback for dialogs */
|
||||
cb_ret_t dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
|
||||
|
||||
void dlg_erase (WDialog * h);
|
||||
void dlg_stop (WDialog * h);
|
||||
|
||||
/* Redraw all dialogs */
|
||||
|
|
|
@ -316,6 +316,9 @@ menubar_finish (WMenuBar * menubar)
|
|||
/* Move the menubar to the bottom so that widgets displayed on top of
|
||||
* an "invisible" menubar get the first chance to respond to mouse events. */
|
||||
widget_set_bottom (w);
|
||||
/* background must be bottom */
|
||||
if (DIALOG (w->owner)->bg != NULL)
|
||||
widget_set_bottom (WIDGET (DIALOG (w->owner)->bg));
|
||||
|
||||
group_select_widget_by_id (w->owner, menubar->previous_widget);
|
||||
do_refresh ();
|
||||
|
|
|
@ -572,7 +572,7 @@ quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
|
|||
}
|
||||
|
||||
/* skip frame widget */
|
||||
if (dd->frame != NULL)
|
||||
if (dd->bg != NULL)
|
||||
nskip++;
|
||||
|
||||
while (nskip-- != 0)
|
||||
|
|
|
@ -758,11 +758,6 @@ edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v
|
|||
edit_dlg_init ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_DRAW:
|
||||
tty_setcolor (EDITOR_BACKGROUND);
|
||||
dlg_erase (h);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_RESIZE:
|
||||
dlg_default_callback (w, NULL, MSG_RESIZE, 0, NULL);
|
||||
menubar_arrange (find_menubar (h));
|
||||
|
@ -913,6 +908,31 @@ edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static cb_ret_t
|
||||
edit_dialog_bg_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_INIT:
|
||||
{
|
||||
Widget *wo = WIDGET (w->owner);
|
||||
|
||||
w->y = wo->y + 1;
|
||||
w->x = wo->x;
|
||||
w->lines = wo->lines - 2;
|
||||
w->cols = wo->cols;
|
||||
w->pos_flags |= WPOS_KEEP_ALL;
|
||||
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
default:
|
||||
return background_callback (w, sender, msg, parm, data);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static cb_ret_t
|
||||
edit_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
|
||||
{
|
||||
|
@ -1226,6 +1246,11 @@ edit_files (const GList * files)
|
|||
|
||||
g = GROUP (edit_dlg);
|
||||
|
||||
edit_dlg->bg =
|
||||
WIDGET (background_new
|
||||
(1, 0, wd->lines - 2, wd->cols, EDITOR_BACKGROUND, ' ', edit_dialog_bg_callback));
|
||||
group_add_widget (g, edit_dlg->bg);
|
||||
|
||||
menubar = menubar_new (NULL, TRUE);
|
||||
w = WIDGET (menubar);
|
||||
group_add_widget_autopos (g, w, w->pos_flags, NULL);
|
||||
|
|
|
@ -755,7 +755,7 @@ advanced_chown_init (void)
|
|||
ch_grp = GROUP (ch_dlg);
|
||||
|
||||
/* draw background */
|
||||
WIDGET (ch_dlg->frame)->callback = advanced_chown_bg_callback;
|
||||
ch_dlg->bg->callback = advanced_chown_bg_callback;
|
||||
|
||||
l_filename = label_new (2, 3, "");
|
||||
group_add_widget (ch_grp, l_filename);
|
||||
|
|
|
@ -325,7 +325,7 @@ chmod_init (const char *fname, const struct stat *sf_stat)
|
|||
g = GROUP (ch_dlg);
|
||||
|
||||
/* draw background */
|
||||
WIDGET (ch_dlg->frame)->callback = chmod_bg_callback;
|
||||
ch_dlg->bg->callback = chmod_bg_callback;
|
||||
|
||||
group_add_widget (g, groupbox_new (PY, PX, BUTTONS_PERM + 2, perm_gb_len, _("Permission")));
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ chown_init (void)
|
|||
g = GROUP (ch_dlg);
|
||||
|
||||
/* draw background */
|
||||
WIDGET (ch_dlg->frame)->callback = chown_bg_callback;
|
||||
ch_dlg->bg->callback = chown_bg_callback;
|
||||
|
||||
group_add_widget (g, groupbox_new (2, 3, GH, GW, _("User name")));
|
||||
l_user = listbox_new (3, 4, GH - 2, GW - 2, FALSE, NULL);
|
||||
|
|
|
@ -1526,7 +1526,7 @@ find_adjust_header (WDialog * h)
|
|||
memmove (title + title_len, "...", 4);
|
||||
}
|
||||
|
||||
frame_set_title (h->frame, title);
|
||||
frame_set_title (FRAME (h->bg), title);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -561,7 +561,7 @@ layout_dlg_create (void)
|
|||
g = GROUP (layout_dlg);
|
||||
|
||||
/* draw background */
|
||||
WIDGET (layout_dlg->frame)->callback = layout_bg_callback;
|
||||
layout_dlg->bg->callback = layout_bg_callback;
|
||||
|
||||
#define XTRACT(i) (*check_options[i].variable != 0), check_options[i].text
|
||||
|
||||
|
|
|
@ -1130,7 +1130,7 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
|
|||
g = GROUP (whelp);
|
||||
widget_want_tab (WIDGET (whelp), TRUE);
|
||||
/* draw background */
|
||||
WIDGET (whelp->frame)->callback = help_bg_callback;
|
||||
whelp->bg->callback = help_bg_callback;
|
||||
|
||||
selected_item = search_string_node (main_node, STRING_LINK_START) - 1;
|
||||
currentpoint = main_node + 1; /* Skip the newline following the start of the node */
|
||||
|
|
Loading…
Reference in New Issue