-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bks_Ui.h
144 lines (121 loc) · 3.56 KB
/
Bks_Ui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#ifndef __BKS_UI_H__
#define __BKS_UI_H__
#include <Ecore.h>
#include <Evas.h>
#include <Elementary.h>
#include "Bks_Types.h"
#include "Bks_Status.h"
#include "Bks_Job.h"
#include "Bks_Controller.h"
#include "Bks_Model.h"
#include "Bks_Model_Product.h"
#include "Bks_Model_Sale.h"
#include "Bks_Model_User_Account.h"
typedef struct _Bks_Ui_Naviframe_Page Bks_Ui_Naviframe_Page;
typedef struct _Bks_Ui_Lockwindow Bks_Ui_Lockwindow;
struct _Bks_Ui_Naviframe_Page {
Evas_Object *content, *prev_btn, *next_btn;
Elm_Object_Item *eoi;
};
struct _Bks_Ui_Lockwindow {
Evas_Object *win, *content;
};
struct _Bks_Ui {
Evas_Object *win, *naviframe;
Bks_Ui_Lockwindow lock_window;
struct {
Bks_Ui_Naviframe_Page enp;
Evas_Object *panes, *favs, *alpha, *list, *grid;
const Elm_Object_Item *selected;
Bks_Ui_Lockwindow lock_window;
} products;
struct {
Bks_Ui_Naviframe_Page enp;
Evas_Object *list;
Bks_Ui_Lockwindow lock_window;
} user_accounts;
struct {
Evas_Object *note;
} notification;
};
/**
* @brief initializes the central ui.
*
*/
void bks_ui_init(int argc, char *argv[]);
/**
* @brief shuts the central Bks_Ui down
*
*/
void bks_ui_shutdown(void);
/**
* @brief Clears the ui elements (lists, etc.). Selected elements and accounts
* are reset as well.
*/
void bks_ui_controller_clear(void);
/**
* @brief Updates the UI to reflect the given status
* @param status status to be reflected
*/
void bks_ui_controller_status_set(const Bks_Status status);
/**
* @brief called, when a product sale was successful registered by the model.
* @desc The function is called by a finished sale worker.
* The given sale has to be freed afterwards.
* @param sale The sale that was finished and has to be freed.
*/
void bks_ui_controller_sale_finished(Bks_Model_Sale *sale);
//User accounts page
/**
* @brief Clears the user accounts ui elements.
*/
void bks_ui_controller_user_accounts_clear(void);
/**
* @brief fills the UI using @p user_accounts.
* @param accounts The user accounts used to fill the list.
*/
void bks_ui_controller_user_accounts_page_set(Eina_List *accounts);
/**
* @brief Gets the list of selected user accounts
* @return List of Bks_Model_User_Account elements
*/
Eina_List *bks_ui_controller_user_accounts_selected_get(void);
//Products page
/**
* @brief Clears the products alphabeticaly sorted ui elements.
*/
void bks_ui_controller_products_alpha_clear(void);
/**
* @brief Clears the products favourites' ui elements.
*/
void bks_ui_controller_products_favs_clear(void);
/**
* @brief fills the UI's favourite's region using @p products.
* @param element The thread, that has to be waited for.
*
*/
void bks_ui_controller_products_page_favs_set(Eina_List *products);
/**
* @brief fills the UI's alphabetic products list using @p products.
* @param element The thread, that has to be waited for.
*/
void bks_ui_controller_products_page_alpha_set(Eina_List *products);
/**
* @brief Gets the selected product
* @return The selected Bks_Model_Product element.
*/
const Bks_Model_Product *bks_ui_controller_product_selected_get(void);
/**
* @brief Opens a "Open file" dialog to retrieve the location of the database
* file.
*/
void bks_ui_controller_db_path_get(void);
/**
* @brief Creates a notification displayed to the user
*/
void bks_ui_controller_notification_set(const char* text, Elm_Popup_Orient orient, double timeout, Eina_Bool block_input);
/**
* @brief locks the ui and displays a message
*/
void bks_ui_controller_lock_set(Eina_Bool locked, const char *msg);
#endif