(simple_status_msg_t): simple status message with label and 'Abort' button.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
55e604901f
Коммит
9d4bafd889
@ -669,3 +669,38 @@ status_msg_common_update (status_msg_t * sm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
/**
|
||||||
|
* Callback to initialize already created simple status message window object
|
||||||
|
*
|
||||||
|
* @param sm status message window object
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
simple_status_msg_init_cb (status_msg_t * sm)
|
||||||
|
{
|
||||||
|
simple_status_msg_t *ssm = SIMPLE_STATUS_MSG (sm);
|
||||||
|
Widget *wd = WIDGET (sm->dlg);
|
||||||
|
|
||||||
|
const char *b_name = N_("&Abort");
|
||||||
|
int b_width;
|
||||||
|
int wd_width, y;
|
||||||
|
Widget *b;
|
||||||
|
|
||||||
|
#ifdef ENABLE_NLS
|
||||||
|
b_name = _(b_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
b_width = str_term_width1 (b_name) + 4;
|
||||||
|
wd_width = max (wd->cols, b_width + 6);
|
||||||
|
|
||||||
|
y = 2;
|
||||||
|
ssm->label = label_new (y++, 3, "");
|
||||||
|
add_widget_autopos (sm->dlg, ssm->label, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||||
|
add_widget (sm->dlg, hline_new (y++, -1, -1));
|
||||||
|
b = WIDGET (button_new (y++, 3, B_CANCEL, NORMAL_BUTTON, b_name, NULL));
|
||||||
|
add_widget_autopos (sm->dlg, b, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, NULL);
|
||||||
|
|
||||||
|
widget_set_size (wd, wd->y, wd->x, y + 2, wd_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
typedef struct status_msg_t status_msg_t;
|
typedef struct status_msg_t status_msg_t;
|
||||||
#define STATUS_MSG(x) ((status_msg_t *)(x))
|
#define STATUS_MSG(x) ((status_msg_t *)(x))
|
||||||
|
|
||||||
|
typedef struct simple_status_msg_t simple_status_msg_t;
|
||||||
|
#define SIMPLE_STATUS_MSG(x) ((simple_status_msg_t *)(x))
|
||||||
|
|
||||||
typedef void (*status_msg_cb) (status_msg_t * sm);
|
typedef void (*status_msg_cb) (status_msg_t * sm);
|
||||||
typedef int (*status_msg_update_cb) (status_msg_t * sm);
|
typedef int (*status_msg_update_cb) (status_msg_t * sm);
|
||||||
|
|
||||||
@ -48,6 +51,14 @@ struct status_msg_t
|
|||||||
status_msg_cb deinit; /* callback to deinit deribed clesses */
|
status_msg_cb deinit; /* callback to deinit deribed clesses */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Simple status message with label and 'Abort' button */
|
||||||
|
struct simple_status_msg_t
|
||||||
|
{
|
||||||
|
status_msg_t status_msg; /* base class */
|
||||||
|
|
||||||
|
WLabel *label;
|
||||||
|
};
|
||||||
|
|
||||||
/*** global variables defined in .c file *********************************************************/
|
/*** global variables defined in .c file *********************************************************/
|
||||||
|
|
||||||
/*** declarations of public functions ************************************************************/
|
/*** declarations of public functions ************************************************************/
|
||||||
@ -83,6 +94,8 @@ void status_msg_init (status_msg_t * sm, const char *title, double delay, status
|
|||||||
void status_msg_deinit (status_msg_t * sm);
|
void status_msg_deinit (status_msg_t * sm);
|
||||||
int status_msg_common_update (status_msg_t * sm);
|
int status_msg_common_update (status_msg_t * sm);
|
||||||
|
|
||||||
|
void simple_status_msg_init_cb (status_msg_t * sm);
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
|
|
||||||
#endif /* MC__WTOOLS_H */
|
#endif /* MC__WTOOLS_H */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user