wxWindow::wxWindow()
{
// Generic
+ m_isWindow = TRUE; // An optimization
m_windowId = 0;
m_windowStyle = 0;
m_windowParent = NULL;
const wxString& name)
{
// Generic
+ m_isWindow = TRUE; // An optimization
m_windowId = 0;
m_windowStyle = 0;
m_windowParent = NULL;
*x = xx; *y = yy;
}
-void wxWindow::SetSize(int x, int y, int width, int height, int sizeFlags)
+void wxWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
// A bit of optimization to help sort out the flickers.
int oldX, oldY, oldW, oldH;
*/
}
-void wxWindow::SetClientSize(int width, int height)
+void wxWindow::DoSetClientSize(int width, int height)
{
if (m_drawingArea)
{
// Get the window with the focus
wxWindow *wxWindow::FindFocus()
{
- // TODO
- return NULL;
+ // TODO Problems:
+ // (1) Can there be multiple focussed widgets in an application?
+ // In which case we need to find the top-level window that's
+ // currently active.
+ // (2) The widget with the focus may not be in the widget table
+ // depending on which widgets I put in the table
+
+ wxNode *node = wxTopLevelWindows.First();
+ while (node)
+ {
+ wxWindow *win = (wxWindow *)node->Data();
+
+ Widget w = XmGetFocusWidget ((Widget) win->GetTopWidget()) ;
+
+ if (w != (Widget) NULL)
+ {
+ wxWindow* focusWin = wxGetWindowFromTable(w);
+ if (focusWin)
+ return focusWin;
+ }
+
+ node = node->Next();
+ }
+ return (wxWindow*) NULL;
}
void wxWindow::AddChild(wxWindow *child)
// Get the underlying X window and display
WXWindow wxWindow::GetXWindow() const
{
- return (WXWindow) XtWindow((Widget) GetMainWidget());
+ if (GetMainWidget())
+ return (WXWindow) XtWindow((Widget) GetMainWidget());
+ else
+ return (WXWindow) 0;
}
WXDisplay *wxWindow::GetXDisplay() const
{
- return (WXDisplay*) XtDisplay((Widget) GetMainWidget());
+ if (GetMainWidget())
+ return (WXDisplay*) XtDisplay((Widget) GetMainWidget());
+ else
+ return (WXDisplay*) NULL;
}
WXWidget wxWindow::GetMainWidget() const