Panel.cpp
gehe zur Dokumentation dieser Datei
00001 
00028 // ============================================================================
00029 // declarations
00030 // ============================================================================
00031 
00032 // ----------------------------------------------------------------------------
00033 // headers
00034 // ----------------------------------------------------------------------------
00035 
00036 // For compilers that support precompilation, includes "wx.h".
00037 #include "wx/wxprec.h"
00038 
00039 #ifdef __BORLANDC__
00040     #pragma hdrstop
00041 #endif
00042 
00043 #ifndef WX_PRECOMP
00044     #include "wx/object.h"
00045     #include "wx/font.h"
00046     #include "wx/colour.h"
00047     #include "wx/settings.h"
00048     #include "wx/log.h"
00049     #include "wx/panel.h"
00050     #include "wx/containr.h"
00051 #endif
00052 
00053 // ----------------------------------------------------------------------------
00054 // wxWin macros
00055 // ----------------------------------------------------------------------------
00056 
00057 #if wxUSE_EXTENDED_RTTI
00058 WX_DEFINE_FLAGS( MutPanelStyle )
00059 
00060 wxBEGIN_FLAGS( MutPanelStyle )
00061     // new style border flags, we put them first to
00062     // use them for streaming out
00063     wxFLAGS_MEMBER(wxBORDER_SIMPLE)
00064     wxFLAGS_MEMBER(wxBORDER_SUNKEN)
00065     wxFLAGS_MEMBER(wxBORDER_DOUBLE)
00066     wxFLAGS_MEMBER(wxBORDER_RAISED)
00067     wxFLAGS_MEMBER(wxBORDER_STATIC)
00068     wxFLAGS_MEMBER(wxBORDER_NONE)
00069 
00070     // old style border flags
00071     wxFLAGS_MEMBER(wxSIMPLE_BORDER)
00072     wxFLAGS_MEMBER(wxSUNKEN_BORDER)
00073     wxFLAGS_MEMBER(wxDOUBLE_BORDER)
00074     wxFLAGS_MEMBER(wxRAISED_BORDER)
00075     wxFLAGS_MEMBER(wxSTATIC_BORDER)
00076     wxFLAGS_MEMBER(wxBORDER)
00077 
00078     // standard window styles
00079     wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
00080     wxFLAGS_MEMBER(wxCLIP_CHILDREN)
00081     wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
00082     wxFLAGS_MEMBER(wxWANTS_CHARS)
00083     wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
00084     wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
00085     wxFLAGS_MEMBER(wxVSCROLL)
00086     wxFLAGS_MEMBER(wxHSCROLL)
00087 
00088 wxEND_FLAGS( MutPanelStyle )
00089 
00090 IMPLEMENT_DYNAMIC_CLASS_XTI(MutPanel, wxControl,"Panel.h")
00091 
00092 wxBEGIN_PROPERTIES_TABLE(MutPanel)
00093     wxPROPERTY_FLAGS( WindowStyle , MutPanelStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
00094 // style wxTAB_TRAVERSAL
00095 wxEND_PROPERTIES_TABLE()
00096 
00097 wxBEGIN_HANDLERS_TABLE(MutPanel)
00098 wxEND_HANDLERS_TABLE()
00099 
00100 wxCONSTRUCTOR_5( MutPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
00101 
00102 #else
00103 IMPLEMENT_DYNAMIC_CLASS(MutPanel, wxControl)
00104 #endif
00105 
00106 BEGIN_EVENT_TABLE(MutPanel, wxControl)
00107     EVT_SIZE(MutPanel::OnSize)
00108 
00109     WX_EVENT_TABLE_CONTROL_CONTAINER(MutPanel)
00110 END_EVENT_TABLE()
00111 
00112 // ============================================================================
00113 // implementation
00114 // ============================================================================
00115 
00116 WX_DELEGATE_TO_CONTROL_CONTAINER(MutPanel, wxControl)
00117 
00118 // ----------------------------------------------------------------------------
00119 // wxPanel creation
00120 // ----------------------------------------------------------------------------
00121 
00122 void MutPanel::Init()
00123 {
00124     m_container.SetContainerWindow(this);
00125 }
00126 
00127 bool MutPanel::Create(wxWindow *parent,
00128                       wxWindowID winid,
00129                       const wxPoint& pos,
00130                       const wxSize& size,
00131                       long style,
00132                       const wxValidator& validator,
00133                       const wxString& name)
00134 {
00135         if (!wxControl::Create( parent, winid, pos, size, style, validator, name))
00136                 return false;
00137         
00138         // so we don't have too much problems with background style settings.
00139         SetBackgroundStyle(wxBG_STYLE_SYSTEM);
00140             
00141         // so that non-solid background renders correctly under GTK+:
00142         SetThemeEnabled(true);
00143 
00144 #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__))
00145         // Required to get solid control backgrounds under WinCE
00146         SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
00147 #endif
00148 
00149         return true;
00150 }
00151 
00152 MutPanel::~MutPanel()
00153 {
00154 }
00155 
00156 void MutPanel::InitDialog()
00157 {
00158         wxInitDialogEvent event(GetId());
00159         event.SetEventObject(this);
00160         GetEventHandler()->ProcessEvent(event);
00161 }
00162 
00163 // ----------------------------------------------------------------------------
00164 // event handlers
00165 // ----------------------------------------------------------------------------
00166 
00167 void MutPanel::OnSize(wxSizeEvent& event)
00168 {
00169     if (GetAutoLayout())
00170         Layout();
00171 #if wxUSE_CONSTRAINTS
00172 #if defined(__WXPM__) && 0
00173     else
00174     {
00175         // Need to properly move child windows under OS/2
00176 
00177         PSWP                        pWinSwp = GetSwp();
00178 
00179         if (pWinSwp->cx == 0 && pWinSwp->cy == 0 && pWinSwp->fl == 0)
00180         {
00181             // Uninitialized
00182 
00183             ::WinQueryWindowPos(GetHWND(), pWinSwp);
00184         }
00185         else
00186         {
00187             SWP                     vSwp;
00188             int                     nYDiff;
00189 
00190             ::WinQueryWindowPos(GetHWND(), &vSwp);
00191             nYDiff = pWinSwp->cy - vSwp.cy;
00192             MoveChildren(nYDiff);
00193             pWinSwp->cx = vSwp.cx;
00194             pWinSwp->cy = vSwp.cy;
00195         }
00196     }
00197 #endif
00198 #endif // wxUSE_CONSTRAINTS
00199 
00200     event.Skip();
00201 }
00202 
00203 

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