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

FXDirBox.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * D i r e c t o r y 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: FXDirBox.h,v 1.25 2006/01/22 17:58:00 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXDIRBOX_H
25 #define FXDIRBOX_H
26 
27 #ifndef FXTREELISTBOX_H
28 #include "FXTreeListBox.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXIcon;
35 class FXFileDict;
36 
37 /// Directory Box options
38 enum {
39  DIRBOX_NO_OWN_ASSOC = 0x00020000 /// Do not create associations for files
40  };
41 
42 
43 /**
44 * A Directory Box widget allows the user to select parts of a file path.
45 * First, it is filled with a string comprising a file path, like "/a/b/c".
46 * Then, the user can select "/a/b/c", "/a/b", "/a", and "/" from the drop-down
47 * list. The entries in the drop-down list are automatically provided with icons
48 * by consulting the file-associations registry settings.
49 * The Directory Box sends SEL_CHANGED and SEL_COMMAND messages, with the string
50 * containing the full path to the selected item.
51 */
52 class FXAPI FXDirBox : public FXTreeListBox {
54 protected:
55  FXFileDict *associations; // Association table
56  FXIcon *foldericon; // Folder icons
57  FXIcon *cdromicon; // CDROM icon
58  FXIcon *harddiskicon; // Hard disk icon
59  FXIcon *netdriveicon; // Networked drive icon
60  FXIcon *floppyicon; // Floppy icon
61  FXIcon *nethoodicon; // Network neighborhood icon
62  FXIcon *zipdiskicon; // Zip drive icon
63 protected:
64  FXDirBox(){}
65  FXString getItemPathname(FXTreeItem *item) const;
66  FXTreeItem* getPathnameItem(const FXString& path);
67 private:
68  FXDirBox(const FXDirBox&);
69  FXDirBox &operator=(const FXDirBox&);
70 public:
71  long onTreeChanged(FXObject*,FXSelector,void*);
72  long onTreeClicked(FXObject*,FXSelector,void*);
73  long onCmdSetValue(FXObject*,FXSelector,void*);
74  long onCmdSetStringValue(FXObject*,FXSelector,void*);
75  long onCmdGetStringValue(FXObject*,FXSelector,void*);
76 public:
77 
78  /// Construct a Directory Box
80 
81  /// Create server-side resources
82  virtual void create();
83 
84  /// Detach server-side resources
85  virtual void detach();
86 
87  /// Destroy server-side resources
88  virtual void destroy();
89 
90  /// Save to stream
91  virtual void save(FXStream& store) const;
92 
93  /// Load from stream
94  virtual void load(FXStream& store);
95 
96  /// Set current directory
97  void setDirectory(const FXString& pathname);
98 
99  /// Return current directory
100  FXString getDirectory() const;
101 
102  /// Change file associations used to look up icons
103  void setAssociations(FXFileDict* assoc);
104 
105  /// Return file associations
106  FXFileDict* getAssociations() const { return associations; }
107 
108  /// Destructor
109  virtual ~FXDirBox();
110  };
111 
112 }
113 
114 #endif
Tree list Item.
Definition: FXTreeList.h:63
unsigned int FXuint
Definition: fxdefs.h:389
Definition: FXFrame.h:56
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Sunken border.
Definition: FXWindow.h:76
Base composite.
Definition: FXComposite.h:35
Normal style.
Definition: FXTreeListBox.h:39
#define NULL
Definition: fxdefs.h:41
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:99
The File Association dictionary associates a file extension with a File Association record which cont...
Definition: FXFileDict.h:85
The Tree List Box behaves very much like a List Box, except that it supports a hierarchical, tree structured display of the items.
Definition: FXTreeListBox.h:60
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
A Directory Box widget allows the user to select parts of a file path.
Definition: FXDirBox.h:59
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Thick border.
Definition: FXWindow.h:78
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
Do not create associations for files.
Definition: FXDirBox.h:42
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp