\chapter{elm\+\_\+bubble -\/ Simple use.}
\hypertarget{bubble_01_example_page}{}\label{bubble_01_example_page}\index{elm\_bubble -\/ Simple use.@{elm\_bubble -\/ Simple use.}}


This example shows a bubble with all fields set(label, info, content and icon) and the selected corner changing when the bubble is clicked. To be able use a bubble we need to do some setup and create a window, for this example we are going to ignore that part of the code since it isn\textquotesingle{}t relevant to the bubble.

To have the selected corner change in a clockwise motion we are going to use the following callback\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{char}\ corner\ =\ 0;}
\DoxyCodeLine{\ \ \ ++corner;}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{if}\ (corner\ >\ 3)}
\DoxyCodeLine{\ \ \ \ \ elm\_bubble\_pos\_set(obj,\ \mbox{\hyperlink{group__Elm__Bubble_gga2f2d2253c8a8990486de63c48f195881a776e89a494d03a786326b0e15802c960}{ELM\_BUBBLE\_POS\_TOP\_LEFT}});}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\ \ \ \ \ elm\_bubble\_pos\_set(obj,\ corner);}
\DoxyCodeLine{}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN\ \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int}\ argc\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},\ \textcolor{keywordtype}{char}\ **argv\ \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ Evas\_Object\ *win,\ *bubble,\ *label,\ *icon;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}},\ \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ win\ =\ \mbox{\hyperlink{group__Elm__Win__Group_ga23d9d1ffa0a65a1a1dd482d570db1ba0}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}bubble"{}},\ \textcolor{stringliteral}{"{}Bubble"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win,\ \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ label\ =\ \mbox{\hyperlink{group__Elm__Label__Group_ga39a584d245f8a4b18d742e3ede702507}{elm\_label\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(label,\ \textcolor{stringliteral}{"{}This\ is\ the\ CONTENT\ of\ our\ bubble"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(label);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ icon\ =\ \mbox{\hyperlink{group__Evas__Object__Rectangle_ga1b7a9d8e6ce240590c1734da5f3449d2}{evas\_object\_rectangle\_add}}(\mbox{\hyperlink{group__Evas__Object__Group_ga7e211219d11abced5f3089362f7476b9}{evas\_object\_evas\_get}}(win));}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_gab751e9d24c16e74af6f7c08ea5b930c2}{evas\_object\_color\_set}}(icon,\ 0,\ 0,\ 255,\ 255);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(icon);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ bubble\ =\ \mbox{\hyperlink{group__Elm__Bubble_ga3213cbfb40f6523e9f734c5cdd8aa6ad}{elm\_bubble\_add}}(win);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga0531ec8867c72def7c780601764ca642}{elm\_object\_part\_content\_set}}(bubble,\ \textcolor{stringliteral}{"{}icon"{}},\ icon);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_ga9c088563c442670796564d2e5158f154}{elm\_object\_part\_text\_set}}(bubble,\ \textcolor{stringliteral}{"{}info"{}},\ \textcolor{stringliteral}{"{}INFO"{}});}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(bubble,\ \textcolor{stringliteral}{"{}LABEL"{}});}
\DoxyCodeLine{\ \ \ elm\_object\_content\_set(bubble,\ label);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(bubble,\ 300,\ 100);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bubble);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Smart__Object__Group_gac12dd6655f488cc47ce6cf00eb7d12b2}{evas\_object\_smart\_callback\_add}}(bubble,\ \textcolor{stringliteral}{"{}clicked"{}},\ \_bla,\ NULL);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ label\ =\ \mbox{\hyperlink{group__Elm__Label__Group_ga39a584d245f8a4b18d742e3ede702507}{elm\_label\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_text\_set(label,\ \textcolor{stringliteral}{"{}Bubble\ with\ no\ icon,\ info\ or\ label"{}});}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(label);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ bubble\ =\ \mbox{\hyperlink{group__Elm__Bubble_ga3213cbfb40f6523e9f734c5cdd8aa6ad}{elm\_bubble\_add}}(win);}
\DoxyCodeLine{\ \ \ elm\_object\_content\_set(bubble,\ label);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(bubble,\ 200,\ 50);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_ga335c8ee6eaeaac9710656af4f8b0db91}{evas\_object\_move}}(bubble,\ 0,\ 110);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(bubble);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group_gacad94595f83580c18908cb3b69b08d1a}{evas\_object\_resize}}(win,\ 300,\ 200);}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga07208fcafd4739de606bc35fff684bf5}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 Here we are creating an elm\+\_\+label that is going to be used as the content for our bubble\+: 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
\begin{DoxyNote}{Note}
You could use any evas\+\_\+object for this, we are using an elm\+\_\+label for simplicity.
\end{DoxyNote}
Despite it\textquotesingle{}s name the bubble\textquotesingle{}s icon doesn\textquotesingle{}t have to be an icon, it can be any evas\+\_\+object. For this example we are going to make the icon a simple blue rectangle\+: 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 And finally we have the actual bubble creation and the setting of it\textquotesingle{}s label, info and content\+: 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
\begin{DoxyNote}{Note}
Because we didn\textquotesingle{}t set a corner, the default("{}top\+\_\+left"{}) will be used.
\end{DoxyNote}
Now that we have our bubble all that is left is connecting the "{}clicked"{} signals to our callback\+: 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 This last bubble we created was very complete, so it\textquotesingle{}s pertinent to show that most of that stuff is optional a bubble can be created with nothing but content\+: 
\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 Our example will look like this\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/bubble_example_01}}
\end{DoxyImageNoCaption}


See the full source code \doxylink{bubble_example_01_8c-example}{bubble\+\_\+example\+\_\+01.\+c} here. 