| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
constexpr const int GUI_MSG_WINDOW_INIT = 1; |
| 17 |
constexpr const int GUI_MSG_WINDOW_DEINIT = 2; |
| 18 |
constexpr const int GUI_MSG_WINDOW_RESET = 27; |
| 19 |
|
| 20 |
constexpr const int GUI_MSG_SETFOCUS = 3; |
| 21 |
constexpr const int GUI_MSG_LOSTFOCUS = 4; |
| 22 |
|
| 23 |
constexpr const int GUI_MSG_CLICKED = 5; |
| 24 |
|
| 25 |
constexpr const int GUI_MSG_VISIBLE = 6; |
| 26 |
constexpr const int GUI_MSG_HIDDEN = 7; |
| 27 |
|
| 28 |
constexpr const int GUI_MSG_ENABLED = 8; |
| 29 |
constexpr const int GUI_MSG_DISABLED = 9; |
| 30 |
|
| 31 |
constexpr const int GUI_MSG_SET_SELECTED = 10; |
| 32 |
constexpr const int GUI_MSG_SET_DESELECTED = 11; |
| 33 |
|
| 34 |
constexpr const int GUI_MSG_LABEL_ADD = 12; |
| 35 |
|
| 36 |
constexpr const int GUI_MSG_LABEL_SET = 13; |
| 37 |
|
| 38 |
constexpr const int GUI_MSG_LABEL_RESET = 14; |
| 39 |
|
| 40 |
constexpr const int GUI_MSG_ITEM_SELECTED = 15; |
| 41 |
constexpr const int GUI_MSG_ITEM_SELECT = 16; |
| 42 |
constexpr const int GUI_MSG_LABEL2_SET = 17; |
| 43 |
constexpr const int GUI_MSG_SHOWRANGE = 18; |
| 44 |
|
| 45 |
constexpr const int GUI_MSG_FULLSCREEN = 19; |
| 46 |
constexpr const int GUI_MSG_EXECUTE = 20; |
| 47 |
|
| 48 |
constexpr const int GUI_MSG_NOTIFY_ALL = 21; |
| 49 |
|
| 50 |
|
| 51 |
constexpr const int GUI_MSG_REFRESH_THUMBS = 22; |
| 52 |
|
| 53 |
constexpr const int GUI_MSG_MOVE = 23; |
| 54 |
|
| 55 |
|
| 56 |
constexpr const int GUI_MSG_LABEL_BIND = 24; |
| 57 |
|
| 58 |
constexpr const int GUI_MSG_FOCUSED = 26; |
| 59 |
|
| 60 |
constexpr const int GUI_MSG_PAGE_CHANGE = 28; |
| 61 |
|
| 62 |
constexpr const int GUI_MSG_REFRESH_LIST = 29; |
| 63 |
|
| 64 |
constexpr const int GUI_MSG_PAGE_UP = 30; |
| 65 |
constexpr const int GUI_MSG_PAGE_DOWN = 31; |
| 66 |
constexpr const int GUI_MSG_MOVE_OFFSET = 32; |
| 67 |
|
| 68 |
constexpr const int GUI_MSG_SET_TYPE = 33; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
constexpr const int GUI_MSG_WINDOW_RESIZE = 34; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
constexpr const int GUI_MSG_RENDERER_LOST = 35; |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
constexpr const int GUI_MSG_RENDERER_RESET = 36; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
constexpr const int GUI_MSG_EXCLUSIVE_MOUSE = 37; |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
constexpr const int GUI_MSG_GESTURE_NOTIFY = 38; |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
constexpr const int GUI_MSG_ADD_CONTROL = 39; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
constexpr const int GUI_MSG_REMOVE_CONTROL = 40; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
constexpr const int GUI_MSG_UNFOCUS_ALL = 41; |
| 114 |
|
| 115 |
constexpr const int GUI_MSG_SET_TEXT = 42; |
| 116 |
|
| 117 |
constexpr const int GUI_MSG_WINDOW_LOAD = 43; |
| 118 |
|
| 119 |
constexpr const int GUI_MSG_VALIDITY_CHANGED = 44; |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
constexpr const int GUI_MSG_IS_SELECTED = 45; |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
constexpr const int GUI_MSG_SET_LABELS = 46; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
constexpr const int GUI_MSG_SET_FILENAME = 47; |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
constexpr const int GUI_MSG_GET_FILENAME = 48; |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
constexpr const int GUI_MSG_UI_READY = 49; |
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
constexpr const int GUI_MSG_REFRESH_TIMER = 50; |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
constexpr const int GUI_MSG_STATE_CHANGED = 51; |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
constexpr const int GUI_MSG_SUBTITLE_DOWNLOADED = 52; |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
constexpr const int GUI_MSG_RESET_MULTI_IMAGE = 53; |
| 166 |
|
| 167 |
constexpr const int GUI_MSG_USER = 1000; |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
constexpr const int GUI_MSG_CODINGTABLE_LOOKUP_COMPLETED = 65000; |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
#define CONTROL_SELECT(controlID) \ |
| 179 |
do \ |
| 180 |
{ \ |
| 181 |
CGUIMessage _msg(GUI_MSG_SET_SELECTED, GetID(), controlID); \ |
| 182 |
OnMessage(_msg); \ |
| 183 |
} while (0) |
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
#define CONTROL_DESELECT(controlID) \ |
| 190 |
do \ |
| 191 |
{ \ |
| 192 |
CGUIMessage _msg(GUI_MSG_SET_DESELECTED, GetID(), controlID); \ |
| 193 |
OnMessage(_msg); \ |
| 194 |
} while (0) |
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
#define CONTROL_ENABLE(controlID) \ |
| 202 |
do \ |
| 203 |
{ \ |
| 204 |
CGUIMessage _msg(GUI_MSG_ENABLED, GetID(), controlID); \ |
| 205 |
OnMessage(_msg); \ |
| 206 |
} while (0) |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
#define CONTROL_DISABLE(controlID) \ |
| 213 |
do \ |
| 214 |
{ \ |
| 215 |
CGUIMessage _msg(GUI_MSG_DISABLED, GetID(), controlID); \ |
| 216 |
OnMessage(_msg); \ |
| 217 |
} while (0) |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
#define CONTROL_ENABLE_ON_CONDITION(controlID, bCondition) \ |
| 225 |
do \ |
| 226 |
{ \ |
| 227 |
CGUIMessage _msg(bCondition ? GUI_MSG_ENABLED : GUI_MSG_DISABLED, GetID(), controlID); \ |
| 228 |
OnMessage(_msg); \ |
| 229 |
} while (0) |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
#define CONTROL_SELECT_ITEM(controlID, iItem) \ |
| 237 |
do \ |
| 238 |
{ \ |
| 239 |
CGUIMessage _msg(GUI_MSG_ITEM_SELECT, GetID(), controlID, iItem); \ |
| 240 |
OnMessage(_msg); \ |
| 241 |
} while (0) |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
#define SET_CONTROL_LABEL(controlID, label) \ |
| 248 |
do \ |
| 249 |
{ \ |
| 250 |
CGUIMessage _msg(GUI_MSG_LABEL_SET, GetID(), controlID); \ |
| 251 |
_msg.SetLabel(label); \ |
| 252 |
OnMessage(_msg); \ |
| 253 |
} while (0) |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
#define SET_CONTROL_LABEL_THREAD_SAFE(controlID, label) \ |
| 260 |
{ \ |
| 261 |
CGUIMessage _msg(GUI_MSG_LABEL_SET, GetID(), controlID); \ |
| 262 |
_msg.SetLabel(label); \ |
| 263 |
if (CServiceBroker::GetAppMessenger()->IsProcessThread()) \ |
| 264 |
OnMessage(_msg); \ |
| 265 |
else \ |
| 266 |
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(_msg, GetID()); \ |
| 267 |
} |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
#define SET_CONTROL_LABEL2(controlID, label) \ |
| 274 |
do \ |
| 275 |
{ \ |
| 276 |
CGUIMessage _msg(GUI_MSG_LABEL2_SET, GetID(), controlID); \ |
| 277 |
_msg.SetLabel(label); \ |
| 278 |
OnMessage(_msg); \ |
| 279 |
} while (0) |
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
#define SET_CONTROL_LABELS(controlID, defaultValue, labels) \ |
| 286 |
do \ |
| 287 |
{ \ |
| 288 |
CGUIMessage _msg(GUI_MSG_SET_LABELS, GetID(), controlID, defaultValue); \ |
| 289 |
_msg.SetPointer(labels); \ |
| 290 |
OnMessage(_msg); \ |
| 291 |
} while (0) |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
#define SET_CONTROL_FILENAME(controlID, label) \ |
| 298 |
do \ |
| 299 |
{ \ |
| 300 |
CGUIMessage _msg(GUI_MSG_SET_FILENAME, GetID(), controlID); \ |
| 301 |
_msg.SetLabel(label); \ |
| 302 |
OnMessage(_msg); \ |
| 303 |
} while (0) |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
#define SET_CONTROL_HIDDEN(controlID) \ |
| 310 |
do \ |
| 311 |
{ \ |
| 312 |
CGUIMessage _msg(GUI_MSG_HIDDEN, GetID(), controlID); \ |
| 313 |
OnMessage(_msg); \ |
| 314 |
} while (0) |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
#define SET_CONTROL_FOCUS(controlID, dwParam) \ |
| 321 |
do \ |
| 322 |
{ \ |
| 323 |
CGUIMessage _msg(GUI_MSG_SETFOCUS, GetID(), controlID, dwParam); \ |
| 324 |
OnMessage(_msg); \ |
| 325 |
} while (0) |
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
#define SET_CONTROL_VISIBLE(controlID) \ |
| 332 |
do \ |
| 333 |
{ \ |
| 334 |
CGUIMessage _msg(GUI_MSG_VISIBLE, GetID(), controlID); \ |
| 335 |
OnMessage(_msg); \ |
| 336 |
} while (0) |
| 337 |
|
| 338 |
#define SET_CONTROL_SELECTED(dwSenderId, controlID, bSelect) \ |
| 339 |
do \ |
| 340 |
{ \ |
| 341 |
CGUIMessage _msg(bSelect ? GUI_MSG_SET_SELECTED : GUI_MSG_SET_DESELECTED, dwSenderId, \ |
| 342 |
controlID); \ |
| 343 |
OnMessage(_msg); \ |
| 344 |
} while (0) |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
#define SEND_CLICK_MESSAGE(id, parentID, action) \ |
| 351 |
do \ |
| 352 |
{ \ |
| 353 |
CGUIMessage _msg(GUI_MSG_CLICKED, id, parentID, action); \ |
| 354 |
SendWindowMessage(_msg); \ |
| 355 |
} while (0) |
| 356 |
|
| 357 |
#include <string> |
| 358 |
#include <vector> |
| 359 |
#include <memory> |
| 360 |
|
| 361 |
|
| 362 |
class CGUIListItem; |
| 363 |
class CFileItemList; |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
class CGUIMessage final |
| 370 |
{ |
| 371 |
public: |
| 372 |
CGUIMessage(int dwMsg, int senderID, int controlID, int64_t param1 = 0, int64_t param2 = 0); |
| 373 |
CGUIMessage( |
| 374 |
int msg, int senderID, int controlID, int64_t param1, int64_t param2, CFileItemList* item); |
| 375 |
CGUIMessage(int msg, |
| 376 |
int senderID, |
| 377 |
int controlID, |
| 378 |
int64_t param1, |
| 379 |
int64_t param2, |
| 380 |
const std::shared_ptr<CGUIListItem>& item); |
| 381 |
CGUIMessage(const CGUIMessage& msg); |
| 382 |
~CGUIMessage(void); |
| 383 |
CGUIMessage& operator = (const CGUIMessage& msg); |
| 384 |
|
| 385 |
int GetControlId() const ; |
| 386 |
int GetMessage() const; |
| 387 |
void* GetPointer() const; |
| 388 |
std::shared_ptr<CGUIListItem> GetItem() const; |
| 389 |
int GetParam1() const; |
| 390 |
int64_t GetParam1AsI64() const; |
| 391 |
int GetParam2() const; |
| 392 |
int64_t GetParam2AsI64() const; |
| 393 |
int GetSenderId() const; |
| 394 |
void SetParam1(int64_t param1); |
| 395 |
void SetParam2(int64_t param2); |
| 396 |
void SetPointer(void* pointer); |
| 397 |
void SetLabel(const std::string& strLabel); |
| 398 |
void SetLabel(int iString); |
| 399 |
const std::string& GetLabel() const; |
| 400 |
void SetStringParam(const std::string &strParam); |
| 401 |
void SetStringParams(const std::vector<std::string> ¶ms); |
| 402 |
const std::string& GetStringParam(size_t param = 0) const; |
| 403 |
size_t GetNumStringParams() const; |
| 404 |
void SetItem(std::shared_ptr<CGUIListItem> item); |
| 405 |
|
| 406 |
private: |
| 407 |
std::string m_strLabel; |
| 408 |
std::vector<std::string> m_params; |
| 409 |
int m_senderID; |
| 410 |
int m_controlID; |
| 411 |
int m_message; |
| 412 |
void* m_pointer; |
| 413 |
int64_t m_param1; |
| 414 |
int64_t m_param2; |
| 415 |
std::shared_ptr<CGUIListItem> m_item; |
| 416 |
|
| 417 |
static std::string empty_string; |
| 418 |
}; |
| 419 |
|