1 /******************************************************************************** 2 * * 3 * D r i v e B o x W i d g e t * 4 * * 5 ********************************************************************************* 6 * Copyright (C) 1999,2006 by Jeroen van der Zijp. All Rights Reserved. * 7 ********************************************************************************* 8 * This library is free software; you can redistribute it and/or * 9 * modify it under the terms of the GNU Lesser General Public * 10 * License as published by the Free Software Foundation; either * 11 * version 2.1 of the License, or (at your option) any later version. * 12 * * 13 * This library is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 16 * Lesser General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU Lesser General Public * 19 * License along with this library; if not, write to the Free Software * 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 21 ********************************************************************************* 22 * $Id: FXDriveBox.h 3297 2015-12-14 20:30:04Z arthurcnorman $ * 23 ********************************************************************************/ 24 #ifndef FXDRIVEBOX_H 25 #define FXDRIVEBOX_H 26 27 #ifndef FXLISTBOX_H 28 #include "FXListBox.h" 29 #endif 30 31 namespace FX { 32 33 34 class FXIcon; 35 class FXFileDict; 36 37 /// Drive Box options 38 enum { 39 DRIVEBOX_NO_OWN_ASSOC = 0x00020000 /// Do not create associations for files 40 }; 41 42 43 /// Directory Box 44 class FXAPI FXDriveBox : public FXListBox { 45 FXDECLARE(FXDriveBox) 46 protected: 47 FXFileDict *associations; // Association table 48 FXIcon *foldericon; // Folder icons 49 FXIcon *cdromicon; // CDROM icon 50 FXIcon *harddiskicon; // Hard disk icon 51 FXIcon *netdriveicon; // Networked drive icon 52 FXIcon *floppyicon; // Floppy icon 53 FXIcon *nethoodicon; // Network neighborhood icon 54 FXIcon *zipdiskicon; // Zip drive icon 55 protected: FXDriveBox()56 FXDriveBox(){} 57 void listDrives(); 58 private: 59 FXDriveBox(const FXDriveBox&); 60 FXDriveBox &operator=(const FXDriveBox&); 61 public: 62 long onListChanged(FXObject*,FXSelector,void*); 63 long onListClicked(FXObject*,FXSelector,void*); 64 long onCmdSetValue(FXObject*,FXSelector,void*); 65 long onCmdSetStringValue(FXObject*,FXSelector,void*); 66 long onCmdGetStringValue(FXObject*,FXSelector,void*); 67 public: 68 69 /// Constructor 70 FXDriveBox(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); 71 72 /// Create server-side resources 73 virtual void create(); 74 75 /// Detach server-side resources 76 virtual void detach(); 77 78 /// Destroy server-side resources 79 virtual void destroy(); 80 81 /// Save to stream 82 virtual void save(FXStream& store) const; 83 84 /// Load from stream 85 virtual void load(FXStream& store); 86 87 /// Set current drive 88 FXbool setDrive(const FXString& drive); 89 90 /// Return current drive 91 FXString getDrive() const; 92 93 /// Change file associations 94 void setAssociations(FXFileDict* assoc); 95 96 /// Return file associations getAssociations()97 FXFileDict* getAssociations() const { return associations; } 98 99 /// Destructor 100 virtual ~FXDriveBox(); 101 }; 102 103 } 104 105 #endif 106