diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-05 16:19:10 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-05 16:19:10 +0100 |
commit | 14d393b11ebcbc34916213055b45f39d0afa8db2 (patch) | |
tree | fa6f3d9f6c1e3435410cec1aec0629861f3b9828 /src/gui/gtk | |
parent | d64e852a3863ba495cb3638ebe4bf1b89983a7f3 (diff) | |
download | weechat-14d393b11ebcbc34916213055b45f39d0afa8db2.zip |
Partial support of bars, with custom items.
Today only root bars are partially working (refresh is not always performed),
and bars are not saved in configuration file. To be continued...
Diffstat (limited to 'src/gui/gtk')
-rw-r--r-- | src/gui/gtk/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/gui/gtk/Makefile.am | 3 | ||||
-rw-r--r-- | src/gui/gtk/gui-gtk-bar.c | 109 | ||||
-rw-r--r-- | src/gui/gtk/gui-gtk-window.c | 15 | ||||
-rw-r--r-- | src/gui/gtk/gui-gtk.h | 11 |
5 files changed, 140 insertions, 4 deletions
diff --git a/src/gui/gtk/CMakeLists.txt b/src/gui/gtk/CMakeLists.txt index 9bb081098..5d5ec2315 100644 --- a/src/gui/gtk/CMakeLists.txt +++ b/src/gui/gtk/CMakeLists.txt @@ -14,9 +14,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -SET(WEECHAT_GTK_SRC gui-gtk-chat.c gui-gtk-color.c gui-gtk-infobar.c -gui-gtk-input.c gui-gtk-keyboard.c gui-gtk-main.c gui-gtk-nicklist.c -gui-gtk-status.c gui-gtk-window.c gui-gtk.h) +SET(WEECHAT_GTK_SRC gui-gtk-bar.c gui-gtk-chat.c gui-gtk-color.c +gui-gtk-infobar.c gui-gtk-input.c gui-gtk-keyboard.c gui-gtk-main.c +gui-gtk-nicklist.c gui-gtk-status.c gui-gtk-window.c gui-gtk.h) SET(EXECUTABLE weechat-gtk) diff --git a/src/gui/gtk/Makefile.am b/src/gui/gtk/Makefile.am index 6d58071c3..4fcc6424c 100644 --- a/src/gui/gtk/Makefile.am +++ b/src/gui/gtk/Makefile.am @@ -37,7 +37,8 @@ weechat_gtk_LDADD = ../../core/weechat.o \ $(PLUGINS_LFLAGS) \ $(GTK_LFLAGS) -weechat_gtk_SOURCES = gui-gtk-chat.c \ +weechat_gtk_SOURCES = gui-gtk-bar.c \ + gui-gtk-chat.c \ gui-gtk-color.c \ gui-gtk-infobar.c \ gui-gtk-input.c \ diff --git a/src/gui/gtk/gui-gtk-bar.c b/src/gui/gtk/gui-gtk-bar.c new file mode 100644 index 000000000..6c726bc8a --- /dev/null +++ b/src/gui/gtk/gui-gtk-bar.c @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* gui-gtk-bar.c: bar functions for Gtk GUI */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> + +#include "../../core/weechat.h" +#include "../../core/wee-log.h" +#include "../gui-bar.h" +#include "../gui-chat.h" +#include "../gui-color.h" +#include "../gui-window.h" +#include "gui-gtk.h" + + +/* + * gui_bar_windows_get_size: get total bar size (window bars) for a position + * bar is optional, if not NULL, size is computed + * from bar 1 to bar # - 1 + */ + +int +gui_bar_window_get_size (struct t_gui_bar *bar, struct t_gui_window *window, + int position) +{ + (void) bar; + (void) window; + (void) position; + + /* TODO: write this function for Gtk */ + return 0; +} + +/* + * gui_bar_window_new: create a new "window bar" for a bar, in screen or a window + * if window is not NULL, bar window will be in this window + */ + +int +gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window) +{ + (void) bar; + (void) window; + + /* TODO: write this function for Gtk */ + return 0; +} + +/* + * gui_bar_draw: draw a bar + */ + +void +gui_bar_draw (struct t_gui_bar *bar) +{ + (void) bar; + + /* TODO: write this function for Gtk */ +} + +/* + * gui_bar_window_free: delete an bar window + */ + +void +gui_bar_window_free (struct t_gui_bar_window *bar_window) +{ + /* TODO: complete this function for Gtk */ + + /* free bar window */ + free (bar_window); +} + +/* + * gui_bar_window_print_log: print bar window infos in log (usually for crash dump) + */ + +void +gui_bar_window_print_log (struct t_gui_bar_window *bar_window) +{ + log_printf (""); + log_printf (" [window bar (addr:0x%x)]", bar_window); + log_printf (" bar . . . . . . . : 0x%x", bar_window->bar); + log_printf (" x . . . . . . . . : %d", bar_window->x); + log_printf (" y . . . . . . . . : %d", bar_window->y); + log_printf (" width . . . . . . : %d", bar_window->width); + log_printf (" height. . . . . . : %d", bar_window->height); +} diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c index 12526333c..8f22655a8 100644 --- a/src/gui/gtk/gui-gtk-window.c +++ b/src/gui/gtk/gui-gtk-window.c @@ -76,6 +76,7 @@ gui_window_objects_init (struct t_gui_window *window) GUI_GTK(window)->texttag_chat = NULL; GUI_GTK(window)->textview_nicklist = NULL; GUI_GTK(window)->textbuffer_nicklist = NULL; + GUI_GTK(window)->bar_windows = NULL; return 1; } else @@ -919,9 +920,23 @@ gui_window_title_reset () void gui_window_objects_print_log (struct t_gui_window *window) { + struct t_gui_bar_window *ptr_bar_win; + log_printf (" textview_chat . . . : 0x%x", GUI_GTK(window)->textview_chat); log_printf (" textbuffer_chat . . : 0x%x", GUI_GTK(window)->textbuffer_chat); log_printf (" texttag_chat. . . . : 0x%x", GUI_GTK(window)->texttag_chat); log_printf (" textview_nicklist . : 0x%x", GUI_GTK(window)->textview_nicklist); log_printf (" textbuffer_nicklist : 0x%x", GUI_GTK(window)->textbuffer_nicklist); + + for (ptr_bar_win = GUI_GTK(window)->bar_windows; ptr_bar_win; + ptr_bar_win = ptr_bar_win->next_bar_window) + { + log_printf (""); + log_printf (" [window bar (addr:0x%x)]", ptr_bar_win); + log_printf (" bar . . . . . . . : 0x%x", ptr_bar_win->bar); + log_printf (" x . . . . . . . . : %d", ptr_bar_win->x); + log_printf (" y . . . . . . . . : %d", ptr_bar_win->y); + log_printf (" width . . . . . . : %d", ptr_bar_win->width); + log_printf (" height. . . . . . : %d", ptr_bar_win->height); + } } diff --git a/src/gui/gtk/gui-gtk.h b/src/gui/gtk/gui-gtk.h index 6b6189ba0..8bedd73cf 100644 --- a/src/gui/gtk/gui-gtk.h +++ b/src/gui/gtk/gui-gtk.h @@ -54,6 +54,16 @@ struct t_gui_line; #define GUI_GTK(window) ((t_gui_gtk_objects *)(window->gui_objects)) +struct t_gui_bar_window +{ + struct t_gui_bar *bar; /* pointer to bar */ + int x, y; /* position of window */ + int width, height; /* window size */ + struct t_gui_bar_window *next_bar_window; + /* link to next bar window */ + /* (only used if bar is in windows) */ +}; + typedef struct t_gui_gtk_objects t_gui_gtk_objects; struct t_gui_gtk_objects @@ -63,6 +73,7 @@ struct t_gui_gtk_objects GtkTextTag *texttag_chat; /* texttag widget for chat */ GtkWidget *textview_nicklist; /* textview widget for nicklist */ GtkTextBuffer *textbuffer_nicklist; /* textbuffer widget for nicklist */ + struct t_gui_bar_window *bar_windows; /* bar windows */ }; //extern t_gui_color gui_weechat_colors[]; |