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.0/entry.cmod

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

#include 

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

#include "gtk2.h"


/*! @module GUI */
/*! @module GTK2 */
/*! @class Entry
 *! 
 *! a single line text entry field
 */

PIKECLASS Entry
 program_flags PROGRAM_USES_PARENT;
{
  INHERIT Widget;

  /*! @decl void create()
   *! 
   *! creates a new Entry
   */
  PIKEFUN void create()
  {
    GTK2_LOW=(void*)gtk_entry_new();
  }

  /*! @decl void set_text(string text)
   *! 
   *! Sets the text in the Entry to the given value, replacing the current contents.
   *!
   *! @param text
   *!    the new text
   */
  PIKEFUN void set_text(string text)
  {
    f_string_to_utf8(1);
    gtk_entry_set_text(GTK_ENTRY(GTK2_LOW),Pike_sp[-1].u.string->str);
    pop_n_elems(args);
  }

  /*! @decl string get_text()
   *!
   *! Retrieves the contents of the entry widget
   */
  PIKEFUN string get_text()
  {
    const gchar* chr=gtk_entry_get_text(GTK_ENTRY(GTK2_LOW));
    push_string(make_shared_binary_string(chr,strlen(chr)));
    f_utf8_to_string(1); 
  }

  /*! @decl void set_visibility(int(0..1) visible)
   *!
   *! Sets whether the contents of the entry are visible or not. When@
   *! visibility is set to 0, characters are displayed as the invisible@
   *! char, and will also appear that way when the text in the entry@
   *! widget is copied elsewhere.
   *!
   *! The default invisible char is the asterisk '*', but it can be@
   *! changed with @[set_invisible_char()].
   */
  PIKEFUN void set_visibility(int(0..1) visible)
  {
    gtk_entry_set_visibility(GTK_ENTRY(GTK2_LOW),visible);
    pop_n_elems(args);
  }

  /*! @decl void set_invisible_char(int ch)
   *!
   *! Sets the character to use in place of the actual text when@
   *! gtk_entry_set_visibility() has been called to set text visibility@
   *! to 0. i.e. this is the character used in "password mode"@
   *! to show the user how many characters have been typed. The default@
   *! invisible char is an asterisk ('*'). If you set the invisible@
   *! char to 0, then the user will get no feedback at all; there@
   *! will be no text on the screen as they type.
   *!
   *! @param ch
   *!    a character
   */
  PIKEFUN void set_invisible_char(int ch)
  {
    gtk_entry_set_invisible_char(GTK_ENTRY(GTK2_LOW),(gunichar)ch);
    pop_n_elems(args);
  }

  INIT
  {
  }

  EXIT
  {
  }

}

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

void pike_init_gtk2_entry(void)
{
  INIT
}

void pike_exit_gtk2_entry(void)
{
  EXIT
}


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