2017-04-15 10:32:05 +00:00
|
|
|
/*
|
|
|
|
* rofi
|
|
|
|
*
|
|
|
|
* MIT/X11 License
|
2022-02-07 22:16:46 +00:00
|
|
|
* Copyright © 2013-2022 Qball Cow <qball@gmpclient.org>
|
2017-04-15 10:32:05 +00:00
|
|
|
*
|
|
|
|
* 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
|
2021-08-19 11:34:01 +00:00
|
|
|
#include "keyb.h"
|
|
|
|
#include "mode.h"
|
|
|
|
#include "theme.h"
|
2016-10-08 16:57:59 +00:00
|
|
|
#include "widgets/box.h"
|
2021-08-19 11:34:01 +00:00
|
|
|
#include "widgets/container.h"
|
2018-06-09 17:13:57 +00:00
|
|
|
#include "widgets/icon.h"
|
2019-08-08 18:02:20 +00:00
|
|
|
#include "widgets/listview.h"
|
2021-08-19 11:34:01 +00:00
|
|
|
#include "widgets/textbox.h"
|
|
|
|
#include "widgets/widget.h"
|
2017-05-31 22:12:03 +00:00
|
|
|
#include "xcb.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.
|
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
struct RofiViewState {
|
|
|
|
/** #Mode bound to to this view. */
|
|
|
|
Mode *sw;
|
2016-02-06 13:27:36 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Flag indicating if view needs to be refiltered. */
|
|
|
|
int refilter;
|
|
|
|
/** Widget representing the main container. */
|
|
|
|
box *main_window;
|
|
|
|
/** #textbox showing the prompt in the input bar. */
|
|
|
|
textbox *prompt;
|
|
|
|
/** #textbox with the user input in the input bar. */
|
|
|
|
textbox *text;
|
|
|
|
/** #textbox showing the state of the case sensitive and sortng. */
|
|
|
|
textbox *case_indicator;
|
2016-10-08 16:57:59 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** #listview holding the displayed elements. */
|
|
|
|
listview *list_view;
|
|
|
|
/** #textbox widget showing the overlay. */
|
|
|
|
textbox *overlay;
|
|
|
|
/** #container holding the message box */
|
|
|
|
container *mesg_box;
|
|
|
|
/** #textbox containing the message entry */
|
|
|
|
textbox *mesg_tb;
|
2017-03-01 08:37:20 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Array with the levenshtein distance for each element. */
|
|
|
|
int *distance;
|
|
|
|
/** Array with the translation between the filtered and unfiltered list. */
|
|
|
|
unsigned int *line_map;
|
|
|
|
/** number of (unfiltered) elements to show. */
|
|
|
|
unsigned int num_lines;
|
2016-02-06 13:27:36 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** number of (filtered) elements to show. */
|
|
|
|
unsigned int filtered_lines;
|
2016-02-06 13:27:36 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Previously called key action. */
|
|
|
|
KeyBindingAction prev_action;
|
|
|
|
/** Time previous key action was executed. */
|
|
|
|
xcb_timestamp_t last_button_press;
|
2016-02-06 13:27:36 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Indicate view should terminate */
|
|
|
|
int quit;
|
|
|
|
/** Indicate if we should absorb the key release */
|
|
|
|
int skip_absorb;
|
|
|
|
/** The selected line (in the unfiltered list) */
|
|
|
|
unsigned int selected_line;
|
|
|
|
/** The return state of the view */
|
|
|
|
MenuReturn retv;
|
|
|
|
/** Monitor #workarea the view is displayed on */
|
|
|
|
workarea mon;
|
2016-02-06 13:27:36 +00:00
|
|
|
|
2022-02-23 21:42:56 +00:00
|
|
|
/** #box holding the different modes buttons */
|
2021-08-19 11:34:01 +00:00
|
|
|
box *sidebar_bar;
|
2022-02-23 21:42:56 +00:00
|
|
|
/** number of modes to display */
|
|
|
|
unsigned int num_modes;
|
|
|
|
/** Array of #textbox that act as buttons for switching modes */
|
|
|
|
textbox **modes;
|
2019-11-07 10:49:45 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Total rows. */
|
|
|
|
textbox *tb_total_rows;
|
|
|
|
/** filtered rows */
|
|
|
|
textbox *tb_filtered_rows;
|
2019-11-07 10:49:45 +00:00
|
|
|
|
2022-06-27 14:56:59 +00:00
|
|
|
textbox *tb_current_entry;
|
2022-06-27 15:09:21 +00:00
|
|
|
icon *icon_current_entry;
|
2022-06-27 14:56:59 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Settings of the menu */
|
|
|
|
MenuFlags menu_flags;
|
|
|
|
/** If mouse was within view previously */
|
|
|
|
int mouse_seen;
|
|
|
|
/** Flag indicating if view needs to be reloaded. */
|
|
|
|
int reload;
|
|
|
|
/** The function to be called when finalizing this view */
|
|
|
|
void (*finalize)(struct RofiViewState *state);
|
2016-09-17 15:49:45 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** 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
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** Position and target of the mouse. */
|
|
|
|
struct {
|
|
|
|
/** X position */
|
|
|
|
int x;
|
|
|
|
/** Y position */
|
|
|
|
int y;
|
|
|
|
/** Widget being targeted. */
|
|
|
|
widget *motion_target;
|
|
|
|
} mouse;
|
2017-05-28 00:18:09 +00:00
|
|
|
|
2021-08-19 11:34:01 +00:00
|
|
|
/** 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
|