rofi/include/view-internal.h

138 lines
4.4 KiB
C
Raw Normal View History

/*
* 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 13:27:36 +00:00
#ifndef ROFI_VIEW_INTERNAL_H
#define ROFI_VIEW_INTERNAL_H
#include "widgets/container.h"
#include "widgets/widget.h"
#include "widgets/textbox.h"
#include "widgets/box.h"
#include "widgets/icon.h"
#include "widgets/listview.h"
#include "keyb.h"
#include "xcb.h"
2016-12-27 21:19:15 +00:00
#include "theme.h"
2016-02-06 13:27:36 +00:00
/**
2016-02-08 17:16:16 +00:00
* @ingroup ViewHandle
2016-02-06 13:27:36 +00:00
*
* @{
*/
// State of the menu.
2016-02-11 19:24:29 +00:00
struct RofiViewState
2016-02-06 13:27:36 +00:00
{
/** #Mode bound to to this view. */
2016-05-08 09:13:11 +00:00
Mode *sw;
2016-02-06 13:27:36 +00:00
/** Flag indicating if view needs to be refiltered. */
2016-05-08 09:13:11 +00:00
int refilter;
/** Widget representing the main container. */
2017-05-27 15:08:46 +00:00
box *main_window;
/** #textbox showing the prompt in the input bar. */
textbox *prompt;
/** #textbox with the user input in the input bar. */
2016-05-08 09:13:11 +00:00
textbox *text;
/** #textbox showing the state of the case sensitive and sortng. */
2016-05-08 09:13:11 +00:00
textbox *case_indicator;
/** #listview holding the displayed elements. */
listview *list_view;
/** #textbox widget showing the overlay. */
2016-06-26 13:48:12 +00:00
textbox *overlay;
/** #container holding the message box */
container *mesg_box;
/** #textbox containing the message entry */
textbox *mesg_tb;
/** Array with the levenshtein distance for each eleemnt. */
2016-05-08 09:13:11 +00:00
int *distance;
/** Array with the translation between the filtered and unfiltered list. */
2016-05-08 09:13:11 +00:00
unsigned int *line_map;
/** number of (unfiltered) elements to show. */
2016-05-08 09:13:11 +00:00
unsigned int num_lines;
2016-02-06 13:27:36 +00:00
/** number of (filtered) elements to show. */
2016-05-08 09:13:11 +00:00
unsigned int filtered_lines;
2016-02-06 13:27:36 +00:00
/** Previously called key action. */
KeyBindingAction prev_action;
/** Time previous key action was executed. */
2016-05-08 09:13:11 +00:00
xcb_timestamp_t last_button_press;
2016-02-06 13:27:36 +00:00
/** Indicate view should terminate */
2016-05-08 09:13:11 +00:00
int quit;
/** Indicate if we should absorb the key release */
2016-05-08 09:13:11 +00:00
int skip_absorb;
/** The selected line (in the unfiltered list) */
2016-05-08 09:13:11 +00:00
unsigned int selected_line;
/** The return state of the view */
2016-05-08 09:13:11 +00:00
MenuReturn retv;
/** Monitor #workarea the view is displayed on */
2016-05-08 09:13:11 +00:00
workarea mon;
2016-02-06 13:27:36 +00:00
/** #box holding the different modi buttons */
box *sidebar_bar;
/** number of modi to display */
2016-05-08 09:13:11 +00:00
unsigned int num_modi;
/** Array of #textbox that act as buttons for switching modi */
2016-05-08 09:13:11 +00:00
textbox **modi;
/** Settings of the menu */
2016-05-08 09:13:11 +00:00
MenuFlags menu_flags;
/** If mouse was within view previously */
int mouse_seen;
/** Flag indicating if view needs to be reloaded. */
int reload;
2017-11-23 17:41:52 +00:00
/** The function to be called when finalizing this view */
2016-05-08 09:13:11 +00:00
void ( *finalize )( struct RofiViewState *state );
/** Width of the view */
int width;
/** Height of the view */
int height;
/** X position of the view */
int x;
/** Y position of the view */
int y;
2016-10-11 06:18:34 +00:00
/** Position and target of the mouse. */
struct
{
/** X position */
int x;
/** Y position */
int y;
/** Widget being targetted. */
widget *motion_target;
2017-10-05 15:45:50 +00:00
} mouse;
/** Regexs used for matching */
rofi_int_matcher **tokens;
2016-02-11 19:24:29 +00:00
};
2016-02-06 13:27:36 +00:00
/** @} */
#endif