OSDN Git Service

イニシャルコミット。
[marathon/ShapeFusion.git] / Shapes / FrameBrowser.h
1 /*
2  * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
3  *
4  * ShapeFusion is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * ShapeFusion is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with ShapeFusion; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18
19 //
20 // FrameBrowser
21 // A widget for displaying a list of ShapesFrame's as a scrollable list
22 // of selectable thumbnails. Each thumbnail displays the frame's
23 // associated bitmap, altered with the specified mirror transformations.
24 //
25
26 #ifndef FRAMEBROWSER_H
27 #define FRAMEBROWSER_H
28
29 #include "wx/wxprec.h"
30 #ifndef WX_PRECOMP
31     #include "wx/wx.h"
32 #endif
33 #include "ShapesElements.h"
34
35 DECLARE_EVENT_TYPE(wxEVT_FRAMEBROWSER, -1)
36 DECLARE_EVENT_TYPE(wxEVT_FRAMEBROWSER_DELETE, -1)
37
38 class FrameBrowser: public wxScrolledWindow {
39 private:
40         vector<ShapesFrame*>    mFrames;                        // pointers to frames
41         vector<ShapesBitmap*>   mBitmaps;                       // pointers to bitmaps
42         vector<wxBitmap>                mThumbnails;            // scaled/rendered frame thumbnails
43         ShapesColorTable                *mColorTable;           // which palette to use for display
44         vector<wxPoint>                 mThumbnailPositions;    // thumbnail positions within window
45         wxCoord                                 mThumbnailSize,
46                                                         mMargin;                        // margin between thumbnails and window edges
47         bool                                    mAutoSize,
48                                                         mWhiteTransparency;
49         int                                             mSelection,
50                                                         mNumCols,
51                                                         mNumRows;
52         wxPen                                   mThumbnailPen,
53                                                         mSelectionPen;
54         unsigned int                    mFrozenCount;
55
56         wxBitmap CreateThumbnail(ShapesFrame *fp);
57         void UpdateVirtualSize(void);
58
59 protected:
60         DECLARE_EVENT_TABLE();
61
62 public:
63         FrameBrowser(wxWindow *parent, wxWindowID id);
64         // event handlers
65         void OnPaint(wxPaintEvent& e);
66         void OnSize(wxSizeEvent& e);
67         void OnMouseDown(wxMouseEvent& e);
68         void OnKeyDown(wxKeyEvent& e);
69         // wx things
70         void Freeze(void);
71         void Thaw(void);
72         // access methods
73         int GetSelection(void) const;
74         void SetThumbnailSize(int size);
75         void SetTranspPixelsDisplay(bool show);
76         void AddFrame(ShapesFrame *fp);
77         void AddBitmap(ShapesBitmap *bp);
78         void SetColorTable(ShapesColorTable *ct);
79         void Clear(void);
80         void ClearBitmaps(void);
81         // utilities
82         void RebuildThumbnail(unsigned int i);
83         void RebuildThumbnails(void);
84 };
85
86 #endif