00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "precomp.h"
00010 #include "API/GUI/listbox.h"
00011 #include "API/GUI/component_options.h"
00012 #include "API/GUI/stylemanager.h"
00013 #include "listbox_generic.h"
00014
00016
00017
00018 CL_ListBox::CL_ListBox(
00019 const CL_ComponentOptions &options,
00020 CL_Component *parent,
00021 CL_StyleManager *style)
00022 :
00023 CL_Component(options, parent, style),
00024 impl(NULL)
00025 {
00026 impl = new CL_ListBox_Generic(this, options, get_style_manager());
00027 get_style_manager()->connect_styles("listbox", options, this);
00028 }
00029
00030 CL_ListBox::CL_ListBox(
00031 const CL_Rect &pos,
00032 CL_Component *parent,
00033 CL_StyleManager *style)
00034 :
00035 CL_Component(
00036 CL_ListBox_Generic::create_options(pos),
00037 parent,
00038 style),
00039 impl(NULL)
00040 {
00041 CL_ComponentOptions options = CL_ListBox_Generic::create_options(pos);
00042 impl = new CL_ListBox_Generic(this, options, get_style_manager());
00043 get_style_manager()->connect_styles("listbox", options, this);
00044 }
00045
00046 CL_ListBox::~CL_ListBox()
00047 {
00048 delete impl;
00049 }
00050
00052
00053
00054 CL_Component *CL_ListBox::get_client_area() const
00055 {
00056 return impl->client_area;
00057 }
00058
00059 int CL_ListBox::get_count() const
00060 {
00061 return impl->get_count();
00062 }
00063
00064 std::list<std::string> &CL_ListBox::get_items() const
00065 {
00066 return impl->get_items();
00067 }
00068
00069 std::string CL_ListBox::get_current_text() const
00070 {
00071 return impl->get_current_text();
00072 }
00073
00074 std::string CL_ListBox::get_text(int index) const
00075 {
00076 return impl->get_text(index);
00077 }
00078
00079 int CL_ListBox::get_current_item() const
00080 {
00081 return impl->get_current_item();
00082 }
00083
00084 bool CL_ListBox::is_selected(int index) const
00085 {
00086 return impl->is_selected(index);
00087 }
00088
00089 int CL_ListBox::get_item_height() const
00090 {
00091 return impl->get_item_height();
00092 }
00093
00094 int CL_ListBox::get_max_visible_items() const
00095 {
00096 return impl->max_visible_items;
00097 }
00098
00099 int CL_ListBox::get_top_item() const
00100 {
00101 return impl->get_top_item();
00102 }
00103
00104
00105
00106
00107
00108
00109
00111
00112
00113 int CL_ListBox::insert_item(const std::string &text, int index)
00114 {
00115 return impl->insert_item(text, index);
00116 }
00117
00118 void CL_ListBox::remove_item(int index)
00119 {
00120 impl->remove_item(index);
00121 }
00122
00123 void CL_ListBox::change_item(const std::string &text, int index)
00124 {
00125 impl->change_item(text, index);
00126 }
00127
00128 void CL_ListBox::set_current_item(int index)
00129 {
00130 impl->set_current_item(index);
00131 }
00132
00133 void CL_ListBox::clear_selection()
00134 {
00135 impl->clear_selection();
00136 }
00137
00138 void CL_ListBox::set_item_height(int height)
00139 {
00140 impl->set_item_height(height);
00141 }
00142
00143 void CL_ListBox::sort(bool ascending)
00144 {
00145 impl->sort(ascending);
00146 }
00147
00148 void CL_ListBox::clear()
00149 {
00150 impl->clear();
00151 }
00152
00153 void CL_ListBox::set_max_visible_items(int count)
00154 {
00155 impl->set_max_visible_items(count);
00156 }
00157
00158 void CL_ListBox::set_top_item(int index)
00159 {
00160 impl->set_top_item(index);
00161 }
00162
00164
00165
00166 CL_Signal_v1<int> &CL_ListBox::sig_highlighted()
00167 {
00168 return impl->sig_highlighted;
00169 }
00170
00171 CL_Signal_v1<int> &CL_ListBox::sig_activated()
00172 {
00173 return impl->sig_activated;
00174 }