]> git.saurik.com Git - wxWidgets.git/commitdiff
textctrl.cpp: Removed assert from CanRedo/CanUndo since the best behaviour is
authorJulian Smart <julian@anthemion.co.uk>
Mon, 13 May 2002 16:54:32 +0000 (16:54 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Mon, 13 May 2002 16:54:32 +0000 (16:54 +0000)
to return FALSE (Redo/Undo functions are unimplemented)
treectrlg.cpp: in InsertItem, allow previous item to be null in order
to insert at first position of possibly-empty child list
dcclient.cpp: allow setting of null font (common espec. on Windows)

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

src/generic/treectlg.cpp
src/gtk/dcclient.cpp
src/gtk/textctrl.cpp
src/gtk1/dcclient.cpp
src/gtk1/textctrl.cpp

index 79a9facb901e8de0968c1c7d7c2c09c1e28c440c..92610cada4526d6eea35ffb8916dfe2d922cc30d 100644 (file)
@@ -1246,9 +1246,13 @@ wxTreeItemId wxGenericTreeCtrl::InsertItem(const wxTreeItemId& parentId,
         return AddRoot(text, image, selImage, data);
     }
 
         return AddRoot(text, image, selImage, data);
     }
 
-    int index = parent->GetChildren().Index((wxGenericTreeItem*) idPrevious.m_pItem);
-    wxASSERT_MSG( index != wxNOT_FOUND,
-                  wxT("previous item in wxGenericTreeCtrl::InsertItem() is not a sibling") );
+    int index = -1;
+    if (idPrevious.IsOk())
+    {
+        index = parent->GetChildren().Index((wxGenericTreeItem*) idPrevious.m_pItem);
+        wxASSERT_MSG( index != wxNOT_FOUND,
+                      wxT("previous item in wxGenericTreeCtrl::InsertItem() is not a sibling") );
+    }
 
     return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data);
 }
 
     return DoInsertItem(parentId, (size_t)++index, text, image, selImage, data);
 }
index 736b8a1332fa4f1a7f3e59b2351a4c82f569d79c..5af43d6f273c00be651908b7ae66b7c03d726540 100644 (file)
@@ -1594,7 +1594,9 @@ void wxWindowDC::Clear()
 
 void wxWindowDC::SetFont( const wxFont &font )
 {
 
 void wxWindowDC::SetFont( const wxFont &font )
 {
-    wxCHECK_RET( font.Ok(), _T("invalid font in wxWindowDC::SetFont") );
+    // It is common practice to set the font to wxNullFont, so
+    // don't consider it to be an error
+    //    wxCHECK_RET( font.Ok(), _T("invalid font in wxWindowDC::SetFont") );
 
     m_font = font;
 #ifdef __WXGTK20__
 
     m_font = font;
 #ifdef __WXGTK20__
index bfa26d0b92b13eecec7ed01482be1673a979ae5d..a655706aa5b9b55eab3690c784e33e6f06fe57cd 100644 (file)
@@ -929,14 +929,14 @@ void wxTextCtrl::Redo()
 bool wxTextCtrl::CanUndo() const
 {
     // TODO
 bool wxTextCtrl::CanUndo() const
 {
     // TODO
-    wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
+    //wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
     return FALSE;
 }
 
 bool wxTextCtrl::CanRedo() const
 {
     // TODO
     return FALSE;
 }
 
 bool wxTextCtrl::CanRedo() const
 {
     // TODO
-    wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
+    //wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
     return FALSE;
 }
 
     return FALSE;
 }
 
index 736b8a1332fa4f1a7f3e59b2351a4c82f569d79c..5af43d6f273c00be651908b7ae66b7c03d726540 100644 (file)
@@ -1594,7 +1594,9 @@ void wxWindowDC::Clear()
 
 void wxWindowDC::SetFont( const wxFont &font )
 {
 
 void wxWindowDC::SetFont( const wxFont &font )
 {
-    wxCHECK_RET( font.Ok(), _T("invalid font in wxWindowDC::SetFont") );
+    // It is common practice to set the font to wxNullFont, so
+    // don't consider it to be an error
+    //    wxCHECK_RET( font.Ok(), _T("invalid font in wxWindowDC::SetFont") );
 
     m_font = font;
 #ifdef __WXGTK20__
 
     m_font = font;
 #ifdef __WXGTK20__
index bfa26d0b92b13eecec7ed01482be1673a979ae5d..a655706aa5b9b55eab3690c784e33e6f06fe57cd 100644 (file)
@@ -929,14 +929,14 @@ void wxTextCtrl::Redo()
 bool wxTextCtrl::CanUndo() const
 {
     // TODO
 bool wxTextCtrl::CanUndo() const
 {
     // TODO
-    wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
+    //wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
     return FALSE;
 }
 
 bool wxTextCtrl::CanRedo() const
 {
     // TODO
     return FALSE;
 }
 
 bool wxTextCtrl::CanRedo() const
 {
     // TODO
-    wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
+    //wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
     return FALSE;
 }
 
     return FALSE;
 }