46 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT) 47 #error "Only <final/final.h> can be included directly." 52 #include "final/fwidget.h" 53 #include "final/util/fdata.h" 54 #include "final/widget/flineedit.h" 55 #include "final/widget/flistbox.h" 56 #include "final/widget/fwindow.h" 73 using FWidget::setGeometry;
82 auto getClassName()
const ->
FString override;
85 void setGeometry (
const FPoint&,
const FSize&,
bool =
true )
override;
88 auto isEmpty()
const -> bool;
99 auto containsWidget (
const FPoint&) -> bool;
113 inline auto FDropDownListBox::getClassName()
const ->
FString 114 {
return "FDropDownListBox"; }
117 inline auto FDropDownListBox::isEmpty()
const ->
bool 118 {
return list.getCount() == 0; }
129 using FWidget::setGeometry;
130 using LabelOrientation = FLineEdit::LabelOrientation;
139 auto getClassName()
const ->
FString override;
140 auto getCount()
const -> std::size_t;
141 auto getText()
const ->
FString;
142 template <
typename DT>
143 auto getItemData() -> clean_fdata_t<DT>&;
144 auto getLabelOrientation()
const -> LabelOrientation;
147 void setSize (
const FSize&,
bool =
true)
override;
148 void setGeometry (
const FPoint&,
const FSize&,
bool =
true)
override;
149 void setEnable (
bool =
true)
override;
150 void unsetEnable()
override;
151 void setDisable()
override;
152 void setShadow (
bool =
true);
154 void setEditable (
bool =
true);
155 void unsetEditable();
156 void setCurrentItem (std::size_t);
157 void setMaxVisibleItems (std::size_t);
160 void setLabelText (
const FString&);
161 void setLabelOrientation (
const LabelOrientation);
164 auto hasShadow()
const -> bool;
169 ,
typename DT = std::nullptr_t>
170 void insert (
const std::initializer_list<T>& list, DT&& = DT());
171 template <
typename ItemT
172 ,
typename DT = std::nullptr_t>
173 void insert (
const ItemT&, DT&& = DT());
174 void remove (std::size_t);
175 void reserve (std::size_t);
177 virtual void showDropDown();
178 virtual void hideDropDown();
191 auto isMouseOverListWindow (
const FPoint&) -> bool;
195 void initCallbacks();
196 void draw()
override;
200 void processClick()
const;
201 void processRowChanged()
const;
204 void cb_setInputField();
205 void cb_closeComboBox();
206 void cb_inputFieldSwitch();
207 void cb_inputFieldHandOver();
212 std::size_t max_items{8};
214 bool is_editable{
true};
219 void closeOpenComboBox();
224 inline auto FComboBox::getClassName()
const ->
FString 225 {
return "FComboBox"; }
228 inline auto FComboBox::getCount()
const -> std::size_t
229 {
return list_window.list.getCount(); }
232 inline auto FComboBox::getText()
const ->
FString 233 {
return input_field.getText(); }
236 template <
typename DT>
237 inline auto FComboBox::getItemData() -> clean_fdata_t<DT>&
239 const std::size_t index = list_window.list.currentItem();
240 return list_window.list.getItem(index).getData<DT>();
244 inline auto FComboBox::getLabelOrientation()
const -> FLineEdit::LabelOrientation
245 {
return input_field.getLabelOrientation(); }
248 inline void FComboBox::unsetEnable()
249 { setEnable(
false); }
252 inline void FComboBox::setDisable()
253 { setEnable(
false); }
256 inline void FComboBox::unsetShadow()
257 { setShadow(
false); }
260 inline void FComboBox::unsetEditable()
261 { setEditable(
false); }
264 inline auto FComboBox::hasShadow()
const ->
bool 265 {
return getFlags().shadow.shadow; }
270 void FComboBox::insert (
const std::initializer_list<T>& list, DT&& d)
272 for (
const auto& item : list)
280 template <
typename ItemT
282 void FComboBox::insert (
const ItemT& item, DT&& d)
289 inline void FComboBox::reserve (std::size_t new_cap)
290 { list_window.list.reserve(new_cap); }
293 inline void FComboBox::setText (
const FString& s)
294 { input_field.setText(s); }
297 inline void FComboBox::clearText()
298 { input_field.clear(); }
301 inline void FComboBox::setLabelText (
const FString& s)
302 { input_field.setLabelText(s); }
305 inline void FComboBox::setLabelOrientation (
const LabelOrientation o)
306 { input_field.setLabelOrientation(o); }
310 #endif // FCOMBOBOX_H
Definition: flistbox.h:173
Definition: class_template.cpp:25
Definition: fcombobox.h:69
Definition: flistbox.h:71
Definition: fcombobox.h:125
Definition: flineedit.h:67