apply FSL(Flora Software License)
[apps/home/gallery.git] / ug / ug-gallery-efl / src / ge-button.c
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   *
4   * Licensed under the Flora License, Version 1.0 (the "License");
5   * you may not use this file except in compliance with the License.
6   * You may obtain a copy of the License at
7   *
8   *     http://www.tizenopensource.org/license
9   *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16
17 #include "ge-debug.h"
18 #include "ge-ui-util.h"
19 #include "ge-util.h"
20 #include "ge-button.h"
21 #include "ge-strings.h"
22
23 Evas_Object *_ge_but_create_but(Evas_Object *parent, ge_but_mode mode, But_Smart_Cb cb_func, const void *data)
24 {
25         ge_dbg("Button mode: %d", mode);
26         Evas_Object *btn = NULL;
27         GE_CHECK_NULL(parent);
28
29         btn = elm_button_add(parent);
30         GE_CHECK_NULL(btn);
31
32         switch (mode) {
33         case GE_BUT_OK:
34                 elm_object_text_set(btn,
35                                     (char*)_GE_GETSYSTEMSTR("IDS_COM_SK_OK"));
36                 break;
37         case GE_BUT_CANCEL:
38                 elm_object_text_set(btn,
39                                     (char*)_GE_GETSYSTEMSTR("IDS_COM_SK_CANCEL"));
40                 break;
41         default:
42                 break;
43         }
44
45         if (cb_func)
46                 evas_object_smart_callback_add(btn, "clicked", cb_func, data);
47
48         return btn;
49 }