]> git.saurik.com Git - wxWidgets.git/commitdiff
Changed wxGridCellAttr::HasAlignment to treat values of -1 as no
authorMichael Bedward <mbedward@ozemail.com.au>
Thu, 27 Jul 2000 04:09:21 +0000 (04:09 +0000)
committerMichael Bedward <mbedward@ozemail.com.au>
Thu, 27 Jul 2000 04:09:21 +0000 (04:09 +0000)
alignment because wxALIGN_LEFT and wxALIGN_TOP are 0.

Updated griddemo.cpp to use correct alignment defs.

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

include/wx/generic/grid.h
samples/newgrid/griddemo.cpp

index 8015b1cf232b1a08c71d5e8d554626f1d8e4a047..02ae366dc72ce573014a658c687b6b327cf8f914 100644 (file)
@@ -564,7 +564,8 @@ public:
     wxGridCellAttr()
     {
         Init();
-        SetAlignment(0, 0);
+        // MB: args used to be 0,0 here but wxALIGN_LEFT is 0
+        SetAlignment(-1, -1);
     }
 
     // VZ: considering the number of members wxGridCellAttr has now, this ctor
@@ -610,7 +611,7 @@ 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 || m_vAlign; }
+    bool HasAlignment() const { return (m_hAlign != -1 || m_vAlign != -1); }
     bool HasRenderer() const { return m_renderer != NULL; }
     bool HasEditor() const { return m_editor != NULL; }
 
index 5f34c1c833f9772a86362aa54f1098983b1be7d5..81882094529abb70d9d0a4b8529afd3b8e4c5316 100644 (file)
@@ -229,7 +229,7 @@ GridFrame::GridFrame()
     grid->SetCellBackgroundColour(3, 3, *wxLIGHT_GREY);
 
     grid->SetCellValue(4, 4, "a weird looking cell");
-    grid->SetCellAlignment(4, 4, wxCENTRE, wxCENTRE);
+    grid->SetCellAlignment(4, 4, wxALIGN_CENTRE, wxALIGN_CENTRE);
     grid->SetCellRenderer(4, 4, new MyGridCellRenderer);
 
     grid->SetCellValue(3, 0, "1");
@@ -398,16 +398,16 @@ void GridFrame::SetRowLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) )
 
     switch ( horiz )
     {
-        case wxLEFT:
-            horiz = wxCENTRE;
+        case wxALIGN_LEFT:
+            horiz = wxALIGN_CENTRE;
             break;
 
-        case wxCENTRE:
-            horiz = wxRIGHT;
+        case wxALIGN_CENTRE:
+            horiz = wxALIGN_RIGHT;
             break;
 
-        case wxRIGHT:
-            horiz = wxLEFT;
+        case wxALIGN_RIGHT:
+            horiz = wxALIGN_LEFT;
             break;
     }
 
@@ -421,16 +421,16 @@ void GridFrame::SetRowLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) )
 
     switch ( vert )
     {
-        case wxTOP:
-            vert = wxCENTRE;
+        case wxALIGN_TOP:
+            vert = wxALIGN_CENTRE;
             break;
 
-        case wxCENTRE:
-            vert = wxBOTTOM;
+        case wxALIGN_CENTRE:
+            vert = wxALIGN_BOTTOM;
             break;
 
-        case wxBOTTOM:
-            vert = wxTOP;
+        case wxALIGN_BOTTOM:
+            vert = wxALIGN_TOP;
             break;
     }
 
@@ -445,16 +445,16 @@ void GridFrame::SetColLabelHorizAlignment( wxCommandEvent& WXUNUSED(ev) )
 
     switch ( horiz )
     {
-        case wxLEFT:
-            horiz = wxCENTRE;
+        case wxALIGN_LEFT:
+            horiz = wxALIGN_CENTRE;
             break;
 
-        case wxCENTRE:
-            horiz = wxRIGHT;
+        case wxALIGN_CENTRE:
+            horiz = wxALIGN_RIGHT;
             break;
 
-        case wxRIGHT:
-            horiz = wxLEFT;
+        case wxALIGN_RIGHT:
+            horiz = wxALIGN_LEFT;
             break;
     }
 
@@ -469,16 +469,16 @@ void GridFrame::SetColLabelVertAlignment( wxCommandEvent& WXUNUSED(ev) )
 
     switch ( vert )
     {
-        case wxTOP:
-            vert = wxCENTRE;
+        case wxALIGN_TOP:
+            vert = wxALIGN_CENTRE;
             break;
 
-        case wxCENTRE:
-            vert = wxBOTTOM;
+        case wxALIGN_CENTRE:
+            vert = wxALIGN_BOTTOM;
             break;
 
-        case wxBOTTOM:
-            vert = wxTOP;
+        case wxALIGN_BOTTOM:
+            vert = wxALIGN_TOP;
             break;
     }