mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
(dlg_adjust_position): rename to widget_adjust_position and make public.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
f6c4ae2f31
commit
297391fd60
@ -604,36 +604,6 @@ dlg_widget_set_position (gpointer data, gpointer user_data)
|
|||||||
widget_set_size (c, y, x, lines, cols);
|
widget_set_size (c, y, x, lines, cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
static void
|
|
||||||
dlg_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols)
|
|
||||||
{
|
|
||||||
if ((pos_flags & WPOS_FULLSCREEN) != 0)
|
|
||||||
{
|
|
||||||
*y = 0;
|
|
||||||
*x = 0;
|
|
||||||
*lines = LINES;
|
|
||||||
*cols = COLS;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
|
|
||||||
*x = (COLS - *cols) / 2;
|
|
||||||
|
|
||||||
if ((pos_flags & WPOS_CENTER_VERT) != 0)
|
|
||||||
*y = (LINES - *lines) / 2;
|
|
||||||
|
|
||||||
if ((pos_flags & WPOS_TRYUP) != 0)
|
|
||||||
{
|
|
||||||
if (*y > 3)
|
|
||||||
*y -= 2;
|
|
||||||
else if (*y == 3)
|
|
||||||
*y = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
/*** public functions ****************************************************************************/
|
/*** public functions ****************************************************************************/
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -712,7 +682,7 @@ dlg_set_size (WDialog * h, int lines, int cols)
|
|||||||
{
|
{
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
|
|
||||||
dlg_adjust_position (WIDGET (h)->pos_flags, &y, &x, &lines, &cols);
|
widget_adjust_position (WIDGET (h)->pos_flags, &y, &x, &lines, &cols);
|
||||||
dlg_set_position (h, y, x, lines, cols);
|
dlg_set_position (h, y, x, lines, cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,7 +741,7 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flag
|
|||||||
|
|
||||||
new_d = g_new0 (WDialog, 1);
|
new_d = g_new0 (WDialog, 1);
|
||||||
w = WIDGET (new_d);
|
w = WIDGET (new_d);
|
||||||
dlg_adjust_position (pos_flags, &y1, &x1, &lines, &cols);
|
widget_adjust_position (pos_flags, &y1, &x1, &lines, &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);
|
||||||
w->pos_flags = pos_flags;
|
w->pos_flags = pos_flags;
|
||||||
|
@ -329,6 +329,36 @@ widget_set_state (Widget * w, widget_state_t state, gboolean enable)
|
|||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void
|
||||||
|
widget_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols)
|
||||||
|
{
|
||||||
|
if ((pos_flags & WPOS_FULLSCREEN) != 0)
|
||||||
|
{
|
||||||
|
*y = 0;
|
||||||
|
*x = 0;
|
||||||
|
*lines = LINES;
|
||||||
|
*cols = COLS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
|
||||||
|
*x = (COLS - *cols) / 2;
|
||||||
|
|
||||||
|
if ((pos_flags & WPOS_CENTER_VERT) != 0)
|
||||||
|
*y = (LINES - *lines) / 2;
|
||||||
|
|
||||||
|
if ((pos_flags & WPOS_TRYUP) != 0)
|
||||||
|
{
|
||||||
|
if (*y > 3)
|
||||||
|
*y -= 2;
|
||||||
|
else if (*y == 3)
|
||||||
|
*y = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
widget_set_size (Widget * widget, int y, int x, int lines, int cols)
|
widget_set_size (Widget * widget, int y, int x, int lines, int cols)
|
||||||
{
|
{
|
||||||
|
@ -180,6 +180,7 @@ cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg,
|
|||||||
void *data);
|
void *data);
|
||||||
void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
|
void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
|
||||||
cb_ret_t widget_set_state (Widget * w, widget_state_t state, gboolean enable);
|
cb_ret_t widget_set_state (Widget * w, widget_state_t state, gboolean enable);
|
||||||
|
void widget_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols);
|
||||||
void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
|
void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
|
||||||
/* select color for widget in dependance of state */
|
/* select color for widget in dependance of state */
|
||||||
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);
|
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);
|
||||||
|
Loading…
Reference in New Issue
Block a user