Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008
00009
00010
00011
00012 #include "vgui_gtk2_statusbar.h"
00013
00014 vgui_gtk2_statusbar::vgui_gtk2_statusbar()
00015 : statusbuf(new vgui_statusbuf(this))
00016 , out(statusbuf)
00017 {
00018 }
00019
00020
00021 vgui_gtk2_statusbar::~vgui_gtk2_statusbar()
00022 {
00023
00024
00025 delete statusbuf;
00026 }
00027
00028 static int context_id = 1;
00029
00030 int vgui_gtk2_statusbar::write(const char* text, int n) {
00031 if (n == 1) {
00032 if (text[0] == '\n') {
00033 gtk_statusbar_pop(GTK_STATUSBAR(widget), context_id);
00034 gtk_statusbar_push(GTK_STATUSBAR(widget), context_id, linebuffer.c_str() );
00035 linebuffer = "";
00036 }
00037 else
00038 linebuffer += text[0];
00039 }
00040 else {
00041 linebuffer.append(text, n);
00042 if (linebuffer.find('\n')) {
00043 gtk_statusbar_pop(GTK_STATUSBAR(widget), context_id);
00044 gtk_statusbar_push(GTK_STATUSBAR(widget), context_id, linebuffer.c_str() );
00045 linebuffer = "";
00046 }
00047 }
00048 return n;
00049 }
00050
00051
00052 int vgui_gtk2_statusbar::write(const char* text) {
00053
00054 gtk_statusbar_pop(GTK_STATUSBAR(widget), context_id);
00055 gtk_statusbar_push(GTK_STATUSBAR(widget), context_id, text );
00056 return 1;
00057 }