FileTabs.h

IƱaki Zabala, 06/27/2020 01:27 AM

Download (1.73 KB)

 
1
class FileTabs : public TabBar
2
{
3
private:
4
        bool stackedicons:1;
5
        bool greyedicons:1;
6
        Color filecolor;
7
        Color extcolor;
8
protected:
9
        // Overload this to change grouping behaviour
10
        virtual String GetFileGroup(const String &file);
11
        // Overload this to change stacking behaviour
12
        virtual String GetStackId(const Tab &a);
13
        virtual hash_t GetStackSortOrder(const Tab &a);        
14
        
15
        virtual void ComposeTab(Tab& tab, const Font &font, Color ink, int style);
16
        virtual void ComposeStackedTab(Tab& tab, const Tab& stacked_tab, const Font &font, Color ink, int style);
17
        virtual Size GetStackedSize(const Tab &t);
18
        
19
public:
20
        FileTabs();
21

    
22
        virtual void Serialize(Stream& s);
23

    
24
        void          AddFile(const WString &file, bool make_active = true);
25
        void          AddFile(const WString &file, Image img, bool make_active = true);
26
        void          InsertFile(int ix, const WString &file, bool make_active = true);
27
        void          InsertFile(int ix, const WString &file, Image img, bool make_active = true);
28

    
29
        void         AddFiles(const Vector<String> &files, bool make_active = true);
30
        void          AddFiles(const Vector<String> &files, const Vector<Image> &img, bool make_active = true);
31
        void          InsertFiles(int ix, const Vector<String> &files, bool make_active = true);
32
        void          InsertFiles(int ix, const Vector<String> &files, const Vector<Image> &img, bool make_active = true);
33
        
34
        void         RenameFile(const WString &from, const WString &to, Image icon = Null);
35
        
36
        FileTabs& FileColor(Color c)         { filecolor = c; Refresh(); return *this; }
37
        FileTabs& ExtColor(Color c)         { extcolor = c; Refresh(); return *this; }
38
        
39
        FileTabs& FileIcons(bool normal = true, bool stacked = true, bool stacked_greyedout = true);
40
        
41
        Vector<String>        GetFiles() const;
42
        FileTabs& operator<<(const FileTabs &src);
43
};