From: Robert Roebling Date: Mon, 7 Sep 1998 22:01:55 +0000 (+0000) Subject: After resolving all conflicts that came down the X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d84eb0838423075d768a425ab8a0d49d28735c05?ds=sidebyside After resolving all conflicts that came down the telephone line: DialogEd is ready for general consumption now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index 4e9a085d73..70e82bedb8 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -59,7 +59,7 @@ class wxFont: public wxGDIObject wxFont& operator = ( const wxFont& font ); bool operator == ( const wxFont& font ); bool operator != ( const wxFont& font ); - bool Ok(); + bool Ok() const; int GetPointSize(void) const; wxString GetFaceName(void) const; diff --git a/include/wx/gtk1/font.h b/include/wx/gtk1/font.h index 4e9a085d73..70e82bedb8 100644 --- a/include/wx/gtk1/font.h +++ b/include/wx/gtk1/font.h @@ -59,7 +59,7 @@ class wxFont: public wxGDIObject wxFont& operator = ( const wxFont& font ); bool operator == ( const wxFont& font ); bool operator != ( const wxFont& font ); - bool Ok(); + bool Ok() const; int GetPointSize(void) const; wxString GetFaceName(void) const; diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 3883d1d7e2..c4aac9364a 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -56,8 +56,6 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetValidator( validator ); - wxControl::SetLabel( label ); - m_widget = gtk_check_button_new_with_label( m_label ); wxSize newSize = size; @@ -70,6 +68,8 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label PostCreation(); + SetLabel( label ); + Show( TRUE ); return TRUE; diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 2152854752..dfb4fd8be2 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -20,21 +20,6 @@ // local data //----------------------------------------------------------------------------- -static char *wx_font_family [] = { - "wxDEFAULT", "wxDECORATIVE", "wxROMAN", "wxSCRIPT", - "wxSWISS", "wxMODERN", "wxTELETYPE", -}; - -/* -static char *wx_font_style [] = { - "wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC", -}; - -static char *wx_font_weight [] = { - "wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT", -}; -*/ - extern wxFontNameDirectory *wxTheFontNameDirectory; //----------------------------------------------------------------------------- @@ -64,10 +49,10 @@ class wxFontRefData: public wxObjectRefData wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER) { m_byXFontName = FALSE; - m_pointSize = -1; - m_family = -1; - m_style = -1; - m_weight = -1; + m_pointSize = 12; + m_family = wxSWISS; + m_style = wxNORMAL; + m_weight = wxNORMAL; m_underlined = FALSE; m_fontId = 0; m_faceName = (char *) NULL; @@ -128,8 +113,11 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight, M_FONTDATA->m_fontId = FontIdOrFamily; M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily ); } + if (Style == wxDEFAULT) Style = wxSWISS; M_FONTDATA->m_style = Style; + if (Weight == wxDEFAULT) Weight = wxNORMAL; M_FONTDATA->m_weight = Weight; + if (PointSize == wxDEFAULT) PointSize = 10; M_FONTDATA->m_pointSize = PointSize; M_FONTDATA->m_underlined = Underlined; @@ -189,106 +177,120 @@ bool wxFont::operator != ( const wxFont& font ) return m_refData != font.m_refData; } -bool wxFont::Ok() +bool wxFont::Ok() const { - return (m_refData != NULL); + if (!m_refData) + { + wxFAIL_MSG( "invalid font" ); + return FALSE; + } + else + return TRUE; } int wxFont::GetPointSize(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_pointSize; } wxString wxFont::GetFaceString(void) const { + if (!Ok()) return ""; + wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); return s; } wxString wxFont::GetFaceName(void) const { + if (!Ok()) return ""; + wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); return s; } int wxFont::GetFamily(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_family; } wxString wxFont::GetFamilyString(void) const { - wxString s = wx_font_family[M_FONTDATA->m_family - wxDEFAULT]; - return s; + if (!Ok()) return "wxDEFAULT"; + + switch (M_FONTDATA->m_family) + { + case wxDECORATIVE: return wxString("wxDECORATIVE"); + case wxROMAN: return wxString("wxROMAN"); + case wxSCRIPT: return wxString("wxSCRIPT"); + case wxSWISS: return wxString("wxSWISS"); + case wxMODERN: return wxString("wxMODERN"); + case wxTELETYPE: return wxString("wxTELETYPE"); + default: return "wxDEFAULT"; + } + + return "wxDEFAULT"; } int wxFont::GetFontId(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_fontId; // stub } int wxFont::GetStyle(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_style; } wxString wxFont::GetStyleString(void) const { - switch (M_FONTDATA->m_style) - { - case wxNORMAL: - { - return wxString("wxNORMAL"); - } - case wxSLANT: - { - return wxString("wxSLANT"); - } - case wxITALIC: - { - return wxString("wxITALIC"); - } - case wxDEFAULT: - default: - { - return wxString("wxDEFAULT"); - } - } - return wxString("wxDEFAULT"); + if (!Ok()) return "wxDEFAULT"; + + switch (M_FONTDATA->m_style) + { + case wxNORMAL: return wxString("wxNORMAL"); + case wxSLANT: return wxString("wxSLANT"); + case wxITALIC: return wxString("wxITALIC"); + default: return wxString("wxDEFAULT"); + } + + return wxString("wxDEFAULT"); } int wxFont::GetWeight(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_weight; } wxString wxFont::GetWeightString(void) const { - switch (M_FONTDATA->m_weight) - { - case wxNORMAL: - { - return wxString("wxNORMAL"); - } - case wxBOLD: - { - return wxString("wxBOLD"); - } - case wxLIGHT: - { - return wxString("wxLIGHT"); - } - case wxDEFAULT: - default: - { - return wxString("wxDEFAULT"); - } - } - return wxString("wxDEFAULT"); + if (!Ok()) return "wxDEFAULT"; + + switch (M_FONTDATA->m_weight) + { + case wxNORMAL: return wxString("wxNORMAL"); + case wxBOLD: return wxString("wxBOLD"); + case wxLIGHT: return wxString("wxLIGHT"); + default: return wxString("wxDEFAULT"); + } + + return wxString("wxDEFAULT"); } bool wxFont::GetUnderlined(void) const { + if (!Ok()) return FALSE; + return M_FONTDATA->m_underlined; } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 1e2e80ebc8..fdd21a83ee 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -85,7 +85,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, m_list = GTK_LIST( gtk_list_new() ); - GtkSelectionMode mode = GTK_SELECTION_SINGLE; + GtkSelectionMode mode = GTK_SELECTION_BROWSE; if (style & wxLB_MULTIPLE) mode = GTK_SELECTION_MULTIPLE; else if (style & wxLB_EXTENDED) @@ -96,6 +96,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) ); gtk_widget_show( GTK_WIDGET(m_list) ); + wxSize newSize = size; + if (newSize.x == -1) newSize.x = 100; + if (newSize.y == -1) newSize.y = 110; + SetSize( newSize.x, newSize.y ); + for (int i = 0; i < n; i++) { GtkWidget *list_item; @@ -222,21 +227,14 @@ char *wxListBox::GetClientData( int n ) const int wxListBox::GetSelection(void) const { - GList *selection = m_list->selection; - if (selection) + GList *child = m_list->children; + int count = 0; + while (child) { - GList *child = m_list->children; - int count = 0; - while (child) - { - if (child->data == selection->data) return count; - count++; - child = child->next; - } + if (GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED) return count; + count++; + child = child->next; } - // No, I think it's reasonable to return -1 to indicate - // there is no selection. -- JACS -// wxFAIL_MSG("wrong listbox index"); return -1; } diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 050d1718ce..25210a4e0b 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -80,15 +80,11 @@ int wxDisplayDepth(void) // user and home routines //------------------------------------------------------------------------ -char* wxGetHomeDir( char *dest ) +const char* wxGetHomeDir( wxString *home ) { - wxString tmp = wxGetUserHome( wxString() ); - if (tmp.IsNull()) - strcpy( wxBuffer, "/" ); - else - strcpy( wxBuffer, tmp ); - if (dest) strcpy( dest, WXSTRINGCAST tmp ); - return wxBuffer; + *home = wxGetUserHome( wxString() ); + if (home->IsNull()) *home = "/"; + return *home; }; char *wxGetUserHome( const wxString &user ) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 863f51e463..7cba0eb41e 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -116,6 +116,7 @@ extern wxList wxPendingDelete; extern wxList wxTopLevelWindows; extern bool g_blockEventsOnDrag; +wxWindow *g_captureWindow = (wxWindow*)NULL; //----------------------------------------------------------------------------- // "expose_event" (of m_wxwindow, not of m_widget) @@ -299,6 +300,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton { if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (win->m_wxwindow) @@ -403,6 +406,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (!win->HasVMT()) return TRUE; @@ -469,6 +475,9 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) { if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (!win->HasVMT()) return TRUE; @@ -599,7 +608,11 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { if (widget->window != gdk_event->window) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; + if (!win->HasVMT()) return TRUE; if (widget->window) @@ -621,9 +634,13 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { if (widget->window != gdk_event->window) return TRUE; - if (!win->HasVMT()) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; + if (!win->HasVMT()) return TRUE; + if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); @@ -1981,6 +1998,7 @@ void wxWindow::CaptureMouse(void) GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK), (GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME ); + g_captureWindow = this; } void wxWindow::ReleaseMouse(void) @@ -1988,6 +2006,7 @@ void wxWindow::ReleaseMouse(void) GtkWidget *connect_widget = GetConnectWidget(); gtk_grab_remove( connect_widget ); gdk_pointer_ungrab ( GDK_CURRENT_TIME ); + g_captureWindow = (wxWindow*) NULL;; } void wxWindow::SetTitle( const wxString &WXUNUSED(title) ) diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 3883d1d7e2..c4aac9364a 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -56,8 +56,6 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetValidator( validator ); - wxControl::SetLabel( label ); - m_widget = gtk_check_button_new_with_label( m_label ); wxSize newSize = size; @@ -70,6 +68,8 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label PostCreation(); + SetLabel( label ); + Show( TRUE ); return TRUE; diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 2152854752..dfb4fd8be2 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -20,21 +20,6 @@ // local data //----------------------------------------------------------------------------- -static char *wx_font_family [] = { - "wxDEFAULT", "wxDECORATIVE", "wxROMAN", "wxSCRIPT", - "wxSWISS", "wxMODERN", "wxTELETYPE", -}; - -/* -static char *wx_font_style [] = { - "wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC", -}; - -static char *wx_font_weight [] = { - "wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT", -}; -*/ - extern wxFontNameDirectory *wxTheFontNameDirectory; //----------------------------------------------------------------------------- @@ -64,10 +49,10 @@ class wxFontRefData: public wxObjectRefData wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER) { m_byXFontName = FALSE; - m_pointSize = -1; - m_family = -1; - m_style = -1; - m_weight = -1; + m_pointSize = 12; + m_family = wxSWISS; + m_style = wxNORMAL; + m_weight = wxNORMAL; m_underlined = FALSE; m_fontId = 0; m_faceName = (char *) NULL; @@ -128,8 +113,11 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight, M_FONTDATA->m_fontId = FontIdOrFamily; M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily ); } + if (Style == wxDEFAULT) Style = wxSWISS; M_FONTDATA->m_style = Style; + if (Weight == wxDEFAULT) Weight = wxNORMAL; M_FONTDATA->m_weight = Weight; + if (PointSize == wxDEFAULT) PointSize = 10; M_FONTDATA->m_pointSize = PointSize; M_FONTDATA->m_underlined = Underlined; @@ -189,106 +177,120 @@ bool wxFont::operator != ( const wxFont& font ) return m_refData != font.m_refData; } -bool wxFont::Ok() +bool wxFont::Ok() const { - return (m_refData != NULL); + if (!m_refData) + { + wxFAIL_MSG( "invalid font" ); + return FALSE; + } + else + return TRUE; } int wxFont::GetPointSize(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_pointSize; } wxString wxFont::GetFaceString(void) const { + if (!Ok()) return ""; + wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); return s; } wxString wxFont::GetFaceName(void) const { + if (!Ok()) return ""; + wxString s = wxTheFontNameDirectory->GetFontName( M_FONTDATA->m_fontId ); return s; } int wxFont::GetFamily(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_family; } wxString wxFont::GetFamilyString(void) const { - wxString s = wx_font_family[M_FONTDATA->m_family - wxDEFAULT]; - return s; + if (!Ok()) return "wxDEFAULT"; + + switch (M_FONTDATA->m_family) + { + case wxDECORATIVE: return wxString("wxDECORATIVE"); + case wxROMAN: return wxString("wxROMAN"); + case wxSCRIPT: return wxString("wxSCRIPT"); + case wxSWISS: return wxString("wxSWISS"); + case wxMODERN: return wxString("wxMODERN"); + case wxTELETYPE: return wxString("wxTELETYPE"); + default: return "wxDEFAULT"; + } + + return "wxDEFAULT"; } int wxFont::GetFontId(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_fontId; // stub } int wxFont::GetStyle(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_style; } wxString wxFont::GetStyleString(void) const { - switch (M_FONTDATA->m_style) - { - case wxNORMAL: - { - return wxString("wxNORMAL"); - } - case wxSLANT: - { - return wxString("wxSLANT"); - } - case wxITALIC: - { - return wxString("wxITALIC"); - } - case wxDEFAULT: - default: - { - return wxString("wxDEFAULT"); - } - } - return wxString("wxDEFAULT"); + if (!Ok()) return "wxDEFAULT"; + + switch (M_FONTDATA->m_style) + { + case wxNORMAL: return wxString("wxNORMAL"); + case wxSLANT: return wxString("wxSLANT"); + case wxITALIC: return wxString("wxITALIC"); + default: return wxString("wxDEFAULT"); + } + + return wxString("wxDEFAULT"); } int wxFont::GetWeight(void) const { + if (!Ok()) return 0; + return M_FONTDATA->m_weight; } wxString wxFont::GetWeightString(void) const { - switch (M_FONTDATA->m_weight) - { - case wxNORMAL: - { - return wxString("wxNORMAL"); - } - case wxBOLD: - { - return wxString("wxBOLD"); - } - case wxLIGHT: - { - return wxString("wxLIGHT"); - } - case wxDEFAULT: - default: - { - return wxString("wxDEFAULT"); - } - } - return wxString("wxDEFAULT"); + if (!Ok()) return "wxDEFAULT"; + + switch (M_FONTDATA->m_weight) + { + case wxNORMAL: return wxString("wxNORMAL"); + case wxBOLD: return wxString("wxBOLD"); + case wxLIGHT: return wxString("wxLIGHT"); + default: return wxString("wxDEFAULT"); + } + + return wxString("wxDEFAULT"); } bool wxFont::GetUnderlined(void) const { + if (!Ok()) return FALSE; + return M_FONTDATA->m_underlined; } diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 1e2e80ebc8..fdd21a83ee 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -85,7 +85,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, m_list = GTK_LIST( gtk_list_new() ); - GtkSelectionMode mode = GTK_SELECTION_SINGLE; + GtkSelectionMode mode = GTK_SELECTION_BROWSE; if (style & wxLB_MULTIPLE) mode = GTK_SELECTION_MULTIPLE; else if (style & wxLB_EXTENDED) @@ -96,6 +96,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) ); gtk_widget_show( GTK_WIDGET(m_list) ); + wxSize newSize = size; + if (newSize.x == -1) newSize.x = 100; + if (newSize.y == -1) newSize.y = 110; + SetSize( newSize.x, newSize.y ); + for (int i = 0; i < n; i++) { GtkWidget *list_item; @@ -222,21 +227,14 @@ char *wxListBox::GetClientData( int n ) const int wxListBox::GetSelection(void) const { - GList *selection = m_list->selection; - if (selection) + GList *child = m_list->children; + int count = 0; + while (child) { - GList *child = m_list->children; - int count = 0; - while (child) - { - if (child->data == selection->data) return count; - count++; - child = child->next; - } + if (GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED) return count; + count++; + child = child->next; } - // No, I think it's reasonable to return -1 to indicate - // there is no selection. -- JACS -// wxFAIL_MSG("wrong listbox index"); return -1; } diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index 050d1718ce..25210a4e0b 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -80,15 +80,11 @@ int wxDisplayDepth(void) // user and home routines //------------------------------------------------------------------------ -char* wxGetHomeDir( char *dest ) +const char* wxGetHomeDir( wxString *home ) { - wxString tmp = wxGetUserHome( wxString() ); - if (tmp.IsNull()) - strcpy( wxBuffer, "/" ); - else - strcpy( wxBuffer, tmp ); - if (dest) strcpy( dest, WXSTRINGCAST tmp ); - return wxBuffer; + *home = wxGetUserHome( wxString() ); + if (home->IsNull()) *home = "/"; + return *home; }; char *wxGetUserHome( const wxString &user ) diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 863f51e463..7cba0eb41e 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -116,6 +116,7 @@ extern wxList wxPendingDelete; extern wxList wxTopLevelWindows; extern bool g_blockEventsOnDrag; +wxWindow *g_captureWindow = (wxWindow*)NULL; //----------------------------------------------------------------------------- // "expose_event" (of m_wxwindow, not of m_widget) @@ -299,6 +300,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton { if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (win->m_wxwindow) @@ -403,6 +406,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win ) { if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (!win->HasVMT()) return TRUE; @@ -469,6 +475,9 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win ) { if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (!win->HasVMT()) return TRUE; @@ -599,7 +608,11 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { if (widget->window != gdk_event->window) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; + if (!win->HasVMT()) return TRUE; if (widget->window) @@ -621,9 +634,13 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { if (widget->window != gdk_event->window) return TRUE; - if (!win->HasVMT()) return TRUE; + + if ((g_captureWindow) && (win != g_captureWindow)) return TRUE; + if (g_blockEventsOnDrag) return TRUE; + if (!win->HasVMT()) return TRUE; + if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); @@ -1981,6 +1998,7 @@ void wxWindow::CaptureMouse(void) GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK), (GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME ); + g_captureWindow = this; } void wxWindow::ReleaseMouse(void) @@ -1988,6 +2006,7 @@ void wxWindow::ReleaseMouse(void) GtkWidget *connect_widget = GetConnectWidget(); gtk_grab_remove( connect_widget ); gdk_pointer_ungrab ( GDK_CURRENT_TIME ); + g_captureWindow = (wxWindow*) NULL;; } void wxWindow::SetTitle( const wxString &WXUNUSED(title) ) diff --git a/utils/dialoged/src/dlghndlr.cpp b/utils/dialoged/src/dlghndlr.cpp index cfa37ec97e..f312fb0ec0 100644 --- a/utils/dialoged/src/dlghndlr.cpp +++ b/utils/dialoged/src/dlghndlr.cpp @@ -371,13 +371,16 @@ void wxResourceEditorDialogHandler::OnItemEvent(wxControl *item, wxMouseEvent& e event.m_x = event.m_x + x; event.m_y = event.m_y + y; + ProcessItemEvent(item, event, dragType); } void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEvent& event, int selectionHandle) { wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler(); - + + if (dragItem) childHandler = (wxResourceEditorControlHandler *)dragItem->GetEventHandler(); + long x, y; event.Position(&x, &y); int keys = 0; diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index 9c98a3553f..6dd1d8987d 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -150,13 +150,8 @@ bool wxResourceManager::Initialize() strcat(buf, "\\dialoged.ini"); m_optionsResourceFilename = buf; #elif defined(__WXGTK__) - /* - wxString buf; - wxGetHomeDir(&buf); - buf += "/.dialogedrc"; - m_optionsResourceFilename = buf; - */ - m_optionsResourceFilename = ".dialoged.rc"; + wxGetHomeDir( &m_optionsResourceFilename ); + m_optionsResourceFilename += "/.dialogedrc"; #else #error "Unsupported platform." #endif