listview.h

Go to the documentation of this file.
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 // (Note, enum moved here because of problems with gcc not allowing "enum CL_ListViewDisplayMode;")
00036 enum CL_ListViewDisplayMode
00037 {
00038         listview_mode_thumbnails,
00039         listview_mode_tiles,
00040         listview_mode_icons,
00041         listview_mode_list,
00042         listview_mode_details
00043 };
00044 
00045 #include "../api_gui.h"
00046 #include "../gui_component.h"
00047 #include "listview_item.h"
00048 #include "listview_selected_item.h"
00049 #include "listview_column_header.h"
00050 #include "listview_icon_list.h"
00051 
00052 class CL_ListViewHeader;
00053 class CL_ListView_Impl;
00054 class CL_ListViewIconList;
00055 class CL_InputEvent;
00056 
00060 class CL_API_GUI CL_ListView : public CL_GUIComponent
00061 {
00064 
00065 public:
00066 
00070         CL_ListView(CL_GUIComponent *parent);
00071 
00072         virtual ~CL_ListView();
00073 
00077 
00078 public:
00079 
00083         CL_ListViewHeader *get_header() const;
00084 
00088         CL_ListViewItem get_document_item() const;
00089 
00093         bool get_select_whole_row() const;
00094 
00098         CL_ListViewIconList get_icon_list() const;
00099 
00101         CL_ListViewSelection get_selected_items() const;
00102 
00104         CL_ListViewItem get_selected_item();
00105 
00107         CL_Size get_preferred_size() const;
00108 
00112         CL_ListViewDisplayMode get_display_mode() const;
00113 
00117 
00118 public:
00119 
00123         CL_ListViewItem create_item();
00124 
00128         void on_process_message(CL_GUIMessage &msg);
00129 
00131         void set_select_whole_row(bool value);
00132 
00134         void set_multi_select(bool value);
00135 
00139         void set_display_mode(CL_ListViewDisplayMode mode);
00140 
00142         void clear();
00143 
00145         void clear_selection();
00146 
00151         void set_selected(CL_ListViewItem &item, bool selected=true);
00152 
00154         CL_ListViewItem find(const CL_StringRef &col_id, const CL_StringRef &str, bool recursive=true);
00155 
00157         CL_ListViewItem find(int id, bool recursive=true);
00158 
00160         CL_ListViewItem find(CL_UnknownSharedPtr userdata, bool recursive=true);
00161 
00165 
00166 public:
00168         CL_Callback_v1<CL_ListViewSelection> &func_selection_changed();
00169 
00172         CL_Callback_2<bool, CL_ListViewItem, CL_String &> &func_item_edited();
00173 
00174         CL_Callback_v1<CL_InputEvent> &func_key_pressed();
00175 
00176         CL_Callback_v1<CL_InputEvent> &func_key_released();
00177 
00180         CL_Callback_v1<CL_Point> &func_mouse_right_up();
00181 
00185 
00186 private:
00187         CL_SharedPtr<CL_ListView_Impl> impl;
00188 
00189         friend class CL_ListViewRenderer;
00191 };
00192 

Generated on Thu Dec 3 02:39:29 2009 for ClanLib by  doxygen 1.4.6