diff options
author | Aaron Ash <aaron.ash@gmail.com> | 2017-04-12 17:58:32 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-05-30 19:00:57 +0200 |
commit | 43053cdfc34539dd73ba6a028090038f99d4093e (patch) | |
tree | 787829616f0e34cd92a89ee65d712db668e4b67a /source/dialogs | |
parent | 4e6af2eab84157794684c485d15fb9624ec0f306 (diff) |
view: Add icon (basic) support
Diffstat (limited to 'source/dialogs')
-rw-r--r-- | source/dialogs/combi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index 8fa4a438..5631c519 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -247,6 +247,18 @@ static char * combi_get_completion ( const Mode *sw, unsigned int index ) return NULL; } +static cairo_surface_t * combi_get_icon ( const Mode *sw, unsigned int index, int height ) +{ + CombiModePrivateData *pd = mode_get_private_data ( sw ); + for ( unsigned i = 0; i < pd->num_switchers; i++ ) { + if ( index >= pd->starts[i] && index < ( pd->starts[i] + pd->lengths[i] ) ) { + cairo_surface_t *icon = mode_get_icon ( pd->switchers[i].mode, index - pd->starts[i], height ); + return icon; + } + } + return NULL; +} + static char * combi_preprocess_input ( Mode *sw, const char *input ) { CombiModePrivateData *pd = mode_get_private_data ( sw ); @@ -285,6 +297,7 @@ Mode combi_mode = ._token_match = combi_mode_match, ._get_completion = combi_get_completion, ._get_display_value = combi_mgrv, + ._get_icon = combi_get_icon, ._preprocess_input = combi_preprocess_input, .private_data = NULL, .free = NULL |