2 * @defgroup Start Getting Started
5 * To write an Elementary app, you can get started with the following:
8 * #include <Elementary.h>
10 * elm_main(int argc, char **argv)
12 * // create window(s) here and do any application init
13 * elm_run(); // run main loop
14 * elm_shutdown(); // after mainloop finishes running, shutdown
15 * return 0; // exit 0 for exit code
20 * To use autotools (which helps in many ways in the long run, like being able
21 * to immediately create releases of your software directly from your tree
22 * and ensure everything needed to build it is there) you will need a
23 * configure.ac, Makefile.am and autogen.sh file.
28 * AC_INIT(myapp, 0.0.0, myname@mydomain.com)
30 * AC_CONFIG_SRCDIR(configure.ac)
31 * AM_CONFIG_HEADER(config.h)
33 * AM_INIT_AUTOMAKE(1.6 dist-bzip2)
34 * PKG_CHECK_MODULES([ELEMENTARY], elementary)
41 * AUTOMAKE_OPTIONS = 1.4 foreign
42 * MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in configure depcomp install-sh missing
44 * INCLUDES = -I$(top_srcdir)
46 * bin_PROGRAMS = myapp
48 * myapp_SOURCES = main.c
49 * myapp_LDADD = @ELEMENTARY_LIBS@
50 * myapp_CFLAGS = @ELEMENTARY_CFLAGS@
57 * echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
58 * echo "Running autoheader..." ; autoheader || exit 1
59 * echo "Running autoconf..." ; autoconf || exit 1
60 * echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
64 * To generate all the things needed to bootstrap just run:
70 * This will generate Makefile.in's, the configure script and everything else.
71 * After this it works like all normal autotools projects:
78 * Note sudo was assumed to get root permissions, as this would install in
79 * /usr/local which is system-owned. Use any way you like to gain root, or
80 * specify a different prefix with configure:
83 * ./configure --prefix=$HOME/mysoftware
86 * Also remember that autotools buys you some useful commands like:
91 * This uninstalls the software after it was installed with "make install".
92 * It is very useful to clear up what you built if you wish to clean the
99 * This firstly checks if your build tree is "clean" and ready for
100 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
101 * ready to upload and distribute to the world, that contains the generated
102 * Makefile.in's and configure script. The users do not need to run
103 * autogen.sh - just configure and on. They don't need autotools installed.
104 * This tarball also builds cleanly, has all the sources it needs to build
105 * included (that is sources for your application, not libraries it depends
106 * on like Elementary). It builds cleanly in a buildroot and does not
107 * contain any files that are temporarily generated like binaries and other
108 * build-generated files, so the tarball is clean, and no need to worry
109 * about cleaning up your tree before packaging.
115 * This cleans up all build files (binaries, objects etc.) from the tree.
121 * This cleans out all files from the build and from configure's output too.
124 * make maintainer-clean
127 * This deletes all the files autogen.sh will produce so the tree is clean
128 * to be put into a revision-control system (like CVS, SVN or GIT for example).
130 * There is a more advanced way of making use of the quicklaunch infrastructure
131 * in Elementary (which will not be covered here due to its more advanced
134 * Now let's actually create an interactive "Hello World" gui that you can
135 * click the ok button to exit. It's more code because this now does something
136 * much more significant, but it's still very simple:
139 * #include <Elementary.h>
142 * on_done(void *data, Evas_Object *obj, void *event_info)
144 * // quit the mainloop (elm_run function will return)
149 * elm_main(int argc, char **argv)
151 * Evas_Object *win, *box, *lab, *btn;
153 * // new window - do the usual and give it a name (hello) and title (Hello)
154 * win = elm_win_util_standard_add("hello", "Hello");
155 * // when the user clicks "close" on a window there is a request to delete
156 * evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
158 * // add a box object - default is vertical. a box holds children in a row,
159 * // either horizontally or vertically. nothing more.
160 * box = elm_box_add(win);
161 * // make the box horizontal
162 * elm_box_horizontal_set(box, EINA_TRUE);
163 * // add object as a resize object for the window (controls window minimum
164 * // size as well as gets resized if window is resized)
165 * elm_win_resize_object_add(win, box);
166 * evas_object_show(box);
168 * // add a label widget, set the text and put it in the pad frame
169 * lab = elm_label_add(win);
170 * // set default text of the label
171 * elm_object_text_set(lab, "Hello out there world!");
172 * // pack the label at the end of the box
173 * elm_box_pack_end(box, lab);
174 * evas_object_show(lab);
176 * // add an ok button
177 * btn = elm_button_add(win);
178 * // set default text of button to "OK"
179 * elm_object_text_set(btn, "OK");
180 * // pack the button at the end of the box
181 * elm_box_pack_end(box, btn);
182 * evas_object_show(btn);
183 * // call on_done when button is clicked
184 * evas_object_smart_callback_add(btn, "clicked", on_done, NULL);
186 * // now we are done, show the window
187 * evas_object_show(win);
189 * // run the mainloop and process events and callbacks