]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
incomplete paste error
[wxWidgets.git] / src / gtk1 / window.cpp
index a670cf909941cf84ca67f75bd20fe64a91a29e0c..9dc790f7ffb81b9310fc6eeb857986ea51f02f9a 100644 (file)
@@ -245,7 +245,7 @@ extern bool g_mainThreadLocked;
 #endif
 
 // the trace mask used for the focus debugging messages
-#define TRACE_FOCUS _T("focus")
+#define TRACE_FOCUS wxT("focus")
 
 //-----------------------------------------------------------------------------
 // missing gdk functions
@@ -620,7 +620,7 @@ static void gtk_window_draw_callback( GtkWidget *widget,
 //-----------------------------------------------------------------------------
 
 // set WXTRACE to this to see the key event codes on the console
-#define TRACE_KEYS  _T("keyevent")
+#define TRACE_KEYS  wxT("keyevent")
 
 // translates an X key symbol to WXK_XXX value
 //
@@ -954,9 +954,9 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
 
     KeySym keysym = gdk_event->keyval;
 
-    wxLogTrace(TRACE_KEYS, _T("Key %s event: keysym = %ld"),
-               event.GetEventType() == wxEVT_KEY_UP ? _T("release")
-                                                    : _T("press"),
+    wxLogTrace(TRACE_KEYS, wxT("Key %s event: keysym = %ld"),
+               event.GetEventType() == wxEVT_KEY_UP ? wxT("release")
+                                                    : wxT("press"),
                keysym);
 
     long key_code = wxTranslateKeySymToWXKey(keysym, false /* !isChar */);
@@ -985,7 +985,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
             Display *dpy = (Display *)wxGetDisplay();
             KeyCode keycode = XKeysymToKeycode(dpy, keysym);
 
-            wxLogTrace(TRACE_KEYS, _T("\t-> keycode %d"), keycode);
+            wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode);
 
             KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
 
@@ -1024,7 +1024,7 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
         }
     }
 
-    wxLogTrace(TRACE_KEYS, _T("\t-> wxKeyCode %ld"), key_code);
+    wxLogTrace(TRACE_KEYS, wxT("\t-> wxKeyCode %ld"), key_code);
 
     // sending unknown key events doesn't really make sense
     if ( !key_code )
@@ -1141,7 +1141,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
             int command = ancestor->GetAcceleratorTable()->GetCommand( event );
             if (command != -1)
             {
-                wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
+                wxCommandEvent command_event( wxEVT_MENU, command );
                 ret = ancestor->HandleWindowEvent( command_event );
                 break;
             }
@@ -1176,7 +1176,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
 
         if ( key_code )
         {
-            wxLogTrace(TRACE_KEYS, _T("Char event: %ld"), key_code);
+            wxLogTrace(TRACE_KEYS, wxT("Char event: %ld"), key_code);
 
             event.m_keyCode = key_code;
 
@@ -1257,7 +1257,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
 
         if ( btnCancel )
         {
-            wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+            wxCommandEvent eventClick(wxEVT_BUTTON, wxID_CANCEL);
             eventClick.SetEventObject(btnCancel);
             ret = btnCancel->HandleWindowEvent(eventClick);
         }
@@ -1332,6 +1332,7 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
     if (event.GetEventType() == wxEVT_MOUSEWHEEL)
     {
        event.m_linesPerAction = 3;
+       event.m_columnsPerAction = 3;
        event.m_wheelDelta = 120;
        if (((GdkEventButton*)gdk_event)->button == 4)
            event.m_wheelRotation = 120;
@@ -1680,7 +1681,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget,
             break;
 
         default:
-            // unknwon button, don't process
+            // unknown button, don't process
             return FALSE;
     }
 
@@ -1820,7 +1821,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
     g_focusWindow = win;
 
     wxLogTrace(TRACE_FOCUS,
-               _T("%s: focus in"), win->GetName().c_str());
+               wxT("%s: focus in"), win->GetName().c_str());
 
 #ifdef HAVE_XIM
     if (win->m_ic)
@@ -1868,7 +1869,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget),
         wxapp_install_idle_handler();
 
     wxLogTrace( TRACE_FOCUS,
-                _T("%s: focus out"), win->GetName().c_str() );
+                wxT("%s: focus out"), win->GetName().c_str() );
 
 
     wxWindowGTK *winFocus = wxFindFocusedChild(win);
@@ -2413,9 +2414,7 @@ wxMouseState wxGetMouseState()
 // method
 #ifdef __WXUNIVERSAL__
     IMPLEMENT_ABSTRACT_CLASS(wxWindowGTK, wxWindowBase)
