Custom widgets -- how to roll my own



Hi.  I have wanted a simple, graphical To-Do application for my desktop
for a little while.  I set about building one in Tcl some time ago and
lost interest (and free time).  Recently I found Glade and built up a
quickie prototype for it.  I am stumbling on how I ought to map my
design/requirements/whatever onto reality, because I need it to act in
an unusual manner.

I would like something akin to a list, except that the widget should act
like a stack growing downwards from the top of its container, with the
stack frames composed of a pair of buttons per frame, a large one to
display the item's text in a (separately contained) text entry widget,
and a small one to delete the item and push the rest of the stack up.

Where should I look for documentation on making my program's guts work
the way I want them to?  I'm pretty sure that other people could use the
program (I already use the prototype, just sitting around in Glade, to
keep track of things), but I need to make it work right.

Thanks in advance for any help, comments, or whatever.  By the way, I am
attaching the gnu-todo.glade file if anyone would like to view it and
see what I'm trying to build.  I haven't defined all the signals yet,
nor have I decided whether to code the handlers in Python or regular old
C.  I would like to flesh things out a bit more and fix the "look".


-- 
  "For many years it was believed that countless monkeys working
  on countless typewriters would eventually reproduce the genius
  of Shakespeare.  Now, thanks to the World Wide Web,
  we know this to be false."                         --anonymous
<?xml version="1.0"?>
<GTK-Interface>

<project>
  <name>gnu-todo</name>
  <program_name>gnu-todo</program_name>
  <directory></directory>
  <source_directory>src</source_directory>
  <pixmaps_directory>pixmaps</pixmaps_directory>
  <language>C</language>
  <gnome_support>False</gnome_support>
  <gettext_support>True</gettext_support>
  <use_widget_names>False</use_widget_names>
  <output_main_file>True</output_main_file>
  <output_support_files>True</output_support_files>
  <output_build_files>True</output_build_files>
  <backup_source_files>True</backup_source_files>
  <main_source_file>interface.c</main_source_file>
  <main_header_file>interface.h</main_header_file>
  <handler_source_file>callbacks.c</handler_source_file>
  <handler_header_file>callbacks.h</handler_header_file>
  <support_source_file>support.c</support_source_file>
  <support_header_file>support.h</support_header_file>
  <translatable_strings_file></translatable_strings_file>
</project>

