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 00037 class CL_ListViewColumnHeader_Impl; 00038 class CL_GUIThemePart; 00039 00043 class CL_API_GUI CL_ListViewColumnHeader 00044 { 00047 00048 public: 00049 // Construct a null instance 00050 CL_ListViewColumnHeader(); 00051 00052 ~CL_ListViewColumnHeader(); 00053 00057 00058 public: 00059 enum TextAlignment 00060 { 00061 align_left, 00062 align_right, 00063 align_center 00064 }; 00065 00067 bool is_null() const { return !impl; } 00068 00070 void throw_if_null() const; 00071 00075 CL_StringRef get_column_id() const; 00076 00080 CL_StringRef get_caption() const; 00081 00085 int get_width(); 00086 00090 int get_used_width(); 00091 00092 CL_ListViewColumnHeader::TextAlignment get_alignment(); 00093 00097 CL_ListViewColumnHeader get_next_sibling(); 00098 00102 CL_ListViewColumnHeader get_prev_sibling(); 00103 00107 00108 public: 00109 00113 void set_alignment(CL_ListViewColumnHeader::TextAlignment align); 00114 00118 void set_width(int width); 00119 00123 void set_caption(const CL_StringRef &str); 00124 00128 void set_column_id(const CL_StringRef &str); 00129 00133 00134 public: 00135 CL_Callback_v1<CL_ListViewColumnHeader> &func_size_changed(); 00136 00140 00141 private: 00142 00146 CL_ListViewColumnHeader(const CL_SharedPtr<CL_ListViewColumnHeader_Impl> &impl); 00147 00151 void set_rect(const CL_Rect &rect); 00152 00156 void set_gui_theme_part(const CL_GUIThemePart &part); 00157 00158 CL_SharedPtr<CL_ListViewColumnHeader_Impl> impl; 00159 00160 friend class CL_ListView_Impl; 00161 friend class CL_ListViewHeader; 00162 friend class CL_ListViewHeader_Impl; 00164 }; 00165