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

FXDirWatch.h
1 /********************************************************************************
2 * *
3 * W a t c h D i r e c t o r i e s f o r C h a n g e s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2006,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXDIRWATCH_H
22 #define FXDIRWATCH_H
23 
24 #ifndef FXOBJECT_H
25 #include "FXObject.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXApp;
32 
33 #define DIRWATCH 1
34 
41 class FXAPI FXDirWatch : public FXObject {
42  FXDECLARE(FXDirWatch)
43 private:
44  FXApp* app; // Back link to application object
45 protected:
46  FXInputHandle hnd; // Handle
47  FXDictionary pathToHandle; // Path to handle map
48  FXReverseDictionary handleToPath; // Handle to path map
49  FXTime timestamp; // Time stamp
50  FXObject* target; // Target object
51  FXSelector message; // Message ID
52 private:
53  FXDirWatch(const FXDirWatch&);
54  FXDirWatch& operator=(const FXDirWatch&);
55 public:
56  enum{
57  ID_CHANGE=1,
58  ID_LAST
59  };
60 public:
61  long onMessage(FXObject*,FXSelector,void*);
62 public:
63 
65  FXDirWatch(FXApp* a=nullptr,FXObject* tgt=nullptr,FXSelector sel=0);
66 
68  FXApp* getApp() const { return app; }
69 
71  void setTarget(FXObject *t){ target=t; }
72 
74  FXObject* getTarget() const { return target; }
75 
77  void setSelector(FXSelector sel){ message=sel; }
78 
80  FXSelector getSelector() const { return message; }
81 
83  FXbool addWatch(const FXString& path);
84 
86  FXbool remWatch(const FXString& path);
87 
89  FXbool clearAll();
90 
92  virtual ~FXDirWatch();
93  };
94 
95 }
96 
97 #endif
98 
99 
Watches one or more directories (on Linux, also files..).
Definition: FXDirWatch.h:41
FXObject * getTarget() const
Get the message target object.
Definition: FXDirWatch.h:74
The dictionary class is a fast-access hash table, mapping strings to void-pointers.
Definition: FXDictionary.h:36
The Application object is the central point of a FOX user-interface.
Definition: FXApp.h:134
The reverse dictionary class is a fast-access hash table, mapping void-pointers to strings...
Definition: FXReverseDictionary.h:39
Definition: FX4Splitter.h:28
FXSelector getSelector() const
Get the message identifier.
Definition: FXDirWatch.h:80
FXApp * getApp() const
Get application pointer.
Definition: FXDirWatch.h:68
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
void setTarget(FXObject *t)
Set the message target object.
Definition: FXDirWatch.h:71
void setSelector(FXSelector sel)
Set the message identifier.
Definition: FXDirWatch.h:77
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp