From c4864c0446f8ad6fc04f0ece8fb4d9b7ba38d173 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 10 Mar 2013 01:09:37 +0000 Subject: [PATCH] Use symbolic constants instead of magic numbers in wxDataViewCtrl code. No real changes, just add SortColumn_XXX symbolic constants which are somewhat more clear than -1 and -2 used before. Although the code based on the global variables remains as bad as before. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 3841f24767..94ff9da24e 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -80,7 +80,19 @@ static const int EXPANDER_OFFSET = 1; // For the generic implementation, both the leaf nodes and the nodes are sorted for // fast search when needed static wxDataViewModel* g_model; -static int g_column = -2; + +// The column is either the index of the column to be used for sorting or one +// of the special values in this enum: +enum +{ + // Don't sort at all. + SortColumn_None = -2, + + // Sort using the model default sort order. + SortColumn_Default = -1 +}; + +static int g_column = SortColumn_None; static bool g_asending = true; // ---------------------------------------------------------------------------- @@ -588,9 +600,9 @@ public: if( !col ) { if (g_model->HasDefaultCompare()) - g_column = -1; + g_column = SortColumn_Default; else - g_column = -2; + g_column = SortColumn_None; g_asending = true; return; -- 2.47.2