mirror of
https://github.com/lbonn/rofi
synced 2024-11-15 08:37:17 +00:00
3c64507f02
* Initial support for using boxes for packing widgets. * Make CapiTalIzation more consistent * Move widgets to subdirectory * Removed nolonger needed resize function. * Small cleanup * When switching mode, reuse view, don't rebuild it. Reduces artifacts. * Needs cleaning up. * Remove separate prompt argument, use display_name * Simplify run-switcher code. * Add notion of parents, and trigger parent update on resize. * Use widget_get_height wrapper, avoid crash * Size separator width based on height. (indent) * TODO add margin to box. * First draft version of listview. * Add scrollbar to listview widget * Add padding option to box * Move access to global config out of widget. (1/2 done) * Remove printf * Make listview not access global config * Add click support, implement on mode buttons. * Re-introduce mouse handling on list-view. * TODO draggin on scrollbar. * Fix multi-select * Fix warnings * Fix include
167 lines
4.2 KiB
C
167 lines
4.2 KiB
C
#ifndef ROFI_VIEW_H
|
|
#define ROFI_VIEW_H
|
|
|
|
#include "xkb.h"
|
|
|
|
/**
|
|
* @defgroup View View
|
|
*
|
|
* The rofi Menu view.
|
|
*
|
|
* @defgroup ViewHandle ViewHandle
|
|
* @ingroup View
|
|
*
|
|
* @{
|
|
*/
|
|
typedef struct RofiViewState RofiViewState;
|
|
typedef enum
|
|
{
|
|
/** Create a menu for entering text */
|
|
MENU_NORMAL = 0,
|
|
/** Create a menu for entering passwords */
|
|
MENU_PASSWORD = 1,
|
|
/** Create amanaged window. */
|
|
MENU_NORMAL_WINDOW = 2,
|
|
/** ERROR dialog */
|
|
MENU_ERROR_DIALOG = 4,
|
|
/** INDICATOR */
|
|
MENU_INDICATOR = 8,
|
|
} MenuFlags;
|
|
|
|
/**
|
|
* @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.
|
|
* @param finalize the finailze callback
|
|
*
|
|
* Main menu callback.
|
|
*
|
|
* @returns The command issued (see MenuReturn)
|
|
*/
|
|
RofiViewState *rofi_view_create ( Mode *sw, const char *input, const char *message, MenuFlags flags, void ( *finalize )(
|
|
RofiViewState * ) )
|
|
__attribute__ ( ( nonnull ( 1, 2, 5 ) ) );
|
|
|
|
/**
|
|
* @param state The Menu Handle
|
|
*
|
|
* Check if a finalize function is set, and if sets executes it.
|
|
*/
|
|
void rofi_view_finalize ( RofiViewState *state );
|
|
|
|
MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
|
|
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
|
|
void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *event, xkb_stuff *xkb );
|
|
unsigned int rofi_view_get_completed ( const RofiViewState *state );
|
|
const char * rofi_view_get_user_input ( const RofiViewState *state );
|
|
|
|
/**
|
|
* @param state The Menu Handle
|
|
* @param selected_line The line to select.
|
|
*
|
|
* Select a line.
|
|
*/
|
|
void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_line );
|
|
|
|
/**
|
|
* @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 );
|
|
|
|
/**
|
|
* @param state The handle to the view
|
|
*
|
|
* Update the state of the view. This involves filter state.
|
|
*/
|
|
void rofi_view_update ( RofiViewState *state );
|
|
|
|
gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction action );
|
|
|
|
/**
|
|
* @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 );
|
|
|
|
/**
|
|
* @param msg The error message to show.
|
|
* @param markup The error message uses pango markup.
|
|
*
|
|
* The error message to show.
|
|
*/
|
|
int rofi_view_error_dialog ( const char *msg, int markup );
|
|
|
|
/**
|
|
* 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 );
|
|
|
|
Mode * rofi_view_get_mode ( RofiViewState *state );
|
|
/** @} */
|
|
/***
|
|
* @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 );
|
|
|
|
void __create_window ( MenuFlags menu_flags );
|
|
void rofi_view_set_overlay ( RofiViewState *state, const char *text );
|
|
/**
|
|
* Unmap the window.
|
|
*/
|
|
void rofi_view_hide ( void );
|
|
void rofi_view_reload ( void );
|
|
void rofi_view_switch_mode ( RofiViewState *state, Mode *mode );
|
|
/**@}*/
|
|
#endif
|