]> git.saurik.com Git - wxWidgets.git/commitdiff
SetSelection must not send an event. Fixed an off
authorMattia Barbon <mbarbon@cpan.org>
Wed, 26 Mar 2003 22:20:59 +0000 (22:20 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Wed, 26 Mar 2003 22:20:59 +0000 (22:20 +0000)
by one index, and a crash (probably a Motif bug).
  Improved wxSpinButton appearance.
  Fixed some build warnings here and there in the samples,
removed use of deprecated wxList methods in prntdlgg.cpp, fixed
aot-of-range ID in tipdlg.cpp, fixed some errors detected by
valgrind.

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

include/wx/motif/combobox.h
include/wx/motif/private.h
samples/dragimag/dragimag.cpp
samples/propsize/mondrian.xpm
src/common/treebase.cpp
src/generic/prntdlgg.cpp
src/generic/tipdlg.cpp
src/motif/combobox_native.cpp
src/motif/cursor.cpp
src/motif/evtloop.cpp
src/motif/spinbutt.cpp

index 618756c3452488e96a8a053f5a44994241e6ec25..20681ffb4f864e6672ddeb672a2dad91cff972c3 100644 (file)
@@ -27,7 +27,7 @@ class WXDLLEXPORT wxComboBox: public wxChoice
     DECLARE_DYNAMIC_CLASS(wxComboBox)
         
 public:
-    wxComboBox() {}
+    wxComboBox() { m_inSetSelection = false; }
     ~wxComboBox();
     
     inline wxComboBox(wxWindow *parent, wxWindowID id,
@@ -39,6 +39,7 @@ public:
         const wxValidator& validator = wxDefaultValidator,
         const wxString& name = wxComboBoxNameStr)
     {
+        m_inSetSelection = false;
         Create(parent, id, value, pos, size, n, choices,
                style, validator, name);
     }
@@ -94,6 +95,10 @@ protected:
 private:
     // only implemented for native combo box
     void AdjustDropDownListSize();
+
+    // implementation detail, should really be private
+public:
+    bool m_inSetSelection;
 };
 
 #endif
index f93dc7b81e5e8158921ea38ea6b327aa6d3b364b..2f6270776c02e9000ab383140c4111b3077ca5a8 100644 (file)
 #include "wx/defs.h"
 #include "X11/Xlib.h"
 
+class WXDLLEXPORT wxFont;
+class WXDLLEXPORT wxWindow;
+class WXDLLEXPORT wxSize;
+
 #include "wx/x11/privx.h"
 
 // Put any private declarations here: native Motif types may be used because
index 0f68a70ff43f4735a8cecd392a8784a6687ea6c1..f1c9764ac6d77f12e483271e5a8f0e92f4583712 100644 (file)
@@ -337,7 +337,8 @@ MyFrame::MyFrame()
     
     wxMenuBar *menu_bar = new wxMenuBar();
     menu_bar->Append(file_menu, _T("&File"));
-    
+
+    SetIcon(wxICON(mondrian));
     SetMenuBar( menu_bar );
     
     CreateStatusBar(2);
index 0d72d6803f48c7680206d945b11c48a965f077e6..409b2cb2d8b0d9bb8f76dd7e5c50100cdd0e5d72 100644 (file)
@@ -41,4 +41,4 @@ static char *mondrian_xpm[] = {
 " ++++++ OOOOOOOOOOOO XXXXX ++++ ",\r
 " ++++++ OOOOOOOOOOOO XXXXX ++++ ",\r
 "                                "\r
-};
\ No newline at end of file
+};\r
index 6bf725823f8ebaee1c6adcaae6df23a7688e9899..656da196ac33832e7294e9dc444cc5f0a3cdf671 100644 (file)
@@ -37,7 +37,6 @@
 #include "wx/dynarray.h"
 #include "wx/arrimpl.cpp"
 #include "wx/dcclient.h"
-#include "wx/msgdlg.h"
 
 
 // ----------------------------------------------------------------------------
index e7fef1cdae2ed4dedb7130d59db955dd950d2684..df920489596ce08f9bf68a3260864e42504ee8bf 100644 (file)
@@ -33,8 +33,6 @@
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/dc.h"
-    #include "wx/app.h"
-    #include "wx/frame.h"
     #include "wx/stattext.h"
     #include "wx/statbox.h"
     #include "wx/button.h"
@@ -42,7 +40,6 @@
     #include "wx/textctrl.h"
     #include "wx/radiobox.h"
     #include "wx/filedlg.h"
-    #include "wx/choice.h"
     #include "wx/combobox.h"
     #include "wx/intl.h"
     #include "wx/sizer.h"
@@ -506,7 +503,7 @@ bool wxGenericPrintSetupDialog::TransferDataFromWindow()
         int selectedItem = m_paperTypeChoice->GetSelection();
         if (selectedItem != -1)
         {
-            wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(selectedItem)->Data();
+            wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData();
             if (paper != NULL)
               m_printData.SetPaperId( paper->GetId());
         }
