]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed Fontdialog
authorRobert Roebling <robert@roebling.de>
Sun, 2 Aug 1998 20:38:05 +0000 (20:38 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 2 Aug 1998 20:38:05 +0000 (20:38 +0000)
  Fixed frame positions/centering
  Fixed inserting mdi windows
  Changed control callbacks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

28 files changed:
include/wx/generic/fontdlgg.h
samples/dialogs/dialogs.cpp
samples/dnd/dnd.cpp
samples/forty/playerdg.cpp
src/common/gdicmn.cpp
src/generic/fontdlgg.cpp
src/gtk/bmpbuttn.cpp
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/choice.cpp
src/gtk/combobox.cpp
src/gtk/filedlg.cpp
src/gtk/listbox.cpp
src/gtk/radiobox.cpp
src/gtk/scrolbar.cpp
src/gtk/slider.cpp
src/gtk/window.cpp
src/gtk1/bmpbuttn.cpp
src/gtk1/button.cpp
src/gtk1/checkbox.cpp
src/gtk1/choice.cpp
src/gtk1/combobox.cpp
src/gtk1/filedlg.cpp
src/gtk1/listbox.cpp
src/gtk1/radiobox.cpp
src/gtk1/scrolbar.cpp
src/gtk1/slider.cpp
src/gtk1/window.cpp

index 8afda5b745299239ab0a98dbd5ab26ea20e315e3..bd997e45e30192961179e893a21d8cc29618947a 100644 (file)
@@ -54,6 +54,7 @@ class WXDLLEXPORT wxGenericFontDialog: public wxDialog
   wxChoice *colourChoice;
   wxCheckBox *underLineCheckBox;
   wxChoice   *pointSizeChoice;
+  bool       m_useEvents;
 
 //  static bool fontDialogCancelled;
  public:
index 0d8fd9a3633991485722abb3f34cfd0cf32a7ded..7a501ba5efe60d0c488a7f8201328c75d3e67fba 100644 (file)
@@ -50,7 +50,7 @@ IMPLEMENT_WXWIN_MAIN
 bool MyApp::OnInit(void)
 {
   m_canvasTextColour = wxColour("BLACK");
-  m_canvasFont = *wxSWISS_FONT;
+  m_canvasFont = *wxNORMAL_FONT;
 
   // Create the main frame window
   MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300));