<widget>
  <class>GtkWindow</class>
  <name>Main_Window</name>
  <title>Gnu ToDo</title>
  <type>GTK_WINDOW_TOPLEVEL</type>
  <position>GTK_WIN_POS_NONE</position>
  <modal>False</modal>
  <default_width>300</default_width>
  <default_height>350</default_height>
  <allow_shrink>False</allow_shrink>
  <allow_grow>True</allow_grow>
  <auto_shrink>False</auto_shrink>

  <widget>
    <class>GtkVBox</class>
    <name>vbox1</name>
    <homogeneous>False</homogeneous>
    <spacing>0</spacing>

    <widget>
      <class>GtkHandleBox</class>
      <name>handlebox1</name>
      <shadow_type>GTK_SHADOW_OUT</shadow_type>
      <handle_position>GTK_POS_LEFT</handle_position>
      <snap_edge>GTK_POS_TOP</snap_edge>
      <child>
	<padding>0</padding>
	<expand>False</expand>
	<fill>True</fill>
      </child>

      <widget>
	<class>GtkMenuBar</class>
	<name>menubar1</name>
	<shadow_type>GTK_SHADOW_OUT</shadow_type>

	<widget>
	  <class>GtkMenuItem</class>
	  <name>file2</name>
	  <signal>
	    <name>activate</name>
	    <handler>on_file2_activate</handler>
	    <last_modification_time>Tue, 26 Oct 1999 09:18:44 GMT</last_modification_time>
	  </signal>
	  <label>File</label>
	  <right_justify>False</right_justify>
	</widget>

	<widget>
	  <class>GtkMenuItem</class>
	  <name>edit2</name>
	  <signal>
	    <name>activate</name>
	    <handler>on_edit2_activate</handler>
	    <last_modification_time>Tue, 26 Oct 1999 09:18:44 GMT</last_modification_time>
	  </signal>
	  <label>Edit</label>
	  <right_justify>False</right_justify>
	</widget>

	<widget>
	  <class>GtkMenuItem</class>
	  <name>help1</name>
	  <label>Help</label>
	  <right_justify>True</right_justify>

	  <widget>
	    <class>GtkMenu</class>
	    <name>help1_menu</name>

	    <widget>
	      <class>GtkMenuItem</class>
	      <name>about1</name>
	      <signal>
		<name>activate</name>
		<handler>on_about1_activate</handler>
		<last_modification_time>Tue, 26 Oct 1999 09:19:14 GMT</last_modification_time>
	      </signal>
	      <label>About...</label>
	      <right_justify>False</right_justify>
	    </widget>
	  </widget>
	</widget>
      </widget>
    </widget>

    <widget>
      <class>GtkHBox</class>
      <name>hbox2</name>
      <homogeneous>False</homogeneous>
      <spacing>0</spacing>
      <child>
	<padding>0</padding>
	<expand>True</expand>
	<fill>True</fill>
      </child>

      <widget>
	<class>Custom</class>
	<name>custom1</name>
	<int1>0</int1>
	<int2>0</int2>
	<last_modification_time>Sun, 07 Nov 1999 04:02:21 GMT</last_modification_time>
	<child>
	  <padding>0</padding>
	  <expand>True</expand>
	  <fill>True</fill>
	</child>
      </widget>

      <widget>
	<class>GtkVBox</class>
	<name>vbox2</name>
	<homogeneous>False</homogeneous>
	<spacing>0</spacing>
	<child>
	  <padding>0</padding>
	  <expand>True</expand>
	  <fill>True</fill>
	</child>

	<widget>
	  <class>GtkHBox</class>
	  <name>hbox4</name>
	  <homogeneous>False</homogeneous>
	  <spacing>0</spacing>
	  <child>
	    <padding>0</padding>
	    <expand>False</expand>
	    <fill>False</fill>
	  </child>

	  <widget>
	    <class>GtkLabel</class>
	    <name>label2</name>
	    <label>Name of item</label>
	    <justify>GTK_JUSTIFY_CENTER</justify>
	    <wrap>False</wrap>
	    <xalign>0.5</xalign>
	    <yalign>0.5</yalign>
	    <xpad>0</xpad>
	    <ypad>0</ypad>
	    <child>
	      <padding>0</padding>
	      <expand>True</expand>
	      <fill>True</fill>
	    </child>
	  </widget>

	  <widget>
	    <class>GtkEntry</class>
	    <name>entry1</name>
	    <can_focus>True</can_focus>
	    <editable>True</editable>
	    <text_visible>True</text_visible>
	    <text_max_length>0</text_max_length>
	    <text></text>
	    <child>
	      <padding>0</padding>
	      <expand>False</expand>
	      <fill>False</fill>
	    </child>
	  </widget>
	</widget>

	<widget>
	  <class>GtkText</class>
	  <name>text1</name>
	  <can_focus>True</can_focus>
	  <editable>True</editable>
	  <text>flubble needs admedia and rollout
slurp script for polls needs updating
xoom.it logger needs looking at!!!
admtool source wrapper (Perl XS?)
Xoom.it and xoom.fr need admin
Xoom.be needs to be set up again

Set up LXR on DX, Apache, Octave
eAct.org needs to be set up w/Mason
efficient weighted matrix impl. for Waterman
working threading code for Pevzner
Affymetrix project &amp; grant details?
Datalogic demo in Berkeley</text>
	  <child>
	    <padding>0</padding>
	    <expand>True</expand>
	    <fill>True</fill>
	  </child>
	</widget>

	<widget>
	  <class>GtkHBox</class>
	  <name>hbox3</name>
	  <homogeneous>False</homogeneous>
	  <spacing>0</spacing>
	  <child>
	    <padding>0</padding>
	    <expand>True</expand>
	    <fill>True</fill>
	  </child>

	  <widget>
	    <class>GtkLabel</class>
	    <name>label3</name>
	    <label>Relative importance
</label>
	    <justify>GTK_JUSTIFY_FILL</justify>
	    <wrap>False</wrap>
	    <xalign>0.5</xalign>
	    <yalign>0.5</yalign>
	    <xpad>0</xpad>
	    <ypad>0</ypad>
	    <child>
	      <padding>0</padding>
	      <expand>True</expand>
	      <fill>True</fill>
	    </child>
	  </widget>

	  <widget>
	    <class>GtkOptionMenu</class>
	    <name>optionmenu1</name>
	    <can_focus>True</can_focus>
	    <items>Low
Moderate
Normal
High
Critical
</items>
	    <initial_choice>2</initial_choice>
	    <child>
	      <padding>0</padding>
	      <expand>True</expand>
	      <fill>True</fill>
	    </child>
	  </widget>
	</widget>
      </widget>
    </widget>
  </widget>
</widget>

</GTK-Interface>


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