1 /* Header for NS Cocoa part of xwidget and webkit widget.
2 
3 Copyright (C) 2019-2021 Free Software Foundation, Inc.
4 
5 This file is part of GNU Emacs.
6 
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or (at
10 your option) any later version.
11 
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
19 
20 #ifndef NSXWIDGET_H_INCLUDED
21 #define NSXWIDGET_H_INCLUDED
22 
23 /* This file can be included from non-objc files through 'xwidget.h'.  */
24 #ifdef __OBJC__
25 #import <AppKit/NSView.h>
26 #endif
27 
28 #include "dispextern.h"
29 #include "lisp.h"
30 #include "xwidget.h"
31 
32 /* Functions for xwidget webkit.  */
33 
34 bool nsxwidget_is_web_view (struct xwidget *xw);
35 Lisp_Object nsxwidget_webkit_uri (struct xwidget *xw);
36 Lisp_Object nsxwidget_webkit_title (struct xwidget *xw);
37 void nsxwidget_webkit_goto_uri (struct xwidget *xw, const char *uri);
38 void nsxwidget_webkit_goto_history (struct xwidget *xw, int rel_pos);
39 void nsxwidget_webkit_zoom (struct xwidget *xw, double zoom_change);
40 void nsxwidget_webkit_execute_script (struct xwidget *xw, const char *script,
41                                       Lisp_Object fun);
42 
43 /* Functions for xwidget model.  */
44 
45 #ifdef __OBJC__
46 @interface XwWindow : NSView
47 @property struct xwidget *xw;
48 @end
49 #endif
50 
51 void nsxwidget_init (struct xwidget *xw);
52 void nsxwidget_kill (struct xwidget *xw);
53 void nsxwidget_resize (struct xwidget *xw);
54 Lisp_Object nsxwidget_get_size (struct xwidget *xw);
55 
56 /* Functions for xwidget view.  */
57 
58 #ifdef __OBJC__
59 @interface XvWindow : NSView
60 @property struct xwidget *xw;
61 @property struct xwidget_view *xv;
62 @end
63 #endif
64 
65 void nsxwidget_init_view (struct xwidget_view *xv,
66                           struct xwidget *xww,
67                           struct glyph_string *s,
68                           int x, int y);
69 void nsxwidget_delete_view (struct xwidget_view *xv);
70 
71 void nsxwidget_show_view (struct xwidget_view *xv);
72 void nsxwidget_hide_view (struct xwidget_view *xv);
73 void nsxwidget_resize_view (struct xwidget_view *xv,
74                             int widget, int height);
75 
76 void nsxwidget_move_view (struct xwidget_view *xv, int x, int y);
77 void nsxwidget_move_widget_in_view (struct xwidget_view *xv, int x, int y);
78 void nsxwidget_set_needsdisplay (struct xwidget_view *xv);
79 
80 #endif /* NSXWIDGET_H_INCLUDED */
81