-#else // __WXGTK__
-    IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-#endif // __WXUNIVERSAL__/__WXGTK__
+#endif // __WXUNIVERSAL__
 
 void wxWindowGTK::Init()
 {
@@ -2931,9 +2930,9 @@ void wxWindowGTK::OnInternalIdle()
     GtkUpdate();
 
     wxCursor cursor = m_cursor;
-    if (g_globalCursor.Ok()) cursor = g_globalCursor;
+    if (g_globalCursor.IsOk()) cursor = g_globalCursor;
 
-    if (cursor.Ok())
+    if (cursor.IsOk())
     {
         /* I now set the cursor anew in every OnInternalIdle call
            as setting the cursor in a parent window also effects the
@@ -2946,7 +2945,7 @@ void wxWindowGTK::OnInternalIdle()
             if (window)
                 gdk_window_set_cursor( window, cursor.GetCursor() );
 
-            if (!g_globalCursor.Ok())
+            if (!g_globalCursor.IsOk())
                 cursor = *wxSTANDARD_CURSOR;
 
             window = m_widget->window;
@@ -2962,8 +2961,7 @@ void wxWindowGTK::OnInternalIdle()
         }
     }
 
-    if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
-        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
+    wxWindowBase::OnInternalIdle();
 }
 
 void wxWindowGTK::DoGetSize( int *width, int *height ) const
@@ -3221,7 +3219,7 @@ int wxWindowGTK::GetCharHeight() const
     wxCHECK_MSG( (m_widget != NULL), 12, wxT("invalid window") );
 
     wxFont font = GetFont();
-    wxCHECK_MSG( font.Ok(), 12, wxT("invalid font") );
+    wxCHECK_MSG( font.IsOk(), 12, wxT("invalid font") );
 
     GdkFont *gfont = font.GetInternalFont( 1.0 );
 
@@ -3233,23 +3231,23 @@ int wxWindowGTK::GetCharWidth() const
     wxCHECK_MSG( (m_widget != NULL), 8, wxT("invalid window") );
 
     wxFont font = GetFont();
-    wxCHECK_MSG( font.Ok(), 8, wxT("invalid font") );
+    wxCHECK_MSG( font.IsOk(), 8, wxT("invalid font") );
 
     GdkFont *gfont = font.GetInternalFont( 1.0 );
 
     return gdk_string_width( gfont, "g" );
 }
 
-void wxWindowGTK::GetTextExtent( const wxString& string,
-                                 int *x,
-                                 int *y,
-                                 int *descent,
-                                 int *externalLeading,
-                                 const wxFont *theFont ) const
+void wxWindowGTK::DoGetTextExtent(const wxString& string,
+                                  int *x,
+                                  int *y,
+                                  int *descent,
+                                  int *externalLeading,
+                                  const wxFont *theFont) const
 {
     wxFont fontToUse = theFont ? *theFont : GetFont();
 
-    wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") );
+    wxCHECK_RET( fontToUse.IsOk(), wxT("invalid font") );
 
     if (string.empty())
     {
@@ -3292,7 +3290,7 @@ void wxWindowGTK::SetFocus()
                 // it should be focused and will do it later, during the idle
                 // time, as soon as we can
                 wxLogTrace(TRACE_FOCUS,
-                           _T("Delaying setting focus to %s(%s)"),
+                           wxT("Delaying setting focus to %s(%s)"),
                            GetClassInfo()->GetClassName(), GetLabel().c_str());
 
                 g_delayedFocus = this;
@@ -3300,7 +3298,7 @@ void wxWindowGTK::SetFocus()
             else
             {
                 wxLogTrace(TRACE_FOCUS,
-                           _T("Setting focus to %s(%s)"),
+                           wxT("Setting focus to %s(%s)"),
                            GetClassInfo()->GetClassName(), GetLabel().c_str());
 
                 gtk_widget_grab_focus (m_widget);
@@ -3314,7 +3312,7 @@ void wxWindowGTK::SetFocus()
         else
         {
            wxLogTrace(TRACE_FOCUS,
-                      _T("Can't set focus to %s(%s)"),
+                      wxT("Can't set focus to %s(%s)"),
                       GetClassInfo()->GetClassName(), GetLabel().c_str());
         }
     }
@@ -3700,7 +3698,7 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
     if (!wxWindowBase::SetBackgroundColour(colour))
         return false;
 
-    if (colour.Ok())
+    if (colour.IsOk())
     {
         // We need the pixel value e.g. for background clearing.
         m_backgroundColour.CalcPixel(gtk_widget_get_colormap(m_widget));
@@ -3723,7 +3721,7 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
         return false;
     }
 
-    if (colour.Ok())
+    if (colour.IsOk())
     {
         // We need the pixel value e.g. for background clearing.
         m_foregroundColour.CalcPixel(gtk_widget_get_colormap(m_widget));
@@ -3740,21 +3738,21 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
 {
     // do we need to apply any changes at all?
     if ( !forceStyle &&
-         !m_font.Ok() &&
-         !m_foregroundColour.Ok() && !m_backgroundColour.Ok() )
+         !m_font.IsOk() &&
+         !m_foregroundColour.IsOk() && !m_backgroundColour.IsOk() )
     {
         return NULL;
     }
 
     GtkRcStyle *style = gtk_rc_style_new();
 
-    if ( m_font.Ok() )
+    if ( m_font.IsOk() )
     {
         wxString xfontname = m_font.GetNativeFontInfo()->GetXFontName();
         style->fontset_name = g_strdup(xfontname.c_str());
     }
 
-    if ( m_foregroundColour.Ok() )
+    if ( m_foregroundColour.IsOk() )
     {
         GdkColor *fg = m_foregroundColour.GetColor();
 
@@ -3768,7 +3766,7 @@ GtkRcStyle *wxWindowGTK::CreateWidgetStyle(bool forceStyle)
         style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_FG;
     }
 
-    if ( m_backgroundColour.Ok() )
+    if ( m_backgroundColour.IsOk() )
     {
         GdkColor *bg = m_backgroundColour.GetColor();
 
@@ -3913,10 +3911,10 @@ void wxWindowGTK::DoCaptureMouse()
     else
         window = GetConnectWidget()->window;
 
-    wxCHECK_RET( window, _T("CaptureMouse() failed") );
+    wxCHECK_RET( window, wxT("CaptureMouse() failed") );
 
     const wxCursor* cursor = &m_cursor;
-    if (!cursor->Ok())
+    if (!cursor->IsOk())
         cursor = wxSTANDARD_CURSOR;
 
     gdk_pointer_grab( window, FALSE,