00001 /* 00002 ** ClanLib SDK 00003 ** Copyright (c) 1997-2011 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 #include "../gui_component.h" 00037 #include "../../Core/Signals/callback_v0.h" 00038 #include "../../Core/Signals/callback_v1.h" 00039 #include "listview.h" 00040 00041 class CL_ListViewColumnHeader; 00042 class CL_ListViewHeader_Impl; 00043 00047 class CL_API_GUI CL_ListViewHeader : public CL_GUIComponent 00048 { 00051 00052 public: 00053 00057 CL_ListViewHeader(CL_GUIComponent *parent); 00058 00059 ~CL_ListViewHeader(); 00060 00064 00065 public: 00066 00070 CL_ListViewColumnHeader get_first_column(); 00071 00077 CL_ListViewColumnHeader get_column(const CL_StringRef &column_id); 00078 00082 bool get_visible() const; 00083 00087 virtual CL_Size get_preferred_size() const; 00088 00092 00093 public: 00094 00101 CL_ListViewColumnHeader create_column(const CL_StringRef &column_id, const CL_StringRef &caption); 00102 00108 CL_ListViewColumnHeader append(CL_ListViewColumnHeader column); 00109 00115 CL_ListViewColumnHeader remove(const CL_StringRef &column_id); 00116 00123 CL_ListViewColumnHeader insert_after(const CL_StringRef &column_id, CL_ListViewColumnHeader new_column); 00124 00131 CL_ListViewColumnHeader insert_before(const CL_StringRef &column_id, CL_ListViewColumnHeader new_column); 00132 00136 void set_visible(bool visible); 00137 00141 void set_display_mode(CL_ListViewDisplayMode mode); 00142 00146 00147 public: 00148 CL_Callback_v1<CL_ListViewColumnHeader> &func_column_added(); 00149 00150 CL_Callback_v1<CL_ListViewColumnHeader> &func_column_removed(); 00151 00152 CL_Callback_v1<CL_ListViewColumnHeader> &func_column_size_changed(); 00153 00157 00158 private: 00159 00164 CL_ListViewHeader(const CL_Rect &geometry, CL_GUIComponent *parent); 00165 00169 void update_geometry(const CL_Rect &parent_content_rect); 00170 00171 CL_SharedPtr<CL_ListViewHeader_Impl> impl; 00172 00173 friend class CL_ListView_Impl; 00175 }; 00176