sources/coloredline.h

changeset 142
b4f89893c702
parent 132
8a4690db252e
child 143
b9993733952a
equal deleted inserted replaced
140:e49aa4aa98c0 142:b4f89893c702
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 21 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
22 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,
24 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #pragma once 31 #pragma once
32 #include "main.h" 32 #include "main.h"
33 BEGIN_ZFC_NAMESPACE 33 BEGIN_ZFC_NAMESPACE
34 34
35 // The order of these colors appears to differ between curses distributions (PDCurses and its 35 // The order of these colors appears to differ between curses distributions(PDCurses and its
36 // win32a for instance have blue and red swapped). So we need to explicitly define the values 36 // win32a for instance have blue and red swapped). So we need to explicitly define the values
37 // of the enumerators based on their curses values. 37 // of the enumerators based on their curses values.
38 enum Color 38 enum Color
39 { 39 {
40 BLACK = COLOR_BLACK, 40 BLACK = COLOR_BLACK,
66 public: 66 public:
67 ColoredLine(); 67 ColoredLine();
68 68
69 const Vector<int>& data() const { return m_data; } 69 const Vector<int>& data() const { return m_data; }
70 int length() const { return m_length; } 70 int length() const { return m_length; }
71 void add_char (char ch); 71 void add_char(char ch);
72 void add_string (const String& msg); 72 void add_string(const String& msg);
73 void finalize(); 73 void finalize();
74 int rows (int cols) const; 74 int rows(int cols) const;
75 75
76 private: 76 private:
77 void activate_color (Color color, bool bold); 77 void activate_color(Color color, bool bold);
78 void set_color (Color a, bool on); 78 void set_color(Color a, bool on);
79 79
80 Vector<int> m_data; 80 Vector<int> m_data;
81 int m_length; 81 int m_length;
82 bool m_final; 82 bool m_final;
83 Color m_activeColor; 83 Color m_activeColor;

mercurial