Added new window and layout types

This commit is contained in:
James Booth
2014-12-16 01:39:47 +00:00
parent 070547a7ff
commit 630fef015d
8 changed files with 466 additions and 389 deletions

View File

@@ -56,6 +56,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,
@@ -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