BoxIconShape.cpp
gehe zur Dokumentation dieser Datei
00001 // -*-C++ -*-
00059 //#include "Defs.h"
00060 //#include "wx/wx.h"
00061 #include "BoxIconShape.h"
00062 //#include "MutApp.h"
00063 //#include "MutIcon.h"
00064 //#include "MutRouteWnd.h"
00065 //#include "InputDevDlg.h"
00066 //#include "Device.h"
00067 
00068 
00069 
00070 void MutBoxIconShape::GetBordersForSizer(int &borderTop, int &borderOther) const
00071 {
00072         const int BORDER = 5; // FIXME: hardcoded value
00073 
00074         wxSize s = DoGetBestSize();
00075         DEBUGLOG (other, _T("Best Size: %dx%d"),s.x,s.y);
00076         /*      if (GetIcon().IsOk()) {
00077                 s.x = std::max (GetIcon().GetWidth(), s.x);
00078                 s.y += GetIcon().GetHeight();
00079                 }
00080                 return s;
00081         */
00082         borderTop = s.y;
00083         borderOther = 0;
00084 }
00085 
00086 void MutBoxIconShape::OnDraw (wxDC & dc) 
00087 {
00088         DEBUGLOG (other, _T("Checking icon"));
00089 
00090         if (!GetIcon().IsOk()) {
00091                 SetIcon(GetMutIcon());
00092                 DEBUGLOG (other, _T("Checking icon again"));
00093 
00094         }
00095         DEBUGLOG (other, _T("Icon ok."));
00096 
00097         int x, y;
00098         x = 0;
00099         y = 0;
00100         wxRect size = GetRect();
00101         if (staticText) y += staticText->GetSize().y;
00102         if (GetIcon().IsOk()) {
00103                 DEBUGLOG (other, _T("Size: %dx%d"),GetIcon().GetHeight(),
00104                          GetIcon().GetWidth());
00105                 x = (size.width-GetIcon().GetWidth())/2;
00106                 dc.DrawIcon(GetIcon(), x, y);
00107         }
00108 
00109         DEBUGLOG (other, _T("Focus %p and this %p"),FindFocus(),this);
00110         if (FindFocus() == this) {
00111                 DEBUGLOG (other, _T("Painting Box"));
00112                 dc.SetPen(*wxBLACK_PEN);
00113                 dc.SetBrush(*wxTRANSPARENT_BRUSH);
00114                 dc.DrawRectangle(0,0,size.width,size.height);
00115         }
00116 }
00117 
00118 bool MutBoxIconShape::Layout() {
00119         if (!MutIconShape::Layout()) return false;
00120         DEBUGLOG (other, _T(""));
00121         if (staticText) {
00122                 staticText->Move(0,0);
00123                 staticText->CentreOnParent(wxHORIZONTAL);
00124         }
00125         return true;
00126 }
00127 
00128 
00129 
00130 /*
00131  * \}
00132  */

Erzeugt am Sun Aug 21 2011 10:51:55 für Mutabor von doxygen 1.7.4