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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <QtInstanceComboBox.hxx>
QtInstanceComboBox::QtInstanceComboBox(QComboBox* pComboBox)
: QtInstanceWidget(pComboBox)
, m_pComboBox(pComboBox)
, m_bSorted(false)
{
assert(pComboBox);
}
void QtInstanceComboBox::insert(int nPos, const OUString& rStr, const OUString* pId,
const OUString* pIconName, VirtualDevice* pImageSurface)
{
if (pId || pIconName || pImageSurface)
assert(false && "Handling for these not implemented yet");
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] {
m_pComboBox->insertItem(nPos, toQString(rStr));
if (m_bSorted)
sortItems();
});
}
void QtInstanceComboBox::insert_vector(const std::vector<weld::ComboBoxEntry>&, bool)
{
assert(false && "Not implemented yet");
}
void QtInstanceComboBox::insert_separator(int, const OUString&)
{
assert(false && "Not implemented yet");
}
int QtInstanceComboBox::get_count() const
{
SolarMutexGuard g;
int nCount;
GetQtInstance().RunInMainThread([&] { nCount = m_pComboBox->count(); });
return nCount;
}
void QtInstanceComboBox::make_sorted()
{
SolarMutexGuard g;
m_bSorted = true;
GetQtInstance().RunInMainThread([&] { sortItems(); });
}
void QtInstanceComboBox::clear()
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pComboBox->clear(); });
}
int QtInstanceComboBox::get_active() const
{
SolarMutexGuard g;
int nCurrentIndex;
GetQtInstance().RunInMainThread([&] { nCurrentIndex = m_pComboBox->currentIndex(); });
return nCurrentIndex;
}
void QtInstanceComboBox::set_active(int nPos)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pComboBox->setCurrentIndex(nPos); });
}
void QtInstanceComboBox::remove(int nPos)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pComboBox->removeItem(nPos); });
}
OUString QtInstanceComboBox::get_active_text() const
{
SolarMutexGuard g;
OUString sCurrentText;
GetQtInstance().RunInMainThread([&] { sCurrentText = toOUString(m_pComboBox->currentText()); });
return sCurrentText;
}
OUString QtInstanceComboBox::get_text(int nPos) const
{
SolarMutexGuard g;
OUString sItemText;
GetQtInstance().RunInMainThread([&] { sItemText = toOUString(m_pComboBox->itemText(nPos)); });
return sItemText;
}
int QtInstanceComboBox::find_text(const OUString& rStr) const
{
SolarMutexGuard g;
int nIndex;
GetQtInstance().RunInMainThread([&] { nIndex = m_pComboBox->findText(toQString(rStr)); });
return nIndex;
}
OUString QtInstanceComboBox::get_active_id() const
{
assert(false && "Not implemented yet");
return OUString();
}
void QtInstanceComboBox::set_active_id(const OUString&) { assert(false && "Not implemented yet"); }
OUString QtInstanceComboBox::get_id(int) const
{
assert(false && "Not implemented yet");
return OUString();
}
void QtInstanceComboBox::set_id(int, const OUString&) { assert(false && "Not implemented yet"); }
int QtInstanceComboBox::find_id(const OUString&) const
{
assert(false && "Not implemented yet");
return -1;
}
bool QtInstanceComboBox::changed_by_direct_pick() const
{
assert(false && "Not implemented yet");
return false;
}
bool QtInstanceComboBox::has_entry() const
{
SolarMutexGuard g;
bool bEditable;
GetQtInstance().RunInMainThread([&] { bEditable = m_pComboBox->isEditable(); });
return bEditable;
}
void QtInstanceComboBox::set_entry_message_type(weld::EntryMessageType)
{
assert(false && "Not implemented yet");
}
void QtInstanceComboBox::set_entry_text(const OUString& rStr)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pComboBox->setEditText(toQString(rStr)); });
}
void QtInstanceComboBox::set_entry_width_chars(int) { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::set_entry_max_length(int) { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::select_entry_region(int, int) { assert(false && "Not implemented yet"); }
bool QtInstanceComboBox::get_entry_selection_bounds(int&, int&)
{
assert(false && "Not implemented yet");
return false;
}
void QtInstanceComboBox::set_entry_completion(bool, bool)
{
assert(false && "Not implemented yet");
}
void QtInstanceComboBox::set_entry_placeholder_text(const OUString& rText)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pComboBox->setEditText(toQString(rText)); });
}
void QtInstanceComboBox::set_entry_editable(bool bEditable)
{
SolarMutexGuard g;
GetQtInstance().RunInMainThread([&] { m_pComboBox->setEditable(bEditable); });
}
void QtInstanceComboBox::cut_entry_clipboard() { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::copy_entry_clipboard() { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::paste_entry_clipboard() { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::set_font(const vcl::Font&) { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::set_entry_font(const vcl::Font&)
{
assert(false && "Not implemented yet");
}
vcl::Font QtInstanceComboBox::get_entry_font()
{
assert(false && "Not implemented yet");
return vcl::Font();
}
bool QtInstanceComboBox::get_popup_shown() const
{
assert(false && "Not implemented yet");
return false;
}
void QtInstanceComboBox::set_custom_renderer(bool) { assert(false && "Not implemented yet"); }
VclPtr<VirtualDevice> QtInstanceComboBox::create_render_virtual_device() const
{
assert(false && "Not implemented yet");
return nullptr;
}
void QtInstanceComboBox::set_item_menu(const OUString&, weld::Menu*)
{
assert(false && "Not implemented yet");
}
int QtInstanceComboBox::get_menu_button_width() const
{
assert(false && "Not implemented yet");
return -1;
}
int QtInstanceComboBox::get_max_mru_count() const
{
assert(false && "Not implemented yet");
return -1;
}
void QtInstanceComboBox::set_max_mru_count(int) { assert(false && "Not implemented yet"); }
OUString QtInstanceComboBox::get_mru_entries() const
{
assert(false && "Not implemented yet");
return OUString();
}
void QtInstanceComboBox::set_mru_entries(const OUString&)
{
assert(false && "Not implemented yet");
}
void QtInstanceComboBox::set_max_drop_down_rows(int) { assert(false && "Not implemented yet"); }
void QtInstanceComboBox::sortItems() { m_pComboBox->model()->sort(0, Qt::AscendingOrder); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|