Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Module Information
GUI.GTK2
Viewing contents of GUI_GTK2-0.1/widget.cmod

#include "global.h"
#include "svalue.h"
#include "interpret.h"

#include 

/* This must be included last! */
#include "module.h"

#include "gtk2.h"

/* Global variables
 */


/*! @module GUI */
/*! @module GTK2 */
/*! @class Widget
 *!
 *! Base class for all widgets
 *!
 *! @b{Signal Prototypes@}
 *!
 *! @i{"accel-closures-changed"@} void user_function (Widget object, mixed user_data)
 *!
 *! @i{"grab-focus"@} void user_function (Widget object, mixed user_data)
 */

PIKECLASS Widget
 program_flags PROGRAM_USES_PARENT;
{
  INHERIT Object;

  PIKEFUN void create()
  {
    printf("widget created\n");
  }

  /*! @decl void show_all()
   *!
   *! Recursively shows a widget, and any child widgets (if the widget is a container).
   */
  PIKEFUN void show_all()
  {
    gtk_widget_show_all(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void show()
   *!
   *! Flags a widget to be displayed. Any widget that isn't shown will
   *! not appear on the screen. If you want to show all the widgets in
   *! a container, it's easier to call @[show_all()] on the container,
   *! instead of individually showing the widgets.
   *!
   *! Remember that you have to show the containers containing a widget,
   *! in addition to the widget itself, before it will appear onscreen.
   *!
   *! When a toplevel container is shown, it is immediately realized and
   *! mapped; other shown widgets are realized and mapped when their
   *! toplevel container is realized and mapped.
   */
  PIKEFUN void show()
  {
    gtk_widget_show(GTK_WIDGET(GTK2_LOW));
  }


  /*! @decl void hide()
   *!
   *! Reverses the effects of @[show()], causing the widget to
   *! be hidden (invisible to the user).
   */
  PIKEFUN void hide()
  {
    gtk_widget_hide(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void hide_all()
   *!
   *! Recursively hides a widget and any child widgets.
   */
  PIKEFUN void hide_all()
  {
    gtk_widget_hide_all(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void map()
   *!
   *! This function is only for use in widget implementations.
   *! Causes a widget to be mapped if it isn't already.
   */
  PIKEFUN void map()
  {
    gtk_widget_map(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void unmap()
   *!
   *! This function is only for use in widget implementations.
   *! Causes a widget to be unmapped if it's currently mapped.
   */
  PIKEFUN void unmap()
  {
    gtk_widget_unmap(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void realize()
   *!
   *! Creates the GDK (windowing system) resources associated
   *! with a widget. Normally realization happens implicitly;
   *! if you show a widget and all its parent containers, then
   *! the widget will be realized and mapped automatically.
   *!
   *! Realizing a widget requires all the widget's parent widgets
   *! to be realized; calling realize() realizes the widget's parents
   *! in addition to widget itself. If a widget is not yet inside a
   *! toplevel window when you realize it, bad things will happen.
   *!
   *! This function is primarily used in widget implementations,
   *! and isn't very useful otherwise. 
   */
  PIKEFUN void realize()
  {
    gtk_widget_realize(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void unrealize()
   *!
   *! This function is only useful in widget implementations.
   *! Causes a widget to be unrealized (frees all GDK resources
   *! associated with the widget).
   */
  PIKEFUN void unrealize()
  {
    gtk_widget_unrealize(GTK_WIDGET(GTK2_LOW));
  }

  /*! @decl void set_sensitive(int(0..1) sensitive)
   *! 
   *! Sets the sensitivity of a widget. A widget is sensitive if@
   *! the user can interact with it. Insensitive widgets are@
   *! "grayed out" and the user can't interact with them. Insensitive@
   *! widgets are known as "inactive", "disabled", or "ghosted" in@
   *! some other toolkits.
   *!
   *! @param sensitive
   *!    1 to make a widget sensitive
   */
  PIKEFUN void set_sensitive(int(0..1) sensitive)
  {
    gtk_widget_set_sensitive(GTK_WIDGET(GTK2_LOW),sensitive);
    pop_n_elems(args);
  }
 
  /*! @decl void destroy()
   *!
   *! Destroys a widget. When a widget is destroyed, it will
   *! break any references it holds to other objects. If the
   *! widget is inside a container, the widget will be removed
   *! from the container. If the widget is a toplevel (derived
   *! from Window), it will be removed from the list of toplevels,
   *! and the reference GTK+ holds to it will be removed. Removing
   *! a widget from its container or the list of toplevels results
   *! in the widget being finalized, unless you've added additional
   *! references to the widget with g_object_ref().
   *!
   *! FIXME: implement g_object_ref()
   *! FIXME: convince me not to implement g_object_ref()
   *!
   *! In most cases, only toplevel widgets (windows) require explicit
   *! destruction, because when you destroy a toplevel its children
   *! will be destroyed as well.
   */
  PIKEFUN void destroy_me()
  {
    gtk_widget_destroy(GTK_WIDGET(GTK2_LOW));
    GTK2_LOW=NULL;
  }

  INIT
  {
  }

  EXIT
  {
  }
}

/*! @endclass */
/*! @endmodule */
/*! @endmodule */

void pike_init_gtk2_widget(void)
{
  INIT
}

void pike_exit_gtk2_widget(void)
{
  EXIT
}


gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University