1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Writing Applets</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7
<link rel="home" href="index.html" title="Panel Applet Library Reference Manual">
8
<link rel="up" href="index.html" title="Panel Applet Library Reference Manual">
9
<link rel="prev" href="index.html" title="Panel Applet Library Reference Manual">
10
<link rel="next" href="server-files.html" title="Bonobo Activation .server Files For Applets">
11
<meta name="generator" content="GTK-Doc V1.15.1 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
16
<td><a accesskey="p" href="index.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19
<th width="100%" align="center">Panel Applet Library Reference Manual</th>
20
<td><a accesskey="n" href="server-files.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23
<div class="titlepage"><div><div><h2 class="title">
24
<a name="applet-writing"></a>Writing Applets</h2></div></div></div>
26
<dt><span class="sect1"><a href="applet-writing.html#hello-world">Hello World Applet</a></span></dt>
27
<dt><span class="sect1"><a href="server-files.html">Bonobo Activation .server Files For Applets</a></span></dt>
28
<dt><span class="sect1"><a href="applet-popups.html">Defining a Popup Context Menu</a></span></dt>
29
<dt><span class="sect1"><a href="panel-signals.html">Detecting Changes in the Panel.</a></span></dt>
30
<dt><span class="sect1"><a href="session-saving.html">Session/Preference Saving.</a></span></dt>
31
<dt><span class="sect1"><a href="multi-applets.html">Multiple Applets</a></span></dt>
33
<p>Writing applets is very simple. You take some boiler plate
34
code like below, change a couple of things and write the code that
35
implements your widgetry. The hardest part is writing your widgetry -
36
and its completely up to yourself how hard that should be.
39
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
40
<a name="hello-world"></a>Hello World Applet</h2></div></div></div>
41
<p>As usual, following the pointless tradition of starting with
42
an example of how get 'Hello World' on the screen in some form, here's
43
just about the simplest applet you could write.
45
<pre class="programlisting">
46
#include <string.h>
48
#include <panel-applet.h>
49
#include <gtk/gtklabel.h>
52
hello_applet_fill (PanelApplet *applet,
58
if (strcmp (iid, "OAFIID:My_HelloApplet") != 0)
61
label = gtk_label_new ("Hello World");
62
gtk_container_add (GTK_CONTAINER (applet), label);
64
gtk_widget_show_all (GTK_WIDGET (applet));
70
PANEL_APPLET_BONOBO_FACTORY ("OAFIID:My_HelloApplet_Factory",
72
"TheHelloWorldApplet",
77
<p>The code here is very similar to writing a normal Bonobo
78
control. You define a factory using PANEL_APPLET_BONOBO_FACTORY(),
79
passing it a factory function like hello_applet_fill().
81
<p>libpanel-applet automatically creates a #PanelApplet object
82
for you, passing this to your factory method. Here, you should fill
83
the applet with your widgets just like a #GtkBin. For example, if you
84
were writing a cdplayer applet you would create a #GtkHBox, pack the
85
hbox with the cdplayer buttons and in turn add the hbox to the applet.
91
Generated by GTK-Doc V1.15.1</div>
b'\\ No newline at end of file'