Re: gtk_window_set_decorated() function doesn't work



Well, I found the solution.

Andrew E. Makeev wrote:

Hello.

After installing Gtk+-2.8 packages on Win32 I found that my toplevel window won't lose it's title bar and borders when

gtk_window_set_decorated( GTK_WINDOW( win ), FALSE );

function called. (It worked well for Gtk+-2.4).
Help file says that function should always work on Win32.

Any comments?

Regards,
-andrew

------------------------------------------------------------------------

#include <gtk/gtkmain.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkbutton.h>

GtkWidget* create_app()
{
   GtkWidget* window;
   GtkWidget* box;
   GtkWidget* button;

   window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_widget_realize( window ); // this heals decoration management

   gtk_window_set_decorated( GTK_WINDOW( window ), FALSE );

   box = gtk_vbox_new( FALSE, 0 );
   gtk_container_add( GTK_CONTAINER( window ), box );
   gtk_widget_show( box );

   button = gtk_button_new_with_label( "BUTTON" );
   gtk_box_pack_start( GTK_BOX( box ), button, TRUE, FALSE, 2 );
   gtk_widget_show( button );

   return window;
}

int main( int argc, char* argv[] )
{
   GtkWidget* app;

   gtk_init( &argc, &argv );

   app = create_app();
   g_signal_connect( G_OBJECT( app ), "destroy", G_CALLBACK( gtk_main_quit ), NULL );
   gtk_widget_show( app );

   gtk_main();

   return 0;
}
------------------------------------------------------------------------





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]