]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/window.cpp
Add doc for wxGraphicsContext.Create(), which is a lightweight context with no target...
[wxWidgets.git] / src / motif / window.cpp
index 32f3dabc2eee7c3951ba4e533463e8a8fa73c909..a3db88113b741fde9c32a9b29e43fee3981c7425 100644 (file)
@@ -38,6 +38,7 @@
 #endif
 
 #include "wx/evtloop.h"
 #endif
 
 #include "wx/evtloop.h"
+#include "wx/unix/utilsx11.h"
 
 #if  wxUSE_DRAG_AND_DROP
     #include "wx/dnd.h"
 
 #if  wxUSE_DRAG_AND_DROP
     #include "wx/dnd.h"
@@ -131,8 +132,6 @@ static int str16len(const char *s)
 // event tables
 // ----------------------------------------------------------------------------
 
 // event tables
 // ----------------------------------------------------------------------------
 
-    IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-
     BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
         EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
     END_EVENT_TABLE()
     BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
         EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
     END_EVENT_TABLE()
@@ -345,11 +344,11 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
 // Destructor
 wxWindow::~wxWindow()
 {
 // Destructor
 wxWindow::~wxWindow()
 {
+    SendDestroyEvent();
+
     if (g_captureWindow == this)
         g_captureWindow = NULL;
 
     if (g_captureWindow == this)
         g_captureWindow = NULL;
 
-    m_isBeingDeleted = true;
-
     // Motif-specific actions first
     WXWidget wMain = GetMainWidget();
     if ( wMain )
     // Motif-specific actions first
     WXWidget wMain = GetMainWidget();
     if ( wMain )
@@ -688,10 +687,10 @@ bool wxWindow::SetCursor(const wxCursor& cursor)
         return false;
     }
 
         return false;
     }
 
-    //    wxASSERT_MSG( m_cursor.Ok(),
+    //    wxASSERT_MSG( m_cursor.IsOk(),
     //                  wxT("cursor must be valid after call to the base version"));
     const wxCursor* cursor2 = NULL;
     //                  wxT("cursor must be valid after call to the base version"));
     const wxCursor* cursor2 = NULL;
-    if (m_cursor.Ok())
+    if (m_cursor.IsOk())
         cursor2 = & m_cursor;
     else
         cursor2 = wxSTANDARD_CURSOR;
         cursor2 = & m_cursor;
     else
         cursor2 = wxSTANDARD_CURSOR;
@@ -1083,7 +1082,6 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 
     menu->SetId(1); /* Mark as popped-up */
     menu->CreateMenu(NULL, widget, menu, 0);
 
     menu->SetId(1); /* Mark as popped-up */
     menu->CreateMenu(NULL, widget, menu, 0);
-    menu->SetInvokingWindow(this);
 
     menu->UpdateUI();
 
 
     menu->UpdateUI();
 
@@ -1456,7 +1454,7 @@ int wxWindow::GetCharHeight() const
 {
     int height;
 
 {
     int height;
 
-    if (m_font.Ok())
+    if (m_font.IsOk())
         wxGetTextExtent (GetXDisplay(), m_font, 1.0,
                          "x", NULL, &height, NULL, NULL);
     else
         wxGetTextExtent (GetXDisplay(), m_font, 1.0,
                          "x", NULL, &height, NULL, NULL);
     else
@@ -1469,7 +1467,7 @@ int wxWindow::GetCharWidth() const
 {
     int width;
 
 {
     int width;
 
-    if (m_font.Ok())
+    if (m_font.IsOk())
         wxGetTextExtent (GetXDisplay(), m_font, 1.0,
                          "x", &width, NULL, NULL, NULL);
     else
         wxGetTextExtent (GetXDisplay(), m_font, 1.0,
                          "x", &width, NULL, NULL, NULL);
     else
@@ -1478,16 +1476,17 @@ int wxWindow::GetCharWidth() const
     return width;
 }
 
     return width;
 }
 
-void wxWindow::GetTextExtent(const wxString& string,
-                             int *x, int *y,
-                             int *descent, int *externalLeading,
-                             const wxFont *theFont) const
+void wxWindow::DoGetTextExtent(const wxString& string,
+                               int *x, int *y,
+                               int *descent,
+                               int *externalLeading,
+                               const wxFont *theFont) const
 {
     const wxFont *fontToUse = theFont ? theFont : &m_font;
 
     if (externalLeading)
         *externalLeading = 0;
 {
     const wxFont *fontToUse = theFont ? theFont : &m_font;
 
     if (externalLeading)
         *externalLeading = 0;
-    if (fontToUse->Ok())
+    if (fontToUse->IsOk())
         wxGetTextExtent (GetXDisplay(), *fontToUse, 1.0,
                          string, x, y, NULL, descent);
     else
         wxGetTextExtent (GetXDisplay(), *fontToUse, 1.0,
                          string, x, y, NULL, descent);
     else
@@ -1653,14 +1652,6 @@ void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
     }
 }
 
     }
 }
 
