void clone_keyproperties(SclPrivateKeyProperties* priv, sclbyte input_mode_index, sclbyte layout_index, sclbyte key_index);
void enable_button(const sclchar* custom_id, sclboolean enabled);
+ sclboolean get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle);
void set_string_substitution(const sclchar *original, const sclchar *substitute);
void unset_string_substitution(const sclchar *original);
*/
sclboolean process_key_event(const char *key);
+ /**
+ * @brief This API request SCL library to return the geometry information of a button with given ID
+ * @param[in] custom_id the name of the key to be queried
+ * @return non-zero value is returned when successful
+ */
+ sclboolean get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle);
private:
CSCLUIImpl *m_impl;
};
void set_autocapital_shift_state(sclboolean flag);
sclboolean process_key_event(const char *key);
+ sclboolean get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle);
private:
sclboolean m_initialized;
}
}
+/**
+* Get geometry information of a button with given custom_id
+*/
+sclboolean CSCLResourceCache::get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle)
+{
+ SCL_DEBUG();
+
+ CSCLContext *context = CSCLContext::get_instance();
+ SclResParserManager *sclres_manager = SclResParserManager::get_instance();
+
+ if (!context || !sclres_manager) return FALSE;
+
+ sclint loop;
+ if (custom_id && rectangle) {
+ sclbyte layout_index = NOT_USED;
+ PSclLayoutKeyCoordinatePointerTable sclres_layout_key_coordinate_pointer_frame =
+ sclres_manager->get_key_coordinate_pointer_frame();
+ if (!sclres_layout_key_coordinate_pointer_frame) return FALSE;
+
+ if (context) {
+ layout_index = context->get_base_layout();
+ }
+ if (scl_check_arrindex_unsigned(layout_index, MAX_SCL_LAYOUT)) {
+ for (loop = 0;loop < MAX_KEY;loop++) {
+ SclLayoutKeyCoordinatePointer p =
+ sclres_layout_key_coordinate_pointer_frame[layout_index][loop];
+ if (!p || !(p->valid)) break;
+ if (p->custom_id) {
+ if (strcmp(p->custom_id, custom_id) == 0) {
+ rectangle->x = p->x;
+ rectangle->y = p->y;
+ rectangle->width = p->width;
+ rectangle->height = p->height;
+
+ return TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ return FALSE;
+}
+
void
CSCLResourceCache::set_string_substitution(const sclchar *original, const sclchar *substitute)
{
}
return FALSE;
}
+
+sclboolean
+CSCLUI::get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle)
+{
+ if (m_impl) {
+ return m_impl->get_button_geometry(custom_id, rectangle);
+ }
+ return FALSE;
+}
\ No newline at end of file
}
return FALSE;
}
+
+sclboolean
+CSCLUIImpl::get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle)
+{
+ if (m_initialized) {
+ CSCLResourceCache *cache= CSCLResourceCache::get_instance();
+ return cache->get_button_geometry(custom_id, rectangle);
+ }
+ return FALSE;
+}