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

FXDirBox.h

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,2005 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: FXDirBox.h,v 1.24 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXDIRBOX_H 00025 #define FXDIRBOX_H 00026 00027 #ifndef FXTREELISTBOX_H 00028 #include "FXTreeListBox.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXIcon; 00035 class FXFileDict; 00036 00037 /// Directory Box options 00038 enum { 00039 DIRBOX_NO_OWN_ASSOC = 0x00020000 /// Do not create associations for files 00040 }; 00041 00042 00043 /** 00044 * A Directory Box widget allows the user to select parts of a file path. 00045 * First, it is filled with a string comprising a file path, like "/a/b/c". 00046 * Then, the user can select "/a/b/c", "/a/b", "/a", and "/" from the drop-down 00047 * list. The entries in the drop-down list are automatically provided with icons 00048 * by consulting the file-associations registry settings. 00049 * The Directory Box sends SEL_CHANGED and SEL_COMMAND messages, with the string 00050 * containing the full path to the selected item. 00051 */ 00052 class FXAPI FXDirBox : public FXTreeListBox { 00053 FXDECLARE(FXDirBox) 00054 protected: 00055 FXFileDict *associations; // Association table 00056 FXIcon *foldericon; // Folder icons 00057 FXIcon *cdromicon; // CDROM icon 00058 FXIcon *harddiskicon; // Hard disk icon 00059 FXIcon *netdriveicon; // Networked drive icon 00060 FXIcon *floppyicon; // Floppy icon 00061 FXIcon *nethoodicon; // Network neighborhood icon 00062 FXIcon *zipdiskicon; // Zip drive icon 00063 protected: 00064 FXDirBox(){} 00065 FXString getItemPathname(FXTreeItem *item) const; 00066 FXTreeItem* getPathnameItem(const FXString& path); 00067 private: 00068 FXDirBox(const FXDirBox&); 00069 FXDirBox &operator=(const FXDirBox&); 00070 public: 00071 long onTreeChanged(FXObject*,FXSelector,void*); 00072 long onTreeClicked(FXObject*,FXSelector,void*); 00073 long onCmdSetValue(FXObject*,FXSelector,void*); 00074 long onCmdSetStringValue(FXObject*,FXSelector,void*); 00075 long onCmdGetStringValue(FXObject*,FXSelector,void*); 00076 public: 00077 00078 /// Construct a Directory Box 00079 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); 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 /// Save to stream 00091 virtual void save(FXStream& store) const; 00092 00093 /// Load from stream 00094 virtual void load(FXStream& store); 00095 00096 /// Set current directory 00097 void setDirectory(const FXString& pathname); 00098 00099 /// Return current directory 00100 FXString getDirectory() const; 00101 00102 /// Change file associations used to look up icons 00103 void setAssociations(FXFileDict* assoc); 00104 00105 /// Return file associations 00106 FXFileDict* getAssociations() const { return associations; } 00107 00108 /// Destructor 00109 virtual ~FXDirBox(); 00110 }; 00111 00112 } 00113 00114 #endif

Copyright © 1997-2005 Jeroen van der Zijp