-bool wxWindow::IsShown() const
-{
- return m_isShown;
-}
-
-int wxWindow::GetCharHeight() const
-{
- if (!m_windowFont.Ok())
- return 0;
-
- WXFontStructPtr pFontStruct = m_windowFont.GetFontStruct(1.0, GetXDisplay());
-
- int direction, ascent, descent;
- XCharStruct overall;
- XTextExtents ((XFontStruct*) pFontStruct, "x", 1, &direction, &ascent,
- &descent, &overall);
-// return (overall.ascent + overall.descent);
- return (ascent + descent);
-}
-
-int wxWindow::GetCharWidth() const
-{
- if (!m_windowFont.Ok())
- return 0;
-
- WXFontStructPtr pFontStruct = m_windowFont.GetFontStruct(1.0, GetXDisplay());
-
- int direction, ascent, descent;
- XCharStruct overall;
- XTextExtents ((XFontStruct*) pFontStruct, "x", 1, &direction, &ascent,
- &descent, &overall);
- return overall.width;
-}
-
-/* Helper function for 16-bit fonts */
-static int str16len(const char *s)
-{
- int count = 0;
-
- while (s[0] && s[1]) {
- count++;
- s += 2;
- }
-
- return count;
-}
-
-void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
- int *descent, int *externalLeading, const wxFont *theFont, bool use16) const
-{
- wxFont *fontToUse = (wxFont *)theFont;
- if (!fontToUse)
- fontToUse = (wxFont *) & m_windowFont;
-
- if (!fontToUse->Ok())
- return;
-
- WXFontStructPtr pFontStruct = theFont->GetFontStruct(1.0, GetXDisplay());
-
- int direction, ascent, descent2;
- XCharStruct overall;
- int slen;
-
- if (use16) slen = str16len(string); else slen = strlen(string);
-
- if (use16)
- XTextExtents16((XFontStruct*) pFontStruct, (XChar2b *) (char*) (const char*) string, slen, &direction,
- &ascent, &descent2, &overall);
- else
- XTextExtents((XFontStruct*) pFontStruct, (char*) (const char*) string, slen, &direction,
- &ascent, &descent2, &overall);
-
- *x = (overall.width);
- *y = (ascent + descent2);
- if (descent)
- *descent = descent2;
- if (externalLeading)
- *externalLeading = 0;
-}
-
-void wxWindow::Refresh(bool eraseBack, const wxRect *rect)
-{
- Display *display = XtDisplay((Widget) GetMainWidget());
- Window thisWindow = XtWindow((Widget) GetMainWidget());
-
- XExposeEvent dummyEvent;
- int width, height;
- GetSize(&width, &height);
-
- dummyEvent.type = Expose;
- dummyEvent.display = display;
- dummyEvent.send_event = True;
- dummyEvent.window = thisWindow;
- if (rect)
- {
- dummyEvent.x = rect->x;
- dummyEvent.y = rect->y;
- dummyEvent.width = rect->width;
- dummyEvent.height = rect->height;
- }
- else
- {
- dummyEvent.x = 0;
- dummyEvent.y = 0;
- dummyEvent.width = width;
- dummyEvent.height = height;
- }
- dummyEvent.count = 0;
-
- if (eraseBack)
- {
- wxClientDC dc(this);
- wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
- dc.SetBackground(backgroundBrush);
- if (rect)
- dc.Clear(*rect);
- else
- dc.Clear();
- }
-
- XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
-}
-
-// Responds to colour changes: passes event on to children.
-void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
-{
- wxNode *node = GetChildren().First();
- while ( node )
- {
- // Only propagate to non-top-level windows
- wxWindow *win = (wxWindow *)node->Data();
- if ( win->GetParent() )
- {
- wxSysColourChangedEvent event2;
- event.m_eventObject = win;
- win->GetEventHandler()->ProcessEvent(event2);
- }
-
- node = node->Next();
- }
-}
-
-// This can be called by the app (or wxWindows) to do default processing for the current
-// event. Save message/event info in wxWindow so they can be used in this function.
-long wxWindow::Default()
-{
- // TODO
- return 0;
-}
-
-void wxWindow::InitDialog()
-{
- wxInitDialogEvent event(GetId());
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
-}
-
-// Default init dialog behaviour is to transfer data to window
-void wxWindow::OnInitDialog(wxInitDialogEvent& event)
-{
- TransferDataToWindow();
-}
-
-// Caret manipulation
-void wxWindow::CreateCaret(int w, int h)
-{
- m_caretWidth = w;
- m_caretHeight = h;
- m_caretEnabled = TRUE;
-}
-
-void wxWindow::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
-{
- // TODO
-}
-
-void wxWindow::ShowCaret(bool show)
-{
- // TODO
-}
-
-void wxWindow::DestroyCaret()
-{
- // TODO
- m_caretEnabled = FALSE;
-}
-
-void wxWindow::SetCaretPos(int x, int y)
-{
- // TODO
-}
-
-void wxWindow::GetCaretPos(int *x, int *y) const
-{
- // TODO
-}
-
-wxWindow *wxGetActiveWindow()
-{
- // TODO
- return NULL;
-}
-
-void wxWindow::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW, int incH)
-{
- m_minSizeX = minW;
- m_minSizeY = minH;
- m_maxSizeX = maxW;
- m_maxSizeY = maxH;
-
- if (!this->IsKindOf(CLASSINFO(wxFrame)))
- return;
-
- wxFrame *frame = (wxFrame *)this;
- Widget widget = (Widget) frame->GetShellWidget();
-
- if (minW > -1)
- XtVaSetValues(widget, XmNminWidth, minW, NULL);
- if (minH > -1)
- XtVaSetValues(widget, XmNminHeight, minH, NULL);
- if (maxW > -1)
- XtVaSetValues(widget, XmNmaxWidth, maxW, NULL);
- if (maxH > -1)
- XtVaSetValues(widget, XmNmaxHeight, maxH, NULL);
- if (incW > -1)
- XtVaSetValues(widget, XmNwidthInc, incW, NULL);
- if (incH > -1)
- XtVaSetValues(widget, XmNheightInc, incH, NULL);
-}
-
-void wxWindow::Centre(int direction)
-{
- int x, y, width, height, panel_width, panel_height, new_x, new_y;
-
- wxWindow *father = (wxWindow *)GetParent();
- if (!father)
- return;
-
- father->GetClientSize(&panel_width, &panel_height);
- GetSize(&width, &height);
- GetPosition(&x, &y);
-
- new_x = -1;
- new_y = -1;
-
- if (direction & wxHORIZONTAL)
- new_x = (int)((panel_width - width)/2);
-
- if (direction & wxVERTICAL)
- new_y = (int)((panel_height - height)/2);
-
- SetSize(new_x, new_y, -1, -1);
-
-}
-