1 // $Id: WrappedStatic.h 508 2010-03-07 13:30:36Z felfert $ 2 // 3 // Copyright (C) 2006 The OpenNX Team 4 // Author: Fritz Elfert 5 // 6 // This program is free software; you can redistribute it and/or modify 7 // it under the terms of the GNU Library General Public License as 8 // published by the Free Software Foundation; either version 2 of the 9 // 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 Library General Public 17 // License along with this program; if not, write to the 18 // Free Software Foundation, Inc., 19 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 // 21 22 #ifndef _WRAPPED_STATIC_H_ 23 #define _WRAPPED_STATIC_H_ 24 25 #if defined(__GNUG__) && !defined(__APPLE__) 26 #pragma interface "WrappedStatic.cpp" 27 #endif 28 29 #include <wx/stattext.h> 30 31 class WrappedStaticText : public wxStaticText 32 { 33 DECLARE_DYNAMIC_CLASS(WrappedStaticText); 34 35 public: WrappedStaticText()36 WrappedStaticText() 37 : wxStaticText() 38 { 39 #if defined(__WXMSW__) || defined(__WXMAC__) 40 minwrap = -1; 41 inWrap = false; 42 #endif 43 } 44 45 WrappedStaticText(wxWindow *parent, wxWindowID id, const wxString &label, 46 const wxPoint &pos = wxDefaultPosition, 47 const wxSize &size = wxDefaultSize, 48 long style = 0, const wxString &name = wxStaticTextNameStr ) wxStaticText(parent,id,label,pos,size,style,name)49 : wxStaticText(parent, id, label, pos, size, style, name) 50 { 51 #if defined(__WXMSW__) || defined(__WXMAC__) 52 minwrap = -1; 53 inWrap = false; 54 #endif 55 } 56 57 #if defined(__WXMSW__) || defined(__WXMAC__) DoSetSize(int x,int y,int w,int h,int sizeFlags)58 virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags) 59 { 60 if ((!inWrap) && (w > minwrap)) { 61 minwrap = w; 62 Wrap(w); 63 } 64 wxStaticText::DoSetSize(x, y, w, h, sizeFlags); 65 } 66 67 void Wrap(int width); 68 69 private: 70 int minwrap; 71 bool inWrap; 72 #endif 73 }; 74 75 #endif 76