Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

slstview.hpp

Go to the documentation of this file.
00001 /* 00002 * wxChecksums 00003 * Copyright (C) 2003-2004 Julien Couot 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /** 00021 * \file slstview.hpp 00022 * A sortable ListView control. 00023 */ 00024 00025 #ifndef INC_SLSTVIEW_HPP 00026 #define INC_SLSTVIEW_HPP 00027 00028 //--------------------------------------------------------------------------- 00029 // For compilers that support precompilation, includes "wx.h". 00030 #include <wx/wxprec.h> 00031 00032 #ifdef __BORLANDC__ 00033 #pragma hdrstop 00034 #endif 00035 00036 #ifndef WX_PRECOMP 00037 // Include your minimal set of headers here, or wx.h 00038 #include <wx/wx.h> 00039 #endif 00040 #include <wx/listctrl.h> 00041 //--------------------------------------------------------------------------- 00042 00043 00044 /** 00045 * A sortable ListView control. 00046 * 00047 * This control is a wxListView control with two more attributes: 00048 * - The sort order (ascending, descending, none). 00049 * - The column to sort. 00050 */ 00051 class wxSortableListView : public wxListView 00052 { 00053 public: 00054 /// Default Constructor. 00055 wxSortableListView(); 00056 00057 /** 00058 * Constructor, creating and showing a list control. 00059 * 00060 * @param parent Parent window. Must not be <CODE>NULL</CODE>. 00061 * @param id Window identifier. A value of <CODE>-1</CODE> indicates a 00062 * default value. 00063 * @param pos Window position. 00064 * @param size Window size. If the default size <CODE>(-1, -1)</CODE> is 00065 * specified then the window is sized appropriately. 00066 * @param style Window style. See <CODE>wxListCtrl</CODE>. 00067 * @param validator Window validator. 00068 * @param name Window name. 00069 */ 00070 wxSortableListView(wxWindow *parent, 00071 wxWindowID id = -1, 00072 const wxPoint& pos = wxDefaultPosition, 00073 const wxSize& size = wxDefaultSize, 00074 long style = wxLC_REPORT, 00075 const wxValidator& validator = wxDefaultValidator, 00076 const wxString &name = wxT("sortablelistview")); 00077 00078 /// Sort orders 00079 enum SortOrder 00080 { 00081 none = 0, 00082 ascending, 00083 descending 00084 }; 00085 00086 /** 00087 * Gets the sort order of this ListView control. 00088 * 00089 * @return The sort order of this ListView control. 00090 */ 00091 SortOrder GetSortOrder() const 00092 { 00093 return m_sortOrder; 00094 } 00095 00096 /** 00097 * Sets the sort order for this ListView control. 00098 * 00099 * If the sort given order is invalid, the sort order is set to 'none'. 00100 * 00101 * @param sortOrder The new sort order for this ListView control. 00102 */ 00103 void SetSortOrder(const SortOrder sortOrder); 00104 00105 /** 00106 * Gets the column to sort on this ListView control. 00107 * 00108 * @return The column to sort on this ListView control. 00109 */ 00110 int GetColumnToSort() const 00111 { 00112 return m_sortColumn; 00113 } 00114 00115 /** 00116 * Sets the column to sort on this ListView control. 00117 * 00118 * If the given column to sort is invalid, the column will be <CODE>0</CODE>. 00119 * 00120 * @param sortColumn The new column to sort on this ListView control. 00121 */ 00122 void SetColumnToSort(const int sortColumn); 00123 00124 protected: 00125 SortOrder m_sortOrder; ///< The sort order. 00126 int m_sortColumn; ///< The column to sort. 00127 00128 private: 00129 DECLARE_DYNAMIC_CLASS(wxSortableListView) 00130 }; 00131 //--------------------------------------------------------------------------- 00132 00133 #endif // INC_SLSTVIEW_HPP

Generated on Sun May 30 13:37:45 2004 for wxChecksums by doxygen 1.3.7