Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXListBox.h

00001 /******************************************************************************** 00002 * * 00003 * L i s t B o x W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2004 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXListBox.h,v 1.29 2004/02/08 17:17:33 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXLISTBOX_H 00025 #define FXLISTBOX_H 00026 00027 #ifndef FXPACKER_H 00028 #include "FXPacker.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /// List Box styles 00035 enum { 00036 LISTBOX_NORMAL = 0 // Normal style 00037 }; 00038 00039 00040 class FXButton; 00041 class FXMenuButton; 00042 class FXList; 00043 class FXPopup; 00044 00045 00046 /// List Box 00047 class FXAPI FXListBox : public FXPacker { 00048 FXDECLARE(FXListBox) 00049 protected: 00050 FXButton *field; 00051 FXMenuButton *button; 00052 FXList *list; 00053 FXPopup *pane; 00054 protected: 00055 FXListBox(){} 00056 private: 00057 FXListBox(const FXListBox&); 00058 FXListBox &operator=(const FXListBox&); 00059 public: 00060 long onFocusUp(FXObject*,FXSelector,void*); 00061 long onFocusDown(FXObject*,FXSelector,void*); 00062 long onFocusSelf(FXObject*,FXSelector,void*); 00063 long onFieldButton(FXObject*,FXSelector,void*); 00064 long onListUpdate(FXObject*,FXSelector,void*); 00065 long onListChanged(FXObject*,FXSelector,void*); 00066 long onListClicked(FXObject*,FXSelector,void*); 00067 long onCmdSetValue(FXObject*,FXSelector,void*); 00068 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00069 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00070 public: 00071 enum { 00072 ID_LIST=FXPacker::ID_LAST, 00073 ID_FIELD, 00074 ID_LAST 00075 }; 00076 public: 00077 00078 /// Constructor 00079 FXListBox(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK|LISTBOX_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD); 00080 00081 /// Create server-side resources 00082 virtual void create(); 00083 00084 /// Detach server-side resources 00085 virtual void detach(); 00086 00087 /// Destroy server-side resources 00088 virtual void destroy(); 00089 00090 /// Perform layout 00091 virtual void layout(); 00092 00093 /// Enable drive box 00094 virtual void enable(); 00095 00096 /// Disable drive box 00097 virtual void disable(); 00098 00099 /// Return default width 00100 virtual FXint getDefaultWidth(); 00101 00102 /// Return default height 00103 virtual FXint getDefaultHeight(); 00104 00105 /// Return the number of items in the list 00106 FXint getNumItems() const; 00107 00108 /// Return the number of visible items 00109 FXint getNumVisible() const; 00110 00111 /// Set the number of visible items 00112 void setNumVisible(FXint nvis); 00113 00114 /// Return true if current item 00115 FXbool isItemCurrent(FXint index) const; 00116 00117 /// Set the current item (index is zero-based) 00118 void setCurrentItem(FXint index); 00119 00120 /// Get the current item's index 00121 FXint getCurrentItem() const; 00122 00123 /// Return the item at the given index 00124 FXString getItem(FXint index) const; 00125 00126 /// Replace the item at index 00127 FXint setItem(FXint index,const FXString& text,FXIcon* icon=NULL,void* ptr=NULL); 00128 00129 /// Insert a new item at index 00130 FXint insertItem(FXint index,const FXString& text,FXIcon* icon=NULL,void* ptr=NULL); 00131 00132 /// Add an item to the end of the list 00133 FXint appendItem(const FXString& text,FXIcon* icon=NULL,void* ptr=NULL); 00134 00135 /// Prepend an item to the list 00136 FXint prependItem(const FXString& text,FXIcon* icon=NULL,void* ptr=NULL); 00137 00138 /// Move item from oldindex to newindex 00139 FXint moveItem(FXint newindex,FXint oldindex); 00140 00141 /// Remove this item from the list 00142 void removeItem(FXint index); 00143 00144 /// Remove all items from the list 00145 void clearItems(); 00146 00147 /** 00148 * Search items for item by name, starting from start item; the 00149 * flags argument controls the search direction, and case sensitivity. 00150 */ 00151 FXint findItem(const FXString& text,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const; 00152 00153 /// Set text for specified item 00154 void setItemText(FXint index,const FXString& text); 00155 00156 /// Get text for specified item 00157 FXString getItemText(FXint index) const; 00158 00159 /// Change item icon 00160 void setItemIcon(FXint index,FXIcon* icon); 00161 00162 /// Return icon of item at index 00163 FXIcon* getItemIcon(FXint index) const; 00164 00165 /// Set data pointer for specified item 00166 void setItemData(FXint index,void* ptr) const; 00167 00168 /// Get data pointer for specified item 00169 void* getItemData(FXint index) const; 00170 00171 /// Is the pane shown 00172 FXbool isPaneShown() const; 00173 00174 /// Sort items using current sort function 00175 void sortItems(); 00176 00177 /// Set text font 00178 void setFont(FXFont* fnt); 00179 00180 /// Get text font 00181 FXFont* getFont() const; 00182 00183 /// Set window background color 00184 virtual void setBackColor(FXColor clr); 00185 00186 /// Get background color 00187 FXColor getBackColor() const; 00188 00189 /// Change text color 00190 void setTextColor(FXColor clr); 00191 00192 /// Return text color 00193 FXColor getTextColor() const; 00194 00195 /// Change selected background color 00196 void setSelBackColor(FXColor clr); 00197 00198 /// Return selected background color 00199 FXColor getSelBackColor() const; 00200 00201 /// Change selected text color 00202 void setSelTextColor(FXColor clr); 00203 00204 /// Return selected text color 00205 FXColor getSelTextColor() const; 00206 00207 /// Return sort function 00208 FXListSortFunc getSortFunc() const; 00209 00210 /// Change sort function 00211 void setSortFunc(FXListSortFunc func); 00212 00213 /// Set the combobox help text 00214 void setHelpText(const FXString& txt); 00215 00216 /// Get the combobox help text 00217 FXString getHelpText() const; 00218 00219 /// Set the tool tip message for this combobox 00220 void setTipText(const FXString& txt); 00221 00222 /// Get the tool tip message for this combobox 00223 FXString getTipText() const; 00224 00225 /// Save combobox to a stream 00226 virtual void save(FXStream& store) const; 00227 00228 /// Load combobox from a stream 00229 virtual void load(FXStream& store); 00230 00231 /// Destructor 00232 virtual ~FXListBox(); 00233 }; 00234 00235 } 00236 00237 #endif

Copyright © 1997-2004 Jeroen van der Zijp