2016-02-06 08:27:36 -05:00
|
|
|
#ifndef ROFI_VIEW_H
|
|
|
|
#define ROFI_VIEW_H
|
2016-02-06 07:06:58 -05:00
|
|
|
|
2016-02-21 07:10:32 -05:00
|
|
|
#include "xkb.h"
|
|
|
|
|
2016-02-06 08:27:36 -05:00
|
|
|
/**
|
|
|
|
* @defgroup View View
|
|
|
|
*
|
|
|
|
* The rofi Menu view.
|
|
|
|
*
|
2016-02-08 12:16:16 -05:00
|
|
|
* @defgroup ViewHandle ViewHandle
|
|
|
|
* @ingroup View
|
|
|
|
*
|
2016-02-06 08:27:36 -05:00
|
|
|
* @{
|
|
|
|
*/
|
2016-02-07 06:31:17 -05:00
|
|
|
typedef struct RofiViewState RofiViewState;
|
|
|
|
typedef enum
|
|
|
|
{
|
2016-02-08 12:16:16 -05:00
|
|
|
/** Create a menu for entering text */
|
2016-02-10 13:40:19 -05:00
|
|
|
MENU_NORMAL = 0,
|
2016-02-08 12:16:16 -05:00
|
|
|
/** Create a menu for entering passwords */
|
2016-02-10 13:40:19 -05:00
|
|
|
MENU_PASSWORD = 1,
|
|
|
|
/** Create amanaged window. */
|
|
|
|
MENU_NORMAL_WINDOW = 2,
|
2016-02-07 06:31:17 -05:00
|
|
|
} MenuFlags;
|
2016-02-06 07:06:58 -05:00
|
|
|
|
2016-02-07 06:31:17 -05:00
|
|
|
/**
|
|
|
|
* @param sw the Mode to show.
|
|
|
|
* @param input A pointer to a string where the inputted data is placed.
|
|
|
|
* @param prompt The prompt to show.
|
|
|
|
* @param message Extra message to display.
|
|
|
|
* @param flags Flags indicating state of the menu.
|
2016-02-19 13:29:06 -05:00
|
|
|
* @param finalize the finailze callback
|
2016-02-07 06:31:17 -05:00
|
|
|
*
|
|
|
|
* Main menu callback.
|
|
|
|
*
|
|
|
|
* @returns The command issued (see MenuReturn)
|
|
|
|
*/
|
2016-02-19 13:29:06 -05:00
|
|
|
RofiViewState *rofi_view_create ( Mode *sw, const char *input, char *prompt, const char *message, MenuFlags flags, void ( *finalize )(
|
|
|
|
RofiViewState * ) )
|
|
|
|
__attribute__ ( ( nonnull ( 1, 2, 3, 6 ) ) );
|
2016-02-07 14:38:34 -05:00
|
|
|
|
2016-02-06 07:06:58 -05:00
|
|
|
/**
|
|
|
|
* @param state The Menu Handle
|
|
|
|
*
|
|
|
|
* Check if a finalize function is set, and if sets executes it.
|
|
|
|
*/
|
|
|
|
void rofi_view_finalize ( RofiViewState *state );
|
|
|
|
|
2016-02-06 08:27:36 -05:00
|
|
|
MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
|
|
|
|
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
|
2016-02-21 07:10:32 -05:00
|
|
|
void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *event, xkb_stuff *xkb );
|
2016-02-06 08:27:36 -05:00
|
|
|
unsigned int rofi_view_get_completed ( const RofiViewState *state );
|
|
|
|
const char * rofi_view_get_user_input ( const RofiViewState *state );
|
2016-02-08 12:16:16 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param state The Menu Handle
|
|
|
|
* @param selected_line The line to select.
|
|
|
|
*
|
|
|
|
* Select a line.
|
|
|
|
*/
|
2016-02-06 08:27:36 -05:00
|
|
|
void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_line );
|
|
|
|
|
2016-02-08 12:16:16 -05:00
|
|
|
/**
|
|
|
|
* @param state The Menu Handle
|
|
|
|
*
|
|
|
|
* Get the selected line.
|
|
|
|
*
|
|
|
|
* @returns the selected line or UINT32_MAX if none selected.
|
|
|
|
*/
|
|
|
|
unsigned int rofi_view_get_selected_line ( const RofiViewState *state );
|
|
|
|
/**
|
|
|
|
* @param state The Menu Handle
|
|
|
|
*
|
|
|
|
* Restart the menu so it can be displayed again.
|
|
|
|
* Resets RofiViewState::quit and RofiViewState::retv.
|
|
|
|
*/
|
|
|
|
void rofi_view_restart ( RofiViewState *state );
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-02-08 12:16:16 -05:00
|
|
|
/**
|
|
|
|
* @param state The handle to the view
|
|
|
|
*
|
|
|
|
* Update the state of the view. This involves filter state.
|
|
|
|
*/
|
2016-02-07 08:09:00 -05:00
|
|
|
void rofi_view_update ( RofiViewState *state );
|
2016-02-08 12:16:16 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param display Connection to the X server.
|
|
|
|
* @param state The handle to the view
|
|
|
|
*
|
|
|
|
* Enables fake transparancy on this view.
|
|
|
|
*/
|
2016-03-01 12:11:55 -05:00
|
|
|
void rofi_view_setup_fake_transparency ( RofiViewState *state );
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-02-08 12:16:16 -05:00
|
|
|
/**
|
|
|
|
* @param state The handle to the view
|
|
|
|
*
|
|
|
|
* Free's the memory allocated for this handle.
|
|
|
|
* After a call to this function, state is invalid and can no longer be used.
|
|
|
|
*/
|
|
|
|
void rofi_view_free ( RofiViewState *state );
|
|
|
|
/** @} */
|
|
|
|
/**
|
|
|
|
* @defgroup ViewGlobal ViewGlobal
|
|
|
|
* @ingroup View
|
|
|
|
*
|
|
|
|
* Global menu view functions.
|
|
|
|
* These do not work on the view itself but modifies the global state.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the current active view Handle.
|
|
|
|
*
|
|
|
|
* @returns the active view handle or NULL
|
|
|
|
*/
|
|
|
|
RofiViewState * rofi_view_get_active ( void );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param state the new active view handle, NULL to clear.
|
|
|
|
*
|
|
|
|
* Set the current active view Handle.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void rofi_view_set_active ( RofiViewState *state );
|
2016-02-08 03:03:11 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param msg The error message to show.
|
|
|
|
* @param markup The error message uses pango markup.
|
|
|
|
*
|
|
|
|
* The error message to show.
|
|
|
|
*/
|
2016-03-03 02:21:28 -05:00
|
|
|
int rofi_view_error_dialog ( const char *msg, int markup );
|
2016-02-08 12:16:16 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Queue a redraw.
|
|
|
|
* This triggers a X11 Expose Event.
|
|
|
|
*/
|
|
|
|
void rofi_view_queue_redraw ( void );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cleanup internal data of the view.
|
|
|
|
*/
|
|
|
|
void rofi_view_cleanup ( void );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param data A thread_state object.
|
|
|
|
* @param user_data User data to pass to thread_state callback
|
|
|
|
*
|
|
|
|
* Small wrapper function that is internally used to pass a job to a worker.
|
|
|
|
*/
|
|
|
|
void rofi_view_call_thread ( gpointer data, gpointer user_data );
|
|
|
|
|
2016-02-19 13:29:06 -05:00
|
|
|
Mode * rofi_view_get_mode ( RofiViewState *state );
|
2016-02-06 08:27:36 -05:00
|
|
|
/** @} */
|
2016-02-10 13:40:19 -05:00
|
|
|
/***
|
|
|
|
* @defgroup ViewThreadPool ViewThreadPool
|
|
|
|
* @ingroup View
|
|
|
|
*
|
|
|
|
* The view can (optionally) keep a set of worker threads around to parallize work.
|
|
|
|
* This includes filtering and sorting.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
void rofi_view_workers_initialize ( void );
|
|
|
|
void rofi_view_workers_finalize ( void );
|
|
|
|
|
|
|
|
/**@}*/
|
2016-02-06 08:27:36 -05:00
|
|
|
#endif
|