summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl2_text_raw_editable.eo
blob: b13cf8731c860e3c5b564f0e12fe4b5493804816 (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
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]]
}

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]]
         }
      }

      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]]
   }
}