summaryrefslogtreecommitdiff
path: root/ycurses/src/curses
diff options
context:
space:
mode:
authorPaul Buetow (mars.fritz.box) <paul@buetow.org>2013-12-15 11:49:02 +0100
committerPaul Buetow (mars.fritz.box) <paul@buetow.org>2013-12-15 11:49:02 +0100
commit3a96ab7e91145b367d05e98533b5f426f762f83f (patch)
treeac7758a706066e14b785ab6e5f7071a54baa856b /ycurses/src/curses
parent332d7b2107833018b3ef67b64ffe121bff1ef4fb (diff)
add packagespackages
Diffstat (limited to 'ycurses/src/curses')
-rw-r--r--ycurses/src/curses/attributes.cpp80
-rw-r--r--ycurses/src/curses/attributes.h70
-rw-r--r--ycurses/src/curses/color.cpp54
-rw-r--r--ycurses/src/curses/color.h39
-rw-r--r--ycurses/src/curses/coordinate.cpp134
-rw-r--r--ycurses/src/curses/coordinate.h43
-rw-r--r--ycurses/src/curses/coordinate.impl17
-rw-r--r--ycurses/src/curses/curses.cpp86
-rw-r--r--ycurses/src/curses/curses.h55
-rw-r--r--ycurses/src/curses/cursor.cpp32
-rw-r--r--ycurses/src/curses/cursor.h30
-rw-r--r--ycurses/src/curses/dummy.cpp11
-rw-r--r--ycurses/src/curses/dummy.h11
-rw-r--r--ycurses/src/curses/hidden.cpp29
-rw-r--r--ycurses/src/curses/hidden.h21
-rw-r--r--ycurses/src/curses/incl.h8
-rw-r--r--ycurses/src/curses/menu.cpp117
-rw-r--r--ycurses/src/curses/menu.h28
-rw-r--r--ycurses/src/curses/pwindow.cpp99
-rw-r--r--ycurses/src/curses/pwindow.h37
-rw-r--r--ycurses/src/curses/tool.cpp37
-rw-r--r--ycurses/src/curses/tool.h15
-rw-r--r--ycurses/src/curses/window.cpp367
-rw-r--r--ycurses/src/curses/window.h85
-rw-r--r--ycurses/src/curses/ycurses.h6
25 files changed, 0 insertions, 1511 deletions
diff --git a/ycurses/src/curses/attributes.cpp b/ycurses/src/curses/attributes.cpp
deleted file mode 100644
index b859da0..0000000
--- a/ycurses/src/curses/attributes.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef ATTRIBUTES_CPP
-#define ATTRIBUTES_CPP
-
-#include "attributes.h"
-
-attributes::attributes()
-{
- init();
-}
-
-attributes::attributes(int i_attr)
-{
- init();
- set(true, i_attr);
-}
-
-attributes::attributes(color& r_color)
-{
- init();
- set_color(r_color);
-}
-
-void
-attributes::init()
-{
- p_color = 0;
-}
-
-void
-attributes::use_wattron(WINDOW* p_window)
-{
- std::set<int>::iterator iter;
- for (iter = set_attr.begin(); iter != set_attr.end(); ++iter)
- wattron(p_window, *iter);
-
- if (p_color)
- wattron(p_window, COLOR_PAIR(p_color->get_num()));
-}
-
-void
-attributes::use_wattroff(WINDOW* p_window)
-{
- std::set<int>::iterator iter;
- for (iter = set_attr.begin(); iter != set_attr.end(); ++iter)
- wattroff(p_window, *iter);
-
- if (p_color)
- wattroff(p_window, COLOR_PAIR(p_color->get_num()));
-}
-
-
-void
-attributes::unset_all()
-{
- set_attr.clear();
- p_color = 0;
-}
-
-bool
-attributes::get(int i_attr)
-{
- return set_attr.find(i_attr) != set_attr.end();
-}
-
-void
-attributes::set(bool b, int i_attr)
-{
- if ((set_attr.find(i_attr) != set_attr.end() ) == b)
- return;
-
- set_attr.insert(i_attr);
-}
-
-void
-attributes::set_color(color& r_color)
-{
- this->p_color = &r_color;
-}
-
-#endif
diff --git a/ycurses/src/curses/attributes.h b/ycurses/src/curses/attributes.h
deleted file mode 100644
index 2bc58d6..0000000
--- a/ycurses/src/curses/attributes.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef ATTRIBUTES_H
-#define ATTRIBUTES_H
-
-#include <set>
-#include "incl.h"
-#include "color.h"
-
-using namespace std;
-
-const int Normal = A_NORMAL;
-const int Standout = A_STANDOUT;
-const int Underline = A_UNDERLINE;
-const int Reverse = A_REVERSE;
-const int Blink = A_BLINK;
-const int Dim = A_DIM;
-const int Bold = A_BOLD;
-const int Protect = A_PROTECT;
-const int Invis = A_INVIS;
-const int AltCharSet = A_ALTCHARSET;
-const int CharText = A_CHARTEXT;
-
-class attributes
-{
-private:
- void init();
- set<int> set_attr;
- bool get(int i_attr);
- void set(bool b, int i_attr);
- color* p_color;
-
- friend class window;
- void use_wattron(WINDOW* p_window);
- void use_wattroff(WINDOW* p_window);
-
-public:
- attributes();
- attributes(int i_attr);
- attributes(color& r_color);
-
- void set(int i_attr) { set(true, i_attr); }
- void unset(int i_attr ) { set(false, i_attr); }
- void unset_all();
- void set_color(color& r_color);
-
- void set_normal(bool b) { set(b, Normal); }
- void set_standout(bool b) { set(b, Standout); }
- void set_underline(bool b) { set(b, Underline); }
- void set_reverse(bool b) { set(b, Reverse); }
- void set_blink(bool b) { set(b, Blink); }
- void set_dim(bool b) { set(b, Dim); }
- void set_bold(bool b) { set(b, Bold); }
- void set_protect(bool b) { set(b, Protect); }
- void set_invisible(bool b) { set(b, Invis); }
- void set_altcharset(bool b) { set(b, AltCharSet); }
- void set_chartext(bool b) { set(b, CharText); }
-
- bool get_normal() { return get(Normal); }
- bool get_standout() { return get(Standout); }
- bool get_underline() { return get(Underline); }
- bool get_reverse() { return get(Reverse); }
- bool get_blink() { return get(Blink); }
- bool get_dim() { return get(Dim); }
- bool get_bold() { return get(Bold); }
- bool get_protect() { return get(Protect); }
- bool get_invisible() { return get(Invis); }
- bool get_altcharset() { return get(AltCharSet); }
- bool get_chartext() { return get(CharText); }
-};
-
-#endif
diff --git a/ycurses/src/curses/color.cpp b/ycurses/src/curses/color.cpp
deleted file mode 100644
index 190d343..0000000
--- a/ycurses/src/curses/color.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef COLOR_CPP
-#define COLOR_CPP
-
-#include "color.h"
-
-bool color::b_activated = false;
-int color::i_pair_count = 0;
-
-color::color(short i, short j)
- : i_foreground(i), i_background(j)
-{
- init();
-
- i_pair = ++i_pair_count;
-
- /*
- * Simple color assignment. color pair 0 cannot
- * be redefined.
- */
- init_pair(i_pair, i_foreground, i_background);
-}
-
-color::~color()
-{
-}
-
-void
-color::init()
-{
- if ( !b_activated )
- {
- if (has_colors())
- {
- start_color();
- b_activated = true;
- }
- }
-}
-
-void
-color::enable()
-{
- attron(COLOR_PAIR(i_pair));
-}
-
-void
-color::disable()
-{
- attroff(COLOR_PAIR(i_pair));
-}
-
-
-#endif
-
diff --git a/ycurses/src/curses/color.h b/ycurses/src/curses/color.h
deleted file mode 100644
index a59727c..0000000
--- a/ycurses/src/curses/color.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-#ifndef COLOR_H
-#define COLOR_H
-
-#include "incl.h"
-
-using namespace std;
-
-const short Red = COLOR_RED;
-const short Green = COLOR_GREEN;
-const short Yellow = COLOR_YELLOW;
-const short Blue = COLOR_BLUE;
-const short Cyan = COLOR_CYAN;
-const short Magenta = COLOR_MAGENTA;
-const short White = COLOR_WHITE;
-const short Black = COLOR_BLACK;
-
-class color
-{
- private:
- void init();
-
- static int i_pair_count;
- short i_pair;
- short i_foreground;
- short i_background;
- static bool b_activated;
-
- friend class curses;
-
- public:
- color(short i, short j);
- ~color();
- void enable();
- void disable();
- short get_num() { return i_pair; }
-};
-
-#endif
diff --git a/ycurses/src/curses/coordinate.cpp b/ycurses/src/curses/coordinate.cpp
deleted file mode 100644
index efdf9e2..0000000
--- a/ycurses/src/curses/coordinate.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef COORDONATE_CPP
-#define COORDONATE_CPP
-
-#include "coordinate.h"
-
-coordinate::coordinate()
-{
- y = x = 0;
-}
-
-coordinate::coordinate(coordinate_type type, dummy_window& r_win)
-{
- set(type, r_win);
-}
-
-coordinate::coordinate(coordinate_type type)
-{
- set(type);
-}
-
-coordinate::coordinate(int y, int x)
-{
- this->y = y;
- this->x = x;
-}
-
-coordinate&
-coordinate::set(coordinate_type type, dummy_window& r_win)
-{
- switch (type)
- {
- case Absolutecoord:
- getyx(r_win.get_WINDOW(), y, x);
- break;
-
- case Relativecoord:
- getparyx(r_win.get_WINDOW(), y, x);
- break;
-
- case Beginningcoord:
- getbegyx(r_win.get_WINDOW(), y, x);
- break;
-
- case windowSize:
- getmaxyx(r_win.get_WINDOW(), y, x);
- break;
-
- default:
- set(type);
- }
-
- return *this;
-}
-
-coordinate&
-coordinate::set(coordinate_type type)
-{
- switch (type)
- {
- case TerminalSize:
- y = COLS;
- x = LINES;
- break;
-
- case TerminalCenter:
- y = static_cast<int>(COLS / 2);
- x = static_cast<int>(LINES / 2);
- break;
- }
-
- return *this;
-}
-
-coordinate&
-coordinate::left()
-{
- return left(1);
-}
-
-coordinate&
-coordinate::right()
-{
- return right(1);
-}
-
-coordinate&
-coordinate::up()
-{
- return up(1);
-}
-
-coordinate&
-coordinate::down()
-{
- return down(1);
-}
-
-coordinate&
-coordinate::left(int i)
-{
- x -= i;
- return *this;
-}
-
-coordinate&
-coordinate::right(int i)
-{
- x += i;
- return *this;
-}
-
-coordinate&
-coordinate::up(int i)
-{
- y -= i;
- return *this;
-}
-
-coordinate&
-coordinate::down(int i)
-{
- y += i;
- return *this;
-}
-
-coordinate&
-coordinate::displace(int i_y, int i_x)
-{
- y += i_y;
- x += i_x;
- return *this;
-}
-
-#endif
diff --git a/ycurses/src/curses/coordinate.h b/ycurses/src/curses/coordinate.h
deleted file mode 100644
index c17b36b..0000000
--- a/ycurses/src/curses/coordinate.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef COORDINATE_H
-#define COORDINATE_H
-
-#include "incl.h"
-#include "dummy.h"
-
-using namespace std;
-
-enum coordinate_type
-{
- Absolutecoord,
- Relativecoord,
- Beginningcoord,
- windowSize,
- TerminalSize,
- TerminalCenter
-};
-
-
-struct coordinate
-{
- int y, x;
-
- coordinate();
- coordinate(coordinate_type type, dummy_window& r_win);
- coordinate(coordinate_type type);
- coordinate(int y, int x);
-
- coordinate& set(coordinate_type type, dummy_window& r_win);
- coordinate& set(coordinate_type type);
- coordinate& left();
- coordinate& right();
- coordinate& up();
- coordinate& down();
- coordinate& left(int i);
- coordinate& right(int i);
- coordinate& up(int i);
- coordinate& down(int i);
- coordinate& displace(int i_y, int i_x);
-
-};
-
-#endif
diff --git a/ycurses/src/curses/coordinate.impl b/ycurses/src/curses/coordinate.impl
deleted file mode 100644
index 8bdf17c..0000000
--- a/ycurses/src/curses/coordinate.impl
+++ /dev/null
@@ -1,17 +0,0 @@
-template<class T>
-coordinate
-create_coordinate(dummy_window& d_window)
-{
- coordinate coord;
- T(d_window, coord.x, coord.y);
- return coord;
-}
-
-template<class T>
-coordinate
-create_coordinate()
-{
- coordinate coord;
- T(coord.x, coord.y);
- return coord;
-}
diff --git a/ycurses/src/curses/curses.cpp b/ycurses/src/curses/curses.cpp
deleted file mode 100644
index 3605e59..0000000
--- a/ycurses/src/curses/curses.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef CURSES_CPP
-#define CURSES_CPP
-
-#include "curses.h"
-
-int curses::i_self_counter = 0;
-
-curses::curses()
-{
- if ( ++i_self_counter == 1 )
- {
- initscr();
- raw();
- keypad(stdscr, TRUE);
- noecho();
- }
-}
-
-curses::~curses()
-{
- if ( --i_self_counter == 0 )
- {
-/*
- Factory<attributes>::destroyAll();
- Factory<color>::destroyAll();
- Factory<window>::destroyAll();
- Factory<menu>::destroyAll();
- Factory<pwindow>::destroyAll();
- */
- clear();
- endwin();
- }
-}
-
-void
-curses::finish()
-{
-}
-
-int
-curses::get_char()
-{
- return getch();
-}
-
-string
-curses::get_string()
-{
- char c[1024];
- getstr(c);
- return string(c);
-}
-
-void
-curses::pause()
-{
- getch();
-}
-
-void
-curses::disable()
-{
- refresh();
- def_prog_mode();
- endwin();
-}
-
-void
-curses::enable()
-{
- reset_prog_mode();
- refresh();
-}
-
-void
-curses::clear()
-{
- coordinate coord(LINES, COLS);
- for ( int i = 0; i < coord.y; ++i )
- for ( int j = 0; j < coord.x; ++j )
- mvaddch(i, j, ' ');
-
- refresh();
-}
-
-#endif
diff --git a/ycurses/src/curses/curses.h b/ycurses/src/curses/curses.h
deleted file mode 100644
index 04ed707..0000000
--- a/ycurses/src/curses/curses.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef CURSES_H
-#define CURSES_H
-
-#include "attributes.h"
-#include "incl.h"
-#include "color.h"
-#include "cursor.h"
-#include "menu.h"
-#include "pwindow.h"
-#include "tool.h"
-#include "window.h"
-#include "coordinate.h"
-
-using namespace std;
-
-/* This class is representing the base of curses, it has to be instantiated
- * in order to use curses.
- */
-class curses
-{
- private:
- static int i_self_counter;
-
- public:
- /* Initializes curses before its first use */
- curses();
-
- /* Removes all curses elements, all objects (such as window, color etc)
- * be finished as well!
- */
- ~curses();
-
- /* Waits for user intput and returns the ASCII code being typed */
- static int get_char();
-
- /* Returns the string being typed until the first return */
- static string get_string();
-
- /* Waits intil the user hits a key */
- static void pause();
-
- static void disable();
- static void enable();
-
- /* Removes all curses elements, all objects (such as window, color etc) will
- * be finished as well! This method will be called by ~curses internally.
- * You can also use this method instead of the destructor if you wanna use
- * another shutdown routine like catching SIGINT first, deleting your own
- * stuff, and then running curses::finish();!
- */
- static void finish();
- static void clear();
-};
-
-#endif
diff --git a/ycurses/src/curses/cursor.cpp b/ycurses/src/curses/cursor.cpp
deleted file mode 100644
index eaa10a7..0000000
--- a/ycurses/src/curses/cursor.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef CURSOR_CPP
-#define CURSOR_CPP
-
-#include "cursor.h"
-
-cursor::cursor()
-{
-}
-
-cursor::cursor(cursorType t)
-{
- set(t);
-}
-
-cursor::cursor(coordinate& r_coord)
-{
- set(r_coord);
-}
-
-void
-cursor::set(cursorType t)
-{
- curs_set(t);
-}
-
-void
-cursor::set(coordinate& r_coord)
-{
- move(r_coord.y, r_coord.x);
-}
-
-#endif
diff --git a/ycurses/src/curses/cursor.h b/ycurses/src/curses/cursor.h
deleted file mode 100644
index 504a44c..0000000
--- a/ycurses/src/curses/cursor.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef CURSOR_H
-#define CURSOR_H
-
-#include "incl.h"
-#include "coordinate.h"
-
-using namespace std;
-
-enum cursorType
-{
- Invisible = 0,
- Visible,
- VeryVisible
-};
-
-struct cursor
-{
- cursor();
- cursor(cursorType t);
- cursor(coordinate& r_coord);
-
- static void set(cursorType t);
- static void set(coordinate& r_coord);
-
- static void set_invisible() { set(Invisible); }
- static void setVisible() { set(Visible); }
- static void setVeryVisible() { set(VeryVisible); }
-};
-
-#endif
diff --git a/ycurses/src/curses/dummy.cpp b/ycurses/src/curses/dummy.cpp
deleted file mode 100644
index eab2b13..0000000
--- a/ycurses/src/curses/dummy.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef DUMMY_CPP
-#define DUMMY_CPP
-
-#include "dummy.h"
-
-WINDOW* dummy_window::get_WINDOW()
-{
- return 0;
-}
-
-#endif
diff --git a/ycurses/src/curses/dummy.h b/ycurses/src/curses/dummy.h
deleted file mode 100644
index d691e1c..0000000
--- a/ycurses/src/curses/dummy.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef DUMMY_H
-#define DUMMY_H
-
-#include "incl.h"
-
-struct dummy_window
-{
- virtual WINDOW* get_WINDOW();
-};
-
-#endif
diff --git a/ycurses/src/curses/hidden.cpp b/ycurses/src/curses/hidden.cpp
deleted file mode 100644
index 9f9b39f..0000000
--- a/ycurses/src/curses/hidden.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef HIDDEN_CPP
-#define HIDDEN_CPP
-
-#include "hidden.h"
-
-hidden::hidden()
-{
- show();
-}
-
-void
-hidden::hide()
-{
- b_hidden = true;
-}
-
-void
-hidden::show()
-{
- b_hidden = false;
-}
-
-bool
-hidden::is_hidden()
-{
- return b_hidden;
-}
-
-#endif
diff --git a/ycurses/src/curses/hidden.h b/ycurses/src/curses/hidden.h
deleted file mode 100644
index f0f632a..0000000
--- a/ycurses/src/curses/hidden.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef HIDDEN_H
-#define HIDDEN_H
-
-#include "incl.h"
-
-using namespace std;
-
-class hidden
-{
- private:
- bool b_hidden;
-
- public:
- hidden();
- virtual void hide();
- virtual void show();
- bool is_hidden();
-};
-
-#endif
-
diff --git a/ycurses/src/curses/incl.h b/ycurses/src/curses/incl.h
deleted file mode 100644
index b31d1ff..0000000
--- a/ycurses/src/curses/incl.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <iostream>
-#include <map>
-#include <string>
-#include <vector>
-
-#include <ncurses.h>
-#include <menu.h>
-#include <panel.h>
diff --git a/ycurses/src/curses/menu.cpp b/ycurses/src/curses/menu.cpp
deleted file mode 100644
index e240566..0000000
--- a/ycurses/src/curses/menu.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-#ifndef MENU_CPP
-#define MENU_CPP
-
-#include "menu.h"
-
-menu::menu(vector<string>& vec_choices)
-{
- init(vec_choices);
-}
-
-menu::~menu()
-{
- if (p_items)
- {
- for (int i = 0; i < i_choices; ++i)
- free_item(p_items[i]);
-
- delete [] p_items;
- p_items = 0;
- }
-
- if (p_menu)
- {
- free_menu(p_menu);
- p_menu = 0;
- }
-
- if (p_win)
- {
- delete p_win;
- p_win = 0;
- }
-}
-
-void
-menu::init(vector<string>& vec_choices)
-{
- i_choices = vec_choices.size();
- i_current = 0;
-
- int i_choices = vec_choices.size();
- int iMaxLen = 0;
- p_items = new ITEM*[i_choices];
-
- for (int i = 0; i < i_choices; ++i)
- {
- p_items[i] = new_item(vec_choices.at(i).c_str(), "");
- int iLen = vec_choices.at(i).length();
- if (iLen > iMaxLen)
- iMaxLen = iLen;
- }
-
- p_menu = new_menu(p_items);
-
- p_win = new window(i_choices+2, iMaxLen+4, 4, 4);
- WINDOW* p_window = p_win->get_WINDOW();
-
- set_menu_win(p_menu, p_window);
- set_menu_sub(p_menu, derwin(p_window, i_choices, iMaxLen+2, 1, 1));
-
- refresh();
- post_menu(p_menu);
- wrefresh(p_window);
-}
-
-window&
-menu::get_window()
-{
- return *p_win;
-}
-
-int
-menu::run()
-{
- WINDOW* p_window = p_win->get_WINDOW();
- keypad(p_window, 1);
- int i_choice;
-
- while( (i_choice = wgetch(p_window)) )
- {
- switch(i_choice)
- {
- case KEY_DOWN:
- case 'j': // Vi mode
- if ( i_current < i_choices-1 )
- ++i_current;
- menu_driver(p_menu, REQ_DOWN_ITEM);
- break;
-
- case KEY_UP:
- case 'k': // Vi mode
- if ( i_current > 0 )
- --i_current;
- menu_driver(p_menu, REQ_UP_ITEM);
- break;
-
- case 'h': // Vi mode
- case 'q': // Vi mode
- case 27: // ESC
- i_current = i_choices-1; // Select last entry.
-
- case 'l': // Vi mode
- case 10: // Enter
- case 32: // Space
- keypad(p_window, 0);
- return i_current;
- }
-
-// window win_root(root);
-// win_root.print(i_choice);
-
- wrefresh(p_window);
- }
-}
-
-#endif
-
diff --git a/ycurses/src/curses/menu.h b/ycurses/src/curses/menu.h
deleted file mode 100644
index 3b672c3..0000000
--- a/ycurses/src/curses/menu.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef MENU_H
-#define MENU_H
-
-#include "incl.h"
-#include "window.h"
-
-using namespace std;
-
-class menu
-{
- private:
- void init(vector<string>& vec_choices);
-
- int i_choices, i_current;
- ITEM** p_items;
- MENU* p_menu;
- window* p_win;
-
- public:
- menu(vector<string>& vec_choices);
- menu(string s_name, vector<string>& vec_choices);
- ~menu();
-
- window& get_window();
- int run();
-};
-
-#endif
diff --git a/ycurses/src/curses/pwindow.cpp b/ycurses/src/curses/pwindow.cpp
deleted file mode 100644
index 9ef2d80..0000000
--- a/ycurses/src/curses/pwindow.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef PANEL_CPP
-#define PANEL_CPP
-
-#include "pwindow.h"
-
-pwindow::pwindow(window& r_win)
-{
- p_window = &r_win;
- init();
-}
-
-void
-pwindow::reinit(window& r_win)
-{
- p_window = &r_win;
- init();
-}
-
-pwindow::~pwindow()
-{
- remove();
-}
-
-void
-pwindow::remove()
-{
- if (p_panel)
- {
- del_panel(p_panel);
- p_panel = 0;
- }
-
- update();
-}
-
-void
-pwindow::init()
-{
- p_panel = new_panel(p_window->get_WINDOW());
- update();
-}
-
-void
-pwindow::update()
-{
- update_panels();
- doupdate();
-}
-
-void
-pwindow::on_bottom()
-{
- bottom_panel(p_panel);
- update();
-}
-
-void
-pwindow::on_top()
-{
- top_panel(p_panel);
- update();
-}
-
-void
-pwindow::hide()
-{
- hidden::hide();
- hide_panel(p_panel);
- update();
-}
-
-void
-pwindow::show()
-{
- hidden::show();
- show_panel(p_panel);
- update();
-}
-
-void
-pwindow::move(coordinate& r_coord)
-{
- move(r_coord.y, r_coord.x);
-}
-
-void
-pwindow::move(int y, int x)
-{
- move_panel(p_panel, y, x);
- update();
-}
-
-PANEL*
-pwindow::get_PANEL()
-{
- return p_panel;
-}
-
-#endif
diff --git a/ycurses/src/curses/pwindow.h b/ycurses/src/curses/pwindow.h
deleted file mode 100644
index 49b1d75..0000000
--- a/ycurses/src/curses/pwindow.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef PWINDOW_H
-#define PWINDOW_H
-
-using namespace std;
-
-#include "incl.h"
-#include "coordinate.h"
-#include "hidden.h"
-#include "window.h"
-
-class pwindow : public hidden
-{
-
- private:
- PANEL* p_panel;
- window* p_window;
- void init();
-
- public:
- pwindow(window& r_win);
- ~pwindow();
- void init(window& r_win);
- void reinit(window& r_win);
-
- void remove();
- void on_bottom();
- void on_top();
- void hide();
- void show();
- void move(int y, int x);
- void move(coordinate& r_coord);
-
- static void update();
- PANEL* get_PANEL();
-};
-
-#endif
diff --git a/ycurses/src/curses/tool.cpp b/ycurses/src/curses/tool.cpp
deleted file mode 100644
index 1bce76f..0000000
--- a/ycurses/src/curses/tool.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef TOOL_CPP
-#define TOOL_CPP
-
-#include "tool.h"
-
-string
-tool::int2string(int i_int)
-{
- char buf[64];
- sprintf(buf, "%d", i_int);
- return buf;
-}
-
-int
-tool::string2int(string s)
-{
- const char *p = s.c_str();
- int i_res = 0;
-
- // Convert each digit char and add into result.
- while (*p >= '0' && *p <='9')
- {
- i_res = (i_res * 10) + (*p - '0');
- p++;
- }
-
- // Check that there were no non-digits at end.
- if (*p != 0)
- {
- return -1;
- }
-
- return i_res;
-}
-
-#endif
-
diff --git a/ycurses/src/curses/tool.h b/ycurses/src/curses/tool.h
deleted file mode 100644
index 130bd09..0000000
--- a/ycurses/src/curses/tool.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef TOOL_H
-#define TOOL_H
-
-#include "incl.h"
-
-using namespace std;
-
-class tool
-{
-public:
- static string int2string( int i_int );
- static int string2int( string s );
-};
-
-#endif
diff --git a/ycurses/src/curses/window.cpp b/ycurses/src/curses/window.cpp
deleted file mode 100644
index d5ce37c..0000000
--- a/ycurses/src/curses/window.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-#ifndef WINDOW_CPP
-#define WINDOW_CPP
-
-#include "window.h"
-
-bool window::b_is_rootoot = false;
-
-window::window(window_type t)
-{
- b_is_rootoot = true;
- init();
- p_window = stdscr;
-}
-
-window::window(int i_height, int i_width)
-{
- init();
-
- this->i_height = i_height;
- this->i_width = i_width;
- this->i_start_y = (LINES - i_height) / 2;
- this->i_start_x = (COLS - i_width) / 2;
-
- p_window = create_new_win(i_height, i_width, i_start_y, i_start_x);
-}
-
-window::window(int i_height, int i_width, coordinate& r_coord)
-{
- init();
-
- this->i_height = i_height;
- this->i_width = i_width;
- this->i_start_y = r_coord.y;
- this->i_start_x = r_coord.x;
-
- p_window = create_new_win(i_height, i_width, i_start_y, i_start_x);
-}
-
-window::window(int i_height, int i_width, int i_start_y, int i_start_x)
-{
- init();
-
- this->i_height = i_height;
- this->i_width = i_width;
- this->i_start_y = i_start_y;
- this->i_start_x = i_start_x;
-
- p_window = create_new_win(i_height, i_width, i_start_y, i_start_x);
-}
-
-window::~window()
-{
- if (p_window)
- {
- if(!is_root_win())
- destroy_win(p_window);
-
- p_window = 0;
- }
-}
-
-bool
-window::is_root_win()
-{
- return b_is_rootoot;
-}
-
-void
-window::init()
-{
-}
-
-WINDOW*
-window::create_new_win(int i_height, int i_width, int i_start_y, int i_start_x)
-{
- WINDOW *p_local_win = newwin(i_height, i_width, i_start_y, i_start_x);
- box(p_local_win, 0 , 0); /* 0, 0 gives default characters
- * for the vertical and horizontal
- * lines */
- wrefresh(p_local_win); /* Show that box */
-
- return p_local_win;
-}
-
-void
-window::destroy_win(WINDOW *p_local_win)
-{
- /* box(local_win, ' ', ' '); : This won't produce the desired
- * result of erasing the window. It will leave it's four corners
- * and so an ugly remnant of window.
- */
-
- wborder(p_local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
- /* The parameters taken are
- * 1. win: the window on which to operate
- * 2. ls: character to be used for the left side of the window
- * 3. rs: character to be used for the right side of the window
- * 4. ts: character to be used for the top side of the window
- * 5. bs: character to be used for the bottom side of the window
- * 6. tl: character to be used for the top left corner of the window
- * 7. tr: character to be used for the top right corner of the window
- * 8. bl: character to be used for the bottom left corner of the window
- * 9. br: character to be used for the bottom right corner of the window
- */
-
- wrefresh(p_local_win);
- delwin(p_local_win);
-}
-
-void
-window::hide()
-{
- hidden::hide();
-
- if (p_window)
- destroy_win(p_window);
-}
-
-void
-window::show()
-{
- if (!is_hidden())
- return;
-
- hidden::show();
-
- p_window = create_new_win(i_height, i_width, i_start_y, i_start_x);
-
- refresh();
-}
-
-void
-window::refresh()
-{
- wrefresh(p_window);
-}
-
-void
-window::set_attributes(attributes& r_attr)
-{
- r_attr.use_wattron(p_window);
-}
-
-void
-window::unset_attributes(attributes& r_attr)
-{
- r_attr.use_wattroff(p_window);
-}
-
-int
-window::save_attributes()
-{
- return attr_get(&sr_attributes, &sr_pair, sr_options);
-}
-
-int
-window::restore_attributes()
-{
- return attr_set(sr_attributes, sr_pair, sr_options);
-}
-
-void
-window::print(int i)
-{
- print(tool::int2string(i));
-}
-
-void
-window::print(coordinate &r_coord, string s)
-{
- print(r_coord.y, r_coord.x, s);
-}
-
-void
-window::print(int i_y, int i_x, int i)
-{
- print(i_y, i_x, tool::int2string(i));
-}
-
-void
-window::print(coordinate &r_coord, int i)
-{
- print(r_coord, tool::int2string(i));
-}
-
-void
-window::println(int i)
-{
- println(tool::int2string(i));
-}
-
-void
-window::println(coordinate &r_coord, string s)
-{
- println(r_coord.y, r_coord.x, s);
-}
-
-void
-window::println(int i_y, int i_x, int i)
-{
- println(i_y, i_x, tool::int2string(i));
-}
-
-void
-window::println(coordinate &r_coord, int i)
-{
- println(r_coord, tool::int2string(i));
-}
-
-void
-window::print(string s)
-{
- wprintw(p_window, const_cast<char*>(s.c_str()));
- refresh();
-}
-
-void
-window::print(int i_y, int i_x, string s)
-{
- mvwprintw(p_window, i_y, i_x, const_cast<char*>(s.c_str()));
- refresh();
-}
-
-void
-window::println(string s)
-{
- wprintw(p_window, const_cast<char*>((s+"\n").c_str()));
- refresh();
-}
-
-void
-window::println(int i_y, int i_x, string s)
-{
- mvwprintw(p_window, i_y, i_x, const_cast<char*>((s+"\n").c_str()));
- refresh();
-}
-
-void
-window::print(int i, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- print(tool::int2string(i));
- restore_attributes();
-}
-
-void
-window::print(coordinate &r_coord, string s, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- print(r_coord.y, r_coord.x, s);
- restore_attributes();
-}
-
-void
-window::print(int i_y, int i_x, int i, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- print(i_y, i_x, tool::int2string(i));
- restore_attributes();
-}
-
-void
-window::print(coordinate &r_coord, int i, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- print(r_coord, tool::int2string(i));
- restore_attributes();
-}
-
-void
-window::println(int i, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- println(tool::int2string(i));
- restore_attributes();
-}
-
-void
-window::println(coordinate &r_coord, string s, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- println(r_coord.y, r_coord.x, s);
- restore_attributes();
-}
-
-void
-window::println(int i_y, int i_x, int i, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- println(i_y, i_x, tool::int2string(i));
- restore_attributes();
-}
-
-void
-window::println(coordinate &r_coord, int i, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- println(r_coord, tool::int2string(i));
- restore_attributes();
-}
-
-void
-window::print(string s, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- wprintw(p_window, const_cast<char*>(s.c_str()));
- refresh();
- restore_attributes();
-}
-
-void
-window::print(int i_y, int i_x, string s, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- mvwprintw(p_window, i_y, i_x, const_cast<char*>(s.c_str()));
- refresh();
- restore_attributes();
-}
-
-void
-window::println(string s, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- wprintw(p_window, const_cast<char*>((s+"\n").c_str()));
- refresh();
- restore_attributes();
-}
-
-void
-window::println(int i_y, int i_x, string s, attributes& r_attr)
-{
- save_attributes();
- set_attributes(r_attr);
- mvwprintw(p_window, i_y, i_x, const_cast<char*>((s+"\n").c_str()));
- refresh();
- restore_attributes();
-}
-
-void
-window::move_cursor(coordinate& r_coord)
-{
- move_cursor(r_coord.y, r_coord.x);
-}
-
-void
-window::move_cursor(int i_y, int i_x)
-{
- if (!p_window)
- return;
-
- wmove(p_window, i_y, i_x);
- refresh();
-}
-
-
-#endif
diff --git a/ycurses/src/curses/window.h b/ycurses/src/curses/window.h
deleted file mode 100644
index d194e2f..0000000
--- a/ycurses/src/curses/window.h
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include "attributes.h"
-#include "color.h"
-#include "coordinate.h"
-#include "dummy.h"
-#include "hidden.h"
-#include "incl.h"
-#include "tool.h"
-
-using namespace std;
-
-enum window_type
-{
- root
-};
-
-class window : public dummy_window, hidden
-{
- private:
- WINDOW* p_window;
- int i_height, i_width, i_start_y, i_start_x;
- static bool b_is_rootoot;
-
- /* For save_attributes and restore_attributes */
- attr_t sr_attributes; short sr_pair; void *sr_options;
-
- WINDOW *create_new_win(int i_height, int i_width, int i_start_y, int i_start_x);
- void destroy_win(WINDOW *p_local_win);
-
- /* Called by the constructors */
- void init();
-
- public:
- window(window_type t);
- window(int i_height, int i_width, coordinate& r_coord);
- window(int i_height, int i_width, int i_start_y, int i_start_x);
- window(int i_height, int i_width);
- ~window();
-
- void hide();
- void show();
- void refresh();
- void set_attributes(attributes& r_attr);
- void unset_attributes(attributes& r_attr);
- bool is_root_win();
-
- WINDOW* get_WINDOW() { return p_window; }
-
- int save_attributes();
- int restore_attributes();
-
- void move_cursor(coordinate& r_coord);
- void move_cursor(int i_y, int i_x);
-
- void print(string s);
- void print(int i_y, int i_x, string s);
- void println(string s);
- void println(int i_y, int i_x, string s);
- void print(int i);
- void print(coordinate &r_coord, string s);
- void print(int i_y, int i_x, int i);
- void print(coordinate &r_coord, int i);
- void println(int i);
- void println(coordinate &r_coord, string s);
- void println(int i_y, int i_x, int i);
- void println(coordinate &r_coord, int i);
-
- void print(string s, attributes& r_attr);
- void print(int i_y, int i_x, string s, attributes& r_attr);
- void println(string s, attributes& r_attr);
- void println(int i_y, int i_x, string s, attributes& r_attr);
- void print(int i, attributes& r_attr);
- void print(coordinate &r_coord, string s, attributes& r_attr);
- void print(int i_y, int i_x, int i, attributes& r_attr);
- void print(coordinate &r_coord, int i, attributes& r_attr);
- void println(int i, attributes& r_attr);
- void println(coordinate &r_coord, string s, attributes& r_attr);
- void println(int i_y, int i_x, int i, attributes& r_attr);
- void println(coordinate &r_coord, int i, attributes& r_attr);
-};
-
-#endif
-
diff --git a/ycurses/src/curses/ycurses.h b/ycurses/src/curses/ycurses.h
deleted file mode 100644
index 1699e96..0000000
--- a/ycurses/src/curses/ycurses.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef YCURSES_H
-#define YCURSES_H
-
-#include "curses.h"
-
-#endif