diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-01-07 21:27:20 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-01-07 21:27:20 +0100 |
commit | fa51aeb484374cf22493d0da81e298a9052f1451 (patch) | |
tree | 245055e789ece34b0b6945cc0e949ea4a599e2fc /include/mode.h | |
parent | e8daff0f6ad49cd17b225622fa1875ee2960a70f (diff) |
More splitting and abstracting.
Diffstat (limited to 'include/mode.h')
-rw-r--r-- | include/mode.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/include/mode.h b/include/mode.h index 8a8d62a6..e20391cc 100644 --- a/include/mode.h +++ b/include/mode.h @@ -83,5 +83,91 @@ unsigned int mode_get_num_entries ( const Mode *sw ); * @returns allocated new string and state when get_entry is TRUE otherwise just the state. */ char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, int *state, int get_entry ); + +/** + * @param mode The mode to query + * @param selected_line The entry to query + * + * Return a string that can be used for completion. It has should have no markup. + * + * @returns allocated string. + */ +char * mode_get_completion ( const Mode *mode, unsigned int selected_line ); + +/** + * @param mode The mode to query + * @param selected_line The entry to query + * + * Check if the entry has non-ascii characters. + * + * @returns TRUE when selected line has non-ascii characters. + */ +int mode_is_not_ascii ( const Mode *mode, unsigned int selected_line ); + +/** + * @param mode Object The mode to query + * @param mretv The menu return value. + * @param input Pointer to the user input string. + * @param selected_line the line selected by the user. + * + * Acts on the user interaction. + * + * @returns the next #ModeMode. + */ +ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int selected_line ); + +/** + * @param mode Object The mode to query + * @param tokens The set of tokens to match against + * @param not_ascii If the entry is pure-ascii + * @param case_sensitive If the entry should be matched case sensitive + * @param selected_line The index of the entry to match + * + * Match entry against the set of tokens. + * + * @returns TRUE if matches + */ +int mode_token_match ( const Mode *mode, char **tokens, int not_ascii, int case_sensitive, unsigned int selected_line ); + +/** + * @param mode Object The mode to query + * + * Get the name of the mode. + * + * @returns the name of the mode. + */ +const char * mode_get_name ( const Mode *mode ); + +/** + * @param mode Object The mode to query + * @param key The KeySym to match + * @param state The Modmask to match + * + * Match keybinding of mode. + * + * return TRUE when matching, FALSE otherwise + */ +int mode_check_keybinding ( const Mode *mode, KeySym key, unsigned int modstate ); + +/** + * @param mode Object The mode to query + * + * Free the resources allocated for this mode. + */ +void mode_free ( Mode **mode ); + +/** + * @param mode Object The mode to query + * + * Setup the keybinding for this mode. + */ +void mode_setup_keybinding ( Mode *mode ); + +int mode_grab_key ( Mode *mode, Display *display ); +void mode_ungrab_key ( Mode *mode, Display *display ); +void mode_print_keybindings ( const Mode *mode ); + +void *mode_get_private_data ( const Mode *mode ); +void mode_set_private_data ( Mode *mode, void *pd ); /*@}*/ #endif |