comparison libcore/core/inventory_dialog.h @ 121:789b23e01f52

misc: reorganize hierarchy, closes #2490
author David Demelier <markand@malikania.fr>
date Mon, 05 Oct 2020 13:25:06 +0200
parents src/core/inventory_dialog.h@f6b5e2fbbc81
children eadfed7674ac
comparison
equal deleted inserted replaced
120:b3429b26d60d 121:789b23e01f52
1 /*
2 * inventory_dialog.h -- dialog for items
3 *
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef INVENTORY_DIALOG_H
20 #define INVENTORY_DIALOG_H
21
22 #include "button.h"
23 #include "label.h"
24 #include "frame.h"
25
26 union event;
27
28 struct inventory;
29 struct theme;
30
31 /**
32 * \brief Inventory dialog state.
33 */
34 enum inventory_dialog_state {
35 INVENTORY_DIALOG_NONE,
36 INVENTORY_DIALOG_SHOWING
37 };
38
39 /**
40 * \brief Inventory dialog.
41 */
42 struct inventory_dialog {
43 int x; /*!< (RO) Position in x. */
44 int y; /*!< (RO) Position in y. */
45 struct inventory *inv; /*!< (RW, ref) Inventory to use. */
46 struct theme *theme; /*!< (RW, ref, optional) Theme to use. */
47 struct button bsort; /*!< (RO) Button sort. */
48 struct frame fgrid; /*!< (RO) Grid frame. */
49 struct frame fname; /*!< (RO) Frame for name. */
50 struct frame fdesc; /*!< (RO) Frame for description. */
51 struct label lname; /*!< (RO) Label for name. */
52 struct label ldesc; /*!< (RO) Label for description. */
53 enum inventory_dialog_state state; /*!< (RO) Current dialog state. */
54 unsigned int selrow; /*!< (RO) Current selected row. */
55 unsigned int selcol; /*!< (RO) Current selected column. */
56 };
57
58 void
59 inventory_dialog_open(struct inventory_dialog *dlg);
60
61 void
62 inventory_dialog_handle(struct inventory_dialog *dlg, const union event *event);
63
64 void
65 inventory_dialog_update(struct inventory_dialog *dlg, unsigned int ticks);
66
67 void
68 inventory_dialog_move(struct inventory_dialog *dlg, int x, int y);
69
70 void
71 inventory_dialog_draw(struct inventory_dialog *dlg);
72
73 void
74 inventory_dialog_finish(struct inventory_dialog *dlg);
75
76 #endif /* !INVENTORY_DIALOG_H */