source: mainline/uspace/lib/ui/private/filelist.h@ 1af103e

ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 1af103e was c0757e1f, checked in by Jiri Svoboda <jiri@…>, 2 years ago

UI display configuration utility

In addition to the command-line utility 'disp', we introduce its UI
equivalent 'display-cfg'. Currently this allows the user to configure
seats in a very comfortable way.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 2023 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 libui
30 * @{
31 */
32/**
33 * @file File list
34 */
35
36#ifndef _UI_PRIVATE_FILELIST_H
37#define _UI_PRIVATE_FILELIST_H
38
39#include <gfx/color.h>
40#include <ipc/loc.h>
41#include <ui/list.h>
42#include <ui/window.h>
43#include <stdint.h>
44#include <types/ui/filelist.h>
45
46/** File list entry attributes */
47struct ui_file_list_entry_attr {
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};
57
58/** File list entry */
59struct ui_file_list_entry {
60 /** Containing file list */
61 struct ui_file_list *flist;
62 /** List entry */
63 ui_list_entry_t *entry;
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};
73
74/** File list.
75 *
76 * Allows browsing files and directories.
77 */
78typedef struct ui_file_list {
79 /** Base control object */
80 struct ui_control *control;
81
82 /** Containing window */
83 struct ui_window *window;
84
85 /** UI list */
86 ui_list_t *list;
87
88 /** Callbacks */
89 struct ui_file_list_cb *cb;
90
91 /** Callback argument */
92 void *cb_arg;
93
94 /** Directory-type entry color */
95 gfx_color_t *dir_color;
96
97 /** Service-type entry color */
98 gfx_color_t *svc_color;
99
100 /** Directory */
101 char *dir;
102} ui_file_list_t;
103
104extern bool ui_file_list_is_active(ui_file_list_t *);
105extern void ui_file_list_entry_destroy(ui_file_list_entry_t *);
106extern void ui_file_list_clear_entries(ui_file_list_t *);
107extern errno_t ui_file_list_sort(ui_file_list_t *);
108extern int ui_file_list_entry_ptr_cmp(const void *, const void *);
109extern void ui_file_list_entry_attr_init(ui_file_list_entry_attr_t *);
110extern errno_t ui_file_list_entry_append(ui_file_list_t *,
111 ui_file_list_entry_attr_t *);
112extern ui_file_list_entry_t *ui_file_list_first(ui_file_list_t *);
113extern ui_file_list_entry_t *ui_file_list_last(ui_file_list_t *);
114extern ui_file_list_entry_t *ui_file_list_next(ui_file_list_entry_t *);
115extern ui_file_list_entry_t *ui_file_list_prev(ui_file_list_entry_t *);
116extern errno_t ui_file_list_open_dir(ui_file_list_t *, ui_file_list_entry_t *);
117extern errno_t ui_file_list_open_file(ui_file_list_t *, ui_file_list_entry_t *);
118extern void ui_file_list_activate_req(ui_file_list_t *);
119extern void ui_file_list_selected(ui_file_list_t *, const char *);
120extern errno_t ui_file_list_paint(ui_file_list_t *);
121extern int ui_file_list_list_compare(ui_list_entry_t *, ui_list_entry_t *);
122
123#endif
124
125/** @}
126 */
Note: See TracBrowser for help on using the repository browser.