-void wxWindow::OnInternalIdle()
-{
-    // This calls the UI-update mechanism (querying windows for
-    // menu/toolbar/control state information)
-    if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
-        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
-}
-
 // ----------------------------------------------------------------------------
 // accelerators
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // accelerators
 // ----------------------------------------------------------------------------
@@ -1668,7 +1659,7 @@ void wxWindow::OnInternalIdle()
 bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
 {
 #if wxUSE_ACCEL
 bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
 {
 #if wxUSE_ACCEL
-    if (!m_acceleratorTable.Ok())
+    if (!m_acceleratorTable.IsOk())
         return false;
 
     int count = m_acceleratorTable.GetCount();
         return false;
 
     int count = m_acceleratorTable.GetCount();
@@ -1701,7 +1692,7 @@ bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
                     wxMenuItem* item = frame->GetMenuBar()->FindItem(entry->GetCommand());
                     if (item)
                     {
                     wxMenuItem* item = frame->GetMenuBar()->FindItem(entry->GetCommand());
                     if (item)
                     {
-                        wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, entry->GetCommand());
+                        wxCommandEvent commandEvent(wxEVT_MENU, entry->GetCommand());
                         commandEvent.SetEventObject(frame);
 
                         // If ProcessEvent returns true (it was handled), then
                         commandEvent.SetEventObject(frame);
 
                         // If ProcessEvent returns true (it was handled), then
@@ -1723,7 +1714,7 @@ bool wxWindow::ProcessAccelerator(wxKeyEvent& event)
             // For now, only buttons.
             if ( wxDynamicCast(child, wxButton) )
             {
             // For now, only buttons.
             if ( wxDynamicCast(child, wxButton) )
             {
-                wxCommandEvent commandEvent (wxEVT_COMMAND_BUTTON_CLICKED, child->GetId());
+                wxCommandEvent commandEvent (wxEVT_BUTTON, child->GetId());
                 commandEvent.SetEventObject(child);
                 return child->HandleWindowEvent(commandEvent);
             }
                 commandEvent.SetEventObject(child);
                 return child->HandleWindowEvent(commandEvent);
             }
@@ -2097,7 +2088,7 @@ static void wxScrollBarCallback(Widget scrollbar,
                                 XmScrollBarCallbackStruct *cbs)
 {
     wxWindow *win = wxGetWindowFromTable(scrollbar);
                                 XmScrollBarCallbackStruct *cbs)
 {
     wxWindow *win = wxGetWindowFromTable(scrollbar);
-    wxCHECK_RET( win, _T("invalid widget in scrollbar callback") );
+    wxCHECK_RET( win, wxT("invalid widget in scrollbar callback") );
 
     wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
 
 
     wxOrientation orientation = (wxOrientation)wxPtrToUInt(clientData);
 
@@ -2498,7 +2489,7 @@ void wxWindow::ChangeFont(bool keepOriginalSize)
     // to its original size! We therefore have to set the size
     // back again. TODO: a better way in Motif?
     Widget w = (Widget) GetLabelWidget(); // Usually the main widget
     // to its original size! We therefore have to set the size
     // back again. TODO: a better way in Motif?
     Widget w = (Widget) GetLabelWidget(); // Usually the main widget
-    if (w && m_font.Ok())
+    if (w && m_font.IsOk())
     {
         int width, height, width1, height1;
         GetSize(& width, & height);
     {
         int width, height, width1, height1;
         GetSize(& width, & height);