2017-04-15 06:32:05 -04:00
|
|
|
/*
|
|
|
|
* rofi
|
|
|
|
*
|
|
|
|
* MIT/X11 License
|
|
|
|
* Copyright © 2013-2017 Qball Cow <qball@gmpclient.org>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-02-06 08:27:36 -05:00
|
|
|
#ifndef ROFI_VIEW_INTERNAL_H
|
|
|
|
#define ROFI_VIEW_INTERNAL_H
|
2017-01-05 12:33:57 -05:00
|
|
|
#include "widgets/container.h"
|
2016-10-08 12:57:59 -04:00
|
|
|
#include "widgets/widget.h"
|
|
|
|
#include "widgets/textbox.h"
|
|
|
|
#include "widgets/listview.h"
|
|
|
|
#include "widgets/box.h"
|
2016-04-07 09:32:22 -04:00
|
|
|
#include "keyb.h"
|
2016-02-19 13:29:06 -05:00
|
|
|
#include "x11-helper.h"
|
2016-12-27 16:19:15 -05:00
|
|
|
#include "theme.h"
|
2016-02-06 08:27:36 -05:00
|
|
|
|
|
|
|
/**
|
2016-02-08 12:16:16 -05:00
|
|
|
* @ingroup ViewHandle
|
2016-02-06 08:27:36 -05:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
// State of the menu.
|
|
|
|
|
2016-02-11 14:24:29 -05:00
|
|
|
struct RofiViewState
|
2016-02-06 08:27:36 -05:00
|
|
|
{
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #Mode bound to to this view. */
|
2016-05-08 05:13:11 -04:00
|
|
|
Mode *sw;
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Flag indicating if view needs to be refiltered. */
|
2016-05-08 05:13:11 -04:00
|
|
|
int refilter;
|
2017-01-05 12:33:57 -05:00
|
|
|
/** Widget representing the main container. */
|
2017-01-08 15:36:06 -05:00
|
|
|
container *main_window;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Main #box widget holding different elements. */
|
2016-10-08 12:57:59 -04:00
|
|
|
box *main_box;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #box widget packing the input bar widgets. */
|
2016-10-08 12:57:59 -04:00
|
|
|
box *input_bar;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #textbox showing the prompt in the input bar. */
|
2016-10-08 12:57:59 -04:00
|
|
|
textbox *prompt;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #textbox with the user input in the input bar. */
|
2016-05-08 05:13:11 -04:00
|
|
|
textbox *text;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #textbox showing the state of the case sensitive and sortng. */
|
2016-05-08 05:13:11 -04:00
|
|
|
textbox *case_indicator;
|
2016-10-08 12:57:59 -04:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #listview holding the displayed elements. */
|
2016-10-08 12:57:59 -04:00
|
|
|
listview *list_view;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #textbox widget showing the overlay. */
|
2016-06-26 09:48:12 -04:00
|
|
|
textbox *overlay;
|
2017-03-01 03:37:20 -05:00
|
|
|
/** #container holding the message box */
|
|
|
|
container *mesg_box;
|
|
|
|
/** #textbox containing the message entry */
|
|
|
|
textbox *mesg_tb;
|
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Array with the levenshtein distance for each eleemnt. */
|
2016-05-08 05:13:11 -04:00
|
|
|
int *distance;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Array with the translation between the filtered and unfiltered list. */
|
2016-05-08 05:13:11 -04:00
|
|
|
unsigned int *line_map;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** number of (unfiltered) elements to show. */
|
2016-05-08 05:13:11 -04:00
|
|
|
unsigned int num_lines;
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** number of (filtered) elements to show. */
|
2016-05-08 05:13:11 -04:00
|
|
|
unsigned int filtered_lines;
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Previously called key action. */
|
2016-04-07 09:32:22 -04:00
|
|
|
KeyBindingAction prev_action;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Time previous key action was executed. */
|
2016-05-08 05:13:11 -04:00
|
|
|
xcb_timestamp_t last_button_press;
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Indicate view should terminate */
|
2016-05-08 05:13:11 -04:00
|
|
|
int quit;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Indicate if we should absorb the key release */
|
2016-05-08 05:13:11 -04:00
|
|
|
int skip_absorb;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** The selected line (in the unfiltered list) */
|
2016-05-08 05:13:11 -04:00
|
|
|
unsigned int selected_line;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** The return state of the view */
|
2016-05-08 05:13:11 -04:00
|
|
|
MenuReturn retv;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Monitor #workarea the view is displayed on */
|
2016-05-08 05:13:11 -04:00
|
|
|
workarea mon;
|
2016-02-06 08:27:36 -05:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** #box holding the different modi buttons */
|
2016-10-08 12:57:59 -04:00
|
|
|
box *sidebar_bar;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** number of modi to display */
|
2016-05-08 05:13:11 -04:00
|
|
|
unsigned int num_modi;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Array of #textbox that act as buttons for switching modi */
|
2016-05-08 05:13:11 -04:00
|
|
|
textbox **modi;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Settings of the menu */
|
2016-05-08 05:13:11 -04:00
|
|
|
MenuFlags menu_flags;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** If mouse was within view previously */
|
2016-09-08 16:42:41 -04:00
|
|
|
int mouse_seen;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Flag indicating if view needs to be reloaded. */
|
2016-09-17 11:49:45 -04:00
|
|
|
int reload;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** The funciton to be called when finalizing this view */
|
2016-05-08 05:13:11 -04:00
|
|
|
void ( *finalize )( struct RofiViewState *state );
|
2016-09-17 11:49:45 -04:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Width of the view */
|
2016-09-17 11:49:45 -04:00
|
|
|
int width;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Height of the view */
|
2016-09-17 11:49:45 -04:00
|
|
|
int height;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** X position of the view */
|
2016-09-17 11:49:45 -04:00
|
|
|
int x;
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Y position of the view */
|
2016-09-17 11:49:45 -04:00
|
|
|
int y;
|
2016-10-11 02:18:34 -04:00
|
|
|
|
2016-10-14 02:47:21 -04:00
|
|
|
/** Regexs used for matching */
|
2016-10-11 02:18:34 -04:00
|
|
|
GRegex **tokens;
|
2016-02-11 14:24:29 -05:00
|
|
|
};
|
2016-02-06 08:27:36 -05:00
|
|
|
/** @} */
|
|
|
|
#endif
|