00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2009 The ClanLib Team 00004 ** 00005 ** This software is provided 'as-is', without any express or implied 00006 ** warranty. In no event will the authors be held liable for any damages 00007 ** arising from the use of this software. 00008 ** 00009 ** Permission is granted to anyone to use this software for any purpose, 00010 ** including commercial applications, and to alter it and redistribute it 00011 ** freely, subject to the following restrictions: 00012 ** 00013 ** 1. The origin of this software must not be misrepresented; you must not 00014 ** claim that you wrote the original software. If you use this software 00015 ** in a product, an acknowledgment in the product documentation would be 00016 ** appreciated but is not required. 00017 ** 2. Altered source versions must be plainly marked as such, and must not be 00018 ** misrepresented as being the original software. 00019 ** 3. This notice may not be removed or altered from any source distribution. 00020 ** 00021 ** Note: Some of the libraries ClanLib may link to may have additional 00022 ** requirements or restrictions. 00023 ** 00024 ** File Author(s): 00025 ** 00026 ** Magnus Norddahl 00027 ** Harry Storbacka 00028 */ 00029 00032 00033 #pragma once 00034 00035 #include "../api_gui.h" 00036 00037 class CL_ListViewColumnData; 00038 class CL_ListViewItem_Impl; 00039 00043 class CL_API_GUI CL_ListViewItem 00044 { 00047 00048 public: 00049 CL_ListViewItem(); 00050 00051 ~CL_ListViewItem(); 00052 00056 00057 public: 00058 00062 bool is_null() const; 00063 00067 bool is_item() const; 00068 00074 CL_ListViewColumnData get_column(const CL_StringRef &column_id); 00075 00079 CL_ListViewItem get_parent(); 00080 00084 CL_ListViewItem get_next_sibling(); 00085 00089 CL_ListViewItem get_prev_sibling(); 00090 00094 CL_ListViewItem get_first_child(); 00095 00099 CL_ListViewItem get_last_child(); 00100 00104 CL_ListViewItem get_document_item(); 00105 00109 int get_parent_count(); 00110 00117 int get_child_count(bool recursive=false, bool recurse_only_into_open_items=false); 00118 00122 bool has_children() const; 00123 00127 bool is_open() const; 00128 00132 bool is_selected() const; 00133 00137 bool is_editable() const; 00138 00140 int get_icon() const; 00141 00143 int get_id() const; 00144 00148 CL_UnknownSharedPtr get_userdata() const; 00149 00150 bool operator==(CL_ListViewItem &other) const; 00151 00152 bool operator!=(CL_ListViewItem &other) const; 00153 00154 std::vector<int> get_overlay_icons(); 00155 00159 00160 public: 00161 00167 CL_ListViewItem append_child(CL_ListViewItem &item); 00168 00170 CL_ListViewItem remove(); 00171 00173 void remove_children(); 00174 00179 void set_column_text(const CL_StringRef &column_id, const CL_StringRef &text); 00180 00184 void set_open(bool open); 00185 00189 void set_icon(int icon_index); 00190 00192 void set_id(int id); 00193 00197 void add_overlay_icon(int icon_index); 00198 00202 void remove_overlay_icon(int icon_index); 00203 00207 void set_editable(bool editable); 00208 00212 void set_userdata(CL_UnknownSharedPtr ptr); 00213 00217 00218 public: 00219 CL_Callback_v1<CL_Rect> &func_render_icon(); 00220 00224 00225 private: 00226 00230 CL_ListViewItem(const CL_SharedPtr<CL_ListViewItem_Impl> &impl); 00231 00232 CL_SharedPtr<CL_ListViewItem_Impl> impl; 00233 00234 friend class CL_ListView; 00235 friend class CL_ListView_Impl; 00236 friend class CL_ListViewSelection; 00237 friend class CL_ListViewLayout; 00239 }; 00240
1.4.6