lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master efc01fa 046/156: Allow disabling separator li


From: Greg Chicares
Subject: [lmi-commits] [lmi] master efc01fa 046/156: Allow disabling separator lines in wx_table_generator
Date: Tue, 30 Jan 2018 17:22:07 -0500 (EST)

branch: master
commit efc01fad393154afa7ae63612b9c02f8debde1ca
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>

    Allow disabling separator lines in wx_table_generator
    
    All tables don't have the same appearances.
---
 wx_table_generator.cpp | 24 ++++++++++++++++++------
 wx_table_generator.hpp |  8 ++++++++
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/wx_table_generator.cpp b/wx_table_generator.cpp
index 28f8c28..7c8a96f 100644
--- a/wx_table_generator.cpp
+++ b/wx_table_generator.cpp
@@ -216,7 +216,10 @@ void wx_table_generator::do_output_values
     int const y_text = y + char_height_;
     y += row_height_;
 
-    do_output_vert_separator(x, y_top, y);
+    if(draw_separators_)
+        {
+        do_output_vert_separator(x, y_top, y);
+        }
 
     std::size_t const num_columns = columns_.size();
     for(std::size_t col = 0; col < num_columns; ++col)
@@ -247,7 +250,10 @@ void wx_table_generator::do_output_values
             dc_.DrawText(s, x_text, y_text);
             }
         x += width;
-        do_output_vert_separator(x, y_top, y);
+        if(draw_separators_)
+            {
+            do_output_vert_separator(x, y_top, y);
+            }
         }
 }
 
@@ -328,9 +334,12 @@ void wx_table_generator::output_header(int* pos_y)
         }
 
     // Finally draw the separators above and (a double one) below them.
-    do_output_horz_separator(left_margin_, x,  y_top    );
-    do_output_horz_separator(left_margin_, x, *pos_y - 1);
-    do_output_horz_separator(left_margin_, x, *pos_y    );
+    if(draw_separators_)
+        {
+        do_output_horz_separator(left_margin_, x,  y_top    );
+        do_output_horz_separator(left_margin_, x, *pos_y - 1);
+        do_output_horz_separator(left_margin_, x, *pos_y    );
+        }
 }
 
 void wx_table_generator::output_row
@@ -341,7 +350,10 @@ void wx_table_generator::output_row
     int x = left_margin_;
     do_output_values(x, *pos_y, values);
 
-    do_output_horz_separator(left_margin_, x, *pos_y);
+    if(draw_separators_)
+        {
+        do_output_horz_separator(left_margin_, x, *pos_y);
+        }
 }
 
 void wx_table_generator::output_highlighted_cell
diff --git a/wx_table_generator.hpp b/wx_table_generator.hpp
index 7de6eeb..88b2633 100644
--- a/wx_table_generator.hpp
+++ b/wx_table_generator.hpp
@@ -105,6 +105,9 @@ class wx_table_generator
     // output a separator after the last column.
     void output_vert_separator(std::size_t before_column, int y);
 
+    // Disable separator lines drawn by default.
+    void disable_separators() {draw_separators_ = false;}
+
   private:
     // Return the font used for the headers.
     wxFont get_header_font() const;
@@ -161,6 +164,11 @@ class wx_table_generator
     // Maximal number of lines in any column header, initially 1 but can be
     // higher if multiline headers are used.
     std::size_t max_header_lines_;
+
+    // If false, separator lines are not drawn automatically (they can still be
+    // drawn by calling output_horz_separator() or output_vert_separator()
+    // explicitly).
+    bool draw_separators_ = true;
 };
 
 #endif // wx_table_generator_hpp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]