fix compile against newer giflib
[rofl0r-obeditor.git] / src / entity__wListFrames.h
blob4041966329be6acf70a8c6641961e53b708f61b8
1 /*
2 * wListFrames_Base.h
4 * Created on: 6 nov. 2008
5 * Author: pat
6 */
8 #ifndef WLISTFRAMES_H_
9 #define WLISTFRAMES_H_
12 //****************************************************
14 #include <list>
15 #include <map>
16 #include <vector>
18 #include "common__tools.h"
21 //****************************************************
22 //****************************************************
23 class FrameImgManager
25 public:
26 wxBitmap* BmpGet(const wxString& ob_imgPath );
27 void Invalidate(const wxString& ob_imgPath );
28 void Invalidate_ALL();
30 protected:
31 std::map<wxString,wxBitmap*> map_Path_Bmps;
35 //****************************************************
37 class wListFrames : public wxControl
39 public:
40 static FrameImgManager theFrameImgManager;
42 public:
43 wListFrames( wxWindow *parent );
44 void AssociateToListAnims( wxWindow* _wList_anims);
45 virtual ~wListFrames();
47 //------------------------------------------------------
48 void ReloadFrames(bool b_invalidate_images = false);
50 void On_Selection_Bounds_Change();
51 void On_Ind_ActiveFrame_Change();
53 //------------------------------------------------------
54 void EvtPaint(wxPaintEvent& event );
55 void EvtSize( wxSizeEvent& event );
57 //------------------------------------------------------
58 void EvtScrollDown( wxScrollWinEvent& event );
59 void EvtScrollUp( wxScrollWinEvent& event );
60 void EvtScroll( wxScrollWinEvent& event );
61 void UpdateScrollBar();
63 //------------------------------------------------------
64 virtual void EvtMouseSomething(wxMouseEvent& event);
65 virtual void EvtCharPress(wxKeyEvent& event);
66 void EvtGetFocus(wxFocusEvent& event );
68 //------------------------------------------------------
69 void RefreshSelection(bool b_redo = true );
70 void RestoreSelection( int sv_ind_active, int sv_ind_first, int sv_ind_last );
71 void GetSelection( int& sv_ind_active, int& sv_ind_first, int& sv_ind_last );
72 // -200 to Deselect
73 void SetSelected( int ind_frame = -200
74 , int mod_AddToSelection = 0
75 , bool b_propagate = true );
76 void GetSelectedFrames( int& first_to_play, int& last_to_play );
77 ob_frame* GetActiveFrame()const;
79 //------------------------------------------------------
80 void SetFlipFrame( int _flip_frame );
81 void SetLandFrame( int _landframe );
82 void SetDropFrame( int _dropframe );
83 void SetJumpFrame( int _jumpframe );
85 int GetSelectedFirst(){return select_first;};
86 int GetSelectedLast(){return select_last;};
87 protected:
88 //---------------------------------------------------------
89 // The associated list of anims
90 wxWindow* wList_anims;
91 int total_w;
93 //---------------------------------------------------------
94 class FrameData
96 public:
97 FrameData():pos(0,0),size(0,0),related_frame(NULL){};
98 wxSize pos;
99 wxSize size;
100 ob_frame* related_frame;
103 std::vector<FrameData*> v_frames_datas;
105 //---------------------------------------------------------
106 // ind of the first and last frames selected
107 int select_first, select_last;
108 // the frame that get the mouseDown event
109 int last_indframe_mouseDown;
110 // the frame that have the dragging cursor on his right
111 int mouseDragging__last_left_frame;
113 int GetFrameIndFromPos( int _x, int _y )const;
114 void GetCoupleFramesAssidePos( int m_x, int m_y, int &ind_left, int &ind_right )const ;
116 //---------------------------------------------------------
117 enum
119 M_LOADING = 1,
120 M_REFRESHING = 2,
121 M_REFRESH_SELECTION = 4,
122 M_HAVE_DRAGGED = 8,
124 int m_flag;
126 //---------------------------------------------------------
127 void Clear(bool b_really_all = true);
129 public:
130 //---------------------------------------------------------
131 wxSize DoGetBestSize() const;
133 DECLARE_EVENT_TABLE()
137 //****************************************************
139 class wListFrames_Editable : public wListFrames
141 public:
142 wListFrames_Editable( wxWindow *parent );
143 virtual ~wListFrames_Editable();
145 protected:
146 virtual void EvtMouseSomething(wxMouseEvent& event);
147 virtual void EvtCharPress(wxKeyEvent& event);
148 void EvtGetFocus(wxFocusEvent& event );
149 void EvtNewFrame(wxCommandEvent& event );
150 void EvtDeleteFrame(wxCommandEvent& event );
151 void EvtCopyFrame(wxCommandEvent& event );
152 void EvtContextMenu( wxContextMenuEvent& event );
154 bool DoDragging(int ind_frame, int ind_left, int ind_right, wxMouseEvent& event );
155 wxMenu *popMenu;
157 DECLARE_EVENT_TABLE()
160 #endif /* WLISTFRAMES_BASE_H_ */