ubit
ufinderImpl.hpp
1 /************************************************************************
2  *
3  * ufinderImpl.hpp: ufinder implementation (see ufinder.hpp)
4  * Ubit GUI Toolkit - Version 6
5  * (C) 2009 | Eric Lecolinet | TELECOM ParisTech | http://www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 
17 #ifndef _ufinderImpl_hpp_
18 #define _ufinderImpl_hpp_
19 #include <pthread.h>
20 #include <ubit/uwin.hpp>
21 #include <ubit/uicon.hpp>
22 #include <ubit/ufont.hpp>
23 #include <ubit/ulistbox.hpp>
24 namespace ubit {
25 
26  /* [Impl] A directory in the UFinder.
27  */
28  class UFinderDir : public UItem {
29  friend class UFinder;
30  UStr fpath, fname;
31  uptr<UIconbox> iconbox;
32  UPopmenu popmenu;
33  bool keep_open;
34  int path_type;
35 
36  public:
37  UFinderDir(class UFinder*, const UStr& path, int path_type);
38  ~UFinderDir();
39 
40  const UStr& getDir() const;
41  class UIconbox* getIconbox() const;
42 
43  void setDir(const UStr& dirname);
44  void setIconbox(class UIconbox*);
45 
46  void emph(bool state);
47  void setKeepOpen(bool st) {keep_open = st;}
48  bool isKeepOpen() {return keep_open;}
49  };
50 
51  /* ==================================================== ===== ======= */
52  /* [Impl] A host in the UFinder.
53  */
54  class UFinderHost : public UBox { // UVbox
55  public:
56  typedef void (UFinderHost::*HostMethod)();
57 
58  UFinderHost(class UFinder*, const UStr& hostname);
59  void resolve(HostMethod);
60  void createClone();
61  void deleteClone();
62  void addXhost();
63  void removeXhost();
64  void calibrate();
65  void putFile();
66 
67  protected:
68  friend class UFinder;
69  class UFinder& fd;
70  UStr hostname, address;
71  UBox *clone_btn, *xhost_btn, *put_btn, *get_btn;
72  UWin *clone_win;
73 
74  void resolveCB(UMessageEvent&, HostMethod);
75  void createCloneImpl();
76  void addXhostImpl();
77  void calibrateImpl();
78  void putFileImpl();
79  };
80 
81  /* ==================================================== ===== ======= */
82  /* [Impl] UFinder communication (remote file access by using ssh, etc)
83  */
84  class UFinderCom {
85  public:
86  UFinderCom(UFinder*, const UStr& path, int path_type);
87 
88  protected:
89  enum {INVALID_URL=-2};
90  static void loadDoc(UFinderCom*); // pthread_create() callback
91  void showDoc();
92 
93  pthread_t thread_id;
94  UFinder* fd;
95  UStr path, cachepath;
96  int type, mode;
97  int stat;
98  };
99 
100 }
101 #endif
Box container.
Definition: ubox.hpp:64
UPopmenu: Contextual Menu.
Definition: umenu.hpp:149
file finder.
Definition: ufinder.hpp:47
Item Button widget (a kind of button that is used in UListbox(es)).
Definition: uinteractors.hpp:303
Icon box.
Definition: uicon.hpp:52
Smart Pointer for UObject instances (.
Definition: uobject.hpp:365
Definition: ufinderImpl.hpp:54
Definition: uhardfont.hpp:31
Definition: ufinderImpl.hpp:84
Definition: ufinderImpl.hpp:28
Base class for windows and menus.
Definition: uwin.hpp:47
Ubit String.
Definition: ustr.hpp:72
Ubit Message events.
Definition: uevent.hpp:462