Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Curses;
- using GLib;
- namespace OmegaDawn {
- public class BoxLayout : Object {
- top_pane t_pane;
- weak Window MainWin;
- Window test_win;
- bool running;
- // Setup signals
- signal void WinRefresh();
- public BoxLayout(string[] args) {
- // Aight... Initialize everything
- MainWin = initscr();
- initscr();
- start_color();
- cbreak();
- noecho();
- MainWin.keypad(true);
- //keypad(true);
- running = true;
- // Setup color pairs
- //init_pair(1, Color.BLUE, Color.YELLOW);
- //init_pair(2, Color.WHITE, Color.BLUE);
- //init_pair(3, Color.GREEN, Color.RED);
- // init_color(color_index, r_value, g_value, b_value);
- // init_pair(pair_index, color_fg, color_bg);
- // 256 colors, 32767 pairs
- // init_color(0, 1000, 1000, 1000); // 0: WHITE
- // init_color(1, 0, 0, 0); // 1: BLACK
- // init_color(2, 1000, 0, 0); // 2: 100% Red
- init_color(0, 0, 0, 0); // 0: Black
- init_color(1, 100, 100, 100); // 1: 90% Grey
- init_color(2, 200, 200, 200); // 2: 80% Grey
- init_color(3, 300, 300, 300); // 3: 70% Grey
- init_color(4, 400, 400, 400); // 4: 60% Grey
- init_color(5, 500, 500, 500); // 5: 50% Grey
- init_color(6, 600, 600, 600); // 6: 40% Grey
- init_color(7, 700, 700, 700); // 7: 30% Grey
- init_color(8, 800, 800, 800); // 8: 20% Grey
- init_color(9, 900, 900, 900); // 9: 10% Grey
- init_color(10, 1000, 1000, 1000); // 10: White
- init_color(11, 1000, 0, 0); // 11: Full Yellow
- init_color(12, 0, 1000, 0); //
- init_color(13, 0, 0, 1000); //
- init_color(20, 1000, 0, 1000); // black
- init_color(21, 1000, 1000, 1000); // white
- init_pair(0, (short)10, (short)0); // 0: White on Black
- init_pair(1, (short)0, (short)10); // 1: Black on White
- init_pair(2, 0, 0); // 2: Red on Red
- init_pair(3, 0, 7); // 3: Black on 70% gray
- init_pair(10, 10, 5);
- }
- void initialize_views() {
- // Initialize layouts
- t_pane = new top_pane(2, COLS, 0, 0);
- t_vars tv = new t_vars();
- //t_pane.write(0, 0, tv.print_vars(), 10);
- t_pane.write(0,0, tv.output_string, 10);
- // Initialize signals
- WinRefresh.connect(t_pane.refresh);
- }
- void do_refresh() {
- // TESTING: new blank window
- test_win = new Window(2, COLS, LINES-2, 0);
- test_win.bkgdset(COLOR_PAIR(1));
- test_win.clrtobot();
- MainWin.refresh();
- // Signal
- WinRefresh();
- }
- public void main_loop() {
- initialize_views();
- var ch = 0;
- while (running) {
- do_refresh();
- ch = getch();
- if (ch == -1)
- continue;
- switch (ch) {
- case ('q'):
- running = false;
- break;
- }
- }
- }
- }
- class t_vars {
- public short f_red = 0;
- public short f_green = 0;
- public short f_blue = 0;
- public short b_red = 0;
- public short b_green = 0;
- public short b_blue = 0;
- public short csfg;
- public short csbg;
- public short fg;
- public short bg;
- //private int* NULL = null;
- private string hc;
- private string ccc;
- public string output_string {public get; set; }
- public t_vars() {
- csfg = 10;
- csbg = 5;
- hc = has_colors().to_string();
- ccc = can_change_color().to_string();
- pair_content(10, ref fg, ref bg);
- color_content(fg, ref f_red, ref f_green, ref f_blue);
- color_content(bg, ref b_red, ref b_green, ref b_blue);
- output_string = "Diagnostics: " +
- "has_color: " + hc +
- " can_change_color: " + ccc +
- " pair: (fg: " + fg.to_string() + ", bg: " + bg.to_string() + ")" +
- // string istats = "COLs: " + COLORS.to_string() + ", CPs: " + COLOR_PAIRS.to_string();
- " colors: (csfg: " + fg.to_string() +
- " FR: " + f_red.to_string() +
- " FG: " + f_green.to_string() +
- " FB: " + f_blue.to_string() +
- "), (csbg: " + bg.to_string() +
- " BR: " + b_red.to_string() +
- " BG: " + b_green.to_string() +
- " BB: " + b_blue.to_string() +
- ")";
- }
- // public string print_vars() {
- // return "red: " + red.to_string() + ", green: " + green.to_string() + ", blue: " + blue.to_string();
- // }
- // public string pairs() {
- // return "fg: " + fg.to_string() + ", bg: " + bg.to_string();
- // }
- }
- }
Add Comment
Please, Sign In to add comment