about summary refs log tree commit diff stats
path: root/src/ui/window.h
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-16 01:39:47 +0000
committerJames Booth <boothj5@gmail.com>2014-12-16 01:39:47 +0000
commit630fef015d47083c27fabdcb1092fece557e2f42 (patch)
tree605a22a34857f1e9ae86aa8ccec3e6c62ea9704d /src/ui/window.h
parent070547a7ffbae5c1527a4ff7b5c36ad4e2b629b4 (diff)
downloadprofani-tty-630fef015d47083c27fabdcb1092fece557e2f42.tar.gz
Added new window and layout types
Diffstat (limited to 'src/ui/window.h')
-rw-r--r--src/ui/window.h97
1 files changed, 58 insertions, 39 deletions
diff --git a/src/ui/window.h b/src/ui/window.h
index 65dcb4f7..52e1e80f 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -57,6 +57,29 @@
 #define PAD_SIZE 1000
 
 typedef enum {
+    LAYOUT_SINGLE,
+    LAYOUT_SPLIT
+} layout_type_t;
+
+typedef struct prof_layout_t {
+    layout_type_t type;
+    WINDOW *win;
+    ProfBuff buffer;
+    int y_pos;
+    int paged;
+} ProfLayout;
+
+typedef struct prof_layout_single_t {
+    ProfLayout super;
+} ProfLayoutSingle;
+
+typedef struct prof_layout_split_t {
+    ProfLayout super;
+    WINDOW *subwin;
+    int sub_y_pos;
+} ProfLayoutSplit;
+
+typedef enum {
     WIN_CONSOLE,
     WIN_CHAT,
     WIN_MUC,
@@ -67,49 +90,40 @@ typedef enum {
 
 typedef struct prof_win_t {
     win_type_t type;
-
-    WINDOW *win;
-    ProfBuff buffer;
+    ProfLayout *layout;
     char *from;
-    int y_pos;
-    int paged;
     int unread;
-    union {
-        // WIN_CONSOLE
-        struct {
-            WINDOW *subwin;
-            int sub_y_pos;
-        } cons;
-
-        // WIN_CHAT
-        struct {
-            gboolean is_otr;
-            gboolean is_trusted;
-            char *resource;
-            gboolean history_shown;
-        } chat;
-
-        // WIN_MUC
-        struct {
-            WINDOW *subwin;
-            int sub_y_pos;
-        } muc;
-
-        // WIN_MUC_CONFIG
-        struct {
-            DataForm *form;
-        } conf;
-
-        // WIN_PRIVATE
-        struct {
-        } priv;
-
-        // WIN_XML
-        struct {
-        } xml;
-    } wins;
 } ProfWin;
 
+typedef struct prof_console_win_t {
+    ProfWin super;
+} ProfConsoleWin;
+
+typedef struct prof_chat_win_t {
+    ProfWin super;
+    gboolean is_otr;
+    gboolean is_trusted;
+    char *resource;
+    gboolean history_shown;
+} ProfChatWin;
+
+typedef struct prof_muc_win_t {
+    ProfWin super;
+} ProfMucWin;
+
+typedef struct prof_mucconf_win_t {
+    ProfWin super;
+    DataForm *form;
+} ProfMucConfWin;
+
+typedef struct prof_private_win_t {
+    ProfWin super;
+} ProfPrivateWin;
+
+typedef struct prof_xml_win_t {
+    ProfWin super;
+} ProfXMLWin;
+
 ProfWin* win_create_console(void);
 ProfWin* win_create_chat(const char * const barejid);
 ProfWin* win_create_muc(const char * const roomjid);
@@ -143,4 +157,9 @@ void win_printline_nowrap(WINDOW *win, char *msg);
 gboolean win_is_otr(ProfWin *window);
 gboolean win_is_trusted(ProfWin *window);
 
+gboolean win_has_active_subwin(ProfWin *window);
+gboolean win_has_modified_form(ProfWin *window);
+gboolean win_chat_history_shown(ProfWin *window);
+gboolean win_has_chat_resource(ProfWin *window);
+
 #endif