forked from enlightenment/efl
elm_code: Expose whether or not undo and redo can operate
A quick peek at the stack will allow us to inform users of the widget if operations will apply.
This commit is contained in:
parent
e5dd8327ba
commit
c5dce45a95
|
@ -278,9 +278,17 @@ class Elm.Code_Widget (Elm.Layout, Elm.Interface.Atspi.Text)
|
||||||
undo {
|
undo {
|
||||||
[[Undo last action]]
|
[[Undo last action]]
|
||||||
}
|
}
|
||||||
|
can_undo_get {
|
||||||
|
[[Determine if there are any available undo operations]]
|
||||||
|
return: bool; [[$true if there are undo operations]]
|
||||||
|
}
|
||||||
redo {
|
redo {
|
||||||
[[Redo last action]]
|
[[Redo last action]]
|
||||||
}
|
}
|
||||||
|
can_redo_get {
|
||||||
|
[[Determine if there are any available redo operations]]
|
||||||
|
return: bool; [[$true if there are redo operations]]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
class.constructor;
|
class.constructor;
|
||||||
|
|
|
@ -109,6 +109,12 @@ _elm_code_widget_undo_change(Evas_Object *widget,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_elm_code_widget_can_undo_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
||||||
|
{
|
||||||
|
return !!pd->undo_stack_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_elm_code_widget_undo(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
_elm_code_widget_undo(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +129,15 @@ _elm_code_widget_undo(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
||||||
pd->undo_stack_ptr = eina_list_next(pd->undo_stack_ptr);
|
pd->undo_stack_ptr = eina_list_next(pd->undo_stack_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_elm_code_widget_can_redo_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
||||||
|
{
|
||||||
|
if (pd->undo_stack_ptr)
|
||||||
|
return !!eina_list_prev(pd->undo_stack_ptr);
|
||||||
|
|
||||||
|
return !!eina_list_last(pd->undo_stack);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_elm_code_widget_redo(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
_elm_code_widget_redo(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue