1 module webkit2.EditorState;
2 
3 private import gobject.ObjectG;
4 private import webkit2.c.functions;
5 public  import webkit2.c.types;
6 
7 
8 /**
9  * WebKitEditorState represents the state of a #WebKitWebView editor.
10  * Use webkit_web_view_get_editor_state() to get the WebKitEditorState
11  * of a #WebKitWebView.
12  *
13  * Since: 2.10
14  */
15 public class EditorState : ObjectG
16 {
17 	/** the main Gtk struct */
18 	protected WebKitEditorState* webKitEditorState;
19 
20 	/** Get the main Gtk struct */
21 	public WebKitEditorState* getEditorStateStruct(bool transferOwnership = false)
22 	{
23 		if (transferOwnership)
24 			ownedRef = false;
25 		return webKitEditorState;
26 	}
27 
28 	/** the main Gtk struct as a void* */
29 	protected override void* getStruct()
30 	{
31 		return cast(void*)webKitEditorState;
32 	}
33 
34 	/**
35 	 * Sets our main struct and passes it to the parent class.
36 	 */
37 	public this (WebKitEditorState* webKitEditorState, bool ownedRef = false)
38 	{
39 		this.webKitEditorState = webKitEditorState;
40 		super(cast(GObject*)webKitEditorState, ownedRef);
41 	}
42 
43 
44 	/** */
45 	public static GType getType()
46 	{
47 		return webkit_editor_state_get_type();
48 	}
49 
50 	/**
51 	 * Gets the typing attributes at the current cursor position.
52 	 * If there is a selection, this returns the typing attributes
53 	 * of the selected text. Note that in case of a selection,
54 	 * typing attributes are considered active only when they are
55 	 * present throughout the selection.
56 	 *
57 	 * Returns: a bitmask of #WebKitEditorTypingAttributes flags
58 	 *
59 	 * Since: 2.10
60 	 */
61 	public uint getTypingAttributes()
62 	{
63 		return webkit_editor_state_get_typing_attributes(webKitEditorState);
64 	}
65 
66 	/**
67 	 * Gets whether a copy command can be issued.
68 	 *
69 	 * Returns: %TRUE if copy is currently available
70 	 *
71 	 * Since: 2.20
72 	 */
73 	public bool isCopyAvailable()
74 	{
75 		return webkit_editor_state_is_copy_available(webKitEditorState) != 0;
76 	}
77 
78 	/**
79 	 * Gets whether a cut command can be issued.
80 	 *
81 	 * Returns: %TRUE if cut is currently available
82 	 *
83 	 * Since: 2.20
84 	 */
85 	public bool isCutAvailable()
86 	{
87 		return webkit_editor_state_is_cut_available(webKitEditorState) != 0;
88 	}
89 
90 	/**
91 	 * Gets whether a paste command can be issued.
92 	 *
93 	 * Returns: %TRUE if paste is currently available
94 	 *
95 	 * Since: 2.20
96 	 */
97 	public bool isPasteAvailable()
98 	{
99 		return webkit_editor_state_is_paste_available(webKitEditorState) != 0;
100 	}
101 
102 	/**
103 	 * Gets whether a redo command can be issued.
104 	 *
105 	 * Returns: %TRUE if redo is currently available
106 	 *
107 	 * Since: 2.20
108 	 */
109 	public bool isRedoAvailable()
110 	{
111 		return webkit_editor_state_is_redo_available(webKitEditorState) != 0;
112 	}
113 
114 	/**
115 	 * Gets whether an undo command can be issued.
116 	 *
117 	 * Returns: %TRUE if undo is currently available
118 	 *
119 	 * Since: 2.20
120 	 */
121 	public bool isUndoAvailable()
122 	{
123 		return webkit_editor_state_is_undo_available(webKitEditorState) != 0;
124 	}
125 }