| 1 |
// ---------------------------------------------------------------------------- |
| 2 |
// |
| 3 |
// Copyright (C) 2003-2013 Fons Adriaensen <[email protected]> |
| 4 |
// |
| 5 |
// This program is free software; you can redistribute it and/or modify |
| 6 |
// it under the terms of the GNU General Public License as published by |
| 7 |
// the Free Software Foundation; either version 3 of the License, or |
| 8 |
// (at your option) any later version. |
| 9 |
// |
| 10 |
// This program is distributed in the hope that it will be useful, |
| 11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
// GNU General Public License for more details. |
| 14 |
// |
| 15 |
// You should have received a copy of the GNU General Public License |
| 16 |
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
// |
| 18 |
// ---------------------------------------------------------------------------- |
| 19 |
|
| 20 |
|
| 21 |
#ifndef __FILEWIN_H |
| 22 |
#define __FILEWIN_H |
| 23 |
|
| 24 |
|
| 25 |
#include <clxclient.h> |
| 26 |
#include "global.h" |
| 27 |
|
| 28 |
|
| 29 |
class Filewin : public X_window , public X_callback |
| 30 |
{ |
| 31 |
public: |
| 32 |
|
| 33 |
Filewin (X_window *parent, X_resman *resman); |
| 34 |
~Filewin (void); |
| 35 |
|
| 36 |
void open (X_callback *callb, int cbarg, const char *path, const char *fext, const char *file = 0); |
| 37 |
|
| 38 |
const char *file (void) const { return _tfname->text (); } |
| 39 |
const char *wdir (void) const { return _wdir; } |
| 40 |
|
| 41 |
void set_home (const char *p) { _home = p; } |
| 42 |
void set_sess (const char *p) { _sess = p; } |
| 43 |
|
| 44 |
private: |
| 45 |
|
| 46 |
enum { B_CANCEL, B_ACTION, B_NEWDIR, B_DELETE, B_PARENT, B_GOHOME, B_GOSESS }; |
| 47 |
enum |
| 48 |
{ |
| 49 |
XMIN = 500, YMIN = 400, |
| 50 |
XMAX = 1000, YMAX = 800, |
| 51 |
XPOS = 150, YPOS = 150, |
| 52 |
LM = 4, RM = 4 |
| 53 |
}; |
| 54 |
|
| 55 |
virtual void handle_event (XEvent *xe); |
| 56 |
virtual void handle_callb (int, X_window*, _XEvent*); |
| 57 |
|
| 58 |
void expose (XExposeEvent *E); |
| 59 |
void resize (XConfigureEvent *E); |
| 60 |
void xcmesg (XClientMessageEvent *E); |
| 61 |
void redraw (void); |
| 62 |
void scandir (const char *path, const char *fext); |
| 63 |
void newdir (void); |
| 64 |
void remove (void); |
| 65 |
void select (XButtonEvent *E); |
| 66 |
void action (void); |
| 67 |
void show (const char *path, const char *fext); |
| 68 |
void hide (int cbarg); |
| 69 |
|
| 70 |
Atom _xatom; |
| 71 |
int _xs; |
| 72 |
int _ys; |
| 73 |
char _fext [64]; |
| 74 |
char _cdir [1024]; |
| 75 |
char _wdir [1024]; |
| 76 |
const char *_home; |
| 77 |
const char *_sess; |
| 78 |
X_callback *_callb; |
| 79 |
int _cbarg; |
| 80 |
X_mclist *_mclist; |
| 81 |
X_window *_wbottom; |
| 82 |
X_scroll *_scroll; |
| 83 |
X_textip *_tfpath; |
| 84 |
X_textip *_tfname; |
| 85 |
X_tbutton *_bcancel; |
| 86 |
X_tbutton *_baction; |
| 87 |
X_tbutton *_bnewdir; |
| 88 |
X_tbutton *_bdelete; |
| 89 |
X_tbutton *_bparent; |
| 90 |
X_tbutton *_bgohome; |
| 91 |
X_tbutton *_bgosess; |
| 92 |
}; |
| 93 |
|
| 94 |
|
| 95 |
#endif |