fixed some GTK2 compilation warnings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,12 +46,12 @@ extern wxWindowGTK *g_delayedFocus;
|
|||||||
// helpers
|
// helpers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
static void wxGtkTextInsert(GtkWidget *text,
|
static void wxGtkTextInsert(GtkWidget *text,
|
||||||
const wxTextAttr& attr,
|
const wxTextAttr& attr,
|
||||||
const char *txt,
|
const char *txt,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
#ifndef __WXGTK20__
|
|
||||||
GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
|
GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
@@ -63,8 +63,8 @@ static void wxGtkTextInsert(GtkWidget *text,
|
|||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
|
gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif // GTK 1.x
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// "insert_text" for GtkEntry
|
// "insert_text" for GtkEntry
|
||||||
@@ -554,7 +554,7 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
|
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
|
||||||
gtk_text_buffer_insert_at_cursor( text_buffer, buffer, strlen(buffer) );
|
gtk_text_buffer_insert_at_cursor( text_buffer, buffer, strlen(buffer) );
|
||||||
|
|
||||||
#else
|
#else // GTK 1.x
|
||||||
// After cursor movements, gtk_text_get_point() is wrong by one.
|
// After cursor movements, gtk_text_get_point() is wrong by one.
|
||||||
gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) );
|
gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) );
|
||||||
|
|
||||||
@@ -565,7 +565,7 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
|
|
||||||
// Bring editable's cursor back uptodate.
|
// Bring editable's cursor back uptodate.
|
||||||
SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));
|
SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));
|
||||||
#endif
|
#endif // GTK 1.x/2.0
|
||||||
}
|
}
|
||||||
else // single line
|
else // single line
|
||||||
{
|
{
|
||||||
|
@@ -1900,7 +1900,9 @@ static void gtk_window_vscroll_callback( GtkAdjustment *adjust,
|
|||||||
|
|
||||||
win->m_oldVerticalPos = adjust->value;
|
win->m_oldVerticalPos = adjust->value;
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
||||||
|
#endif
|
||||||
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar));
|
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar));
|
||||||
|
|
||||||
int value = (int)(adjust->value+0.5);
|
int value = (int)(adjust->value+0.5);
|
||||||
@@ -1929,7 +1931,9 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust,
|
|||||||
float diff = adjust->value - win->m_oldHorizontalPos;
|
float diff = adjust->value - win->m_oldHorizontalPos;
|
||||||
if (fabs(diff) < 0.2) return;
|
if (fabs(diff) < 0.2) return;
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
||||||
|
#endif
|
||||||
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->hscrollbar));
|
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->hscrollbar));
|
||||||
|
|
||||||
win->m_oldHorizontalPos = adjust->value;
|
win->m_oldHorizontalPos = adjust->value;
|
||||||
|
@@ -46,12 +46,12 @@ extern wxWindowGTK *g_delayedFocus;
|
|||||||
// helpers
|
// helpers
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
static void wxGtkTextInsert(GtkWidget *text,
|
static void wxGtkTextInsert(GtkWidget *text,
|
||||||
const wxTextAttr& attr,
|
const wxTextAttr& attr,
|
||||||
const char *txt,
|
const char *txt,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
#ifndef __WXGTK20__
|
|
||||||
GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
|
GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
@@ -63,8 +63,8 @@ static void wxGtkTextInsert(GtkWidget *text,
|
|||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
|
gtk_text_insert( GTK_TEXT(text), font, colFg, colBg, txt, len );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif // GTK 1.x
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// "insert_text" for GtkEntry
|
// "insert_text" for GtkEntry
|
||||||
@@ -554,7 +554,7 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
|
GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
|
||||||
gtk_text_buffer_insert_at_cursor( text_buffer, buffer, strlen(buffer) );
|
gtk_text_buffer_insert_at_cursor( text_buffer, buffer, strlen(buffer) );
|
||||||
|
|
||||||
#else
|
#else // GTK 1.x
|
||||||
// After cursor movements, gtk_text_get_point() is wrong by one.
|
// After cursor movements, gtk_text_get_point() is wrong by one.
|
||||||
gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) );
|
gtk_text_set_point( GTK_TEXT(m_text), GET_EDITABLE_POS(m_text) );
|
||||||
|
|
||||||
@@ -565,7 +565,7 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
|
|
||||||
// Bring editable's cursor back uptodate.
|
// Bring editable's cursor back uptodate.
|
||||||
SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));
|
SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) ));
|
||||||
#endif
|
#endif // GTK 1.x/2.0
|
||||||
}
|
}
|
||||||
else // single line
|
else // single line
|
||||||
{
|
{
|
||||||
|
@@ -1900,7 +1900,9 @@ static void gtk_window_vscroll_callback( GtkAdjustment *adjust,
|
|||||||
|
|
||||||
win->m_oldVerticalPos = adjust->value;
|
win->m_oldVerticalPos = adjust->value;
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
||||||
|
#endif
|
||||||
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar));
|
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->vscrollbar));
|
||||||
|
|
||||||
int value = (int)(adjust->value+0.5);
|
int value = (int)(adjust->value+0.5);
|
||||||
@@ -1929,7 +1931,9 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust,
|
|||||||
float diff = adjust->value - win->m_oldHorizontalPos;
|
float diff = adjust->value - win->m_oldHorizontalPos;
|
||||||
if (fabs(diff) < 0.2) return;
|
if (fabs(diff) < 0.2) return;
|
||||||
|
|
||||||
|
#ifndef __WXGTK20__
|
||||||
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW(win->m_widget);
|
||||||
|
#endif
|
||||||
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->hscrollbar));
|
wxEventType command = GtkScrollWinTypeToWx(GET_SCROLL_TYPE(sw->hscrollbar));
|
||||||
|
|
||||||
win->m_oldHorizontalPos = adjust->value;
|
win->m_oldHorizontalPos = adjust->value;
|
||||||
|
Reference in New Issue
Block a user