From b8c631bb299230a18a9d2bbb26d28a426c161a8f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 7 Sep 1998 21:53:34 +0000 Subject: [PATCH] Fixed wxCheckBox on wxGTK (SetLabel called before widget creation), wxListBox::GetSelection returning -1 now doesn't assert; wxProp improvements for wxGTK; parser.y includes under VC++ to eliminate 'read' warning git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@709 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/msw/issues.txt | 34 --------------------------------- docs/msw/todo.txt | 17 +++++++++-------- src/common/dosyacc.c | 3 +++ src/common/parser.y | 4 ++++ src/gtk/checkbox.cpp | 2 +- src/gtk/listbox.cpp | 4 +++- src/gtk1/checkbox.cpp | 2 +- src/gtk1/listbox.cpp | 4 +++- utils/dialoged/src/reseditr.cpp | 9 ++++++--- utils/wxprop/src/proplist.cpp | 21 +++++++++++++------- 10 files changed, 44 insertions(+), 56 deletions(-) diff --git a/docs/msw/issues.txt b/docs/msw/issues.txt index 080459bb80..d8df16c583 100644 --- a/docs/msw/issues.txt +++ b/docs/msw/issues.txt @@ -32,40 +32,6 @@ wxDebugStreamBuf it might help, but I don't know how to do that - I've redefined 'new' throughout as WXDEBUG_NEW (which is itself defined as the 3-argument operator). -Config/registry classes ------------------------ - -Problems with Karsten's/Vadim's existing AppConfig classes: - -- use char* a lot instead of wxString -- rather hard to understand -- will need fairly substantial rewrite -- no native .ini functions (?) for guaranteed Windows - compatibility -- new wxWin docs required - -Good things: - -- exists! -- FileConfig independent of OS -- specifying a base class that will meet nearly all needs for - derived classes -- enumerator - -Other features we should probably have: - -- ability to specify vendor name/app name in constructor -- under Windows, ability to read/write all areas of registry - as an option - -Options: - -- rewrite AppConfig -- start from own CRegistry class -- take elements from both -- do the Windows stuff, let someone else write/adapt the - non-Windows classes - Owner-draw menus ---------------- diff --git a/docs/msw/todo.txt b/docs/msw/todo.txt index 326531ddc8..29f8a89190 100644 --- a/docs/msw/todo.txt +++ b/docs/msw/todo.txt @@ -33,9 +33,10 @@ Update manual. wxTaskBarIcon DONE wxMsgCatalog etc. wxLog - wxConfig, wxRegKey + wxConfig DONE + wxRegKey wxTabCtrl DONE - wxNotebook + wxNotebook DONE (some more explanation required) wxWave DONE wxJoystick DONE wxStatusBar95 and wxFrame status bar functions @@ -44,8 +45,8 @@ Update manual. wxHelpController classes DONE (except for Unix ones) wxString PARTLY DONE Drag and drop (change API if required, e.g. const). - wxCheckListBox - wxAcceleratorTable + wxCheckListBox DONE + wxAcceleratorTable DONE wxBaseArray, other arrays (wxOwnerDrawn) Document the include file for each class @@ -63,8 +64,6 @@ objects. More wxSystemSettings (see comment in settings.cpp). -wxSocket integration. - Convert remaining utilities e.g. (GLCanvas; wxGraphLayout) and samples Check TODO entries. @@ -79,7 +78,7 @@ for all controls, at least in WXWIN_COMPATIBLE mode, but retain (Set)Callback for all compilations. This is following a panicky response to losing callbacks. -Merge dib.cpp, dibutils.cpp. +Merge dib.cpp, dibutils.cpp (see also some DIB code in bitmap.cpp). Add a wxTabCtrl sample. @@ -151,7 +150,9 @@ substituting static text for obsolete labels). Improve and expand wxSizer classes. -Write more validators. +Write more validators. Also, how do they work if loading the +dialog from a .wxr? Could call SetValidator from within +InitDialog for all controls, then call TransferDataToWindow. Classes for file/OS utility functions. diff --git a/src/common/dosyacc.c b/src/common/dosyacc.c index e2bdecb862..bbb0d6ee23 100644 --- a/src/common/dosyacc.c +++ b/src/common/dosyacc.c @@ -4,6 +4,9 @@ static char yysccsid[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90"; #define YYBYACC 1 #line 2 "parser.y" #include "string.h" +#ifdef _MSC_VER +#include +#endif #include "wx/expr.h" #ifndef __EXTERN_C__ diff --git a/src/common/parser.y b/src/common/parser.y index 336ee0f964..7600083ee7 100644 --- a/src/common/parser.y +++ b/src/common/parser.y @@ -1,5 +1,9 @@ %{ #include +#ifdef _MSC_VER +#include +#endif + #include "wx/expr.h" #ifndef __EXTERN_C__ diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index e50abc4759..3883d1d7e2 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -56,7 +56,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetValidator( validator ); - SetLabel( label ); + wxControl::SetLabel( label ); m_widget = gtk_check_button_new_with_label( m_label ); diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index fa5a38a225..1e2e80ebc8 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -234,7 +234,9 @@ int wxListBox::GetSelection(void) const child = child->next; } } - wxFAIL_MSG("wrong listbox index"); + // 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/checkbox.cpp b/src/gtk1/checkbox.cpp index e50abc4759..3883d1d7e2 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -56,7 +56,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetValidator( validator ); - SetLabel( label ); + wxControl::SetLabel( label ); m_widget = gtk_check_button_new_with_label( m_label ); diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index fa5a38a225..1e2e80ebc8 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -234,7 +234,9 @@ int wxListBox::GetSelection(void) const child = child->next; } } - wxFAIL_MSG("wrong listbox index"); + // 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/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index 0b9de9be09..9c98a3553f 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -150,10 +150,13 @@ bool wxResourceManager::Initialize() strcat(buf, "\\dialoged.ini"); m_optionsResourceFilename = buf; #elif defined(__WXGTK__) - char buf[500]; - wxGetHomeDir(buf); - strcat(buf, "/.dialogedrc"); + /* + wxString buf; + wxGetHomeDir(&buf); + buf += "/.dialogedrc"; m_optionsResourceFilename = buf; + */ + m_optionsResourceFilename = ".dialoged.rc"; #else #error "Unsupported platform." #endif diff --git a/utils/wxprop/src/proplist.cpp b/utils/wxprop/src/proplist.cpp index e086dd2377..0f6248f12d 100644 --- a/utils/wxprop/src/proplist.cpp +++ b/utils/wxprop/src/proplist.cpp @@ -182,8 +182,11 @@ bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property) // UpdatePropertyList(FALSE); //#endif + // TODO: why is this necessary? +#ifdef __WXMSW__ if (currentlySelected > -1) propertyScrollingList->SetSelection(currentlySelected); +#endif return TRUE; } @@ -952,7 +955,7 @@ bool wxPropertyListValidator::OnDisplayValue(wxProperty *property, wxPropertyLis // view->GetValueText()->Show(TRUE); wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str.GetData()); + view->GetValueText()->SetValue(str); return TRUE; } @@ -1159,8 +1162,12 @@ bool wxBoolListValidator::OnDisplayValue(wxProperty *property, wxPropertyListVie return FALSE; wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str.GetData()); - view->GetValueList()->SetStringSelection(str.GetData()); + view->GetValueText()->SetValue(str); + + if (view->GetValueList()->IsShown()) + { + view->GetValueList()->SetStringSelection(str); + } return TRUE; } @@ -1274,10 +1281,10 @@ bool wxStringListValidator::OnDisplayValue(wxProperty *property, wxPropertyListV if (!view->GetValueText()) return FALSE; wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str.GetData()); - if (strings && view->GetValueList() && view->GetValueList()->Number() > 0) + view->GetValueText()->SetValue(str); + if (strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->Number() > 0) { - view->GetValueList()->SetStringSelection(str.GetData()); + view->GetValueList()->SetStringSelection(str); } return TRUE; } @@ -1611,7 +1618,7 @@ bool wxListOfStringsListValidator::OnDisplayValue(wxProperty *property, wxProper if (!view->GetValueText()) return FALSE; wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str.GetData()); + view->GetValueText()->SetValue(str); return TRUE; } -- 2.45.2