aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/elementary/elm_web.eo
blob: f1c8e986ecc02962580591101746d05ec5782933 (plain) (blame)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
type Elm_Web_Console_Message: __undefined_type; [[Elementary web console message type]]
type Elm_Web_Window_Open: __undefined_type; [[Elementary web window open type]]
type Elm_Web_Dialog_File_Selector: __undefined_type; [[Elementary web dialog file selector type]]
type Elm_Web_Dialog_Confirm: __undefined_type; [[Elementary web dialog confirm type]]
type Elm_Web_Dialog_Prompt: __undefined_type; [[Elementary web dialog prompt type]]
type Elm_Web_Dialog_Alert: __undefined_type; [[Elementary web dialog alert type]]

enum Elm.Web.Zoom_Mode
{
   [[Types of zoom available.]]
   manual = 0, [[Zoom controlled normally by elm_web_zoom_set]]
   auto_fit, [[Zoom until content fits in web object]]
   auto_fill, [[Zoom until content fills web object]]
   last [[Sentinel value to indicate last enum field during iteration]]
}

class Elm.Web (Elm.Widget)
{
   [[Elementary web view class]]
   legacy_prefix: elm_web;
   eo_prefix: elm_obj_web;
   event_prefix: elm_web;
   methods {
      @property text_matches_highlight @pure_virtual {
         set {
            [[Sets whether to highlight the matched marks.

              If enabled, marks set with @.text_matches_mark will be
              highlighted.
            ]]
            return: bool; [[$true on success, $false otherwise]]
         }
         get {
            [[Get whether highlighting marks is enabled.]]
         }
         values {
            highlight: bool; [[Whether to highlight the marks or not.]]
         }
      }
      @property useragent @pure_virtual {
         set {
            [[Change useragent of a elm_web object.]]
         }
         get {
            [[Return current useragent of elm_web object.]]
         }
         values {
            user_agent: string; [[String for useragent.]]
         }
      }
      @property url @pure_virtual {
         set {
            [[Sets the URL for the web object.

              It must be a full URL, with resource included, in the form
              http://www.enlightenment.org or file:///tmp/something.html
            ]]
            return: bool; [[$true on success, $false otherwise]]
         }
         get {
            [[Get the current URL for the object.

              The returned string must not be freed and is guaranteed to be
              stringshared.
            ]]
         }
         values {
            url: string; [[The URL to set.]]
         }
      }
      @property bg_color @pure_virtual {
         set {
            [[Sets the background color to be used by the web object.

              This is the color that will be used by default when the
              loaded page does not set it's own. Color values are
              pre-multiplied.
            ]]
         }
         get {
            [[Get the background color to be used by the web object.

              This is the color that will be used by default when the
              loaded page does not set it's own. Color values are
              pre-multiplied.
            ]]
         }
         values {
            r: int; [[Red component.]]
            g: int; [[Green component.]]
            b: int; [[Blue component.]]
            a: int; [[Alpha component.]]
         }
      }
      @property inwin_mode @pure_virtual {
         set {
            [[Sets the default dialogs to use an Inwin instead of a
              normal window.

              If set, then the default implementation for the JavaScript
              dialogs and file selector will be opened in an Inwin.
              Otherwise they will use a normal separated window.
            ]]
         }
         get {
            [[Get whether Inwin mode is set for the current object.]]
         }
         values {
            value: bool; [[$true if dialog will be opened as Inwin, $false otherwise]]
         }
      }
      @property tab_propagate @pure_virtual {
         set {
            [[Sets whether to use tab propagation.

              If tab propagation is enabled, whenever the user presses the
              Tab key, Elementary will handle it and switch focus to the
              next widget. The default value is disabled, where WebKit
              will handle the Tab key to cycle focus though its internal
              objects, jumping to the next widget only when that cycle ends.
            ]]
         }
         get {
            [[Get the status of the tab propagation.]]
         }
         values {
            propagate: bool; [[Whether to propagate Tab keys to Elementary or not.]]
         }
      }
      @property history_enabled @pure_virtual {
         set {
            [[Enables or disables the browsing history.]]
         }
         get {
            [[Get whether browsing history is enabled for the given object.]]
         }
         values {
            enable: bool; [[Whether to enable or disable the browsing history.]]
         }
      }
      @property zoom_mode @pure_virtual {
         set {
            [[Sets the zoom mode to use.

              The modes can be any of those defined in .Elm_Web_Zoom_Mode,
              except .ELM_WEB_ZOOM_MODE_LAST. The default is
              .ELM_WEB_ZOOM_MODE_MANUAL.

              .ELM_WEB_ZOOM_MODE_MANUAL means the zoom level will be
              controlled with the @.zoom.set function.

              .ELM_WEB_ZOOM_MODE_AUTO_FIT will calculate the needed zoom
              level to make sure the entirety of the web object's contents
              are shown.

              .ELM_WEB_ZOOM_MODE_AUTO_FILL will calculate the needed zoom
              level to fit the contents in the web object's size, without
              leaving any space unused.
            ]]
         }
         get {
            [[Get the currently set zoom mode.]]
         }
         values {
            mode: Elm.Web.Zoom_Mode; [[The mode to set.]]
         }
      }
      @property zoom @pure_virtual {
         set {
            [[Sets the zoom level of the web object.

              Zoom level matches the Webkit API, so 1.0 means normal zoom,
              with higher values meaning zoom in and lower meaning zoom out.
              This function will only affect the zoom level if the mode set
              with @.zoom_mode.set is .ELM_WEB_ZOOM_MODE_MANUAL.
            ]]
         }
         get {
            [[Get the current zoom level set on the web object

              Note that this is the zoom level set on the web object and
              not that of the underlying Webkit one. In the
              .ELM_WEB_ZOOM_MODE_MANUAL mode, the two zoom levels should
              match, but for the other two modes the Webkit zoom is
              calculated internally to match the chosen mode without
              changing the zoom level set for the web object.
            ]]
         }
         values {
            zoom: double; [[The zoom level to set.]]
         }
      }
      @property console_message_hook {
         set @pure_virtual {
            [[Sets the function to call when a console message is emitted
              from JS.

              This hook will be called when a console message is emitted
              from JavaScript. There is no default implementation for
              this feature.
            ]]
         }
         values {
            func: Elm_Web_Console_Message; [[The callback function to be used.]]
            data: void_ptr; [[User data.]]
         }
      }
      @property window_create_hook {
         set @pure_virtual {
            [[Sets the function to call when a new window is requested.

              This hook will be called when a request to create a new
              window is issued from the web page loaded.
              There is no default implementation for this feature, so
              leaving this unset or passing $null in $func will prevent
              new windows from opening.
            ]]
         }
         values {
            func: Elm_Web_Window_Open @nullable; [[The hook function to be called when a window is requested.]]
            data: void_ptr @optional; [[User data.]]
         }
      }
      @property dialog_file_selector_hook {
         set @pure_virtual {
            [[Sets the function to call when an file selector dialog.

              This hook will be called when a JavaScript file selector
              dialog is requested.
              If no function is set or $null is passed in $func, the default
              implementation will take place.
            ]]
         }
         values {
            func: Elm_Web_Dialog_File_Selector @nullable; [[The callback function to be used.]]
            data: void_ptr @optional; [[User data.]]
         }
      }
      @property dialog_confirm_hook {
         set @pure_virtual {
            [[Sets the function to call when an confirm dialog.

              This hook will be called when a JavaScript confirm dialog is
              requested. If no function is set or $null is passed in $func,
              the default implementation will take place.
            ]]
         }
         values {
            func: Elm_Web_Dialog_Confirm @nullable; [[The callback function to be used.]]
            data: void_ptr @optional; [[User data.]]
         }
      }
      @property popup_selected {
         set @pure_virtual {
            [[Tells the web object which index in the currently open popup
              was selected.

              When the user handles the popup creation from the
              "popup,created" signal, it needs to tell the web object
              which item was selected by calling this function with
              the index corresponding to the item.
            ]]
         }
         values {
            idx: int; [[The index selected.]]
         }
      }
      @property dialog_prompt_hook {
         set @pure_virtual {
            [[Sets the function to call when an prompt dialog.

              This hook will be called when a JavaScript prompt dialog is
              requested. If no function is set or $null is passed in $func,
              the default implementation will take place.
            ]]
         }
         values {
            func: Elm_Web_Dialog_Prompt @nullable; [[The callback function to be used.]]
            data: void_ptr @optional; [[User data.]]
         }
      }
      @property dialog_alert_hook {
         set @pure_virtual {
            [[Sets the function to call when an alert dialog.

              This hook will be called when a JavaScript alert dialog is
              requested. If no function is set or $null is passed in $func,
              the default implementation will take place.
            ]]
         }
         values {
            func: Elm_Web_Dialog_Alert @nullable; [[Callback function to be used.]]
            data: void_ptr @optional; [[User data.]]
         }
      }
      @property forward_possible {
         get @pure_virtual {
            [[Queries whether it's possible to go forward in history.]]
            return: bool; [[$true if it is possible to go forward, $false otherwise]]
         }
      }
      @property webkit_view {
         get @pure_virtual {
            [[Get internal ewk_view object from web object.

              Elementary may not provide some low level features of EWebKit,
              instead of cluttering the API with proxy methods we opted to
              return the internal reference. Be careful using it as it may
              interfere with elm_web behavior.
            ]]
            return: Efl.Canvas.Object; [[The internal ewk_view object or $null
                                     if it does not exist. (Failure to
                                     create or Elementary compiled
                                     without ewebkit)]]
         }
      }
      @property back_possible {
         get @pure_virtual {
            [[Queries whether it's possible to go back in history.]]
            return: bool; [[$true if it is possible to go back, $false otherwise]]
         }
      }
      @property load_progress {
         get @pure_virtual {
            [[Get the overall loading progress of the page.

              Returns the estimated loading progress of the page, with a
              value between 0.0 and 1.0. This is an estimated progress
              accounting for all the frames included in the page.
            ]]
            return: double; [[A value between 0.0 and 1.0 indicating the
                              progress, or -1.0 on failure.]]
         }
      }
      @property selection {
         get @pure_virtual {
            [[Get a copy of the currently selected text.

              The string returned must be freed by the user when it's done
              with it.
            ]]
            /* FIXME: const doesn't belong here */
            return: const(string) @owned @warn_unused; [[A newly allocated string, or
                                                      $null if nothing is selected
                                                      or an error occurred.]]
         }
      }
      @property title {
         get @pure_virtual {
            [[Get the current title.

              The returned string must not be freed and is guaranteed to be
              stringshared.
            ]]
            return: stringshare @owned @warn_unused; [[
               A stringshared internal string with the current title, or $null on
               failure.
            ]]
         }
      }
      navigate @pure_virtual {
         [[Jumps the given number of steps in the browsing history.

           The $steps value can be a negative integer to back in history,
           or a positive to move forward.
         ]]
         return: bool; [[$true on success, $false on error or if not enough
                         history exists to jump the given number of steps]]
         params {
            @in steps: int; [[The number of steps to jump.]]
         }
      }
      back @pure_virtual {
         [[Goes back one step in the browsing history.

           This is equivalent to calling elm_web_object_navigate(obj, -1);
         ]]
         return: bool; [[$true on success, $false otherwise]]
      }
      html_string_load @pure_virtual {
         [[Loads the specified $html string as the content of the web
           object.

           External objects such as stylesheets or images referenced in
           the HTML document are located relative to $base_url.

           If an $unreachable_url is passed it is used as the url for the
           loaded content. This is typically used to display error pages
           for a failed load.

           @since 1.9
         ]]
         return: bool; [[$true on success, $false otherwise]]
         params {
            @in html: string; [[HTML data to load.]]
            @in base_url: string @optional; [[Base URL used for relative paths to external objects (optional).]]
            @in unreachable_url: string @optional; [[URL that could not be reached (optional).]]
         }
      }
      text_search @const @pure_virtual {
         [[Searches the given string in a document.]]
         return: bool; [[$true if the given string was found, $false if not
                         or failure.]]
         params {
            @in string: string; [[String to search.]]
            @in case_sensitive: bool; [[If search should be case sensitive or not.]]
            @in forward: bool; [[If search is from cursor and on or backwards.]]
            @in wrap: bool; [[If search should wrap at the end.]]
         }
      }
      popup_destroy @pure_virtual {
         [[Dismisses an open dropdown popup

           When the popup from a dropdown widget is to be dismissed, either
           after selecting an option or to cancel it, this function must be
           called, which will later emit an "popup,willdelete" signal to
           notify the user that any memory and objects related to this
           popup can be freed.
         ]]
         return: bool; [[$true if the menu was successfully destroyed, or
                         $false if there was no menu to destroy.]]
      }
      region_show @pure_virtual {
         [[Shows the given region in the web object.]]
         params {
            @in x: int; [[The x coordinate of the region to show.]]
            @in y: int; [[The y coordinate of the region to show.]]
            @in w: int; [[The width of the region to show.]]
            @in h: int; [[The height of the region to show.]]
         }
      }
      forward @pure_virtual {
         [[Goes forward one step in the browsing history.

           This is equivalent to calling elm_web_object_navigate(obj, 1);

           See also @.history_enabled.set, @.forward_possible.get,
           @.back, @.navigate.
         ]]
         return: bool; [[$true on success, $false otherwise.]]
      }
      text_matches_mark @pure_virtual {
         [[Marks matches of the given string in a document.]]
         return: uint; [[Number of matched $string.]]
         params {
            @in string: string; [[String to match.]]
            @in case_sensitive: bool; [[If match should be case sensitive or not.]]
            @in highlight: bool; [[If matches should be highlighted.]]
            @in limit: uint; [[Maximum amount of matches, or zero to unlimited.]]
         }
      }
      region_bring_in @pure_virtual {
         [[Brings in the region to the visible area.

           Like @.region_show, but it animates the scrolling of the object
           to show the area.
         ]]
         params {
            @in x: int; [[The x coordinate of the region to show.]]
            @in y: int; [[The y coordinate of the region to show.]]
            @in w: int; [[The width of the region to show.]]
            @in h: int; [[The height of the region to show.]]
         }
      }
      stop @pure_virtual {
         [[Stops loading the current page.

           Cancels the loading of the current page in the web object. This
           will cause a "load,error" signal to be emitted, with the
           is_cancellation flag set to $true.
         ]]
         return: bool; [[$true if the cancel was successful, $false otherwise.]]
      }
      navigate_possible_get @pure_virtual {
         [[Queries whether it's possible to jump the given number of steps.

           The $steps value can be a negative integer to back in history,
           or positive to move forward.
         ]]
         return: bool; [[$true if enough history exists to perform the
                         given jump, $false otherwise.]]
         params {
            @in steps: int; [[The number of steps to check for.]]
         }
      }
      reload_full @pure_virtual {
         [[Requests a reload of the current document, avoiding any
           existing caches.
         ]]
         return: bool; [[$true on success, $false otherwise.]]
      }
      text_matches_unmark_all @pure_virtual {
         [[Clears all marked matches in the document.]]
         return: bool; [[$true on success, $false otherwise.]]
      }
      reload @pure_virtual {
         [[Requests a reload of the current document in the object.]]
         return: bool; [[$true on success, $false otherwise.]]
      }
   }
   implements {
      class.constructor;
      Efl.Object.constructor;
   }
   events {
      uri,changed; [[Called when URI changed]]
      url,changed; [[Called when URL changed]]
      windows,close,request; [[Called when window closed event was received]]
   }
}