source: mainline/uspace/app/nav/types/panel.h@ 7aeb52cb

serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 7aeb52cb was 7aeb52cb, checked in by jxsvoboda <5887334+jxsvoboda@…>, 4 years ago

Different color for service-special files

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2021 Jiri Svoboda
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup nav
30 * @{
31 */
32/**
33 * @file Navigator panel types
34 */
35
36#ifndef TYPES_PANEL_H
37#define TYPES_PANEL_H
38
39#include <adt/list.h>
40#include <gfx/color.h>
41#include <gfx/coord.h>
42#include <ipc/loc.h>
43#include <ui/window.h>
44#include <stdint.h>
45
46/** Panel entry attributes */
47typedef struct {
48 /** File name */
49 const char *name;
50 /** File size */
51 uint64_t size;
52 /** @c true iff entry is a directory */
53 bool isdir;
54 /** Service number for service special entries */
55 service_id_t svc;
56} panel_entry_attr_t;
57
58/** Panel entry */
59typedef struct {
60 /** Containing panel */
61 struct panel *panel;
62 /** Link to @c panel->entries */
63 link_t lentries;
64 /** File name */
65 char *name;
66 /** File size */
67 uint64_t size;
68 /** @c true iff entry is a directory */
69 bool isdir;
70 /** Service number for service special entries */
71 service_id_t svc;
72} panel_entry_t;
73
74/** Navigator panel
75 *
76 * This is a custom UI control.
77 */
78typedef struct panel {
79 /** Base control object */
80 struct ui_control *control;
81
82 /** Containing window */
83 ui_window_t *window;
84
85 /** Panel rectangle */
86 gfx_rect_t rect;
87
88 /** Panel color */
89 gfx_color_t *color;
90
91 /** Panel cursor color */
92 gfx_color_t *curs_color;
93
94 /** Active border color */
95 gfx_color_t *act_border_color;
96
97 /** Directory-type entry color */
98 gfx_color_t *dir_color;
99
100 /** Service-type entry color */
101 gfx_color_t *svc_color;
102
103 /** Panel entries (list of panel_entry_t) */
104 list_t entries;
105
106 /** Number of entries */
107 size_t entries_cnt;
108
109 /** First entry of current page */
110 panel_entry_t *page;
111
112 /** Index of first entry of current page */
113 size_t page_idx;
114
115 /** Cursor position */
116 panel_entry_t *cursor;
117
118 /** Index of entry under cursor */
119 size_t cursor_idx;
120
121 /** @c true iff the panel is active */
122 bool active;
123
124 /** Directory */
125 char *dir;
126} panel_t;
127
128#endif
129
130/** @}
131 */
Note: See TracBrowser for help on using the repository browser.