//window_context = windows->get_window_context(windows->get_base_window(), FALSE);
window_context = windows->get_window_context(windows->get_base_window());
if (window_context) {
- evt.root.x = x + window_context->geometry.x;
- evt.root.y = y + window_context->geometry.y;
+ evt.x = evt.root.x = x + window_context->geometry.x;
+ evt.y = evt.root.y = y + window_context->geometry.y;
evt.multi.device = loop;
mouse_press(NULL, 0, &evt);
}
//window_context = windows->get_window_context(windows->get_base_window(), FALSE);
window_context = windows->get_window_context(windows->get_base_window());
if (window_context) {
- evt.root.x = x + window_context->geometry.x;
- evt.root.y = y + window_context->geometry.y;
+ evt.x = evt.root.x = x + window_context->geometry.x;
+ evt.y = evt.root.y = y + window_context->geometry.y;
evt.multi.device = loop;
mouse_release(NULL, 0, &evt);
}
//window_context = windows->get_window_context(windows->get_base_window(), FALSE);
window_context = windows->get_window_context(windows->get_base_window());
if (window_context) {
- evt.root.x = x + window_context->geometry.x;
- evt.root.y = y + window_context->geometry.y;
+ evt.x = evt.root.x = x + window_context->geometry.x;
+ evt.y = evt.root.y = y + window_context->geometry.y;
evt.multi.device = loop;
mouse_move(NULL, 0, &evt);
}
#include <Elementary.h>
//#include <list>
#include <vector>
+#include <dlog.h>
//#define EXTRACT_PARTIMAGE
return ret;
}
+/**
+ * Returns Evas_Object representing window
+ */
+static Evas_Object *get_evas_window_object(sclwindow window)
+{
+ SclWindowContext *window_context = NULL;
+ CSCLWindows *windows = CSCLWindows::get_instance();
+
+ if (!window || !windows)
+ return NULL;
+
+ Evas_Object *window_object = (Evas_Object*)window;
+
+ window_context = windows->get_window_context(window);
+
+ if (window_context && window_context->is_virtual) {
+ window_object = static_cast<Evas_Object*>(windows->get_base_window());
+ }
+
+ return window_object;
+}
+
+/**
+ * Callback called on accessibility action
+ */
+static Eina_Bool access_action(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info) {
+ CSCLWindows *windows = CSCLWindows::get_instance();
+ CSCLEvents* events = CSCLEvents::get_instance();
+
+ if (!windows || !events || !obj)
+ return EINA_FALSE;
+
+ Evas_Coord ex, ey, ew, eh;
+ evas_object_geometry_get(obj, &ex, &ey, &ew, &eh);
+ scl16 x = ex + ew / 2;
+ scl16 y = ey + eh / 2;
+
+ LOGD("access_action callback x: %d, y: %d", x, y);
+
+ SclWindowContext *window_context = windows->get_window_context(windows->get_base_window());;
+ if (window_context) {
+ x -= window_context->geometry.x;
+ y -= window_context->geometry.y;
+ }
+
+ //simulate button press
+ events->generate_mouse_event(SCL_MOUSE_EVENT_PRESS, x, y);
+ events->generate_mouse_event(SCL_MOUSE_EVENT_RELEASE, x, y);
+ return EINA_TRUE;
+}
+
+/**
+ * Register drawing as atspi object
+ */
+void CSCLGraphicsImplEfl::register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name)
+{
+ SCL_DEBUG();
+
+ Evas_Object *window_object = get_evas_window_object(window);
+ Evas_Object *drawing_object = static_cast<Evas_Object*>(drawing);
+
+ if (!drawing_object || !window_object)
+ return;
+
+ Evas_Object * access_object = elm_access_object_register(drawing_object, window_object);
+ if (!access_object)
+ return;
+
+ if (name)
+ elm_atspi_accessible_name_set(access_object, name);
+
+ elm_atspi_accessible_role_set(access_object, ELM_ATSPI_ROLE_PUSH_BUTTON);
+ elm_access_action_cb_set(access_object, ELM_ACCESS_ACTION_ACTIVATE, access_action, name);
+}
+
extern sclint magnifierx, magnifiery;
-void
+scldrawing
CSCLGraphicsImplEfl::draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image)
} else {
evas_object_layer_set(image_object, window_layer + 1);
}
+ return image_object;
} else {
delete object;
object = NULL;
#endif
}
}
+ return NULL;
}
sclimage
/**
* Draws the given text on cairo-surface
*/
-void
+scldrawing
CSCLGraphicsImplEfl::draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height,
SCLLabelAlignment align, sclint padding_x, sclint padding_y,
window_layer = 29010;
}
evas_object_layer_set(text_object, window_layer + 1);
+ return text_object;
} else {
delete object;
object = NULL;
#endif
}
}
+ return NULL;
}
/**
* Draws a rectangle on cairo-surface
*/
-void
+scldrawing
CSCLGraphicsImplEfl::draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color, sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha)
{
} else {
evas_object_layer_set(rectobj, window_layer + 1);
}
+ return rectobj;
}
}
+ return NULL;
}
SclSize
void init();
void fini();
- void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
+ scldrawing draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo,
sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
sclint src_x, sclint src_y, sclint src_width, sclint src_height, sclboolean extrace_image);
sclimage load_image(const sclchar* image_path);
sclfont create_font(const SclFontInfo& info);
void destroy_font(sclfont font);
- void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
+ scldrawing draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width, sclint height,
SCLLabelAlignment align, sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height);
- void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
+ scldrawing draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color,
sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha);
scldrawctx begin_paint(const sclwindow window, const sclboolean force_draw = FALSE);
void end_paint(const sclwindow window, scldrawctx draw_ctx);
SclSize get_image_size(sclchar* image_path);
SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str);
+
+ void register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name);
+
private:
Evas_Object *m_highlight_ui_object;
};
SclSize actual_size;
}SclTextCachedInfo;
+typedef void * scldrawing;
const SclColor SCLCOLOR_WHITE = {255, 255, 255, 255};
const SclColor SCLCOLOR_GREY = {128, 128, 128, 255};
const SclColor SCLCOLOR_BLACK = {0, 0, 0, 255};
friend class CSCLGraphics;
private:
- virtual void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path,
+ virtual scldrawing draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path,
SclImageCachedInfo *cachedinfo,
sclint dest_x, sclint dest_y, sclint dest_width, sclint dest_height,
sclint src_x, sclint src_y, sclint src_width, sclint src_height,
sclboolean extrace_image) = 0;
- virtual void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
+ virtual scldrawing draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y,
sclint width, sclint height, SCLLabelAlignment align,
sclint padding_x, sclint padding_y, sclint inner_width, sclint inner_height) = 0;
virtual void unload_image(sclimage image_data) = 0;
virtual sclfont create_font(const SclFontInfo& info) = 0;
virtual void destroy_font(sclfont font) = 0;
- virtual void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
+ virtual scldrawing draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color,
sclboolean fill, const SclColor& fill_color, scldouble radius, sclfloat alpha) = 0;
virtual SclSize get_image_size(sclchar* image_path) = 0;
virtual SclSize get_text_size(const SclFontInfo &fontinfo, const sclchar *str) = 0;
+ virtual void register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name) = 0;
};
class CSCLGraphics
void init();
void fini();
- void draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y,
+ scldrawing draw_image(sclwindow window, const scldrawctx draw_ctx, sclchar* image_path, SclImageCachedInfo *cachedinfo, sclint dest_x, sclint dest_y,
sclint dest_width = -1, sclint dest_height = -1, sclint src_x = 0, sclint src_y = 0, sclint src_width = -1, sclint src_height = -1, sclboolean extrace_image = FALSE) {
- get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, cachedinfo, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image);
+ return get_scl_graphics_impl()->draw_image(window, draw_ctx, image_path, cachedinfo, dest_x, dest_y, dest_width, dest_height, src_x, src_y, src_width, src_height, extrace_image);
}
- void draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
+ scldrawing draw_text(sclwindow window, const scldrawctx draw_ctx, const SclFontInfo& font_info, const SclColor& color,
const sclchar *str, SclTextCachedInfo *cachedinfo, sclint pos_x, sclint pos_y, sclint width = 0, sclint height = 0,
SCLLabelAlignment align = LABEL_ALIGN_LEFT_TOP,
sclint padding_x = 0, sclint padding_y = 0, sclint inner_width = 0, sclint inner_height = 0) {
- get_scl_graphics_impl()->draw_text(window, draw_ctx, font_info, color, str, cachedinfo,
+ return get_scl_graphics_impl()->draw_text(window, draw_ctx, font_info, color, str, cachedinfo,
pos_x, pos_y, width, height, align, padding_x, padding_y, inner_width, inner_height);
}
return get_scl_graphics_impl()->end_paint(window, draw_ctx);
}
- void draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
+ scldrawing draw_rectangle(sclwindow window, const scldrawctx draw_ctx, scldouble pos_x, scldouble pos_y,
scldouble width, scldouble height, const scldouble line_width, const SclColor& line_color,
sclboolean fill, const SclColor& fill_color, scldouble radius = 0, sclfloat alpha = 1.0) {
- get_scl_graphics_impl()->draw_rectangle(window, draw_ctx, pos_x, pos_y, width, height, line_width, line_color, fill, fill_color, radius, alpha);
+ return get_scl_graphics_impl()->draw_rectangle(window, draw_ctx, pos_x, pos_y, width, height, line_width, line_color, fill, fill_color, radius, alpha);
}
SclSize get_image_size(sclchar* image_path) {
SclSize get_text_size(const SclFontInfo & fontinfo, const sclchar *str) {
return get_scl_graphics_impl()->get_text_size(fontinfo, str);
}
+
+ void register_atspi_object(sclwindow window, scldrawing drawing, const sclchar* name) {
+ return get_scl_graphics_impl()->register_atspi_object(window, drawing, name);
+ }
+
private:
sclimage load_image(const sclchar *image_path) {
return get_scl_graphics_impl()->load_image(image_path);
private:
sclboolean draw_button_all(const sclwindow window, const scldrawctx draw_ctx, const scl16 x, const scl16 y, const scl16 width, const scl16 height);
- sclboolean draw_button_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state);
+ scldrawing draw_button_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state);
sclboolean draw_window_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const SclSize size,
const scldouble line_width, const SclColor line_color, const SclColor fill_color);
- sclboolean draw_button_bg_by_img(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
+ scldrawing draw_button_bg_by_img(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
SCLButtonState state, SCLShiftState shift);
- sclboolean draw_button_bg_by_layoutimg(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
+ scldrawing draw_button_bg_by_layoutimg(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
const SCLButtonState state, const sclboolean shift);
sclboolean draw_button_label(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index,
SCLButtonState state, SCLShiftState shift);
sclboolean draw_magnifier_label(const sclwindow window, const scldrawctx draw_ctx, const scl16 label_index, const sclchar* label);
+ const sclchar* get_button_text_to_read(const sclwindow window, const scl16 key_index, SCLShiftState shift_index);
+
protected:
/* Backend Primitive */
CSCLGwes *m_gwes;
}
/**
+ * Returns text that should be read if accessibility support is enabled
+ */
+const sclchar*
+CSCLUIBuilder::get_button_text_to_read(const sclwindow window, const scl16 key_index, SCLShiftState shift_index)
+{
+ CSCLResourceCache *cache = CSCLResourceCache::get_instance();
+
+ if (!cache)
+ return NULL;
+
+ const SclLayoutKeyCoordinate *coordinate = cache->get_cur_layout_key_coordinate(window, key_index);
+ SclButtonContext * button_context = cache->get_cur_button_context(window, key_index);
+
+ if (coordinate && button_context && coordinate->key_type != KEY_TYPE_NONE) {
+ const sclchar *targetstr = coordinate->hint_string[shift_index][button_context->multitap_index];
+ if (targetstr == NULL) {
+ targetstr = coordinate->label[shift_index][0];
+ }
+ if (targetstr == NULL) {
+ targetstr = coordinate->key_value[shift_index][button_context->multitap_index];
+ }
+
+ return cache->find_substituted_string(targetstr);
+ }
+ return NULL;
+}
+
+
+/**
* Draws the button of the given key index by type of the button
* @remark draw_button_all
*/
/* check it according to the following check-list */
/* check it whether uses SW style button */
if (layout && coordinate) {
+ scldrawing background = NULL;
if (layout->use_sw_button) {
/* case 1 (uses Software button) */
- draw_button_bg_by_sw(window, draw_ctx, key_index, state);
+ background = draw_button_bg_by_sw(window, draw_ctx, key_index, state);
} else {
/* check it whether uses an individual images */
if (coordinate->bg_image_path[shift_index][state]) {
if (strcmp(coordinate->bg_image_path[shift_index][state], SCL_BACKGROUND_IMAGE_STRING) != 0) {
/* case 2 (uses an indivisual image) */
- draw_button_bg_by_img(window, draw_ctx, key_index, state, shift_index);
+ background = draw_button_bg_by_img(window, draw_ctx, key_index, state, shift_index);
} else {
/* case 3 (uses the layout background image) */
- draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
+ background = draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
}
} else if (force_draw_bg) {
- draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
+ background = draw_button_bg_by_layoutimg(window, draw_ctx, key_index, state, shift_index);
}
/* case 4 (don't draw anything for button's background if image_path is NULL) */
}
/* 2. displaying the label of the button */
draw_button_label(window, draw_ctx, key_index, state, shift_index);
+ /* 3. register button as atspi object */
+ const sclchar * text = get_button_text_to_read(window, key_index, shift_index);
+ graphics->register_atspi_object(window, background, text);
}
}
* Draws a button using software
* @remark draw_button
*/
-sclboolean
+scldrawing
CSCLUIBuilder::draw_button_bg_by_sw(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state)
{
//SCL_DEBUG();
// line_curve,
// bg_alpha);
////}
- return TRUE;
+ return NULL;
}
/**
* Draws a button using the set image
* @remark draw_button
*/
-sclboolean
+scldrawing
CSCLUIBuilder::draw_button_bg_by_img(const sclwindow window, const scldrawctx draw_ctx, scl16 key_index, SCLButtonState state, SCLShiftState shift)
{
SCL_DEBUG();
const SclLayoutKeyCoordinate* coordinate = NULL;
- if (!context || !windows || !graphics || !cache || !sclres_manager) return FALSE;
+ if (!context || !windows || !graphics || !cache || !sclres_manager) return NULL;
coordinate = cache->get_cur_layout_key_coordinate(window, key_index);
PSclModifierDecoration sclres_modifier_decoration = sclres_manager->get_modifier_decoration_table();
assert(sclres_modifier_decoration != NULL);
- scl_assert_return_false(window);
- scl_assert_return_false(draw_ctx);
+ scl_assert_return_null(window);
+ scl_assert_return_null(draw_ctx);
- scl_assert_return_false(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
+ scl_assert_return_null(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
sclchar composed_path[_POSIX_PATH_MAX] = {0, };
(sclint)coordinate->height + (sclint)coordinate->add_hit_top + (sclint)coordinate->add_hit_bottom
);
} else {*/
- graphics->draw_image(
+ return graphics->draw_image(
targetwin,
draw_ctx,
composed_path,
//}
}
- return TRUE;
+ return NULL;
}
/**
* Draws a button using the set layout image
* @remark draw_button
*/
-sclboolean
+scldrawing
CSCLUIBuilder::draw_button_bg_by_layoutimg(const sclwindow window, const scldrawctx draw_ctx, const scl16 key_index, const SCLButtonState state, const sclboolean shift)
{
SCL_DEBUG();
CSCLResourceCache *cache = CSCLResourceCache::get_instance();
SclResParserManager *sclres_manager = SclResParserManager::get_instance();
- if (!context || !windows || !cache || !sclres_manager) return FALSE;
+ if (!context || !windows || !cache || !sclres_manager) return NULL;
const SclLayout* layout = cache->get_cur_layout(window);
const SclLayoutKeyCoordinate* coordinate = cache->get_cur_layout_key_coordinate(window, key_index);
PSclModifierDecoration sclres_modifier_decoration = sclres_manager->get_modifier_decoration_table();
assert(sclres_modifier_decoration != NULL);
- scl_assert_return_false(window);
- scl_assert_return_false(draw_ctx);
+ scl_assert_return_null(window);
+ scl_assert_return_null(draw_ctx);
- scl_assert_return_false(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
+ scl_assert_return_null(state >= BUTTON_STATE_NORMAL && state < SCL_BUTTON_STATE_MAX);
//SclWindowContext *window_context = windows->get_window_context(window, FALSE);
SclWindowContext *window_context = windows->get_window_context(window);
}
}
- m_gwes->m_graphics->draw_image(
+ return m_gwes->m_graphics->draw_image(
window,
draw_ctx,
composed_path,
TRUE);
//}
}
- return TRUE;
+ return NULL;
}
/**