}
}
-ui::Widget g_console;
+ui::TextView g_console{ui::null};
void console_clear(){
- GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
- gtk_text_buffer_set_text( buffer, "", -1 );
+ g_console.text("");
}
-void console_populate_popup( GtkTextView* textview, ui::Menu menu, gpointer user_data ){
+void console_populate_popup( ui::TextView textview, ui::Menu menu, gpointer user_data ){
menu_separator( menu );
ui::Widget item(ui::MenuItem( "Clear" ));
ui::Widget Console_constructWindow( ui::Window toplevel ){
auto scr = ui::ScrolledWindow();
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+ scr.overflow(ui::Policy::AUTOMATIC, ui::Policy::AUTOMATIC);
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
scr.show();
{
- ui::Widget text = ui::TextView();
+ auto text = ui::TextView();
gtk_widget_set_size_request( text, 0, -1 ); // allow shrinking
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( text ), GTK_WRAP_WORD );
gtk_text_view_set_editable( GTK_TEXT_VIEW( text ), FALSE );
GtkTextBufferOutputStream( GtkTextBuffer* textBuffer, GtkTextIter* iter, GtkTextTag* tag ) : textBuffer( textBuffer ), iter( iter ), tag( tag ){
}
std::size_t write( const char* buffer, std::size_t length ){
- gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, 0 );
+ gtk_text_buffer_insert_with_tags( textBuffer, iter, buffer, gint( length ), tag, NULL );
return length;
}
};
}
if ( level != SYS_NOCON ) {
- if ( g_console != 0 ) {
+ if ( g_console ) {
GtkTextBuffer* buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW( g_console ) );
GtkTextIter iter;
const GdkColor yellow = { 0, 0xb0ff, 0xb0ff, 0x0000 };
const GdkColor red = { 0, 0xffff, 0x0000, 0x0000 };
- static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, 0 );
- static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, 0 );
- static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", 0 );
+ static GtkTextTag* error_tag = gtk_text_buffer_create_tag( buffer, "red_foreground", "foreground-gdk", &red, NULL );
+ static GtkTextTag* warning_tag = gtk_text_buffer_create_tag( buffer, "yellow_foreground", "foreground-gdk", &yellow, NULL );
+ static GtkTextTag* standard_tag = gtk_text_buffer_create_tag( buffer, "black_foreground", NULL );
GtkTextTag* tag;
switch ( level )
{