1use crate::{ffi, EntryRow, PreferencesRow};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "AdwPasswordEntryRow")]
11 pub struct PasswordEntryRow(Object<ffi::AdwPasswordEntryRow, ffi::AdwPasswordEntryRowClass>) @extends EntryRow, PreferencesRow, gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable, gtk::Editable;
12
13 match fn {
14 type_ => || ffi::adw_password_entry_row_get_type(),
15 }
16}
17
18impl PasswordEntryRow {
19 #[doc(alias = "adw_password_entry_row_new")]
20 pub fn new() -> PasswordEntryRow {
21 assert_initialized_main_thread!();
22 unsafe { gtk::Widget::from_glib_none(ffi::adw_password_entry_row_new()).unsafe_cast() }
23 }
24
25 pub fn builder() -> PasswordEntryRowBuilder {
30 PasswordEntryRowBuilder::new()
31 }
32}
33
34#[cfg(feature = "v1_2")]
35#[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
36impl Default for PasswordEntryRow {
37 fn default() -> Self {
38 Self::new()
39 }
40}
41
42#[must_use = "The builder must be built to be used"]
47pub struct PasswordEntryRowBuilder {
48 builder: glib::object::ObjectBuilder<'static, PasswordEntryRow>,
49}
50
51impl PasswordEntryRowBuilder {
52 fn new() -> Self {
53 Self {
54 builder: glib::object::Object::builder(),
55 }
56 }
57
58 #[cfg(feature = "v1_2")]
59 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
60 pub fn activates_default(self, activates_default: bool) -> Self {
61 Self {
62 builder: self
63 .builder
64 .property("activates-default", activates_default),
65 }
66 }
67
68 #[cfg(feature = "v1_2")]
69 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
70 pub fn attributes(self, attributes: &pango::AttrList) -> Self {
71 Self {
72 builder: self.builder.property("attributes", attributes.clone()),
73 }
74 }
75
76 #[cfg(feature = "v1_2")]
77 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
78 pub fn enable_emoji_completion(self, enable_emoji_completion: bool) -> Self {
79 Self {
80 builder: self
81 .builder
82 .property("enable-emoji-completion", enable_emoji_completion),
83 }
84 }
85
86 #[cfg(feature = "v1_2")]
87 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
88 pub fn input_hints(self, input_hints: gtk::InputHints) -> Self {
89 Self {
90 builder: self.builder.property("input-hints", input_hints),
91 }
92 }
93
94 #[cfg(feature = "v1_2")]
95 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
96 pub fn input_purpose(self, input_purpose: gtk::InputPurpose) -> Self {
97 Self {
98 builder: self.builder.property("input-purpose", input_purpose),
99 }
100 }
101
102 #[cfg(feature = "v1_6")]
103 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
104 pub fn max_length(self, max_length: i32) -> Self {
105 Self {
106 builder: self.builder.property("max-length", max_length),
107 }
108 }
109
110 #[cfg(feature = "v1_2")]
111 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
112 pub fn show_apply_button(self, show_apply_button: bool) -> Self {
113 Self {
114 builder: self
115 .builder
116 .property("show-apply-button", show_apply_button),
117 }
118 }
119
120 pub fn title(self, title: impl Into<glib::GString>) -> Self {
121 Self {
122 builder: self.builder.property("title", title.into()),
123 }
124 }
125
126 #[cfg(feature = "v1_1")]
127 #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
128 pub fn title_selectable(self, title_selectable: bool) -> Self {
129 Self {
130 builder: self.builder.property("title-selectable", title_selectable),
131 }
132 }
133
134 #[cfg(feature = "v1_2")]
135 #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
136 pub fn use_markup(self, use_markup: bool) -> Self {
137 Self {
138 builder: self.builder.property("use-markup", use_markup),
139 }
140 }
141
142 pub fn use_underline(self, use_underline: bool) -> Self {
143 Self {
144 builder: self.builder.property("use-underline", use_underline),
145 }
146 }
147
148 pub fn activatable(self, activatable: bool) -> Self {
149 Self {
150 builder: self.builder.property("activatable", activatable),
151 }
152 }
153
154 pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
155 Self {
156 builder: self.builder.property("child", child.clone().upcast()),
157 }
158 }
159
160 pub fn selectable(self, selectable: bool) -> Self {
161 Self {
162 builder: self.builder.property("selectable", selectable),
163 }
164 }
165
166 pub fn can_focus(self, can_focus: bool) -> Self {
167 Self {
168 builder: self.builder.property("can-focus", can_focus),
169 }
170 }
171
172 pub fn can_target(self, can_target: bool) -> Self {
173 Self {
174 builder: self.builder.property("can-target", can_target),
175 }
176 }
177
178 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
179 Self {
180 builder: self.builder.property("css-classes", css_classes.into()),
181 }
182 }
183
184 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
185 Self {
186 builder: self.builder.property("css-name", css_name.into()),
187 }
188 }
189
190 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
191 Self {
192 builder: self.builder.property("cursor", cursor.clone()),
193 }
194 }
195
196 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
197 Self {
198 builder: self.builder.property("focus-on-click", focus_on_click),
199 }
200 }
201
202 pub fn focusable(self, focusable: bool) -> Self {
203 Self {
204 builder: self.builder.property("focusable", focusable),
205 }
206 }
207
208 pub fn halign(self, halign: gtk::Align) -> Self {
209 Self {
210 builder: self.builder.property("halign", halign),
211 }
212 }
213
214 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
215 Self {
216 builder: self.builder.property("has-tooltip", has_tooltip),
217 }
218 }
219
220 pub fn height_request(self, height_request: i32) -> Self {
221 Self {
222 builder: self.builder.property("height-request", height_request),
223 }
224 }
225
226 pub fn hexpand(self, hexpand: bool) -> Self {
227 Self {
228 builder: self.builder.property("hexpand", hexpand),
229 }
230 }
231
232 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
233 Self {
234 builder: self.builder.property("hexpand-set", hexpand_set),
235 }
236 }
237
238 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
239 Self {
240 builder: self
241 .builder
242 .property("layout-manager", layout_manager.clone().upcast()),
243 }
244 }
245
246 #[cfg(feature = "gtk_v4_18")]
247 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
248 pub fn limit_events(self, limit_events: bool) -> Self {
249 Self {
250 builder: self.builder.property("limit-events", limit_events),
251 }
252 }
253
254 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
255 Self {
256 builder: self.builder.property("margin-bottom", margin_bottom),
257 }
258 }
259
260 pub fn margin_end(self, margin_end: i32) -> Self {
261 Self {
262 builder: self.builder.property("margin-end", margin_end),
263 }
264 }
265
266 pub fn margin_start(self, margin_start: i32) -> Self {
267 Self {
268 builder: self.builder.property("margin-start", margin_start),
269 }
270 }
271
272 pub fn margin_top(self, margin_top: i32) -> Self {
273 Self {
274 builder: self.builder.property("margin-top", margin_top),
275 }
276 }
277
278 pub fn name(self, name: impl Into<glib::GString>) -> Self {
279 Self {
280 builder: self.builder.property("name", name.into()),
281 }
282 }
283
284 pub fn opacity(self, opacity: f64) -> Self {
285 Self {
286 builder: self.builder.property("opacity", opacity),
287 }
288 }
289
290 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
291 Self {
292 builder: self.builder.property("overflow", overflow),
293 }
294 }
295
296 pub fn receives_default(self, receives_default: bool) -> Self {
297 Self {
298 builder: self.builder.property("receives-default", receives_default),
299 }
300 }
301
302 pub fn sensitive(self, sensitive: bool) -> Self {
303 Self {
304 builder: self.builder.property("sensitive", sensitive),
305 }
306 }
307
308 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
309 Self {
310 builder: self
311 .builder
312 .property("tooltip-markup", tooltip_markup.into()),
313 }
314 }
315
316 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
317 Self {
318 builder: self.builder.property("tooltip-text", tooltip_text.into()),
319 }
320 }
321
322 pub fn valign(self, valign: gtk::Align) -> Self {
323 Self {
324 builder: self.builder.property("valign", valign),
325 }
326 }
327
328 pub fn vexpand(self, vexpand: bool) -> Self {
329 Self {
330 builder: self.builder.property("vexpand", vexpand),
331 }
332 }
333
334 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
335 Self {
336 builder: self.builder.property("vexpand-set", vexpand_set),
337 }
338 }
339
340 pub fn visible(self, visible: bool) -> Self {
341 Self {
342 builder: self.builder.property("visible", visible),
343 }
344 }
345
346 pub fn width_request(self, width_request: i32) -> Self {
347 Self {
348 builder: self.builder.property("width-request", width_request),
349 }
350 }
351
352 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
353 Self {
354 builder: self.builder.property("accessible-role", accessible_role),
355 }
356 }
357
358 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
359 Self {
360 builder: self.builder.property("action-name", action_name.into()),
361 }
362 }
363
364 pub fn action_target(self, action_target: &glib::Variant) -> Self {
365 Self {
366 builder: self
367 .builder
368 .property("action-target", action_target.clone()),
369 }
370 }
371
372 pub fn editable(self, editable: bool) -> Self {
373 Self {
374 builder: self.builder.property("editable", editable),
375 }
376 }
377
378 pub fn enable_undo(self, enable_undo: bool) -> Self {
379 Self {
380 builder: self.builder.property("enable-undo", enable_undo),
381 }
382 }
383
384 pub fn max_width_chars(self, max_width_chars: i32) -> Self {
385 Self {
386 builder: self.builder.property("max-width-chars", max_width_chars),
387 }
388 }
389
390 pub fn text(self, text: impl Into<glib::GString>) -> Self {
391 Self {
392 builder: self.builder.property("text", text.into()),
393 }
394 }
395
396 pub fn width_chars(self, width_chars: i32) -> Self {
397 Self {
398 builder: self.builder.property("width-chars", width_chars),
399 }
400 }
401
402 pub fn xalign(self, xalign: f32) -> Self {
403 Self {
404 builder: self.builder.property("xalign", xalign),
405 }
406 }
407
408 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
411 pub fn build(self) -> PasswordEntryRow {
412 assert_initialized_main_thread!();
413 self.builder.build()
414 }
415}