index 53f2c43f12aa98973a571690257183c742c6b031..68e299b830e0ffc00b5c9775a7ec9584d1bfe0df 100644 (file)
@@ -258,27 +258,23 @@ void DnDFrame::OnAbout(wxCommandEvent& /* event */)
 void DnDFrame::OnHelp(wxCommandEvent& /* event */)
 {
   wxMessageDialog dialog(this, 
-"This small program demonstrates drag & drop support in wxWindows. "
-"The program window consists of 3 parts: the bottom pane is for "
-"debug messages, so that you can see what's going on inside. "
-"The top part is split into 2 listboxes, the left one accepts "
-"files and the right one accepts text."
-"\n\n"
-"To test wxDropTarget: open wordpad (write.exe), select some text in "
-"it and drag it to the right listbox (you'll notice the usual visual "
-"feedback, i.e. the cursor will change). Also, try dragging some "
-"files (you can select several at once) from Windows Explorer (or "
-"File Manager) to the left pane. Hold down Ctrl/Shift keys when "
-"you drop text (doesn't work with files) and see what changes. "
-"\n\n"
-"To test wxDropSource: just press any mouse button on the empty zone of "
-"the window and drag it to wordpad or any other droptarget accepting "
-"text (and of course you can just drag it to the right pane). Due to "
-"a lot of trace messages, the cursor might take some time to change, "
-"don't release the mouse button until it does. You can change the "
-"string being dragged in in \"File|Test drag...\" dialog."
-"\n\n"
-"Please send all questions/bug reports/suggestions &c to "
+"This small program demonstrates drag & drop support in wxWindows. The program window\n"
+"consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n"
+"going on inside. The top part is split into 2 listboxes, the left one accepts files\n" 
+"and the right one accepts text."
+"\n"
+"To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n" 
+"the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n" 
+"Also, try dragging some files (you can select several at once) from Windows Explorer (or \n"
+"File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n"
+"work with files) and see what changes."
+"\n"
+"To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n" 
+"it to wordpad or any other droptarget accepting text (and of course you can just drag it\n"
+"to the right pane). Due to a lot of trace messages, the cursor might take some time to \n"
+"change, don't release the mouse button until it does. You can change the string being\n" 
+"dragged in in \"File|Test drag...\" dialog.\n"
+"Please send all questions/bug reports/suggestions &c to \n"
 "Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>",
                         "wxDnD Help");
 
index d2949f42193a8f20f16a7303744210318826584b..93852d3e8fe70ca999a8bc376cb59c398f83ecd9 100644 (file)
@@ -44,7 +44,7 @@ PlayerSelectionDialog::PlayerSelectionDialog(
                                                        ScoreFile* file
                                                        ) :
        wxDialog(parent, -1, "Player Selection",
-                       wxDefaultPosition, wxSize(250, 200),
+                       wxDefaultPosition, wxSize(320, 200),
                        wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE),
        m_scoreFile(file)
 {
index a30a772c7a450885ceab76555d6a82473d375602..913b36b7b90ec44ba452e3dda05dd230957d7111 100644 (file)
@@ -146,7 +146,7 @@ void wxColourDatabase::Initialize ()
   cdef cc;
   static cdef table[]={
   
-#ifdef __WXMSW__
+// #ifdef __WXMSW__
    {"AQUAMARINE",112, 219, 147},
    {"BLACK",0, 0, 0},
    {"BLUE", 0, 0, 255},
@@ -218,7 +218,7 @@ void wxColourDatabase::Initialize ()
    {"WHITE", 255, 255, 255},
    {"YELLOW", 255, 255, 0},
    {"YELLOW GREEN", 153, 204, 50},
-#endif
+// #endif
 
 #if defined(__WXGTK__) || defined(__X__)
    {"MEDIUM GOLDENROD", 234, 234, 173},
@@ -303,10 +303,11 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
   unsigned char red = colour.Red ();
   unsigned char green = colour.Green ();
   unsigned char blue = colour.Blue ();
-
+  
   for (wxNode * node = First (); node; node = node->Next ())
   {
       wxColour *col = (wxColour *) node->Data ();
+      
       if (col->Red () == red && col->Green () == green && col->Blue () == blue)
        {
          char *found = node->key.string;
index 5d0ea78fbd501e6d37b387a0c5206ab6b9d2c2bb..f12689c76818dcadbc337a725b4eaa0e9d085f82 100644 (file)
@@ -116,12 +116,14 @@ static wxString wxColourDialogNames[NUM_COLS]={"ORANGE",
 
 wxGenericFontDialog::wxGenericFontDialog(void)
 {
+  m_useEvents = FALSE;
   dialogParent = NULL;
 }
 
 wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, wxFontData *data):
   wxDialog(parent, -1, "Font", wxPoint(0, 0), wxSize(600, 600), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL)
 {
+  m_useEvents = FALSE;
   Create(parent, data);
 }
 
@@ -243,15 +245,14 @@ void wxGenericFontDialog::CreateWidgets(void)
   wxButton *okButton = new wxButton(this, wxID_OK, "OK", wxPoint(5, by));
   (void) new wxButton(this, wxID_OK, "Cancel", wxPoint(50, by));
 
-  familyChoice->SetStringSelection(wxFontFamilyIntToString(dialogFont.GetFamily()));
+  familyChoice->SetStringSelection( wxFontFamilyIntToString(dialogFont.GetFamily()) );
   styleChoice->SetStringSelection(wxFontStyleIntToString(dialogFont.GetStyle()));
   weightChoice->SetStringSelection(wxFontWeightIntToString(dialogFont.GetWeight()));
   wxString name(wxTheColourDatabase->FindName(fontData.fontColour));
   colourChoice->SetStringSelection(name);
     
   underLineCheckBox->SetValue(dialogFont.GetUnderlined());
-
-  pointSizeChoice->SetSelection(dialogFont.GetPointSize());
+  pointSizeChoice->SetSelection(dialogFont.GetPointSize()-1);
 
   okButton->SetDefault();
 
@@ -260,6 +261,8 @@ void wxGenericFontDialog::CreateWidgets(void)
   Centre(wxBOTH);
 
   wxEndBusyCursor();
+  
+  m_useEvents = TRUE;
 }
 
 void wxGenericFontDialog::InitializeFont(void)
@@ -278,7 +281,6 @@ void wxGenericFontDialog::InitializeFont(void)
     fontUnderline = fontData.initialFont.GetUnderlined();
   }
   dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
-
 }
 
 void wxGenericFontDialog::PaintFontBackground(wxDC& dc)
@@ -313,6 +315,8 @@ void wxGenericFontDialog::PaintFont(wxDC& dc)
 
 void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event))
 {
+  if (!m_useEvents) return;
+  
   int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection());
   int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection());
   int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection());
