00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "precomp.h"
00010 #include <string>
00011
00012 #include "API/GUI/combobox.h"
00013 #include "API/GUI/component_options.h"
00014 #include "API/GUI/stylemanager.h"
00015 #include "combobox_generic.h"
00016
00018
00019
00020 CL_ComboBox::CL_ComboBox(
00021 const CL_ComponentOptions &options,
00022 CL_Component *parent,
00023 CL_StyleManager *style)
00024 :
00025 CL_Component(options, parent, style),
00026 impl(NULL)
00027 {
00028 impl = new CL_ComboBox_Generic(this, options, get_style_manager());
00029 get_style_manager()->connect_styles("combobox", options, this);
00030 }
00031
00032 CL_ComboBox::CL_ComboBox(
00033 const CL_Rect &pos,
00034 CL_Component *parent,
00035 CL_StyleManager *style)
00036 :
00037 CL_Component(
00038 CL_ComboBox_Generic::create_options(pos),
00039 parent,
00040 style),
00041 impl(NULL)
00042 {
00043 CL_ComponentOptions options = CL_ComboBox_Generic::create_options(pos);
00044 impl = new CL_ComboBox_Generic(this, options, get_style_manager());
00045 get_style_manager()->connect_styles("combobox", options, this);
00046 }
00047
00048 CL_ComboBox::~CL_ComboBox()
00049 {
00050 delete impl;
00051 }
00052
00054
00055
00056 int CL_ComboBox::get_count() const
00057 {
00058 return impl->get_count();
00059 }
00060
00061 std::list<std::string> &CL_ComboBox::get_items() const
00062 {
00063 return impl->get_items();
00064 }
00065
00066 std::string CL_ComboBox::get_current_text() const
00067 {
00068 return impl->get_current_text();
00069 }
00070
00071 std::string CL_ComboBox::get_text(int index) const
00072 {
00073 return impl->get_text(index);
00074 }
00075
00076 int CL_ComboBox::get_current_item() const
00077 {
00078 return impl->get_current_item();
00079 }
00080
00081 bool CL_ComboBox::is_selected(int index) const
00082 {
00083 return impl->is_selected(index);
00084 }
00085
00087
00088
00089 int CL_ComboBox::insert_item(const std::string &text, int index)
00090 {
00091 return impl->insert_item(text, index);
00092 }
00093
00094 void CL_ComboBox::remove_item(int index)
00095 {
00096 impl->remove_item(index);
00097 }
00098
00099 void CL_ComboBox::change_item(const std::string &text, int index)
00100 {
00101 impl->change_item(text, index);
00102 }
00103
00104 void CL_ComboBox::set_current_item(int index)
00105 {
00106 impl->set_current_item(index);
00107 }
00108
00109 void CL_ComboBox::clear_selection()
00110 {
00111 impl->clear_selection();
00112 }
00113
00114 void CL_ComboBox::sort(bool ascending)
00115 {
00116 impl->sort(ascending);
00117 }
00118
00119 void CL_ComboBox::clear()
00120 {
00121 impl->clear();
00122 }
00123
00125
00126
00127 CL_Signal_v1<int> &CL_ComboBox::sig_highlighted()
00128 {
00129 return impl->sig_highlighted;
00130 }
00131
00132 CL_Signal_v1<int> &CL_ComboBox::sig_activated()
00133 {
00134 return impl->sig_activated;
00135 }