#include "wx/button.h"
#include "wx/settings.h"
#include "wx/msgdlg.h"
+#include "wx/frame.h"
#include "wx/menuitem.h"
#include "wx/log.h"
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
#include "wx/dnd.h"
#endif
BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
EVT_CHAR(wxWindow::OnChar)
+ EVT_KEY_DOWN(wxWindow::OnKeyDown)
+ EVT_KEY_UP(wxWindow::OnKeyUp)
EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindow::OnInitDialog)
wxWindow::wxWindow()
{
// Generic
+ m_isWindow = TRUE; // An optimization
m_windowId = 0;
m_windowStyle = 0;
m_windowParent = NULL;
m_caretWidth = 0; m_caretHeight = 0;
m_caretEnabled = FALSE;
m_caretShown = FALSE;
- m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
+ m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
+ // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_foregroundColour = *wxBLACK;
- m_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL;
#endif
}
// Have to delete constraints/sizer FIRST otherwise
// sizers may try to look at deleted windows as they
// delete themselves.
-#if USE_CONSTRAINTS
+#if wxUSE_CONSTRAINTS
DeleteRelatedConstraints();
if (m_constraints)
{
const wxString& name)
{
// Generic
+ m_isWindow = TRUE; // An optimization
m_windowId = 0;
m_windowStyle = 0;
m_windowParent = NULL;
m_autoLayout = FALSE;
m_windowValidator = NULL;
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
m_pDropTarget = NULL;
#endif
else
m_windowId = id;
- m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
+ // m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
+ m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_foregroundColour = *wxBLACK;
- m_defaultForegroundColour = *wxBLACK ;
- m_defaultBackgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
m_windowStyle = style;
return NULL;
}
-#if USE_DRAG_AND_DROP
+#if wxUSE_DRAG_AND_DROP
void wxWindow::SetDropTarget(wxDropTarget *pDropTarget)
{
if ( m_pDropTarget != 0 ) {
- m_pDropTarget->Revoke(m_hWnd);
delete m_pDropTarget;
}
m_pDropTarget = pDropTarget;
if ( m_pDropTarget != 0 )
- m_pDropTarget->Register(m_hWnd);
+ {
+ // TODO
+ }
}
#endif
// TODO
}
-void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect)
+void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
{
// TODO
}
// Responds to colour changes: passes event on to children.
void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
{
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
// Only propagate to non-top-level windows
void wxWindow::SetScrollPos(int orient, int pos, bool refresh)
{
// TODO
- return 0;
+ return;
}
// New function that will replace some of the above.
}
// Does a physical scroll
-void wxWindow::ScrollWindow(int dx, int dy, const wxRectangle *rect)
+void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
{
// TODO
- return 0;
+ return;
}
void wxWindow::SetFont(const wxFont& font)
void wxWindow::OnChar(wxKeyEvent& event)
{
+/* ??
if ( event.KeyCode() == WXK_TAB ) {
// propagate the TABs to the parent - it's up to it to decide what
// to do with it
return;
}
}
+*/
+ Default();
+}
+
+void wxWindow::OnKeyDown(wxKeyEvent& event)
+{
+ Default();
+}
+
+void wxWindow::OnKeyUp(wxKeyEvent& event)
+{
+ Default();
}
void wxWindow::OnPaint(wxPaintEvent& event)
// it's an application error (pops up a dialog)
bool wxWindow::TransferDataToWindow()
{
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
// validation failed: don't quit
bool wxWindow::TransferDataFromWindow()
{
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
bool wxWindow::Validate()
{
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
void wxWindow::AddChild(wxWindow *child)
{
- GetChildren()->Append(child);
+ GetChildren().Append(child);
child->m_windowParent = this;
}
void wxWindow::RemoveChild(wxWindow *child)
{
- if (GetChildren())
- GetChildren()->DeleteObject(child);
+ GetChildren().DeleteObject(child);
child->m_windowParent = NULL;
}
void wxWindow::DestroyChildren()
{
- if (GetChildren()) {
wxNode *node;
- while ((node = GetChildren()->First()) != (wxNode *)NULL) {
+ while ((node = GetChildren().First()) != (wxNode *)NULL) {
wxWindow *child;
if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) {
delete child;
- if ( GetChildren()->Member(child) )
+ if ( GetChildren().Member(child) )
delete node;
}
} /* while */
- }
}
void wxWindow::MakeModal(bool modal)
void wxWindow::OnCommand(wxWindow& win, wxCommandEvent& event)
{
if (GetEventHandler()->ProcessEvent(event) )
- return;
+ return;
if (m_windowParent)
m_windowParent->GetEventHandler()->OnCommand(win, event);
}
{
noChanges = 0;
noFailures = 0;
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while (node)
{
wxWindow *child = (wxWindow *)node->Data();
constr->centreX.SetDone(FALSE);
constr->centreY.SetDone(FALSE);
}
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while (node)
{
wxWindow *win = (wxWindow *)node->Data();
if (recurse)
{
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while (node)
{
wxWindow *win = (wxWindow *)node->Data();
{
wxCloseEvent event(wxEVT_CLOSE_WINDOW, m_windowId);
event.SetEventObject(this);
+#if WXWIN_COMPATIBILITY
event.SetForce(force);
+#endif
+ event.SetCanVeto(!force);
return GetEventHandler()->ProcessEvent(event);
}
wxObject* wxWindow::GetChild(int number) const
{
// Return a pointer to the Nth object in the window
- if (!GetChildren())
- return(NULL) ;
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
int n = number;
while (node && n--)
node = node->Next() ;
{
int maxX = 0;
int maxY = 0;
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
wxWindow *win = (wxWindow *)node->Data();
m_windowValidator->SetWindow(this) ;
}
+void wxWindow::SetAcceleratorTable(const wxAcceleratorTable& accel)
+{
+ m_acceleratorTable = accel;
+}
+
// Find a window by id or name
wxWindow *wxWindow::FindWindow(long id)
{
if ( GetId() == id)
return this;
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
if ( GetName() == name)
return this;
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while ( node )
{
wxWindow *child = (wxWindow *)node->Data();
return (m_updateRegion.Contains(rect) != wxOutRegion);
}
+void wxWindow::SetToolTip(const wxString& tooltip)
+{
+ // TODO
+}
+
+/*
+ * Allocates control IDs
+ */
+
+int wxWindow::NewControlId()
+{
+ static int s_controlId = 0;
+ s_controlId ++;
+ return s_controlId;
+}
+