index f1a0aa1a465684cff5b39f9da1bbd6769ee54cac..4e33f54278948aa48cf32bd1fa7e1626c439d163 100644 (file)
 
 class wxBitmapButton;
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxBitmapButton
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
 
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
+static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
 {
+  if (!button->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
   button->GetEventHandler()->ProcessEvent(event);
index 52c4e2d4b9787992f2a2db0868616a03c13af88c..9e64e2579e839a5b5764f904296526b564a8950b 100644 (file)
 
 class wxButton;
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxButton
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
 
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
 {
+  if (!button->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
   button->GetEventHandler()->ProcessEvent(event);
index b4c8a447ffd8b2dc8299388d24d686bfbedcf304..42c8b4167a52b4acf3df37a2774903342cc68b2b 100644 (file)
 
 #include "wx/checkbox.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxCheckBox
 //-----------------------------------------------------------------------------
 
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
+static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
 {
+  if (!cb->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
   event.SetInt( cb->GetValue() );
   event.SetEventObject(cb);
index 180bbb17d3d93115e708e8dbbd54251d0d50aaf4..ef374c13ad9c2c636381e39e181828f79d3ab141 100644 (file)
 
 #include "wx/choice.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxChoice
 //-----------------------------------------------------------------------------
 
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
+static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
 {
+  if (!choice->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
   event.SetInt( choice->GetSelection() );
   wxString tmp( choice->GetStringSelection() );
index 2e892f7e3ab0c2bf7d854d018619add2f8a5f652..1ac91ffdd4338d25e12b5de5dba87f7a4783e70c 100644 (file)
@@ -29,6 +29,9 @@ extern bool   g_blockEventsOnDrag;
 
 static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
 {
+  if (!combo->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   if (combo->m_alreadySent)
   {
     combo->m_alreadySent = FALSE;
@@ -90,14 +93,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
     GtkWidget *list_item;
     list_item = gtk_list_item_new_with_label( choices[i] ); 
   
-    gtk_signal_connect( GTK_OBJECT(list_item), "select", 
-      GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
-  
     gtk_container_add( GTK_CONTAINER(list), list_item );
     
     m_clientData.Append( (wxObject*)NULL );
     
     gtk_widget_show( list_item );
+    
+    gtk_signal_connect( GTK_OBJECT(list_item), "select", 
+      GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   };
   
   PostCreation();
index bc003c8185b18b2c66ad7956c7dd181e89578698..b4d0ed159285c7b8ceeffbde3446047df4150114 100644 (file)
@@ -65,6 +65,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
   
   m_widget = gtk_file_selection_new( "File selection" );
   
+  int x = (gdk_screen_width () - 400) / 2;
+  int y = (gdk_screen_height () - 400) / 2;
+  gtk_widget_set_uposition( m_widget, x, y );
+  
   GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
 
   m_path.Append(m_dir);
index 359adda8d089d0c98a2803685adfc5e9e77d3991..e4f05dc807276336b2790ab9d5f22dc54708e135 100644 (file)
 #include "wx/dynarray.h"
 #include "wx/listbox.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxListBox
 //-----------------------------------------------------------------------------
 
-void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
+static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
 {
+  if (!listbox->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
   
   event.SetInt( listbox->GetIndex( widget ) );
@@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     GtkWidget *list_item;
     list_item = gtk_list_item_new_with_label( choices[i] ); 
   
+    gtk_container_add( GTK_CONTAINER(m_list), list_item );
+    
     gtk_signal_connect( GTK_OBJECT(list_item), "select", 
       GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
   
-    gtk_container_add( GTK_CONTAINER(m_list), list_item );
-    
     m_clientData.Append( (wxObject*)NULL );
     
     gtk_widget_show( list_item );
index f4efa3d603df13af9d8e5b04ab71a9144f4a8a65..9ff546a945b93a1879b1c054d78debfaf3927739 100644 (file)
 #include "wx/frame.h"
 #include "wx/gtk/win_gtk.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxRadioBox
 //-----------------------------------------------------------------------------
 
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
+static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
 {
+  if (!rb->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   if (rb->m_alreadySent)
   {
     rb->m_alreadySent = FALSE;
index ac11b17d44384355f0dd333f0bc23533a0883df8..37396d960552a9eb0c100ea1fac5860fb852cb90 100644 (file)
 #include "wx/scrolbar.h"
 #include "wx/utils.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxScrollBar
 //-----------------------------------------------------------------------------
 
-void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
+static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
 { 
-/*
-  printf( "OnScroll from " );
-  if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-    printf( win->GetClassInfo()->GetClassName() );
-  printf( ".\n" );
-*/
-  
   if (!win->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
     
   float diff = win->m_adjust->value - win->m_oldPos;
   if (fabs(diff) < 0.2) return;
index d83eb9d7e3211a80f38f8230672f6465b37991fd..fd8d17b8d675290fa77f4d70d3746719532aa28c 100644 (file)
 #include "wx/slider.h"
 #include "wx/utils.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxSlider
 //-----------------------------------------------------------------------------
 
-void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
+static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
 { 
-/*
-  printf( "OnScroll from " );
-  if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-    printf( win->GetClassInfo()->GetClassName() );
-  printf( ".\n" );
-*/
-  
   if (!win->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
     
   float diff = win->m_adjust->value - win->m_oldPos;
   if (fabs(diff) < 0.2) return;
index c064c71faa2fbada70b0d7ad1f46b543c21f4ab0..8cb306519187d0c0f409b5fe5b9ef52d4ce6f9fa 100644 (file)
@@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
   event.m_x = 0;
   event.m_y = 0;
   event.SetEventObject( win );
-  return win->ProcessEvent( event );
+  
+  bool ret = win->ProcessEvent( event );
+/*
+  if (ret) printf( "found.\n") ;
+*/
+  return ret;
 };
 
 //-----------------------------------------------------------------------------
@@ -627,6 +632,8 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *
 
 void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
 {
+  if (!win->HasVMT()) return;
+  
   if (win->GetDropTarget())
   {
     int x = 0;
@@ -662,8 +669,8 @@ bool gtk_window_destroy_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSE
 bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
   if (widget->window != gdk_event->window) return TRUE;
-  
-  if (g_blockEventsOnDrag) return FALSE;
+  if (g_blockEventsOnDrag) return TRUE;
+  if (!win->HasVMT()) return TRUE;
   
   if (widget->window)
     gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
@@ -679,8 +686,8 @@ bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event,
 bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
   if (widget->window != gdk_event->window) return TRUE;
-  
-  if (g_blockEventsOnDrag) return FALSE;
+  if (!win->HasVMT()) return TRUE;
+  if (g_blockEventsOnDrag) return TRUE;
   
   if (widget->window)
     gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
@@ -804,6 +811,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     
   m_wxwindow = gtk_myfixed_new();
   
+  if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+    
   if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
     GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
   else
@@ -1059,18 +1068,16 @@ void wxWindow::ImplementSetSize(void)
 
 void wxWindow::ImplementSetPosition(void)
 {
+  if (IS_KIND_OF(this,wxFrame) || IS_KIND_OF(this,wxDialog))
+  {
+    if ((m_x != -1) || (m_y != -1))
+      gtk_widget_set_uposition( m_widget, m_x, m_y );
+    return;
+  }
+  
   if (!m_parent)
   {
-    if (IsKindOf(CLASSINFO(wxFrame)) ||
-        IsKindOf(CLASSINFO(wxDialog)))
-    {
-      if ((m_x != -1) || (m_y != -1))
-        gtk_widget_set_uposition( m_widget, m_x, m_y );
-    }
-    else
-    {
-      printf( "wxWindow::SetSize error.\n" );
-    }
+    printf( "wxWindow::SetSize error.\n" );
     return;
   }
   
@@ -1325,7 +1332,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
 
 void wxWindow::Centre( int direction )
 {
-  if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
+  if (IS_KIND_OF(this,wxDialog) || IS_KIND_OF(this,wxFrame))
   {
     if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
     if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
index f1a0aa1a465684cff5b39f9da1bbd6769ee54cac..4e33f54278948aa48cf32bd1fa7e1626c439d163 100644 (file)
 
 class wxBitmapButton;
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxBitmapButton
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
 
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
+static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
 {
+  if (!button->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
   button->GetEventHandler()->ProcessEvent(event);
index 52c4e2d4b9787992f2a2db0868616a03c13af88c..9e64e2579e839a5b5764f904296526b564a8950b 100644 (file)
 
 class wxButton;
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxButton
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
 
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
 {
+  if (!button->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
   event.SetEventObject(button);
   button->GetEventHandler()->ProcessEvent(event);
index b4c8a447ffd8b2dc8299388d24d686bfbedcf304..42c8b4167a52b4acf3df37a2774903342cc68b2b 100644 (file)
 
 #include "wx/checkbox.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxCheckBox
 //-----------------------------------------------------------------------------
 
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
+static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
 {
+  if (!cb->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
   event.SetInt( cb->GetValue() );
   event.SetEventObject(cb);
index 180bbb17d3d93115e708e8dbbd54251d0d50aaf4..ef374c13ad9c2c636381e39e181828f79d3ab141 100644 (file)
 
 #include "wx/choice.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxChoice
 //-----------------------------------------------------------------------------
 
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
+static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
 {
+  if (!choice->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
   event.SetInt( choice->GetSelection() );
   wxString tmp( choice->GetStringSelection() );
index 2e892f7e3ab0c2bf7d854d018619add2f8a5f652..1ac91ffdd4338d25e12b5de5dba87f7a4783e70c 100644 (file)
@@ -29,6 +29,9 @@ extern bool   g_blockEventsOnDrag;
 
 static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
 {
+  if (!combo->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   if (combo->m_alreadySent)
   {
     combo->m_alreadySent = FALSE;
@@ -90,14 +93,14 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
     GtkWidget *list_item;
     list_item = gtk_list_item_new_with_label( choices[i] ); 
   
-    gtk_signal_connect( GTK_OBJECT(list_item), "select", 
-      GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
-  
     gtk_container_add( GTK_CONTAINER(list), list_item );
     
     m_clientData.Append( (wxObject*)NULL );
     
     gtk_widget_show( list_item );
+    
+    gtk_signal_connect( GTK_OBJECT(list_item), "select", 
+      GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   };
   
   PostCreation();
index bc003c8185b18b2c66ad7956c7dd181e89578698..b4d0ed159285c7b8ceeffbde3446047df4150114 100644 (file)
@@ -65,6 +65,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
   
   m_widget = gtk_file_selection_new( "File selection" );
   
+  int x = (gdk_screen_width () - 400) / 2;
+  int y = (gdk_screen_height () - 400) / 2;
+  gtk_widget_set_uposition( m_widget, x, y );
+  
   GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
 
   m_path.Append(m_dir);
index 359adda8d089d0c98a2803685adfc5e9e77d3991..e4f05dc807276336b2790ab9d5f22dc54708e135 100644 (file)
 #include "wx/dynarray.h"
 #include "wx/listbox.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxListBox
 //-----------------------------------------------------------------------------
 
-void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
+static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
 {
+  if (!listbox->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
   
   event.SetInt( listbox->GetIndex( widget ) );
@@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     GtkWidget *list_item;
     list_item = gtk_list_item_new_with_label( choices[i] ); 
   
+    gtk_container_add( GTK_CONTAINER(m_list), list_item );
+    
     gtk_signal_connect( GTK_OBJECT(list_item), "select", 
       GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
   
-    gtk_container_add( GTK_CONTAINER(m_list), list_item );
-    
     m_clientData.Append( (wxObject*)NULL );
     
     gtk_widget_show( list_item );
index f4efa3d603df13af9d8e5b04ab71a9144f4a8a65..9ff546a945b93a1879b1c054d78debfaf3927739 100644 (file)
 #include "wx/frame.h"
 #include "wx/gtk/win_gtk.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxRadioBox
 //-----------------------------------------------------------------------------
 
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
+static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
 {
+  if (!rb->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
+  
   if (rb->m_alreadySent)
   {
     rb->m_alreadySent = FALSE;
index ac11b17d44384355f0dd333f0bc23533a0883df8..37396d960552a9eb0c100ea1fac5860fb852cb90 100644 (file)
 #include "wx/scrolbar.h"
 #include "wx/utils.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxScrollBar
 //-----------------------------------------------------------------------------
 
-void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
+static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
 { 
-/*
-  printf( "OnScroll from " );
-  if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-    printf( win->GetClassInfo()->GetClassName() );
-  printf( ".\n" );
-*/
-  
   if (!win->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
     
   float diff = win->m_adjust->value - win->m_oldPos;
   if (fabs(diff) < 0.2) return;
index d83eb9d7e3211a80f38f8230672f6465b37991fd..fd8d17b8d675290fa77f4d70d3746719532aa28c 100644 (file)
 #include "wx/slider.h"
 #include "wx/utils.h"
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxSlider
 //-----------------------------------------------------------------------------
 
-void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
+static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
 { 
-/*
-  printf( "OnScroll from " );
-  if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-    printf( win->GetClassInfo()->GetClassName() );
-  printf( ".\n" );
-*/
-  
   if (!win->HasVMT()) return;
+  if (g_blockEventsOnDrag) return;
     
   float diff = win->m_adjust->value - win->m_oldPos;
   if (fabs(diff) < 0.2) return;
index c064c71faa2fbada70b0d7ad1f46b543c21f4ab0..8cb306519187d0c0f409b5fe5b9ef52d4ce6f9fa 100644 (file)
@@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
   event.m_x = 0;
   event.m_y = 0;
   event.SetEventObject( win );
-  return win->ProcessEvent( event );
+  
+  bool ret = win->ProcessEvent( event );
+/*
+  if (ret) printf( "found.\n") ;
+*/
+  return ret;
 };
 
 //-----------------------------------------------------------------------------
@@ -627,6 +632,8 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *
 
 void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
 {
+  if (!win->HasVMT()) return;
+  
   if (win->GetDropTarget())
   {
     int x = 0;
@@ -662,8 +669,8 @@ bool gtk_window_destroy_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSE
 bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
   if (widget->window != gdk_event->window) return TRUE;
-  
-  if (g_blockEventsOnDrag) return FALSE;
+  if (g_blockEventsOnDrag) return TRUE;
+  if (!win->HasVMT()) return TRUE;
   
   if (widget->window)
     gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
@@ -679,8 +686,8 @@ bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event,
 bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
   if (widget->window != gdk_event->window) return TRUE;
-  
-  if (g_blockEventsOnDrag) return FALSE;
+  if (!win->HasVMT()) return TRUE;
+  if (g_blockEventsOnDrag) return TRUE;
   
   if (widget->window)
     gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
@@ -804,6 +811,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     
   m_wxwindow = gtk_myfixed_new();
   
+  if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+    
   if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
     GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
   else
@@ -1059,18 +1068,16 @@ void wxWindow::ImplementSetSize(void)
 
 void wxWindow::ImplementSetPosition(void)
 {
+  if (IS_KIND_OF(this,wxFrame) || IS_KIND_OF(this,wxDialog))
+  {
+    if ((m_x != -1) || (m_y != -1))
+      gtk_widget_set_uposition( m_widget, m_x, m_y );
+    return;
+  }
+  
   if (!m_parent)
   {
-    if (IsKindOf(CLASSINFO(wxFrame)) ||
-        IsKindOf(CLASSINFO(wxDialog)))
-    {
-      if ((m_x != -1) || (m_y != -1))
-        gtk_widget_set_uposition( m_widget, m_x, m_y );
-    }
-    else
-    {
-      printf( "wxWindow::SetSize error.\n" );
-    }
+    printf( "wxWindow::SetSize error.\n" );
     return;
   }
   
@@ -1325,7 +1332,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
 
 void wxWindow::Centre( int direction )
 {
-  if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame)))
+  if (IS_KIND_OF(this,wxDialog) || IS_KIND_OF(this,wxFrame))
   {
     if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
     if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;