1
1
/*
2
- * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
3
- * (C) 2020 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-tk-lib
6
6
* Created on: 6 июл. 2017 г.
@@ -65,6 +65,16 @@ namespace lsp
65
65
F_MOUSE_IGN = 1 << 2 ,
66
66
};
67
67
68
+ typedef struct estimation_t
69
+ {
70
+ LSPString text;
71
+ float scaling;
72
+ float fscaling;
73
+ ws::size_limit_t *r;
74
+ ws::font_parameters_t fp;
75
+ ws::text_parameters_t tp;
76
+ } estimation_t ;
77
+
68
78
protected:
69
79
size_t nMFlags;
70
80
size_t nState;
@@ -79,21 +89,24 @@ namespace lsp
79
89
prop::SizeConstraints sConstraints ; // Size constraints
80
90
prop::Padding sIPadding ; // Internal padding
81
91
prop::WidgetPtr<Menu> sPopup ; // Popup menu
92
+ lltl::parray<prop::String> vEstimations; // Estimation string
82
93
83
94
protected:
84
95
static status_t slot_on_submit (Widget *sender, void *ptr, void *data);
85
96
static status_t slot_on_before_popup (Widget *sender, void *ptr, void *data);
86
97
static status_t slot_on_popup (Widget *sender, void *ptr, void *data);
87
98
88
99
protected:
89
- virtual void size_request (ws::size_limit_t *r);
90
- virtual void property_changed (Property *prop);
100
+ void estimate_string_size (estimation_t *e, tk::String *s);
101
+
102
+ virtual void size_request (ws::size_limit_t *r) override ;
103
+ virtual void property_changed (Property *prop) override ;
91
104
92
105
public:
93
106
explicit Label (Display *dpy);
94
- virtual ~Label ();
107
+ virtual ~Label () override ;
95
108
96
- virtual status_t init ();
109
+ virtual status_t init () override ;
97
110
98
111
public:
99
112
LSP_TK_PROPERTY (TextLayout, text_layout, &sTextLayout )
@@ -108,22 +121,20 @@ namespace lsp
108
121
LSP_TK_PROPERTY (WidgetPtr<Menu>, popup, &sPopup )
109
122
110
123
public:
111
- virtual void draw (ws::ISurface *s);
112
-
113
- virtual status_t on_mouse_in (const ws::event_t *e);
114
-
115
- virtual status_t on_mouse_out (const ws::event_t *e);
116
-
117
- virtual status_t on_mouse_move (const ws::event_t *e);
124
+ void clear_text_estimations ();
125
+ tk::String *add_text_estimation ();
118
126
119
- virtual status_t on_mouse_down (const ws::event_t *e);
120
-
121
- virtual status_t on_mouse_up (const ws::event_t *e);
127
+ public:
128
+ virtual void draw (ws::ISurface *s) override ;
129
+ virtual status_t on_mouse_in (const ws::event_t *e) override ;
130
+ virtual status_t on_mouse_out (const ws::event_t *e) override ;
131
+ virtual status_t on_mouse_move (const ws::event_t *e) override ;
132
+ virtual status_t on_mouse_down (const ws::event_t *e) override ;
133
+ virtual status_t on_mouse_up (const ws::event_t *e) override ;
122
134
135
+ public:
123
136
virtual status_t on_before_popup (Menu *menu);
124
-
125
137
virtual status_t on_popup (Menu *menu);
126
-
127
138
virtual status_t on_submit ();
128
139
};
129
140
0 commit comments