summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl2_text_raw_editable.eo
blob: d579e1df4a6a20d2cdb87f3561e72ea1d6798cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
struct @beta Efl2.Text.Change_Info {
   [[This structure includes all the information about content changes.

     It's meant to be used to implement undo/redo.
   ]]
   content: string; [[The content added/removed]]
   position: size; [[The position where it was added/removed]]
   length: size; [[The length of content in characters (not bytes, actual unicode characters)]]
   insert: bool; [[$true if the content was inserted, $false if removed]]
   merge: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
}

function @beta Efl2.Ui.Text_Provider.Item {
  [[This is a function that takes in a $.key and creates an object based on it.

    It's meant for translating <item> objects into actual canvas objects.

    If the function found a suitable object it returns the object, otherwise $null.
  ]]
  params {
     @in parent: Efl.Object; [[Parent of the object returned]]
     @in key: string; [[The key to translate into an object]]
  }
  return: Efl.Object;
};

class @beta Efl2.Text.Raw_Editable extends Efl2.Canvas.Text implements Efl2.Input.Text {
   methods {
      @property editable {
         [[Whether the entry is editable.

           By default text interactives are editable. However setting this
           property to $false will make it so that key input will be disregarded.
         ]]
         set {
         }
         get {
         }
         values {
            editable: bool; [[If $true, user input will be inserted in the entry,
            if not, the entry is read-only and no user input is allowed.]]
         }
      }

      @property password_mode {
         [[Whether text is a password]]
         get {}
         set {}
         values {
            enabled: bool; [[$true if the text is a password, $false otherwise]]
         }
      }

      @property replacement_char {
         [[The character used to replace characters that can't be displayed

           Currently only used to replace characters if @.password_mode
           is enabled.
         ]]
         values {
            repch: Eina.Unicode; [[Replacement character]]
         }
      }

      @property main_cursor {
         [[The user visible cursor
         ]]
         get {}
         values {
            cursor: Efl2.Text.Cursor; [[The user visible cursor]]
         }
      }

      @property selection_allowed {
         [[Whether or not selection is allowed on this object]]
         set {}
         get {}
         values {
            allowed: bool; [[$true if enabled, $false otherwise]]
         }
      }

      @property selection_cursors {
         [[The cursors used for selection handling.

           If the cursors are equal there's
           no selection.

           You are allowed to retain and modify them. Modifying them modifies
           the selection of the object.
         ]]
         get {}
         values {
            start: const(Efl2.Text.Cursor); [[The start of the selection]]
            end: const(Efl2.Text.Cursor); [[The end of the selection]]
         }
      }

      @property item_provider {
         [[The item provider which will be used to create items from their names
           e.g.: "emoticon/happy" or "href=file://image.jpg" etc.
         ]]
         set { }
         values {
            provider_function: Efl2.Ui.Text_Provider.Item; [[The provider function]]
         }
      }

      text_filter {
         [[Replaces the string on the change info with the new filtered string

           Works for both inserts, and deletions (e.g. have text you don't want to be deleted).
           If $new_text is $null, the operation is cancelled.
         ]]
         params {
            change_info: Efl2.Text.Change_Info @by_ref; [[The change info from the callback]]
            new_text: string; [[The new text to use]]
         }
      }

      validation_failed {
         [[Marks the text as invalid (haven't passed validation)

           Meant to be called from inside the changed,user callback
         ]]
         params {
            reason: string; [[Optional reason why it was deemed invalid]]
         }
      }
   }
   events {
      // FIXME: All of these signals will be under this namespace, which is wrong. I guess as part of the composite object changes this will have to change.

      // FIXME: doesn't currently let you change the content/cancel operation because the signal is called too late. Needs fixing.
      changed,user,pre: Efl2.Text.Change_Info; [[The text object has changed due to user interaction]]

      // FIXME: remove these and move this callback in ui/text
      redo,request: void; [[Called when redo is requested]]
      undo,request: void; [[Called when undo is requested]]

      // FIXME: Need to improve the docs, not sure what this one actually means and if it should be exposed. Though it's imf related.
      preedit,changed: void; [[Called when entry preedit changed]]

      selection,start: void; [[Called at selection start]]
      selection,changed: void; [[Called when selection is changed]]
      selection,cleared: void; [[Called when selection is cleared]]
   }
}