@@ -772,7 +769,7 @@ bool wxGenericPageSetupDialog::TransferDataFromWindow()
         int selectedItem = m_paperTypeChoice->GetSelection();
         if (selectedItem != -1)
         {
-            wxPrintPaperType *paper = (wxPrintPaperType *)wxThePrintPaperDatabase->Nth(selectedItem)->Data();
+            wxPrintPaperType *paper = (wxPrintPaperType*)wxThePrintPaperDatabase->Item(selectedItem)->GetData();
             if ( paper )
             {
                 m_pageData.SetPaperSize(wxSize(paper->GetWidth()/10, paper->GetHeight()/10));
index bfb16d90ec6f5be256eece573f067e5714127589..d9d19cd600b31815d7297ccef17a2bbf2cc4fe72 100644 (file)
@@ -53,7 +53,7 @@
 // constants
 // ----------------------------------------------------------------------------
 
-static const int wxID_NEXT_TIP = -100;  // whatever
+static const int wxID_NEXT_TIP = 32000;  // whatever
 
 // ----------------------------------------------------------------------------
 // private classes
index 498ce2565f37d27608a46770bb6c276846043828..846d4e10f3e3d799569bbe7eec3a2411af4a0b57 100644 (file)
@@ -179,8 +179,10 @@ void wxComboBox::SetValue(const wxString& value)
 {
     m_inSetValue = true;
 
+    // Fix crash; probably an OpenMotif bug
+    const char* val = value.c_str() ? value.c_str() : "";
     XtVaSetValues( GetXmText(this),
-                   XmNvalue, wxConstCast(value.c_str(), char),
+                   XmNvalue, wxConstCast(val, char),
                    NULL);
 
     m_inSetValue = false;
@@ -229,6 +231,8 @@ void wxComboBox::Clear()
 
 void wxComboBox::SetSelection (int n)
 {
+    m_inSetSelection = true;
+
 #if wxCHECK_LESSTIF()
     XmListSelectPos (GetXmList(this), n + 1, false);
     SetValue(GetString(n));
@@ -241,6 +245,8 @@ void wxComboBox::SetSelection (int n)
                    XmNselectedPosition, n,
                    NULL );
 #endif
+
+    m_inSetSelection = false;
 }
 
 int wxComboBox::GetSelection (void) const
@@ -326,6 +332,8 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
 {
     wxComboBox *item = (wxComboBox *) clientData;
 
+    if( item->m_inSetSelection ) return;
+
     switch (cbs->reason)
     {
     case XmCR_SELECT:
@@ -336,7 +344,7 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
         {
             wxCommandEvent event (wxEVT_COMMAND_COMBOBOX_SELECTED,
                                   item->GetId());
-            int idx = cbs->item_position - 1;
+            int idx = cbs->item_position;
             event.m_commandInt = idx;
             event.m_commandString = item->GetString (idx);
             if ( item->HasClientObjectData() )
@@ -345,7 +353,7 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
                 event.SetClientData( item->GetClientData(idx) );
             event.m_extraLong = true;
             event.SetEventObject(item);
-            item->ProcessCommand (event);
+            item->GetEventHandler()->ProcessEvent(event);
             break;
         }
     case XmCR_VALUE_CHANGED:
@@ -355,7 +363,7 @@ void  wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
             event.m_commandString = item->GetValue();
             event.m_extraLong = true;
             event.SetEventObject(item);
-            item->ProcessCommand (event);
+            item->GetEventHandler()->ProcessEvent(event);
             break;
         }
     default:
index 0abb841b46cc6b40fd52089db1d6cd0878dbecb2..72425e23d85c41c0dc8a7a1308bf98c3700fd01f 100644 (file)
@@ -17,6 +17,7 @@
 #include "wx/app.h"
 #include "wx/utils.h"
 #include "wx/list.h"
+#include "wx/window.h"
 #if wxUSE_IMAGE
 #include "wx/image.h"
 #endif                                                                      
index 217cbfa0abd6e8c0a63693c767482fee6dcdd588..f5f5e000df888c6f56c452d4c5f65b9e789f0cbc 100644 (file)
@@ -35,6 +35,7 @@
 #include "wx/evtloop.h"
 #include "wx/event.h"
 #include "wx/app.h"
+#include "wx/window.h"
 
 #ifdef __VMS__
 #pragma message disable nosimpint
@@ -443,7 +444,7 @@ static void wxInputCallback( XtPointer, int* fd, XtInputId* )
 
 static void wxBreakDispatch()
 {
-    char dummy;
+    char dummy = 0; // for valgrind
 
     // check if wxWakeUpIdle has already been called
     fd_set in;
index d48978ec077a6ce3eb7e7f82153d6da76b2e67d6..99bebdfee045e4f0e8cdef44080589d51550a867 100644 (file)
@@ -209,6 +209,7 @@ bool wxArrowButton::Create( wxSpinButton* parent, wxWindowID id,
         parentWidget,
         XmNarrowDirection, arrow_dir,
         XmNborderWidth, 0,
+        XmNshadowThickness, 0,
         NULL );
 
     XtAddCallback( (Widget) m_mainWidget,
@@ -364,7 +365,7 @@ void wxSpinButton::Increment( int delta )
 
 wxSize wxSpinButton::DoGetBestSize() const
 {
-    return IsVertical() ? wxSize( 24, 34 ) : wxSize( 34, 24 );
+    return IsVertical() ? wxSize( 20, 30 ) : wxSize( 30, 20 );
 }
 
 // Attributes