Reduce the duplicate code to create candidate button
[platform/core/uifw/ise-default.git] / src / include / candidate-multiline-efl.h
1 /*
2  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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
18 #ifndef __CANDIDATE_MULTI_LINE_EFL_H__
19 #define __CANDIDATE_MULTI_LINE_EFL_H__
20 #include "candidate.h"
21 #include <Elementary.h>
22
23 #define CANDIDATE_BAR_NUM 8
24 #define CANDIDATE_MORE_ONE_LINE 8
25
26 typedef struct _candidate_item_size
27 {
28     int width;
29     int height;
30 } candidate_item_size;
31
32 class EflMultiLineCandidate: public Candidate
33 {
34     public:
35         EflMultiLineCandidate(Evas_Object *);
36         ~EflMultiLineCandidate();
37         void show();
38         void hide();
39         void update(const std::vector<std::string> &candidates);
40         void rotate(int degree);
41         int get_height();
42         bool get_floating_mode();
43         void more_btn_clicked();
44         void more_btn_released();
45         void close_btn_clicked();
46         void item_pressed(std::string str);
47         void item_pressed(Evas_Object *);
48         void item_released(Evas_Object *);
49         void item_moved(Evas_Object *);
50 #ifdef _TV
51         sclu32 soft_candidate_handle_key_event(const char *key_name);
52         bool soft_candidate_flag(){return m_highlight_mode;}
53 #endif
54     private:
55         void make_view();
56         void make_more_view();
57         void show_more_view();
58         void hide_more_view();
59         void show_view();
60         void hide_view();
61
62         Evas_Object *create_candidate_button(const char *style, Evas_Object_Event_Cb mouse_down_cb);
63
64         void register_access_object(Evas_Object* obj, std::string name, const Elm_Access_Action_Cb access_action = NULL, const void *data = NULL);
65         Evas_Object *get_candidate_item(candidate_item_size item_text_size);
66         candidate_item_size get_candidate_item_text_size(std::string srcStr);
67         Evas_Object * get_candidate_separate_line_vertical();
68         Evas_Object * get_candidate_separate_line_horizon();
69
70         std::vector<std::string> cur_candidates;
71         Evas_Object *m_window;
72
73         int m_degree;
74         int m_screenWidth;
75         int m_screenHeight;
76         double m_screenRatio;
77         std::string m_candidateFontName;
78         int m_candidateFontSize;
79         bool m_floating_mode;
80         Evas_Object * m_stringWidthCalObj;
81         Evas_Object * m_candidateScrollerBg;
82         Evas_Object * m_candidateScroller;
83         Evas_Object * m_candidateTable;
84         Evas_Object * m_candidateMoreBtn;
85         Evas_Object * m_candidateCloseBtn;
86         Evas_Object * m_candidateMoreScrollerBg;
87         Evas_Object * m_candidateMoreScroller;
88         Evas_Object * m_candidateMoreTable;
89 #ifdef _TV
90         int  m_focused_candidate_index;
91         bool m_highlight_mode;
92         std::vector<Evas_Object *> m_candidates_item;
93 #endif
94 };
95 #endif