| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/generic/panelg.cpp |
| 3 | // Purpose: wxPanel and the keyboard handling code |
| 4 | // Author: Julian Smart, Robert Roebling, Vadim Zeitlin |
| 5 | // Modified by: |
| 6 | // Created: 04/01/98 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | // ============================================================================ |
| 13 | // declarations |
| 14 | // ============================================================================ |
| 15 | |
| 16 | // ---------------------------------------------------------------------------- |
| 17 | // headers |
| 18 | // ---------------------------------------------------------------------------- |
| 19 | |
| 20 | // For compilers that support precompilation, includes "wx.h". |
| 21 | #include "wx/wxprec.h" |
| 22 | |
| 23 | #ifdef __BORLANDC__ |
| 24 | #pragma hdrstop |
| 25 | #endif |
| 26 | |
| 27 | #ifndef WX_PRECOMP |
| 28 | #include "wx/object.h" |
| 29 | #include "wx/font.h" |
| 30 | #include "wx/colour.h" |
| 31 | #include "wx/settings.h" |
| 32 | #include "wx/log.h" |
| 33 | #include "wx/panel.h" |
| 34 | #include "wx/containr.h" |
| 35 | #endif |
| 36 | |
| 37 | // ---------------------------------------------------------------------------- |
| 38 | // wxWin macros |
| 39 | // ---------------------------------------------------------------------------- |
| 40 | |
| 41 | #if wxUSE_EXTENDED_RTTI |
| 42 | WX_DEFINE_FLAGS( wxPanelStyle ) |
| 43 | |
| 44 | wxBEGIN_FLAGS( wxPanelStyle ) |
| 45 | // new style border flags, we put them first to |
| 46 | // use them for streaming out |
| 47 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) |
| 48 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) |
| 49 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) |
| 50 | wxFLAGS_MEMBER(wxBORDER_RAISED) |
| 51 | wxFLAGS_MEMBER(wxBORDER_STATIC) |
| 52 | wxFLAGS_MEMBER(wxBORDER_NONE) |
| 53 | |
| 54 | // old style border flags |
| 55 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) |
| 56 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) |
| 57 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) |
| 58 | wxFLAGS_MEMBER(wxRAISED_BORDER) |
| 59 | wxFLAGS_MEMBER(wxSTATIC_BORDER) |
| 60 | wxFLAGS_MEMBER(wxBORDER) |
| 61 | |
| 62 | // standard window styles |
| 63 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) |
| 64 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) |
| 65 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) |
| 66 | wxFLAGS_MEMBER(wxWANTS_CHARS) |
| 67 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) |
| 68 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) |
| 69 | wxFLAGS_MEMBER(wxVSCROLL) |
| 70 | wxFLAGS_MEMBER(wxHSCROLL) |
| 71 | |
| 72 | wxEND_FLAGS( wxPanelStyle ) |
| 73 | |
| 74 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow,"wx/panel.h") |
| 75 | |
| 76 | wxBEGIN_PROPERTIES_TABLE(wxPanel) |
| 77 | wxPROPERTY_FLAGS( WindowStyle , wxPanelStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style |
| 78 | // style wxTAB_TRAVERSAL |
| 79 | wxEND_PROPERTIES_TABLE() |
| 80 | |
| 81 | wxBEGIN_HANDLERS_TABLE(wxPanel) |
| 82 | wxEND_HANDLERS_TABLE() |
| 83 | |
| 84 | wxCONSTRUCTOR_5( wxPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle ) |
| 85 | |
| 86 | #else |
| 87 | IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow) |
| 88 | #endif |
| 89 | |
| 90 | BEGIN_EVENT_TABLE(wxPanel, wxWindow) |
| 91 | WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel) |
| 92 | END_EVENT_TABLE() |
| 93 | |
| 94 | // ============================================================================ |
| 95 | // implementation |
| 96 | // ============================================================================ |
| 97 | |
| 98 | WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel, wxWindow) |
| 99 | |
| 100 | // ---------------------------------------------------------------------------- |
| 101 | // wxPanel creation |
| 102 | // ---------------------------------------------------------------------------- |
| 103 | |
| 104 | void wxPanel::Init() |
| 105 | { |
| 106 | WX_INIT_CONTROL_CONTAINER(); |
| 107 | |
| 108 | #ifdef __WXMSW__ |
| 109 | m_isTransparent = false; |
| 110 | #endif // __WXMSW__ |
| 111 | } |
| 112 | |
| 113 | bool wxPanel::Create(wxWindow *parent, wxWindowID id, |
| 114 | const wxPoint& pos, |
| 115 | const wxSize& size, |
| 116 | long style, |
| 117 | const wxString& name) |
| 118 | { |
| 119 | if ( !wxWindow::Create(parent, id, pos, size, style, name) ) |
| 120 | return false; |
| 121 | |
| 122 | // so that non-solid background renders correctly under GTK+: |
| 123 | SetThemeEnabled(true); |
| 124 | |
| 125 | #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__)) |
| 126 | // Required to get solid control backgrounds under WinCE |
| 127 | SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); |
| 128 | #endif |
| 129 | |
| 130 | return true; |
| 131 | } |
| 132 | |
| 133 | wxPanel::~wxPanel() |
| 134 | { |
| 135 | } |
| 136 | |
| 137 | void wxPanel::InitDialog() |
| 138 | { |
| 139 | wxInitDialogEvent event(GetId()); |
| 140 | event.SetEventObject(this); |
| 141 | GetEventHandler()->ProcessEvent(event); |
| 142 | } |
| 143 | |