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

FXDirSelector.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *              D i r e c t o r y   S e l e c t i o n   W i d g e t              *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,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: FXDirSelector.h,v 1.31 2009/01/06 13:07:23 fox Exp $                     *
00022 ********************************************************************************/
00023 #ifndef FXDIRSELECTOR_H
00024 #define FXDIRSELECTOR_H
00025 
00026 #ifndef FXPACKER_H
00027 #include "FXPacker.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXFileDict;
00034 class FXDirList;
00035 class FXTextField;
00036 class FXButton;
00037 
00038 
00039 /**
00040 * The Directory Selector widget is the reusable mega-widget component which
00041 * is the core of the Directory Dialog.  The function of the directory selector widget
00042 * is very similar to the file selector widget, except that the directory selector widget
00043 * displays a tree-structured view of the file system, and thereby makes up and down
00044 * navigation through the file system significantly easier.
00045 */
00046 class FXAPI FXDirSelector : public FXPacker {
00047   FXDECLARE(FXDirSelector)
00048 protected:
00049   FXDirList     *dirbox;        // Directory list widget
00050   FXTextField   *dirname;       // Directory name entry field
00051   FXButton      *accept;        // Accept button
00052   FXButton      *cancel;        // Cancel button
00053   FXIcon        *updiricon;     // Up directory icon
00054   FXIcon        *homeicon;      // Go home icon
00055   FXIcon        *workicon;      // Go home icon
00056   FXIcon        *markicon;      // Book mark icon
00057   FXIcon        *clearicon;     // Book clear icon
00058   FXIcon        *newicon;       // New directory icon
00059   FXIcon        *deleteicon;    // Delete file icon
00060   FXIcon        *moveicon;      // Rename file icon
00061   FXIcon        *copyicon;      // Copy file icon
00062   FXIcon        *linkicon;      // Link file icon
00063   FXRecentFiles  mrufiles;      // Recently visited places
00064 protected:
00065   FXDirSelector(){}
00066 private:
00067   FXDirSelector(const FXDirSelector&);
00068   FXDirSelector &operator=(const FXDirSelector&);
00069 public:
00070   long onCmdName(FXObject*,FXSelector,void*);
00071   long onCmdOpened(FXObject*,FXSelector,void*);
00072   long onCmdHome(FXObject*,FXSelector,void*);
00073   long onCmdWork(FXObject*,FXSelector,void*);
00074   long onCmdDirectoryUp(FXObject*,FXSelector,void*);
00075   long onPopupMenu(FXObject*,FXSelector,void*);
00076   long onCmdBookmark(FXObject*,FXSelector,void*);
00077   long onCmdVisit(FXObject*,FXSelector,void*);
00078   long onCmdNew(FXObject*,FXSelector,void*);
00079   long onUpdNew(FXObject*,FXSelector,void*);
00080   long onCmdMove(FXObject*,FXSelector,void*);
00081   long onCmdCopy(FXObject*,FXSelector,void*);
00082   long onCmdLink(FXObject*,FXSelector,void*);
00083   long onCmdRemove(FXObject*,FXSelector,void*);
00084   long onUpdSelected(FXObject*,FXSelector,void*);
00085 public:
00086   enum {
00087     ID_DIRNAME=FXPacker::ID_LAST,
00088     ID_DIRLIST,
00089     ID_HOME,
00090     ID_WORK,
00091     ID_DIRECTORY_UP,
00092     ID_BOOKMARK,
00093     ID_VISIT,
00094     ID_NEW,
00095     ID_REMOVE,
00096     ID_MOVE,
00097     ID_COPY,
00098     ID_LINK,
00099     ID_LAST
00100     };
00101 public:
00102 
00103   /// Constructor
00104   FXDirSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00105 
00106   /// Return a pointer to the "Accept" button
00107   FXButton *acceptButton() const { return accept; }
00108 
00109   /// Return a pointer to the "Cancel" button
00110   FXButton *cancelButton() const { return cancel; }
00111 
00112   /// Change directory
00113   void setDirectory(const FXString& path);
00114 
00115   /// Return directory
00116   FXString getDirectory() const;
00117 
00118   /// Return true if showing files as well as directories
00119   FXbool showFiles() const;
00120 
00121   /// Show or hide normal files
00122   void showFiles(FXbool showing);
00123 
00124   /// Return true if showing hidden directories
00125   FXbool showHiddenFiles() const;
00126 
00127   /// Show or hide hidden directories
00128   void showHiddenFiles(FXbool showing);
00129 
00130   /// Return wildcard matching mode
00131   FXuint getMatchMode() const;
00132 
00133   /// Change wildcard matching mode
00134   void setMatchMode(FXuint mode);
00135 
00136   /// Change Directory List style
00137   void setDirBoxStyle(FXuint style);
00138 
00139   /// Return Directory List style
00140   FXuint getDirBoxStyle() const;
00141 
00142   /// Change file associations; delete old ones if owned
00143   void setAssociations(FXFileDict* assoc,FXbool owned=false);
00144 
00145   /// Return file associations
00146   FXFileDict* getAssociations() const;
00147 
00148   /// Save to stream
00149   virtual void save(FXStream& store) const;
00150 
00151   /// Load from stream
00152   virtual void load(FXStream& store);
00153 
00154   /// Destructor
00155   virtual ~FXDirSelector();
00156   };
00157 
00158 }
00159 
00160 #endif

Copyright © 1997-2009 Jeroen van der Zijp