![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * D i r e c t o r y B o x W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1999,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (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 * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXDirBox.h,v 1.30 2009/01/06 13:07:23 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXDIRBOX_H 00024 #define FXDIRBOX_H 00025 00026 #ifndef FXTREELISTBOX_H 00027 #include "FXTreeListBox.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 class FXIcon; 00034 class FXFileDict; 00035 00036 /// Directory Box options 00037 enum { 00038 DIRBOX_NO_OWN_ASSOC = 0x00020000 /// Do not create associations for files 00039 }; 00040 00041 00042 /** 00043 * A Directory Box widget allows the user to select parts of a file path. 00044 * First, it is filled with a string comprising a file path, like "/a/b/c". 00045 * Then, the user can select "/a/b/c", "/a/b", "/a", and "/" from the drop-down 00046 * list. The entries in the drop-down list are automatically provided with icons 00047 * by consulting the file-associations registry settings. 00048 * The Directory Box sends SEL_CHANGED and SEL_COMMAND messages, with the string 00049 * containing the full path to the selected item. 00050 */ 00051 class FXAPI FXDirBox : public FXTreeListBox { 00052 FXDECLARE(FXDirBox) 00053 protected: 00054 FXFileDict *associations; // Association table 00055 FXIcon *foldericon; // Folder icons 00056 FXIcon *cdromicon; // CDROM icon 00057 FXIcon *harddiskicon; // Hard disk icon 00058 FXIcon *netdriveicon; // Networked drive icon 00059 FXIcon *floppyicon; // Floppy icon 00060 FXIcon *nethoodicon; // Network neighborhood icon 00061 FXIcon *zipdiskicon; // Zip drive icon 00062 protected: 00063 FXDirBox(){} 00064 FXString getItemPathname(FXTreeItem *item) const; 00065 FXTreeItem* getPathnameItem(const FXString& path); 00066 private: 00067 FXDirBox(const FXDirBox&); 00068 FXDirBox &operator=(const FXDirBox&); 00069 public: 00070 long onTreeChanged(FXObject*,FXSelector,void*); 00071 long onTreeClicked(FXObject*,FXSelector,void*); 00072 long onCmdSetValue(FXObject*,FXSelector,void*); 00073 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00074 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00075 public: 00076 00077 /// Construct a Directory Box 00078 FXDirBox(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FRAME_SUNKEN|FRAME_THICK|TREELISTBOX_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); 00079 00080 /// Create server-side resources 00081 virtual void create(); 00082 00083 /// Detach server-side resources 00084 virtual void detach(); 00085 00086 /// Destroy server-side resources 00087 virtual void destroy(); 00088 00089 /// Save to stream 00090 virtual void save(FXStream& store) const; 00091 00092 /// Load from stream 00093 virtual void load(FXStream& store); 00094 00095 /// Set current directory 00096 void setDirectory(const FXString& pathname); 00097 00098 /// Return current directory 00099 FXString getDirectory() const; 00100 00101 /// Change file associations; delete the old one unless it was shared 00102 void setAssociations(FXFileDict* assoc,FXbool owned=false); 00103 00104 /// Return file associations 00105 FXFileDict* getAssociations() const { return associations; } 00106 00107 /// Destructor 00108 virtual ~FXDirBox(); 00109 }; 00110 00111 } 00112 00113 #endif
![]() |