mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
WOP_TOP_SELECT: new widget option
...to place widget on top of other widgets in dialog. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4b72fb5f5e
commit
fd4e56bf39
@ -833,6 +833,7 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
|
|||||||
widget_init (w, y1, x1, lines, cols, (callback != NULL) ? callback : dlg_default_callback,
|
widget_init (w, y1, x1, lines, cols, (callback != NULL) ? callback : dlg_default_callback,
|
||||||
mouse_callback);
|
mouse_callback);
|
||||||
widget_want_cursor (w, FALSE);
|
widget_want_cursor (w, FALSE);
|
||||||
|
w->options |= WOP_TOP_SELECT;
|
||||||
w->state |= WST_CONSTRUCT;
|
w->state |= WST_CONSTRUCT;
|
||||||
|
|
||||||
new_d->modal = modal;
|
new_d->modal = modal;
|
||||||
@ -1120,18 +1121,10 @@ dlg_select_widget (void *w)
|
|||||||
Widget *widget = WIDGET (w);
|
Widget *widget = WIDGET (w);
|
||||||
WDialog *h = widget->owner;
|
WDialog *h = widget->owner;
|
||||||
|
|
||||||
do_select_widget (h, g_list_find (h->widgets, widget), SELECT_EXACT);
|
if (widget_get_options (widget, WOP_TOP_SELECT))
|
||||||
}
|
dlg_set_top_or_bottom_widget (w, TRUE);
|
||||||
|
else
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
do_select_widget (h, g_list_find (h->widgets, widget), SELECT_EXACT);
|
||||||
/**
|
|
||||||
* Set widget at top of widget list and make it current.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
dlg_set_top_widget (void *w)
|
|
||||||
{
|
|
||||||
dlg_set_top_or_bottom_widget (w, TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -159,7 +159,6 @@ void dlg_stop (WDialog * h);
|
|||||||
|
|
||||||
/* Widget selection */
|
/* Widget selection */
|
||||||
void dlg_select_widget (void *w);
|
void dlg_select_widget (void *w);
|
||||||
void dlg_set_top_widget (void *w);
|
|
||||||
void dlg_set_bottom_widget (void *w);
|
void dlg_set_bottom_widget (void *w);
|
||||||
void dlg_one_up (WDialog * h);
|
void dlg_one_up (WDialog * h);
|
||||||
void dlg_one_down (WDialog * h);
|
void dlg_one_down (WDialog * h);
|
||||||
|
@ -892,9 +892,10 @@ menubar_new (int y, int x, int cols, GList * menu, gboolean visible)
|
|||||||
menubar = g_new0 (WMenuBar, 1);
|
menubar = g_new0 (WMenuBar, 1);
|
||||||
w = WIDGET (menubar);
|
w = WIDGET (menubar);
|
||||||
widget_init (w, y, x, 1, cols, menubar_callback, menubar_mouse_callback);
|
widget_init (w, y, x, 1, cols, menubar_callback, menubar_mouse_callback);
|
||||||
|
w->options |= WOP_TOP_SELECT;
|
||||||
|
widget_want_cursor (w, FALSE);
|
||||||
|
|
||||||
menubar->is_visible = visible;
|
menubar->is_visible = visible;
|
||||||
widget_want_cursor (w, FALSE);
|
|
||||||
menubar_set_menu (menubar, menu);
|
menubar_set_menu (menubar, menu);
|
||||||
|
|
||||||
return menubar;
|
return menubar;
|
||||||
@ -1017,7 +1018,7 @@ menubar_activate (WMenuBar * menubar, gboolean dropped, int which)
|
|||||||
|
|
||||||
/* Bring it to the top so it receives all mouse events before any other widget.
|
/* Bring it to the top so it receives all mouse events before any other widget.
|
||||||
* See also comment in menubar_finish(). */
|
* See also comment in menubar_finish(). */
|
||||||
dlg_set_top_widget (w);
|
dlg_select_widget (w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,8 @@ typedef enum
|
|||||||
WOP_DEFAULT = (0 << 0),
|
WOP_DEFAULT = (0 << 0),
|
||||||
WOP_WANT_HOTKEY = (1 << 1),
|
WOP_WANT_HOTKEY = (1 << 1),
|
||||||
WOP_WANT_CURSOR = (1 << 2),
|
WOP_WANT_CURSOR = (1 << 2),
|
||||||
WOP_IS_INPUT = (1 << 3)
|
WOP_IS_INPUT = (1 << 3),
|
||||||
|
WOP_TOP_SELECT = (1 << 4)
|
||||||
} widget_options_t;
|
} widget_options_t;
|
||||||
|
|
||||||
/* Widget state */
|
/* Widget state */
|
||||||
|
@ -2097,6 +2097,7 @@ edit_init (WEdit * edit, int y, int x, int lines, int cols, const vfs_path_t * f
|
|||||||
to_free = TRUE;
|
to_free = TRUE;
|
||||||
|
|
||||||
widget_init (WIDGET (edit), y, x, lines, cols, NULL, NULL);
|
widget_init (WIDGET (edit), y, x, lines, cols, NULL, NULL);
|
||||||
|
widget_set_options (WIDGET (edit), WOP_TOP_SELECT, TRUE);
|
||||||
edit->fullscreen = TRUE;
|
edit->fullscreen = TRUE;
|
||||||
edit_save_size (edit);
|
edit_save_size (edit);
|
||||||
}
|
}
|
||||||
|
@ -2262,7 +2262,7 @@ edit_close_cmd (WEdit * edit)
|
|||||||
{
|
{
|
||||||
edit = find_editor (h);
|
edit = find_editor (h);
|
||||||
if (edit != NULL)
|
if (edit != NULL)
|
||||||
dlg_set_top_widget (edit);
|
dlg_select_widget (edit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ edit_window_list (const WDialog * h)
|
|||||||
if (rv >= 0)
|
if (rv >= 0)
|
||||||
{
|
{
|
||||||
w = g_list_nth (h->widgets, rv + offset);
|
w = g_list_nth (h->widgets, rv + offset);
|
||||||
dlg_set_top_widget (w->data);
|
dlg_select_widget (w->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,11 +485,11 @@ edit_dialog_command_execute (WDialog * h, long command)
|
|||||||
break;
|
break;
|
||||||
case CK_WindowNext:
|
case CK_WindowNext:
|
||||||
dlg_one_down (h);
|
dlg_one_down (h);
|
||||||
dlg_set_top_widget (h->current->data);
|
dlg_select_widget (h->current->data);
|
||||||
break;
|
break;
|
||||||
case CK_WindowPrev:
|
case CK_WindowPrev:
|
||||||
dlg_one_up (h);
|
dlg_one_up (h);
|
||||||
dlg_set_top_widget (h->current->data);
|
dlg_select_widget (h->current->data);
|
||||||
break;
|
break;
|
||||||
case CK_Options:
|
case CK_Options:
|
||||||
edit_options_dialog (h);
|
edit_options_dialog (h);
|
||||||
@ -906,7 +906,7 @@ edit_dialog_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event)
|
|||||||
if (top != h->current)
|
if (top != h->current)
|
||||||
{
|
{
|
||||||
/* Window is not active. Activate it */
|
/* Window is not active. Activate it */
|
||||||
dlg_set_top_widget (e);
|
dlg_select_widget (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle buttons */
|
/* Handle buttons */
|
||||||
@ -1087,7 +1087,7 @@ edit_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event)
|
|||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case MSG_MOUSE_DOWN:
|
case MSG_MOUSE_DOWN:
|
||||||
dlg_set_top_widget (w);
|
dlg_select_widget (w);
|
||||||
edit_update_curs_row (edit);
|
edit_update_curs_row (edit);
|
||||||
edit_update_curs_col (edit);
|
edit_update_curs_col (edit);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user