summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-01-20 18:24:31 +0100
committerDave Davenport <qball@gmpclient.org>2016-01-20 18:24:31 +0100
commitd0716efe12487668fcab9ba55f8e75da87058ff5 (patch)
tree42a4953393e99f62ceed2818d88b5e35a904289c /include
parent94cbe3a00518cac898f58b6a89da6da52809ffc9 (diff)
Refactor menu function into three parts, setup, itterrate and finalize.
Diffstat (limited to 'include')
-rw-r--r--include/rofi.h18
-rw-r--r--include/textbox.h18
2 files changed, 22 insertions, 14 deletions
diff --git a/include/rofi.h b/include/rofi.h
index a43a29eb..c1824090 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -17,6 +17,7 @@
* Pointer to xdg cache directory.
*/
extern const char *cache_dir;
+typedef struct MenuState MenuState;
/**
* @param msg The error message to show.
@@ -49,12 +50,11 @@ typedef enum
*
* @returns The command issued (see MenuReturn)
*/
-MenuReturn menu ( Mode *sw,
- char **input, char *prompt,
- unsigned int *selected_line,
- unsigned int *next_pos,
+MenuState *menu ( Mode *sw,
+ char *input, char *prompt,
+ unsigned int selected_line,
const char *message, MenuFlags flags )
-__attribute__ ( ( nonnull ( 1, 2, 3, 4 ) ) );
+__attribute__ ( ( nonnull ( 1, 2, 3 ) ) );
/** Reset terminal */
#define color_reset "\033[0m"
@@ -84,5 +84,13 @@ int show_error_message ( const char *msg, int markup );
" * The version of rofi you are running\n\n" \
" <i>https://github.com/DaveDavenport/rofi/</i>"
#define ERROR_MSG_MARKUP TRUE
+
+MenuReturn menu_state_get_return_value ( const MenuState *state );
+unsigned int menu_state_get_selected_line ( const MenuState *state );
+unsigned int menu_state_get_next_position ( const MenuState *state );
+void menu_state_itterrate ( MenuState *state, XEvent *event );
+unsigned int menu_state_get_completed ( const MenuState *state );
+const char * menu_state_get_user_input ( const MenuState *state );
+void menu_state_free ( MenuState *state );
/*@}*/
#endif
diff --git a/include/textbox.h b/include/textbox.h
index fe59b02a..ecc52784 100644
--- a/include/textbox.h
+++ b/include/textbox.h
@@ -40,15 +40,15 @@ typedef struct
typedef enum
{
- TB_AUTOHEIGHT = 1 << 0,
- TB_AUTOWIDTH = 1 << 1,
- TB_LEFT = 1 << 16,
- TB_RIGHT = 1 << 17,
- TB_CENTER = 1 << 18,
- TB_EDITABLE = 1 << 19,
- TB_MARKUP = 1 << 20,
- TB_WRAP = 1 << 21,
- TB_PASSWORD = 1 << 22,
+ TB_AUTOHEIGHT = 1 << 0,
+ TB_AUTOWIDTH = 1 << 1,
+ TB_LEFT = 1 << 16,
+ TB_RIGHT = 1 << 17,
+ TB_CENTER = 1 << 18,
+ TB_EDITABLE = 1 << 19,
+ TB_MARKUP = 1 << 20,
+ TB_WRAP = 1 << 21,
+ TB_PASSWORD = 1 << 22,
} TextboxFlags;
typedef enum