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