1 /////////////////////////////////////////////////////////////////////////////// 2 // 3 // wxFormBuilder - A Visual Dialog Editor for wxWidgets. 4 // Copyright (C) 2005 José Antonio Hurtado 5 // 6 // This program is free software; you can redistribute it and/or 7 // modify it under the terms of the GNU General Public License 8 // as published by the Free Software Foundation; either version 2 9 // of the License, or (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software 18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 // 20 // Written by 21 // José Antonio Hurtado - joseantonio.hurtado@gmail.com 22 // Juan Antonio Ortega - jortegalalmolda@gmail.com 23 // 24 /////////////////////////////////////////////////////////////////////////////// 25 26 #ifndef RESIZABLEPANEL_H 27 #define RESIZABLEPANEL_H 28 29 #include <wx/wxprec.h> 30 #ifdef __BORLANDC__ 31 #pragma hdrstop 32 #endif 33 #ifndef WX_PRECOMP 34 #include <wx/wx.h> 35 #endif 36 37 #include <wx/event.h> 38 39 class ResizablePanel : public wxPanel 40 { 41 enum{ 42 NONE, 43 RIGHTBOTTOM, 44 RIGHT, 45 BOTTOM 46 } m_sizing; 47 48 int m_curX, m_curY, m_difX, m_difY; 49 int m_resizeBorder; 50 wxSize m_minSize; 51 public: 52 ResizablePanel(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, 53 const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL); 54 55 void SetResizeBorder(int border); 56 int GetResizeBorder(); 57 void SetMinSize(const wxSize& size); 58 wxSize GetMinSize(); 59 60 void OnMouseMotion(wxMouseEvent& e); 61 void OnLeftDown(wxMouseEvent& e); 62 void OnSetCursor(wxSetCursorEvent& e); 63 void OnLeftUp(wxMouseEvent& e); 64 //void OnSize(wxSizeEvent& e); 65 void OnPanelResized(wxSizeEvent &e); 66 67 DECLARE_EVENT_TABLE() 68 }; 69 70 BEGIN_DECLARE_EVENT_TYPES() 71 DECLARE_LOCAL_EVENT_TYPE(wxEVT_PANEL_RESIZED, 6000) 72 END_DECLARE_EVENT_TYPES() 73 74 #define EVT_PANEL_RESIZED(id, fn) \ 75 DECLARE_EVENT_TABLE_ENTRY( \ 76 wxEVT_PANEL_RESIZED, id, wxID_ANY, \ 77 (wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, &fn ), \ 78 (wxObject *) NULL \ 79 ), 80 81 #endif 82