mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 17:29:28 +03:00
(hotkey_get_text): new hotkey API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
851d2022a9
commit
53314c58b5
@ -228,9 +228,7 @@ button_new (int y, int x, int action, button_flags_t flags, const char *text, bc
|
|||||||
char *
|
char *
|
||||||
button_get_text (const WButton * b)
|
button_get_text (const WButton * b)
|
||||||
{
|
{
|
||||||
if (b->text.hotkey != NULL)
|
return hotkey_get_text (b->text);
|
||||||
return g_strconcat (b->text.start, "&", b->text.hotkey, b->text.end, (char *) NULL);
|
|
||||||
return g_strdup (b->text.start);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -222,6 +222,27 @@ hotkey_draw (Widget * w, const hotkey_t hotkey, gboolean focused)
|
|||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
char *
|
||||||
|
hotkey_get_text (const hotkey_t hotkey)
|
||||||
|
{
|
||||||
|
GString *text;
|
||||||
|
|
||||||
|
text = g_string_new (hotkey.start);
|
||||||
|
|
||||||
|
if (hotkey.hotkey != NULL)
|
||||||
|
{
|
||||||
|
g_string_append_c (text, '&');
|
||||||
|
g_string_append (text, hotkey.hotkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hotkey.end != NULL)
|
||||||
|
g_string_append (text, hotkey.end);
|
||||||
|
|
||||||
|
return g_string_free (text, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
widget_init (Widget * w, int y, int x, int lines, int cols,
|
widget_init (Widget * w, int y, int x, int lines, int cols,
|
||||||
widget_cb_fn callback, widget_mouse_cb_fn mouse_callback)
|
widget_cb_fn callback, widget_mouse_cb_fn mouse_callback)
|
||||||
|
@ -173,6 +173,8 @@ int hotkey_width (const hotkey_t hotkey);
|
|||||||
gboolean hotkey_equal (const hotkey_t hotkey1, const hotkey_t hotkey2);
|
gboolean hotkey_equal (const hotkey_t hotkey1, const hotkey_t hotkey2);
|
||||||
/* draw hotkey of widget */
|
/* draw hotkey of widget */
|
||||||
void hotkey_draw (Widget * w, const hotkey_t hotkey, gboolean focused);
|
void hotkey_draw (Widget * w, const hotkey_t hotkey, gboolean focused);
|
||||||
|
/* get text of hotkey */
|
||||||
|
char *hotkey_get_text (const hotkey_t hotkey);
|
||||||
|
|
||||||
/* widget initialization */
|
/* widget initialization */
|
||||||
void widget_init (Widget * w, int y, int x, int lines, int cols,
|
void widget_init (Widget * w, int y, int x, int lines, int cols,
|
||||||
|
Loading…
Reference in New Issue
Block a user