Subversion Repositories Filer-Free

Rev

Rev 29 | Rev 31 | 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);
30 gdshaw@RISCPKG.ORG 56
        virtual void handle_mouse_click(wimp_pointer& block);
21 gdshaw@RISCPKG.ORG 57
 
58
        /** Get pathname.
59
         * @return the pathname of the directory viewed by this filer window
60
         */
61
        const char* pathname() const
62
                { return _pathname; }
25 gdshaw@RISCPKG.ORG 63
 
64
        /** Get filer options.
65
         * @return the filer options applicable to this window
66
         */
67
        const filer_options& options() const
68
                { return _options; }
69
 
70
        /** Set filer options.
71
         * @param options the required filer options
72
         */
73
        void options(const filer_options& options);
21 gdshaw@RISCPKG.ORG 74
private:
75
        /** Reload directory listing. */
76
        void reload();
25 gdshaw@RISCPKG.ORG 77
 
78
        /** Reformat content of window. */
79
        void reformat();
80
 
81
        /** Reformat content of window to given width.
82
         * @param xsize the required width
83
         */
84
        void reformat(int xsize);
29 gdshaw@RISCPKG.ORG 85
 
30 gdshaw@RISCPKG.ORG 86
        /** Find the cell which contains a given point.
87
         * @param p the point to be found
88
         * @return the cell index if found, otherwise npos
89
         */
90
        unsigned int find_cell(const os_coord& p);
91
 
92
        /** Force a redraw of a given cell.
93
         * @param index the index of the cell to be redrawn
94
         */
95
        void force_redraw_cell(unsigned int index);
96
 
97
        /** Select or deselect all objects
98
         * @param selected the required selection state
99
         */
100
        void select_all(int selected);
101
 
29 gdshaw@RISCPKG.ORG 102
        /** Open filer window for parent directory.
103
         * @param offset the position at which to open the top left-hand
104
         *  corner of the new filer window, with respect to the top left-hand
105
         *  corner of this one
106
         */
107
        void open_parent(const os_coord& offset) const;
21 gdshaw@RISCPKG.ORG 108
};
109
 
110
#endif