]> git.saurik.com Git - wxWidgets.git/commitdiff
Add symbolic constant wxALIGN_INVALID and use it instead of -1 in wxGrid.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 27 Nov 2009 01:47:30 +0000 (01:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 27 Nov 2009 01:47:30 +0000 (01:47 +0000)
wxGridCellAttr was using literal -1 to indicate "no alignment" which wasn't
immediately obvious, use a new wxALIGN_INVALID (which has the same value)
instead.

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

include/wx/defs.h
include/wx/generic/grid.h
interface/wx/defs.h

index 1155806e240cc5559b06c4a4b13cf988285d7df4..0769ee204fdee3f14eabaa77d149fa4c2a0e3038 100644 (file)
@@ -1466,6 +1466,11 @@ enum wxDirection
 
 enum wxAlignment
 {
+    // 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP use
+    // it) so define a symbolic name for an invalid alignment value which can
+    // be assumed to be different from anything else
+    wxALIGN_INVALID           = -1,
+
     wxALIGN_NOT               = 0x0000,
     wxALIGN_CENTER_HORIZONTAL = 0x0100,
     wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
index f2404fcd9d47fe7ad15329a640c1a7ce051745ff..32c3f39e53b8e483fb31e672ce35e4cf7c5f99ca 100644 (file)
@@ -388,8 +388,7 @@ public:
     {
         Init(attrDefault);
 
-        // MB: args used to be 0,0 here but wxALIGN_LEFT is 0
-        SetAlignment(-1, -1);
+        SetAlignment(wxALIGN_INVALID, wxALIGN_INVALID);
     }
 
     // VZ: considering the number of members wxGridCellAttr has now, this ctor
@@ -436,7 +435,10 @@ public:
     bool HasTextColour() const { return m_colText.Ok(); }
     bool HasBackgroundColour() const { return m_colBack.Ok(); }
     bool HasFont() const { return m_font.Ok(); }
-    bool HasAlignment() const { return (m_hAlign != -1 || m_vAlign != -1); }
+    bool HasAlignment() const
+    {
+        return m_hAlign != wxALIGN_INVALID || m_vAlign != wxALIGN_INVALID;
+    }
     bool HasRenderer() const { return m_renderer != NULL; }
     bool HasEditor() const { return m_editor != NULL; }
     bool HasReadWriteMode() const { return m_isReadOnly != Unset; }
@@ -1675,9 +1677,9 @@ public:
     void SetLabelAlignment( int orientation, int align )
         {
             if ( orientation == wxHORIZONTAL )
-                SetColLabelAlignment( align, -1 );
+                SetColLabelAlignment( align, wxALIGN_INVALID );
             else
-                SetRowLabelAlignment( align, -1 );
+                SetRowLabelAlignment( align, wxALIGN_INVALID );
         }
 
     int GetLabelAlignment( int orientation, int WXUNUSED(align) ) const
index 21948b99ffee037f86c2a47184461e2f33bddce6..4c8b47a5d65dda144c012d96cc27564ab142632a 100644 (file)
@@ -66,6 +66,16 @@ enum wxDirection
 */
 enum wxAlignment
 {
+    /**
+        A value different from any valid alignment value.
+
+        Note that you shouldn't use 0 for this as it's the value of (valid)
+        alignments wxALIGN_LEFT and wxALIGN_TOP.
+
+        @since 2.9.1
+     */
+    wxALIGN_INVALID           = -1,
+
     wxALIGN_NOT               = 0x0000,
     wxALIGN_CENTER_HORIZONTAL = 0x0100,
     wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,