|
1 | 1 | /*
|
2 |
| - * Copyright (C) 2021 Linux Studio Plugins Project <https://lsp-plug.in/> |
3 |
| - * (C) 2021 Vladimir Sadovnikov <[email protected]> |
| 2 | + * Copyright (C) 2024 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 | + * (C) 2024 Vladimir Sadovnikov <[email protected]> |
4 | 4 | *
|
5 | 5 | * This file is part of lsp-plugin-fw
|
6 | 6 | * Created on: 27 июн. 2021 г.
|
@@ -33,45 +33,61 @@ namespace lsp
|
33 | 33 | {
|
34 | 34 | namespace ctl
|
35 | 35 | {
|
| 36 | + class ListBoxItem; |
| 37 | + |
36 | 38 | /**
|
37 | 39 | * ComboBox controller
|
38 | 40 | */
|
39 |
| - class ComboBox: public Widget |
| 41 | + class ComboBox: public Widget, public IChildSync |
40 | 42 | {
|
41 | 43 | public:
|
42 | 44 | static const ctl_class_t metadata;
|
43 | 45 |
|
44 | 46 | protected:
|
45 |
| - ui::IPort *pPort; |
46 |
| - ctl::Color sColor; |
47 |
| - ctl::Color sSpinColor; |
48 |
| - ctl::Color sTextColor; |
49 |
| - ctl::Color sSpinTextColor; |
50 |
| - ctl::Color sBorderColor; |
51 |
| - ctl::Color sBorderGapColor; |
52 |
| - ctl::LCString sEmptyText; |
53 |
| - |
54 |
| - float fMin; |
55 |
| - float fMax; |
56 |
| - float fStep; |
| 47 | + ui::IPort *pPort; |
| 48 | + ctl::Color sColor; |
| 49 | + ctl::Color sSpinColor; |
| 50 | + ctl::Color sTextColor; |
| 51 | + ctl::Color sSpinTextColor; |
| 52 | + ctl::Color sBorderColor; |
| 53 | + ctl::Color sBorderGapColor; |
| 54 | + ctl::LCString sEmptyText; |
| 55 | + lltl::parray<ListBoxItem> vItems; // Custom items |
| 56 | + |
| 57 | + float fMin; |
| 58 | + float fMax; |
| 59 | + float fStep; |
57 | 60 |
|
58 | 61 | protected:
|
59 | 62 | static status_t slot_combo_submit(tk::Widget *sender, void *ptr, void *data);
|
60 | 63 |
|
61 | 64 | protected:
|
62 | 65 | virtual void sync_metadata(ui::IPort *port) override;
|
63 | 66 | void submit_value();
|
| 67 | + void do_destroy(); |
| 68 | + void update_selection(); |
64 | 69 |
|
65 | 70 | public:
|
66 | 71 | explicit ComboBox(ui::IWrapper *wrapper, tk::ComboBox *widget);
|
| 72 | + ComboBox(const ComboBox &) = delete; |
| 73 | + ComboBox(ComboBox &&) = delete; |
67 | 74 | virtual ~ComboBox() override;
|
68 | 75 |
|
| 76 | + ComboBox & operator = (const ComboBox &) = delete; |
| 77 | + ComboBox & operator = (ComboBox &&) = delete; |
| 78 | + |
69 | 79 | virtual status_t init() override;
|
| 80 | + virtual void destroy() override; |
70 | 81 |
|
71 |
| - public: |
| 82 | + public: // ctl::Widget |
72 | 83 | virtual void set(ui::UIContext *ctx, const char *name, const char *value) override;
|
| 84 | + virtual status_t add(ui::UIContext *ctx, ctl::Widget *child) override; |
73 | 85 | virtual void notify(ui::IPort *port, size_t flags) override;
|
74 | 86 | virtual void end(ui::UIContext *ctx) override;
|
| 87 | + |
| 88 | + public: // ctl::IChildSync |
| 89 | + virtual void child_changed(Widget *child) override; |
| 90 | + |
75 | 91 | };
|
76 | 92 |
|
77 | 93 | } /* namespace ctl */
|
|
0 commit comments