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;
87 auto isEmpty()
const -> bool;
98 auto containsWidget (
const FPoint&) -> bool;
112 inline auto FDropDownListBox::getClassName()
const ->
FString 113 {
return "FDropDownListBox"; }
116 inline auto FDropDownListBox::isEmpty()
const ->
bool 117 {
return list.getCount() == 0; }
128 using FWidget::setGeometry;
129 using LabelOrientation = FLineEdit::LabelOrientation;
138 auto getClassName()
const ->
FString override;
139 auto getCount()
const -> std::size_t;
140 auto getText()
const ->
FString;
141 template <
typename DT>
142 auto getItemData() -> clean_fdata_t<DT>&;
143 auto getLabelOrientation()
const -> LabelOrientation;
146 void setSize (
const FSize&,
bool =
true)
override;
147 void setGeometry (
const FPoint&,
const FSize&,
bool =
true)
override;
148 void setEnable (
bool =
true)
override;
149 void unsetEnable()
override;
150 void setDisable()
override;
151 void setShadow (
bool =
true);
153 void setEditable (
bool =
true);
154 void unsetEditable();
155 void setCurrentItem (std::size_t);
156 void setMaxVisibleItems (std::size_t);
159 void setLabelText (
const FString&);
160 void setLabelOrientation (
const LabelOrientation);
163 auto hasShadow()
const -> bool;
168 ,
typename DT = std::nullptr_t>
169 void insert (
const std::initializer_list<T>& list, DT&& = DT());
170 template <
typename ItemT
171 ,
typename DT = std::nullptr_t>
172 void insert (
const ItemT&, DT&& = DT());
173 void remove (std::size_t);
174 void reserve (std::size_t);
176 virtual void showDropDown();
177 virtual void hideDropDown();
190 auto isMouseOverListWindow (
const FPoint&) -> bool;
194 void initCallbacks();
195 void draw()
override;
199 void processClick()
const;
200 void processRowChanged()
const;
203 void cb_setInputField();
204 void cb_closeComboBox();
205 void cb_inputFieldSwitch();
206 void cb_inputFieldHandOver();
211 std::size_t max_items{8};
213 bool is_editable{
true};
218 void closeOpenComboBox();
223 inline auto FComboBox::getClassName()
const ->
FString 224 {
return "FComboBox"; }
227 inline auto FComboBox::getCount()
const -> std::size_t
228 {
return list_window.list.getCount(); }
231 inline auto FComboBox::getText()
const ->
FString 232 {
return input_field.getText(); }
235 template <
typename DT>
236 inline auto FComboBox::getItemData() -> clean_fdata_t<DT>&
238 const std::size_t index = list_window.list.currentItem();
239 return list_window.list.getItem(index).getData<DT>();
243 inline auto FComboBox::getLabelOrientation()
const -> FLineEdit::LabelOrientation
244 {
return input_field.getLabelOrientation(); }
247 inline void FComboBox::unsetEnable()
248 { setEnable(
false); }
251 inline void FComboBox::setDisable()
252 { setEnable(
false); }
255 inline void FComboBox::unsetShadow()
256 { setShadow(
false); }
259 inline void FComboBox::unsetEditable()
260 { setEditable(
false); }
263 inline auto FComboBox::hasShadow()
const ->
bool 264 {
return getFlags().shadow.shadow; }
269 void FComboBox::insert (
const std::initializer_list<T>& list, DT&& d)
271 for (
const auto& item : list)
279 template <
typename ItemT
281 void FComboBox::insert (
const ItemT& item, DT&& d)
288 inline void FComboBox::reserve (std::size_t new_cap)
289 { list_window.list.reserve(new_cap); }
292 inline void FComboBox::setText (
const FString& s)
293 { input_field.setText(s); }
296 inline void FComboBox::clearText()
297 { input_field.clear(); }
300 inline void FComboBox::setLabelText (
const FString& s)
301 { input_field.setLabelText(s); }
304 inline void FComboBox::setLabelOrientation (
const LabelOrientation o)
305 { input_field.setLabelOrientation(o); }
309 #endif // FCOMBOBOX_H
Definition: flistbox.h:173
Definition: class_template.cpp:25
Definition: fcombobox.h:69
Definition: flistbox.h:71
Definition: fcombobox.h:124
Definition: flineedit.h:67