Subversion Repositories Filer-Free

Rev

Rev 28 | Rev 30 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21 gdshaw@RISCPKG.ORG 1
// This file is part of the free Filer module for RISC OS.
2
// Copyright  2007 Graham Shaw.
3
// Redistribution and modification are permitted under the terms of the
4
// GNU General Public License (version 2 or any later version).
5
 
6
#ifndef FILER_FILER_WINDOW
7
#define FILER_FILER_WINDOW
8
 
9
#include "directory.h"
10
#include "window.h"
25 gdshaw@RISCPKG.ORG 11
#include "filer_options.h"
21 gdshaw@RISCPKG.ORG 12
 
13
class filer_application;
14
 
15
/** A class to represent a filer window. */
16
class filer_window:
17
        public window
18
{
19
private:
20
        /** The pathname of the directory to be viewed by the filer window. */
21
        char* _pathname;
22
 
25 gdshaw@RISCPKG.ORG 23
        /** The options applicable to this window. */
24
        filer_options _options;
25
 
21 gdshaw@RISCPKG.ORG 26
        /** The content of the directory. */
27
        directory _directory;
25 gdshaw@RISCPKG.ORG 28
 
29
        /** The width of one cell. */
30
        int _xcsize;
31
 
32
        /** The height of one cell. */
33
        int _ycsize;
34
 
35
        /** The number of columns. */
36
        int _xccount;
37
 
38
        /** The number of rows. */
39
        int _yccount;
21 gdshaw@RISCPKG.ORG 40
public:
41
        /** Construct filer window.
42
         * @param app the application to which this filer window belongs
43
         * @param pathname the pathname of the directory to be viewed
44
         * @param box the initial bounding box of the window
25 gdshaw@RISCPKG.ORG 45
         * @param options the initial options for the filer window
21 gdshaw@RISCPKG.ORG 46
         */
47
        filer_window(filer_application* app,const char* pathname,
25 gdshaw@RISCPKG.ORG 48
                const os_box& box,const filer_options& options);
21 gdshaw@RISCPKG.ORG 49
 
50
        /** Destroy filer window. */
51
        ~filer_window();
52
 
29 gdshaw@RISCPKG.ORG 53
        virtual void handle_redraw_request(wimp_draw& block);
28 gdshaw@RISCPKG.ORG 54
        virtual void handle_open_request(wimp_open& block);
29 gdshaw@RISCPKG.ORG 55
        virtual void handle_close_request(wimp_close& block);
21 gdshaw@RISCPKG.ORG 56
 
57
        /** Get pathname.
58
         * @return the pathname of the directory viewed by this filer window
59
         */
60
        const char* pathname() const
61
                { return _pathname; }
25 gdshaw@RISCPKG.ORG 62
 
63
        /** Get filer options.
64
         * @return the filer options applicable to this window
65
         */
66
        const filer_options& options() const
67
                { return _options; }
68
 
69
        /** Set filer options.
70
         * @param options the required filer options
71
         */
72
        void options(const filer_options& options);
21 gdshaw@RISCPKG.ORG 73
private:
74
        /** Reload directory listing. */
75
        void reload();
25 gdshaw@RISCPKG.ORG 76
 
77
        /** Reformat content of window. */
78
        void reformat();
79
 
80
        /** Reformat content of window to given width.
81
         * @param xsize the required width
82
         */
83
        void reformat(int xsize);
29 gdshaw@RISCPKG.ORG 84
 
85
        /** Open filer window for parent directory.
86
         * @param offset the position at which to open the top left-hand
87
         *  corner of the new filer window, with respect to the top left-hand
88
         *  corner of this one
89
         */
90
        void open_parent(const os_coord& offset) const;
21 gdshaw@RISCPKG.ORG 91
};
92
 
93
#endif