libhandy-0.8.0/.cargo_vcs_info.json0000644000000001120000000000000126240ustar { "git": { "sha1": "692f98cb4608492c1750d029469ee56b036630d1" } } libhandy-0.8.0/Cargo.toml0000644000000027530000000000000106370ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] edition = "2018" name = "libhandy" version = "0.8.0" authors = ["Julian Sparber "] exclude = ["gir-files/*", "gir/"] description = "Rust bindings for libhandy" documentation = "https://world.pages.gitlab.gnome.org/Rust/libhandy-rs/stable/0.8/docs/libhandy/" readme = "../README.md" keywords = ["libhandy", "handy", "gtk-rs", "gnome"] license = "LGPL-2.1-only" repository = "https://gitlab.gnome.org/World/Rust/libhandy-rs" [dependencies.bitflags] version = "1.2" [dependencies.ffi] version = "0.8.0" package = "libhandy-sys" [dependencies.gdk] version = "0.14.0" [dependencies.gdk-pixbuf] version = "0.14.0" [dependencies.gio] version = "0.14.0" [dependencies.glib] version = "0.14.0" [dependencies.gtk] version = "0.14.0" features = ["v3_24"] [dependencies.lazy_static] version = "1.4" [dependencies.libc] version = "0.2" [dependencies.pango] version = "0.14.0" [features] default = ["v1_0"] dox = [] v1_0 = ["ffi/v1_0"] v1_2 = ["v1_0", "ffi/v1_2"] libhandy-0.8.0/Cargo.toml.orig000064400000000000000000000015550000000000000142750ustar 00000000000000[package] name = 'libhandy' authors = ['Julian Sparber '] keywords = [ 'libhandy', 'handy', 'gtk-rs', 'gnome', ] version = '0.8.0' description = 'Rust bindings for libhandy' license = 'LGPL-2.1-only' repository = 'https://gitlab.gnome.org/World/Rust/libhandy-rs' documentation = "https://world.pages.gitlab.gnome.org/Rust/libhandy-rs/stable/0.8/docs/libhandy/" exclude = [ 'gir-files/*', 'gir/', ] edition = "2018" readme = "../README.md" [dependencies] libc = '0.2' bitflags = '1.2' lazy_static = '1.4' gdk = "0.14.0" gdk-pixbuf = "0.14.0" gio = "0.14.0" glib = "0.14.0" pango = "0.14.0" [dependencies.gtk] version = "0.14.0" features = ['v3_24'] [dependencies.ffi] package = "libhandy-sys" version = "0.8.0" path = '../libhandy-sys' [features] default = [ "v1_0" ] v1_0 = [ "ffi/v1_0" ] v1_2 = [ "v1_0", "ffi/v1_2" ] dox = [] libhandy-0.8.0/Gir.toml000064400000000000000000000077710000000000000130320ustar 00000000000000[options] girs_directories = ["../", "../gir-files"] library = "Handy" version = "1" min_cfg_version = "1.0" target_path = "." work_mode = "normal" generate_safety_asserts = true deprecate_by_min_version = true # with this option enabled, versions for gir and gir-files saved only to one file to minimize noise single_version_file = true generate_builder = true generate = [ "Handy.AvatarImageLoadFunc", "Handy.CenteringPolicy", "Handy.ComboRowGetEnumValueNameFunc", "Handy.ComboRowGetNameFunc", "Handy.DeckTransitionType", "Handy.EnumValueObject", "Handy.FlapFoldPolicy", "Handy.FlapTransitionType", "Handy.HeaderGroupChild", "Handy.HeaderGroupChildType", "Handy.LeafletTransitionType", "Handy.NavigationDirection", "Handy.SqueezerTransitionType", "Handy.SwipeGroup", "Handy.Swipeable", "Handy.ViewSwitcherPolicy", "Handy.Window", "Handy.WindowHandle", "Handy.ActionRow", "Handy.ApplicationWindow", "Handy.Carousel", "Handy.CarouselIndicatorDots", "Handy.CarouselIndicatorLines", "Handy.Clamp", "Handy.ComboRow", "Handy.ExpanderRow", "Handy.Flap", "Handy.HeaderBar", "Handy.HeaderGroup", "Handy.Keypad", "Handy.PreferencesGroup", "Handy.PreferencesPage", "Handy.PreferencesRow", "Handy.PreferencesWindow", "Handy.SearchBar", "Handy.Squeezer", "Handy.StatusPage", "Handy.SwipeTracker", "Handy.TabBar", "Handy.TabPage", "Handy.TabView", "Handy.TitleBar", "Handy.ViewSwitcher", "Handy.ViewSwitcherBar", "Handy.ViewSwitcherTitle", ] manual = [ "GLib.DestroyNotify", "GLib.String", "GLib.Variant", "GObject.Object", "GObject.Value", "Gdk.Event", "Gdk.EventMask", "Gdk.Rectangle", "GdkPixbuf.Pixbuf", "Gio.ActionGroup", "Gio.ActionMap", "Gio.AsyncReadyCallback", "Gio.AsyncResult", "Gio.Cancellable", "Gio.Icon", "Gio.ListModel", "Gio.LoadableIcon", "Gio.MenuModel", "Gtk.Actionable", "Gtk.Adjustment", "Gtk.Align", "Gtk.ApplicationWindow", "Gtk.BaselinePosition", "Gtk.Bin", "Gtk.Box", "Gtk.Buildable", "Gtk.Button", "Gtk.Container", "Gtk.CornerType", "Gtk.Dialog", "Gtk.DrawingArea", "Gtk.Entry", "Gtk.EventBox", "Gtk.Grid", "Gtk.HeaderBar", "Gtk.IconSize", "Gtk.ListBoxCreateWidgetFunc", "Gtk.ListBoxRow", "Gtk.Orientable", "Gtk.Orientation", "Gtk.PackType", "Gtk.PolicyType", "Gtk.PositionType", "Gtk.ReliefStyle", "Gtk.ResizeMode", "Gtk.ScrolledWindow", "Gtk.ShadowType", "Gtk.Stack", "Gtk.TargetList", "Gtk.Widget", "Pango.EllipsizeMode", ] [[object]] name = "Handy.*" status = "generate" [[object.function]] name = "string_utf8_truncate" ignore = true [[object.function]] name = "string_utf8_len" ignore = true [[object]] name = "Handy.Avatar" status = "generate" [[object.function]] name = "draw_to_pixbuf_async" # gir panics if this is generated ignore = true [[object]] name = "Handy.Deck" status = "generate" [[object.child_prop]] name = "name" type = "utf8" [[object]] name = "Handy.Leaflet" child_type = "Gtk.Widget" status = "generate" [[object.child_prop]] name = "icon-name" type = "utf8" [[object.child_prop]] name = "name" type = "utf8" [[object.child_prop]] name = "needs-attention" type = "gboolean" [[object.child_prop]] name = "position" type = "gint" [[object.child_prop]] name = "title" type = "utf8" [[object]] name = "Handy.ValueObject" status = "generate" [[object.function]] name = "dup_string" ignore = true [[object.function]] name = "copy_value" ignore = true [[object.function]] name = "new_take_string" ignore = true [[object.function]] name = "new_string" ignore = true [[object.property]] name = "value" ignore = true [[object]] name = "Gtk.Window" status = "manual" trait_name = "GtkWindowExt" libhandy-0.8.0/LICENSE000064400000000000000000000635340000000000000124200ustar 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. libhandy-rs Copyright (C) 2021 World / Rust This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libhandy-0.8.0/src/auto/action_row.rs000064400000000000000000000706660000000000000156700ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::PreferencesRow; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyActionRow")] pub struct ActionRow(Object) @extends PreferencesRow, gtk::ListBoxRow, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Actionable; match fn { type_ => || ffi::hdy_action_row_get_type(), } } impl ActionRow { #[doc(alias = "hdy_action_row_new")] pub fn new() -> ActionRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_action_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ActionRow`] objects. /// /// This method returns an instance of [`ActionRowBuilder`] which can be used to create [`ActionRow`] objects. pub fn builder() -> ActionRowBuilder { ActionRowBuilder::default() } } impl Default for ActionRow { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ActionRow`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ActionRowBuilder { activatable_widget: Option, icon_name: Option, subtitle: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] subtitle_lines: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] title_lines: Option, use_underline: Option, title: Option, activatable: Option, selectable: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, action_name: Option, action_target: Option, } impl ActionRowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ActionRowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ActionRow`]. pub fn build(self) -> ActionRow { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref activatable_widget) = self.activatable_widget { properties.push(("activatable-widget", activatable_widget)); } if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref subtitle) = self.subtitle { properties.push(("subtitle", subtitle)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref subtitle_lines) = self.subtitle_lines { properties.push(("subtitle-lines", subtitle_lines)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref title_lines) = self.title_lines { properties.push(("title-lines", title_lines)); } if let Some(ref use_underline) = self.use_underline { properties.push(("use-underline", use_underline)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref activatable) = self.activatable { properties.push(("activatable", activatable)); } if let Some(ref selectable) = self.selectable { properties.push(("selectable", selectable)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref action_name) = self.action_name { properties.push(("action-name", action_name)); } if let Some(ref action_target) = self.action_target { properties.push(("action-target", action_target)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ActionRow") } pub fn activatable_widget>(mut self, activatable_widget: &P) -> Self { self.activatable_widget = Some(activatable_widget.clone().upcast()); self } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn subtitle(mut self, subtitle: &str) -> Self { self.subtitle = Some(subtitle.to_string()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn subtitle_lines(mut self, subtitle_lines: i32) -> Self { self.subtitle_lines = Some(subtitle_lines); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn title_lines(mut self, title_lines: i32) -> Self { self.title_lines = Some(title_lines); self } pub fn use_underline(mut self, use_underline: bool) -> Self { self.use_underline = Some(use_underline); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn activatable(mut self, activatable: bool) -> Self { self.activatable = Some(activatable); self } pub fn selectable(mut self, selectable: bool) -> Self { self.selectable = Some(selectable); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn action_name(mut self, action_name: &str) -> Self { self.action_name = Some(action_name.to_string()); self } pub fn action_target(mut self, action_target: &glib::Variant) -> Self { self.action_target = Some(action_target.clone()); self } } pub const NONE_ACTION_ROW: Option<&ActionRow> = None; pub trait ActionRowExt: 'static { #[doc(alias = "hdy_action_row_activate")] fn activate(&self); #[doc(alias = "hdy_action_row_add_prefix")] fn add_prefix>(&self, widget: &P); #[doc(alias = "hdy_action_row_get_activatable_widget")] #[doc(alias = "get_activatable_widget")] fn activatable_widget(&self) -> Option; #[doc(alias = "hdy_action_row_get_icon_name")] #[doc(alias = "get_icon_name")] fn icon_name(&self) -> Option; #[doc(alias = "hdy_action_row_get_subtitle")] #[doc(alias = "get_subtitle")] fn subtitle(&self) -> Option; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_action_row_get_subtitle_lines")] #[doc(alias = "get_subtitle_lines")] fn subtitle_lines(&self) -> i32; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_action_row_get_title_lines")] #[doc(alias = "get_title_lines")] fn title_lines(&self) -> i32; #[doc(alias = "hdy_action_row_set_activatable_widget")] fn set_activatable_widget>(&self, widget: Option<&P>); #[doc(alias = "hdy_action_row_set_icon_name")] fn set_icon_name(&self, icon_name: &str); #[doc(alias = "hdy_action_row_set_subtitle")] fn set_subtitle(&self, subtitle: Option<&str>); #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_action_row_set_subtitle_lines")] fn set_subtitle_lines(&self, subtitle_lines: i32); #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_action_row_set_title_lines")] fn set_title_lines(&self, title_lines: i32); #[doc(alias = "activated")] fn connect_activated(&self, f: F) -> SignalHandlerId; #[doc(alias = "activatable-widget")] fn connect_activatable_widget_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "icon-name")] fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "subtitle")] fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "subtitle-lines")] fn connect_subtitle_lines_notify(&self, f: F) -> SignalHandlerId; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "title-lines")] fn connect_title_lines_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "use-underline")] fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId; } impl> ActionRowExt for O { fn activate(&self) { unsafe { ffi::hdy_action_row_activate(self.as_ref().to_glib_none().0); } } fn add_prefix>(&self, widget: &P) { unsafe { ffi::hdy_action_row_add_prefix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } fn activatable_widget(&self) -> Option { unsafe { from_glib_none(ffi::hdy_action_row_get_activatable_widget( self.as_ref().to_glib_none().0, )) } } fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_action_row_get_icon_name( self.as_ref().to_glib_none().0, )) } } fn subtitle(&self) -> Option { unsafe { from_glib_none(ffi::hdy_action_row_get_subtitle( self.as_ref().to_glib_none().0, )) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn subtitle_lines(&self) -> i32 { unsafe { ffi::hdy_action_row_get_subtitle_lines(self.as_ref().to_glib_none().0) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn title_lines(&self) -> i32 { unsafe { ffi::hdy_action_row_get_title_lines(self.as_ref().to_glib_none().0) } } fn set_activatable_widget>(&self, widget: Option<&P>) { unsafe { ffi::hdy_action_row_set_activatable_widget( self.as_ref().to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_icon_name(&self, icon_name: &str) { unsafe { ffi::hdy_action_row_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } fn set_subtitle(&self, subtitle: Option<&str>) { unsafe { ffi::hdy_action_row_set_subtitle( self.as_ref().to_glib_none().0, subtitle.to_glib_none().0, ); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn set_subtitle_lines(&self, subtitle_lines: i32) { unsafe { ffi::hdy_action_row_set_subtitle_lines(self.as_ref().to_glib_none().0, subtitle_lines); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn set_title_lines(&self, title_lines: i32) { unsafe { ffi::hdy_action_row_set_title_lines(self.as_ref().to_glib_none().0, title_lines); } } fn connect_activated(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn activated_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyActionRow, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"activated\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_activatable_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_activatable_widget_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::activatable-widget\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_activatable_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::subtitle\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn connect_subtitle_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::subtitle-lines\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_subtitle_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn connect_title_lines_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_lines_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title-lines\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_lines_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyActionRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ActionRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::use-underline\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for ActionRow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ActionRow") } } libhandy-0.8.0/src/auto/application_window.rs000064400000000000000000000500740000000000000174050ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::fmt; glib::wrapper! { #[doc(alias = "HdyApplicationWindow")] pub struct ApplicationWindow(Object) @extends gtk::ApplicationWindow, gtk::Window, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gio::ActionGroup, gio::ActionMap; match fn { type_ => || ffi::hdy_application_window_get_type(), } } impl ApplicationWindow { #[doc(alias = "hdy_application_window_new")] pub fn new() -> ApplicationWindow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_full(ffi::hdy_application_window_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ApplicationWindow`] objects. /// /// This method returns an instance of [`ApplicationWindowBuilder`] which can be used to create [`ApplicationWindow`] objects. pub fn builder() -> ApplicationWindowBuilder { ApplicationWindowBuilder::default() } } impl Default for ApplicationWindow { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ApplicationWindow`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ApplicationWindowBuilder { show_menubar: Option, accept_focus: Option, //application: /*Unknown type*/, attached_to: Option, decorated: Option, default_height: Option, default_width: Option, deletable: Option, destroy_with_parent: Option, focus_on_map: Option, focus_visible: Option, //gravity: /*Unknown type*/, has_resize_grip: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, //screen: /*Unknown type*/, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, //type: /*Unknown type*/, //type-hint: /*Unknown type*/, urgency_hint: Option, //window-position: /*Unknown type*/, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl ApplicationWindowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ApplicationWindowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ApplicationWindow`]. pub fn build(self) -> ApplicationWindow { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref show_menubar) = self.show_menubar { properties.push(("show-menubar", show_menubar)); } if let Some(ref accept_focus) = self.accept_focus { properties.push(("accept-focus", accept_focus)); } if let Some(ref attached_to) = self.attached_to { properties.push(("attached-to", attached_to)); } if let Some(ref decorated) = self.decorated { properties.push(("decorated", decorated)); } if let Some(ref default_height) = self.default_height { properties.push(("default-height", default_height)); } if let Some(ref default_width) = self.default_width { properties.push(("default-width", default_width)); } if let Some(ref deletable) = self.deletable { properties.push(("deletable", deletable)); } if let Some(ref destroy_with_parent) = self.destroy_with_parent { properties.push(("destroy-with-parent", destroy_with_parent)); } if let Some(ref focus_on_map) = self.focus_on_map { properties.push(("focus-on-map", focus_on_map)); } if let Some(ref focus_visible) = self.focus_visible { properties.push(("focus-visible", focus_visible)); } if let Some(ref has_resize_grip) = self.has_resize_grip { properties.push(("has-resize-grip", has_resize_grip)); } if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized { properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized)); } if let Some(ref icon) = self.icon { properties.push(("icon", icon)); } if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref mnemonics_visible) = self.mnemonics_visible { properties.push(("mnemonics-visible", mnemonics_visible)); } if let Some(ref modal) = self.modal { properties.push(("modal", modal)); } if let Some(ref resizable) = self.resizable { properties.push(("resizable", resizable)); } if let Some(ref role) = self.role { properties.push(("role", role)); } if let Some(ref skip_pager_hint) = self.skip_pager_hint { properties.push(("skip-pager-hint", skip_pager_hint)); } if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint { properties.push(("skip-taskbar-hint", skip_taskbar_hint)); } if let Some(ref startup_id) = self.startup_id { properties.push(("startup-id", startup_id)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref transient_for) = self.transient_for { properties.push(("transient-for", transient_for)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ApplicationWindow") } pub fn show_menubar(mut self, show_menubar: bool) -> Self { self.show_menubar = Some(show_menubar); self } pub fn accept_focus(mut self, accept_focus: bool) -> Self { self.accept_focus = Some(accept_focus); self } pub fn attached_to>(mut self, attached_to: &P) -> Self { self.attached_to = Some(attached_to.clone().upcast()); self } pub fn decorated(mut self, decorated: bool) -> Self { self.decorated = Some(decorated); self } pub fn default_height(mut self, default_height: i32) -> Self { self.default_height = Some(default_height); self } pub fn default_width(mut self, default_width: i32) -> Self { self.default_width = Some(default_width); self } pub fn deletable(mut self, deletable: bool) -> Self { self.deletable = Some(deletable); self } pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self { self.destroy_with_parent = Some(destroy_with_parent); self } pub fn focus_on_map(mut self, focus_on_map: bool) -> Self { self.focus_on_map = Some(focus_on_map); self } pub fn focus_visible(mut self, focus_visible: bool) -> Self { self.focus_visible = Some(focus_visible); self } pub fn has_resize_grip(mut self, has_resize_grip: bool) -> Self { self.has_resize_grip = Some(has_resize_grip); self } pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self { self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized); self } pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self { self.icon = Some(icon.clone()); self } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self { self.mnemonics_visible = Some(mnemonics_visible); self } pub fn modal(mut self, modal: bool) -> Self { self.modal = Some(modal); self } pub fn resizable(mut self, resizable: bool) -> Self { self.resizable = Some(resizable); self } pub fn role(mut self, role: &str) -> Self { self.role = Some(role.to_string()); self } pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self { self.skip_pager_hint = Some(skip_pager_hint); self } pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self { self.skip_taskbar_hint = Some(skip_taskbar_hint); self } pub fn startup_id(mut self, startup_id: &str) -> Self { self.startup_id = Some(startup_id.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn transient_for>(mut self, transient_for: &P) -> Self { self.transient_for = Some(transient_for.clone().upcast()); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_APPLICATION_WINDOW: Option<&ApplicationWindow> = None; impl fmt::Display for ApplicationWindow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ApplicationWindow") } } libhandy-0.8.0/src/auto/avatar.rs000064400000000000000000000543260000000000000147750ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyAvatar")] pub struct Avatar(Object) @extends gtk::DrawingArea, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_avatar_get_type(), } } impl Avatar { #[doc(alias = "hdy_avatar_new")] pub fn new(size: i32, text: Option<&str>, show_initials: bool) -> Avatar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_avatar_new( size, text.to_glib_none().0, show_initials.into_glib(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Avatar`] objects. /// /// This method returns an instance of [`AvatarBuilder`] which can be used to create [`Avatar`] objects. pub fn builder() -> AvatarBuilder { AvatarBuilder::default() } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_avatar_draw_to_pixbuf")] pub fn draw_to_pixbuf(&self, size: i32, scale_factor: i32) -> Option { unsafe { from_glib_full(ffi::hdy_avatar_draw_to_pixbuf( self.to_glib_none().0, size, scale_factor, )) } } #[doc(alias = "hdy_avatar_get_icon_name")] #[doc(alias = "get_icon_name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_avatar_get_icon_name(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_avatar_get_loadable_icon")] #[doc(alias = "get_loadable_icon")] pub fn loadable_icon(&self) -> Option { unsafe { from_glib_none(ffi::hdy_avatar_get_loadable_icon(self.to_glib_none().0)) } } #[doc(alias = "hdy_avatar_get_show_initials")] #[doc(alias = "get_show_initials")] pub fn shows_initials(&self) -> bool { unsafe { from_glib(ffi::hdy_avatar_get_show_initials(self.to_glib_none().0)) } } #[doc(alias = "hdy_avatar_get_size")] #[doc(alias = "get_size")] pub fn size(&self) -> i32 { unsafe { ffi::hdy_avatar_get_size(self.to_glib_none().0) } } #[doc(alias = "hdy_avatar_get_text")] #[doc(alias = "get_text")] pub fn text(&self) -> Option { unsafe { from_glib_none(ffi::hdy_avatar_get_text(self.to_glib_none().0)) } } #[doc(alias = "hdy_avatar_set_icon_name")] pub fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::hdy_avatar_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); } } #[cfg_attr(feature = "v1_2", deprecated = "Since 1.2")] #[doc(alias = "hdy_avatar_set_image_load_func")] pub fn set_image_load_func( &self, load_image: Option Option + 'static>>, ) { let load_image_data: Box_< Option Option + 'static>>, > = Box_::new(load_image); unsafe extern "C" fn load_image_func( size: libc::c_int, user_data: glib::ffi::gpointer, ) -> *mut gdk_pixbuf::ffi::GdkPixbuf { let callback: &Option Option + 'static>> = &*(user_data as *mut _); let res = if let Some(ref callback) = *callback { callback(size) } else { panic!("cannot get closure...") }; res.to_glib_full() } let load_image = if load_image_data.is_some() { Some(load_image_func as _) } else { None }; unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { let _callback: Box_ Option + 'static>>> = Box_::from_raw(data as *mut _); } let destroy_call3 = Some(destroy_func as _); let super_callback0: Box_< Option Option + 'static>>, > = load_image_data; unsafe { ffi::hdy_avatar_set_image_load_func( self.to_glib_none().0, load_image, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_avatar_set_loadable_icon")] pub fn set_loadable_icon>(&self, icon: Option<&P>) { unsafe { ffi::hdy_avatar_set_loadable_icon( self.to_glib_none().0, icon.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_avatar_set_show_initials")] pub fn set_show_initials(&self, show_initials: bool) { unsafe { ffi::hdy_avatar_set_show_initials(self.to_glib_none().0, show_initials.into_glib()); } } #[doc(alias = "hdy_avatar_set_size")] pub fn set_size(&self, size: i32) { unsafe { ffi::hdy_avatar_set_size(self.to_glib_none().0, size); } } #[doc(alias = "hdy_avatar_set_text")] pub fn set_text(&self, text: Option<&str>) { unsafe { ffi::hdy_avatar_set_text(self.to_glib_none().0, text.to_glib_none().0); } } #[doc(alias = "icon-name")] pub fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline( this: *mut ffi::HdyAvatar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "loadable-icon")] pub fn connect_loadable_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_loadable_icon_trampoline( this: *mut ffi::HdyAvatar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::loadable-icon\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_loadable_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "show-initials")] pub fn connect_show_initials_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_initials_trampoline( this: *mut ffi::HdyAvatar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-initials\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_initials_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "size")] pub fn connect_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_size_trampoline( this: *mut ffi::HdyAvatar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "text")] pub fn connect_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_text_trampoline( this: *mut ffi::HdyAvatar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::text\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Avatar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AvatarBuilder { icon_name: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] loadable_icon: Option, show_initials: Option, size: Option, text: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl AvatarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AvatarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Avatar`]. pub fn build(self) -> Avatar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref loadable_icon) = self.loadable_icon { properties.push(("loadable-icon", loadable_icon)); } if let Some(ref show_initials) = self.show_initials { properties.push(("show-initials", show_initials)); } if let Some(ref size) = self.size { properties.push(("size", size)); } if let Some(ref text) = self.text { properties.push(("text", text)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties).expect("Failed to create an instance of Avatar") } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn loadable_icon>(mut self, loadable_icon: &P) -> Self { self.loadable_icon = Some(loadable_icon.clone().upcast()); self } pub fn show_initials(mut self, show_initials: bool) -> Self { self.show_initials = Some(show_initials); self } pub fn size(mut self, size: i32) -> Self { self.size = Some(size); self } pub fn text(mut self, text: &str) -> Self { self.text = Some(text.to_string()); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for Avatar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Avatar") } } libhandy-0.8.0/src/auto/carousel.rs000064400000000000000000000704070000000000000153320ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::Swipeable; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyCarousel")] pub struct Carousel(Object) @extends gtk::EventBox, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable, Swipeable; match fn { type_ => || ffi::hdy_carousel_get_type(), } } impl Carousel { #[doc(alias = "hdy_carousel_new")] pub fn new() -> Carousel { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_carousel_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Carousel`] objects. /// /// This method returns an instance of [`CarouselBuilder`] which can be used to create [`Carousel`] objects. pub fn builder() -> CarouselBuilder { CarouselBuilder::default() } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_carousel_get_allow_long_swipes")] #[doc(alias = "get_allow_long_swipes")] pub fn allows_long_swipes(&self) -> bool { unsafe { from_glib(ffi::hdy_carousel_get_allow_long_swipes( self.to_glib_none().0, )) } } #[doc(alias = "hdy_carousel_get_allow_mouse_drag")] #[doc(alias = "get_allow_mouse_drag")] pub fn allows_mouse_drag(&self) -> bool { unsafe { from_glib(ffi::hdy_carousel_get_allow_mouse_drag( self.to_glib_none().0, )) } } #[doc(alias = "hdy_carousel_get_animation_duration")] #[doc(alias = "get_animation_duration")] pub fn animation_duration(&self) -> u32 { unsafe { ffi::hdy_carousel_get_animation_duration(self.to_glib_none().0) } } #[doc(alias = "hdy_carousel_get_interactive")] #[doc(alias = "get_interactive")] pub fn is_interactive(&self) -> bool { unsafe { from_glib(ffi::hdy_carousel_get_interactive(self.to_glib_none().0)) } } #[doc(alias = "hdy_carousel_get_n_pages")] #[doc(alias = "get_n_pages")] pub fn n_pages(&self) -> u32 { unsafe { ffi::hdy_carousel_get_n_pages(self.to_glib_none().0) } } #[doc(alias = "hdy_carousel_get_position")] #[doc(alias = "get_position")] pub fn position(&self) -> f64 { unsafe { ffi::hdy_carousel_get_position(self.to_glib_none().0) } } #[doc(alias = "hdy_carousel_get_reveal_duration")] #[doc(alias = "get_reveal_duration")] pub fn reveal_duration(&self) -> u32 { unsafe { ffi::hdy_carousel_get_reveal_duration(self.to_glib_none().0) } } #[doc(alias = "hdy_carousel_get_spacing")] #[doc(alias = "get_spacing")] pub fn spacing(&self) -> u32 { unsafe { ffi::hdy_carousel_get_spacing(self.to_glib_none().0) } } #[doc(alias = "hdy_carousel_insert")] pub fn insert>(&self, child: &P, position: i32) { unsafe { ffi::hdy_carousel_insert( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, ); } } #[doc(alias = "hdy_carousel_prepend")] pub fn prepend>(&self, child: &P) { unsafe { ffi::hdy_carousel_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0); } } #[doc(alias = "hdy_carousel_reorder")] pub fn reorder>(&self, child: &P, position: i32) { unsafe { ffi::hdy_carousel_reorder( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, ); } } #[doc(alias = "hdy_carousel_scroll_to")] pub fn scroll_to>(&self, widget: &P) { unsafe { ffi::hdy_carousel_scroll_to(self.to_glib_none().0, widget.as_ref().to_glib_none().0); } } #[doc(alias = "hdy_carousel_scroll_to_full")] pub fn scroll_to_full>(&self, widget: &P, duration: i64) { unsafe { ffi::hdy_carousel_scroll_to_full( self.to_glib_none().0, widget.as_ref().to_glib_none().0, duration, ); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_carousel_set_allow_long_swipes")] pub fn set_allow_long_swipes(&self, allow_long_swipes: bool) { unsafe { ffi::hdy_carousel_set_allow_long_swipes( self.to_glib_none().0, allow_long_swipes.into_glib(), ); } } #[doc(alias = "hdy_carousel_set_allow_mouse_drag")] pub fn set_allow_mouse_drag(&self, allow_mouse_drag: bool) { unsafe { ffi::hdy_carousel_set_allow_mouse_drag( self.to_glib_none().0, allow_mouse_drag.into_glib(), ); } } #[doc(alias = "hdy_carousel_set_animation_duration")] pub fn set_animation_duration(&self, duration: u32) { unsafe { ffi::hdy_carousel_set_animation_duration(self.to_glib_none().0, duration); } } #[doc(alias = "hdy_carousel_set_interactive")] pub fn set_interactive(&self, interactive: bool) { unsafe { ffi::hdy_carousel_set_interactive(self.to_glib_none().0, interactive.into_glib()); } } #[doc(alias = "hdy_carousel_set_reveal_duration")] pub fn set_reveal_duration(&self, reveal_duration: u32) { unsafe { ffi::hdy_carousel_set_reveal_duration(self.to_glib_none().0, reveal_duration); } } #[doc(alias = "hdy_carousel_set_spacing")] pub fn set_spacing(&self, spacing: u32) { unsafe { ffi::hdy_carousel_set_spacing(self.to_glib_none().0, spacing); } } #[doc(alias = "page-changed")] pub fn connect_page_changed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn page_changed_trampoline( this: *mut ffi::HdyCarousel, index: libc::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), index) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"page-changed\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( page_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "allow-long-swipes")] pub fn connect_allow_long_swipes_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_allow_long_swipes_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::allow-long-swipes\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_allow_long_swipes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-mouse-drag")] pub fn connect_allow_mouse_drag_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_allow_mouse_drag_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::allow-mouse-drag\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_allow_mouse_drag_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "animation-duration")] pub fn connect_animation_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_animation_duration_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::animation-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_animation_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "interactive")] pub fn connect_interactive_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interactive_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::interactive\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_interactive_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "n-pages")] pub fn connect_n_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pages_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::n-pages\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_n_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "position")] pub fn connect_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_position_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::position\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reveal-duration")] pub fn connect_reveal_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_duration_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reveal-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_reveal_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "spacing")] pub fn connect_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spacing_trampoline( this: *mut ffi::HdyCarousel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::spacing\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Carousel { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Carousel`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct CarouselBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] allow_long_swipes: Option, allow_mouse_drag: Option, animation_duration: Option, interactive: Option, reveal_duration: Option, spacing: Option, above_child: Option, visible_window: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl CarouselBuilder { // rustdoc-stripper-ignore-next /// Create a new [`CarouselBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Carousel`]. pub fn build(self) -> Carousel { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref allow_long_swipes) = self.allow_long_swipes { properties.push(("allow-long-swipes", allow_long_swipes)); } if let Some(ref allow_mouse_drag) = self.allow_mouse_drag { properties.push(("allow-mouse-drag", allow_mouse_drag)); } if let Some(ref animation_duration) = self.animation_duration { properties.push(("animation-duration", animation_duration)); } if let Some(ref interactive) = self.interactive { properties.push(("interactive", interactive)); } if let Some(ref reveal_duration) = self.reveal_duration { properties.push(("reveal-duration", reveal_duration)); } if let Some(ref spacing) = self.spacing { properties.push(("spacing", spacing)); } if let Some(ref above_child) = self.above_child { properties.push(("above-child", above_child)); } if let Some(ref visible_window) = self.visible_window { properties.push(("visible-window", visible_window)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties) .expect("Failed to create an instance of Carousel") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn allow_long_swipes(mut self, allow_long_swipes: bool) -> Self { self.allow_long_swipes = Some(allow_long_swipes); self } pub fn allow_mouse_drag(mut self, allow_mouse_drag: bool) -> Self { self.allow_mouse_drag = Some(allow_mouse_drag); self } pub fn animation_duration(mut self, animation_duration: u32) -> Self { self.animation_duration = Some(animation_duration); self } pub fn interactive(mut self, interactive: bool) -> Self { self.interactive = Some(interactive); self } pub fn reveal_duration(mut self, reveal_duration: u32) -> Self { self.reveal_duration = Some(reveal_duration); self } pub fn spacing(mut self, spacing: u32) -> Self { self.spacing = Some(spacing); self } pub fn above_child(mut self, above_child: bool) -> Self { self.above_child = Some(above_child); self } pub fn visible_window(mut self, visible_window: bool) -> Self { self.visible_window = Some(visible_window); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for Carousel { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Carousel") } } libhandy-0.8.0/src/auto/carousel_indicator_dots.rs000064400000000000000000000341450000000000000204160ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::Carousel; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyCarouselIndicatorDots")] pub struct CarouselIndicatorDots(Object) @extends gtk::DrawingArea, gtk::Widget, @implements gtk::Buildable, gtk::Orientable; match fn { type_ => || ffi::hdy_carousel_indicator_dots_get_type(), } } impl CarouselIndicatorDots { #[doc(alias = "hdy_carousel_indicator_dots_new")] pub fn new() -> CarouselIndicatorDots { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_full(ffi::hdy_carousel_indicator_dots_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CarouselIndicatorDots`] objects. /// /// This method returns an instance of [`CarouselIndicatorDotsBuilder`] which can be used to create [`CarouselIndicatorDots`] objects. pub fn builder() -> CarouselIndicatorDotsBuilder { CarouselIndicatorDotsBuilder::default() } #[doc(alias = "hdy_carousel_indicator_dots_get_carousel")] #[doc(alias = "get_carousel")] pub fn carousel(&self) -> Option { unsafe { from_glib_none(ffi::hdy_carousel_indicator_dots_get_carousel( self.to_glib_none().0, )) } } #[doc(alias = "hdy_carousel_indicator_dots_set_carousel")] pub fn set_carousel(&self, carousel: Option<&Carousel>) { unsafe { ffi::hdy_carousel_indicator_dots_set_carousel( self.to_glib_none().0, carousel.to_glib_none().0, ); } } #[doc(alias = "carousel")] pub fn connect_carousel_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_carousel_trampoline( this: *mut ffi::HdyCarouselIndicatorDots, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::carousel\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_carousel_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for CarouselIndicatorDots { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CarouselIndicatorDots`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct CarouselIndicatorDotsBuilder { carousel: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl CarouselIndicatorDotsBuilder { // rustdoc-stripper-ignore-next /// Create a new [`CarouselIndicatorDotsBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`CarouselIndicatorDots`]. pub fn build(self) -> CarouselIndicatorDots { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref carousel) = self.carousel { properties.push(("carousel", carousel)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties) .expect("Failed to create an instance of CarouselIndicatorDots") } pub fn carousel(mut self, carousel: &Carousel) -> Self { self.carousel = Some(carousel.clone()); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for CarouselIndicatorDots { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("CarouselIndicatorDots") } } libhandy-0.8.0/src/auto/carousel_indicator_lines.rs000064400000000000000000000342570000000000000205630ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::Carousel; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyCarouselIndicatorLines")] pub struct CarouselIndicatorLines(Object) @extends gtk::DrawingArea, gtk::Widget, @implements gtk::Buildable, gtk::Orientable; match fn { type_ => || ffi::hdy_carousel_indicator_lines_get_type(), } } impl CarouselIndicatorLines { #[doc(alias = "hdy_carousel_indicator_lines_new")] pub fn new() -> CarouselIndicatorLines { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_full(ffi::hdy_carousel_indicator_lines_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CarouselIndicatorLines`] objects. /// /// This method returns an instance of [`CarouselIndicatorLinesBuilder`] which can be used to create [`CarouselIndicatorLines`] objects. pub fn builder() -> CarouselIndicatorLinesBuilder { CarouselIndicatorLinesBuilder::default() } #[doc(alias = "hdy_carousel_indicator_lines_get_carousel")] #[doc(alias = "get_carousel")] pub fn carousel(&self) -> Option { unsafe { from_glib_none(ffi::hdy_carousel_indicator_lines_get_carousel( self.to_glib_none().0, )) } } #[doc(alias = "hdy_carousel_indicator_lines_set_carousel")] pub fn set_carousel(&self, carousel: Option<&Carousel>) { unsafe { ffi::hdy_carousel_indicator_lines_set_carousel( self.to_glib_none().0, carousel.to_glib_none().0, ); } } #[doc(alias = "carousel")] pub fn connect_carousel_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_carousel_trampoline< F: Fn(&CarouselIndicatorLines) + 'static, >( this: *mut ffi::HdyCarouselIndicatorLines, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::carousel\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_carousel_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for CarouselIndicatorLines { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CarouselIndicatorLines`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct CarouselIndicatorLinesBuilder { carousel: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl CarouselIndicatorLinesBuilder { // rustdoc-stripper-ignore-next /// Create a new [`CarouselIndicatorLinesBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`CarouselIndicatorLines`]. pub fn build(self) -> CarouselIndicatorLines { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref carousel) = self.carousel { properties.push(("carousel", carousel)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties) .expect("Failed to create an instance of CarouselIndicatorLines") } pub fn carousel(mut self, carousel: &Carousel) -> Self { self.carousel = Some(carousel.clone()); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for CarouselIndicatorLines { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("CarouselIndicatorLines") } } libhandy-0.8.0/src/auto/clamp.rs000064400000000000000000000401270000000000000146050ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyClamp")] pub struct Clamp(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable; match fn { type_ => || ffi::hdy_clamp_get_type(), } } impl Clamp { #[doc(alias = "hdy_clamp_new")] pub fn new() -> Clamp { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_clamp_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Clamp`] objects. /// /// This method returns an instance of [`ClampBuilder`] which can be used to create [`Clamp`] objects. pub fn builder() -> ClampBuilder { ClampBuilder::default() } #[doc(alias = "hdy_clamp_get_maximum_size")] #[doc(alias = "get_maximum_size")] pub fn maximum_size(&self) -> i32 { unsafe { ffi::hdy_clamp_get_maximum_size(self.to_glib_none().0) } } #[doc(alias = "hdy_clamp_get_tightening_threshold")] #[doc(alias = "get_tightening_threshold")] pub fn tightening_threshold(&self) -> i32 { unsafe { ffi::hdy_clamp_get_tightening_threshold(self.to_glib_none().0) } } #[doc(alias = "hdy_clamp_set_maximum_size")] pub fn set_maximum_size(&self, maximum_size: i32) { unsafe { ffi::hdy_clamp_set_maximum_size(self.to_glib_none().0, maximum_size); } } #[doc(alias = "hdy_clamp_set_tightening_threshold")] pub fn set_tightening_threshold(&self, tightening_threshold: i32) { unsafe { ffi::hdy_clamp_set_tightening_threshold(self.to_glib_none().0, tightening_threshold); } } #[doc(alias = "maximum-size")] pub fn connect_maximum_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_maximum_size_trampoline( this: *mut ffi::HdyClamp, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::maximum-size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_maximum_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tightening-threshold")] pub fn connect_tightening_threshold_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tightening_threshold_trampoline( this: *mut ffi::HdyClamp, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tightening-threshold\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_tightening_threshold_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Clamp { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Clamp`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ClampBuilder { maximum_size: Option, tightening_threshold: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl ClampBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ClampBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Clamp`]. pub fn build(self) -> Clamp { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref maximum_size) = self.maximum_size { properties.push(("maximum-size", maximum_size)); } if let Some(ref tightening_threshold) = self.tightening_threshold { properties.push(("tightening-threshold", tightening_threshold)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties).expect("Failed to create an instance of Clamp") } pub fn maximum_size(mut self, maximum_size: i32) -> Self { self.maximum_size = Some(maximum_size); self } pub fn tightening_threshold(mut self, tightening_threshold: i32) -> Self { self.tightening_threshold = Some(tightening_threshold); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for Clamp { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Clamp") } } libhandy-0.8.0/src/auto/combo_row.rs000064400000000000000000000660040000000000000155010ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ActionRow; use crate::EnumValueObject; use crate::PreferencesRow; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyComboRow")] pub struct ComboRow(Object) @extends ActionRow, PreferencesRow, gtk::ListBoxRow, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Actionable; match fn { type_ => || ffi::hdy_combo_row_get_type(), } } impl ComboRow { #[doc(alias = "hdy_combo_row_new")] pub fn new() -> ComboRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_combo_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ComboRow`] objects. /// /// This method returns an instance of [`ComboRowBuilder`] which can be used to create [`ComboRow`] objects. pub fn builder() -> ComboRowBuilder { ComboRowBuilder::default() } } impl Default for ComboRow { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ComboRow`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ComboRowBuilder { selected_index: Option, use_subtitle: Option, activatable_widget: Option, icon_name: Option, subtitle: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] subtitle_lines: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] title_lines: Option, use_underline: Option, title: Option, activatable: Option, selectable: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, action_name: Option, action_target: Option, } impl ComboRowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ComboRowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ComboRow`]. pub fn build(self) -> ComboRow { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref selected_index) = self.selected_index { properties.push(("selected-index", selected_index)); } if let Some(ref use_subtitle) = self.use_subtitle { properties.push(("use-subtitle", use_subtitle)); } if let Some(ref activatable_widget) = self.activatable_widget { properties.push(("activatable-widget", activatable_widget)); } if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref subtitle) = self.subtitle { properties.push(("subtitle", subtitle)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref subtitle_lines) = self.subtitle_lines { properties.push(("subtitle-lines", subtitle_lines)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref title_lines) = self.title_lines { properties.push(("title-lines", title_lines)); } if let Some(ref use_underline) = self.use_underline { properties.push(("use-underline", use_underline)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref activatable) = self.activatable { properties.push(("activatable", activatable)); } if let Some(ref selectable) = self.selectable { properties.push(("selectable", selectable)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref action_name) = self.action_name { properties.push(("action-name", action_name)); } if let Some(ref action_target) = self.action_target { properties.push(("action-target", action_target)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ComboRow") } pub fn selected_index(mut self, selected_index: i32) -> Self { self.selected_index = Some(selected_index); self } pub fn use_subtitle(mut self, use_subtitle: bool) -> Self { self.use_subtitle = Some(use_subtitle); self } pub fn activatable_widget>(mut self, activatable_widget: &P) -> Self { self.activatable_widget = Some(activatable_widget.clone().upcast()); self } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn subtitle(mut self, subtitle: &str) -> Self { self.subtitle = Some(subtitle.to_string()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn subtitle_lines(mut self, subtitle_lines: i32) -> Self { self.subtitle_lines = Some(subtitle_lines); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn title_lines(mut self, title_lines: i32) -> Self { self.title_lines = Some(title_lines); self } pub fn use_underline(mut self, use_underline: bool) -> Self { self.use_underline = Some(use_underline); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn activatable(mut self, activatable: bool) -> Self { self.activatable = Some(activatable); self } pub fn selectable(mut self, selectable: bool) -> Self { self.selectable = Some(selectable); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn action_name(mut self, action_name: &str) -> Self { self.action_name = Some(action_name.to_string()); self } pub fn action_target(mut self, action_target: &glib::Variant) -> Self { self.action_target = Some(action_target.clone()); self } } pub const NONE_COMBO_ROW: Option<&ComboRow> = None; pub trait ComboRowExt: 'static { //#[doc(alias = "hdy_combo_row_bind_model")] //fn bind_model>(&self, model: Option<&P>, create_list_widget_func: Option<&mut dyn (FnMut(&glib::Object) -> gtk::Widget)>, create_current_widget_func: Option gtk::Widget + 'static>>); #[doc(alias = "hdy_combo_row_bind_name_model")] fn bind_name_model>( &self, model: Option<&P>, get_name_func: Option String + 'static>>, ); #[doc(alias = "hdy_combo_row_get_model")] #[doc(alias = "get_model")] fn model(&self) -> Option; #[doc(alias = "hdy_combo_row_get_selected_index")] #[doc(alias = "get_selected_index")] fn selected_index(&self) -> i32; #[doc(alias = "hdy_combo_row_get_use_subtitle")] #[doc(alias = "get_use_subtitle")] fn uses_subtitle(&self) -> bool; #[doc(alias = "hdy_combo_row_set_for_enum")] fn set_for_enum( &self, enum_type: glib::types::Type, get_name_func: Option String + 'static>>, ); #[doc(alias = "hdy_combo_row_set_get_name_func")] fn set_get_name_func( &self, get_name_func: Option String + 'static>>, ); #[doc(alias = "hdy_combo_row_set_selected_index")] fn set_selected_index(&self, selected_index: i32); #[doc(alias = "hdy_combo_row_set_use_subtitle")] fn set_use_subtitle(&self, use_subtitle: bool); #[doc(alias = "selected-index")] fn connect_selected_index_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "use-subtitle")] fn connect_use_subtitle_notify(&self, f: F) -> SignalHandlerId; } impl> ComboRowExt for O { //fn bind_model>(&self, model: Option<&P>, create_list_widget_func: Option<&mut dyn (FnMut(&glib::Object) -> gtk::Widget)>, create_current_widget_func: Option gtk::Widget + 'static>>) { // unsafe { TODO: call ffi:hdy_combo_row_bind_model() } //} fn bind_name_model>( &self, model: Option<&P>, get_name_func: Option String + 'static>>, ) { let get_name_func_data: Box_ String + 'static>>> = Box_::new(get_name_func); unsafe extern "C" fn get_name_func_func>( item: *mut glib::gobject_ffi::GObject, user_data: glib::ffi::gpointer, ) -> *mut libc::c_char { let item = from_glib_borrow(item); let callback: &Option String + 'static>> = &*(user_data as *mut _); let res = if let Some(ref callback) = *callback { callback(&item) } else { panic!("cannot get closure...") }; res.to_glib_full() } let get_name_func = if get_name_func_data.is_some() { Some(get_name_func_func::

as _) } else { None }; unsafe extern "C" fn user_data_free_func_func>( data: glib::ffi::gpointer, ) { let _callback: Box_ String + 'static>>> = Box_::from_raw(data as *mut _); } let destroy_call4 = Some(user_data_free_func_func::

as _); let super_callback0: Box_ String + 'static>>> = get_name_func_data; unsafe { ffi::hdy_combo_row_bind_name_model( self.as_ref().to_glib_none().0, model.map(|p| p.as_ref()).to_glib_none().0, get_name_func, Box_::into_raw(super_callback0) as *mut _, destroy_call4, ); } } fn model(&self) -> Option { unsafe { from_glib_none(ffi::hdy_combo_row_get_model(self.as_ref().to_glib_none().0)) } } fn selected_index(&self) -> i32 { unsafe { ffi::hdy_combo_row_get_selected_index(self.as_ref().to_glib_none().0) } } fn uses_subtitle(&self) -> bool { unsafe { from_glib(ffi::hdy_combo_row_get_use_subtitle( self.as_ref().to_glib_none().0, )) } } fn set_for_enum( &self, enum_type: glib::types::Type, get_name_func: Option String + 'static>>, ) { let get_name_func_data: Box_ String + 'static>>> = Box_::new(get_name_func); unsafe extern "C" fn get_name_func_func( value: *mut ffi::HdyEnumValueObject, user_data: glib::ffi::gpointer, ) -> *mut libc::c_char { let value = from_glib_borrow(value); let callback: &Option String + 'static>> = &*(user_data as *mut _); let res = if let Some(ref callback) = *callback { callback(&value) } else { panic!("cannot get closure...") }; res.to_glib_full() } let get_name_func = if get_name_func_data.is_some() { Some(get_name_func_func as _) } else { None }; unsafe extern "C" fn user_data_free_func_func(data: glib::ffi::gpointer) { let _callback: Box_ String + 'static>>> = Box_::from_raw(data as *mut _); } let destroy_call4 = Some(user_data_free_func_func as _); let super_callback0: Box_ String + 'static>>> = get_name_func_data; unsafe { ffi::hdy_combo_row_set_for_enum( self.as_ref().to_glib_none().0, enum_type.into_glib(), get_name_func, Box_::into_raw(super_callback0) as *mut _, destroy_call4, ); } } fn set_get_name_func( &self, get_name_func: Option String + 'static>>, ) { let get_name_func_data: Box_ String + 'static>>> = Box_::new(get_name_func); unsafe extern "C" fn get_name_func_func( item: *mut glib::gobject_ffi::GObject, user_data: glib::ffi::gpointer, ) -> *mut libc::c_char { let item = from_glib_borrow(item); let callback: &Option String + 'static>> = &*(user_data as *mut _); let res = if let Some(ref callback) = *callback { callback(&item) } else { panic!("cannot get closure...") }; res.to_glib_full() } let get_name_func = if get_name_func_data.is_some() { Some(get_name_func_func as _) } else { None }; unsafe extern "C" fn user_data_free_func_func(data: glib::ffi::gpointer) { let _callback: Box_ String + 'static>>> = Box_::from_raw(data as *mut _); } let destroy_call3 = Some(user_data_free_func_func as _); let super_callback0: Box_ String + 'static>>> = get_name_func_data; unsafe { ffi::hdy_combo_row_set_get_name_func( self.as_ref().to_glib_none().0, get_name_func, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } fn set_selected_index(&self, selected_index: i32) { unsafe { ffi::hdy_combo_row_set_selected_index(self.as_ref().to_glib_none().0, selected_index); } } fn set_use_subtitle(&self, use_subtitle: bool) { unsafe { ffi::hdy_combo_row_set_use_subtitle( self.as_ref().to_glib_none().0, use_subtitle.into_glib(), ); } } fn connect_selected_index_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_index_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::selected-index\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_selected_index_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_use_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_subtitle_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyComboRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ComboRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::use-subtitle\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_use_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for ComboRow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ComboRow") } } libhandy-0.8.0/src/auto/deck.rs000064400000000000000000001140560000000000000144220ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::DeckTransitionType; use crate::NavigationDirection; use crate::Swipeable; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyDeck")] pub struct Deck(Object) @extends gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable, Swipeable; match fn { type_ => || ffi::hdy_deck_get_type(), } } impl Deck { #[doc(alias = "hdy_deck_new")] pub fn new() -> Deck { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_deck_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Deck`] objects. /// /// This method returns an instance of [`DeckBuilder`] which can be used to create [`Deck`] objects. pub fn builder() -> DeckBuilder { DeckBuilder::default() } } impl Default for Deck { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Deck`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct DeckBuilder { can_swipe_back: Option, can_swipe_forward: Option, hhomogeneous: Option, interpolate_size: Option, transition_duration: Option, transition_type: Option, vhomogeneous: Option, visible_child: Option, visible_child_name: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl DeckBuilder { // rustdoc-stripper-ignore-next /// Create a new [`DeckBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Deck`]. pub fn build(self) -> Deck { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref can_swipe_back) = self.can_swipe_back { properties.push(("can-swipe-back", can_swipe_back)); } if let Some(ref can_swipe_forward) = self.can_swipe_forward { properties.push(("can-swipe-forward", can_swipe_forward)); } if let Some(ref hhomogeneous) = self.hhomogeneous { properties.push(("hhomogeneous", hhomogeneous)); } if let Some(ref interpolate_size) = self.interpolate_size { properties.push(("interpolate-size", interpolate_size)); } if let Some(ref transition_duration) = self.transition_duration { properties.push(("transition-duration", transition_duration)); } if let Some(ref transition_type) = self.transition_type { properties.push(("transition-type", transition_type)); } if let Some(ref vhomogeneous) = self.vhomogeneous { properties.push(("vhomogeneous", vhomogeneous)); } if let Some(ref visible_child) = self.visible_child { properties.push(("visible-child", visible_child)); } if let Some(ref visible_child_name) = self.visible_child_name { properties.push(("visible-child-name", visible_child_name)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties).expect("Failed to create an instance of Deck") } pub fn can_swipe_back(mut self, can_swipe_back: bool) -> Self { self.can_swipe_back = Some(can_swipe_back); self } pub fn can_swipe_forward(mut self, can_swipe_forward: bool) -> Self { self.can_swipe_forward = Some(can_swipe_forward); self } pub fn hhomogeneous(mut self, hhomogeneous: bool) -> Self { self.hhomogeneous = Some(hhomogeneous); self } pub fn interpolate_size(mut self, interpolate_size: bool) -> Self { self.interpolate_size = Some(interpolate_size); self } pub fn transition_duration(mut self, transition_duration: u32) -> Self { self.transition_duration = Some(transition_duration); self } pub fn transition_type(mut self, transition_type: DeckTransitionType) -> Self { self.transition_type = Some(transition_type); self } pub fn vhomogeneous(mut self, vhomogeneous: bool) -> Self { self.vhomogeneous = Some(vhomogeneous); self } pub fn visible_child>(mut self, visible_child: &P) -> Self { self.visible_child = Some(visible_child.clone().upcast()); self } pub fn visible_child_name(mut self, visible_child_name: &str) -> Self { self.visible_child_name = Some(visible_child_name.to_string()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } pub const NONE_DECK: Option<&Deck> = None; pub trait DeckExt: 'static { #[doc(alias = "hdy_deck_get_adjacent_child")] #[doc(alias = "get_adjacent_child")] fn adjacent_child(&self, direction: NavigationDirection) -> Option; #[doc(alias = "hdy_deck_get_can_swipe_back")] #[doc(alias = "get_can_swipe_back")] fn can_swipe_back(&self) -> bool; #[doc(alias = "hdy_deck_get_can_swipe_forward")] #[doc(alias = "get_can_swipe_forward")] fn can_swipe_forward(&self) -> bool; #[doc(alias = "hdy_deck_get_child_by_name")] #[doc(alias = "get_child_by_name")] fn child_by_name(&self, name: &str) -> Option; #[doc(alias = "hdy_deck_get_homogeneous")] #[doc(alias = "get_homogeneous")] fn is_homogeneous(&self, orientation: gtk::Orientation) -> bool; #[doc(alias = "hdy_deck_get_interpolate_size")] #[doc(alias = "get_interpolate_size")] fn is_interpolate_size(&self) -> bool; #[doc(alias = "hdy_deck_get_transition_duration")] #[doc(alias = "get_transition_duration")] fn transition_duration(&self) -> u32; #[doc(alias = "hdy_deck_get_transition_running")] #[doc(alias = "get_transition_running")] fn is_transition_running(&self) -> bool; #[doc(alias = "hdy_deck_get_transition_type")] #[doc(alias = "get_transition_type")] fn transition_type(&self) -> DeckTransitionType; #[doc(alias = "hdy_deck_get_visible_child")] #[doc(alias = "get_visible_child")] fn visible_child(&self) -> Option; #[doc(alias = "hdy_deck_get_visible_child_name")] #[doc(alias = "get_visible_child_name")] fn visible_child_name(&self) -> Option; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_deck_insert_child_after")] fn insert_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ); #[doc(alias = "hdy_deck_navigate")] fn navigate(&self, direction: NavigationDirection) -> bool; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_deck_prepend")] fn prepend>(&self, child: &P); #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_deck_reorder_child_after")] fn reorder_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ); #[doc(alias = "hdy_deck_set_can_swipe_back")] fn set_can_swipe_back(&self, can_swipe_back: bool); #[doc(alias = "hdy_deck_set_can_swipe_forward")] fn set_can_swipe_forward(&self, can_swipe_forward: bool); #[doc(alias = "hdy_deck_set_homogeneous")] fn set_homogeneous(&self, orientation: gtk::Orientation, homogeneous: bool); #[doc(alias = "hdy_deck_set_interpolate_size")] fn set_interpolate_size(&self, interpolate_size: bool); #[doc(alias = "hdy_deck_set_transition_duration")] fn set_transition_duration(&self, duration: u32); #[doc(alias = "hdy_deck_set_transition_type")] fn set_transition_type(&self, transition: DeckTransitionType); #[doc(alias = "hdy_deck_set_visible_child")] fn set_visible_child>(&self, visible_child: &P); #[doc(alias = "hdy_deck_set_visible_child_name")] fn set_visible_child_name(&self, name: &str); fn is_hhomogeneous(&self) -> bool; fn set_hhomogeneous(&self, hhomogeneous: bool); fn is_vhomogeneous(&self) -> bool; fn set_vhomogeneous(&self, vhomogeneous: bool); fn child_name>(&self, item: &T) -> Option; fn set_child_name>(&self, item: &T, name: Option<&str>); #[doc(alias = "can-swipe-back")] fn connect_can_swipe_back_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "can-swipe-forward")] fn connect_can_swipe_forward_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "hhomogeneous")] fn connect_hhomogeneous_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "interpolate-size")] fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "transition-duration")] fn connect_transition_duration_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "transition-running")] fn connect_transition_running_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "transition-type")] fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "vhomogeneous")] fn connect_vhomogeneous_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "visible-child")] fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "visible-child-name")] fn connect_visible_child_name_notify(&self, f: F) -> SignalHandlerId; } impl> DeckExt for O { fn adjacent_child(&self, direction: NavigationDirection) -> Option { unsafe { from_glib_none(ffi::hdy_deck_get_adjacent_child( self.as_ref().to_glib_none().0, direction.into_glib(), )) } } fn can_swipe_back(&self) -> bool { unsafe { from_glib(ffi::hdy_deck_get_can_swipe_back( self.as_ref().to_glib_none().0, )) } } fn can_swipe_forward(&self) -> bool { unsafe { from_glib(ffi::hdy_deck_get_can_swipe_forward( self.as_ref().to_glib_none().0, )) } } fn child_by_name(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::hdy_deck_get_child_by_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, )) } } fn is_homogeneous(&self, orientation: gtk::Orientation) -> bool { unsafe { from_glib(ffi::hdy_deck_get_homogeneous( self.as_ref().to_glib_none().0, orientation.into_glib(), )) } } fn is_interpolate_size(&self) -> bool { unsafe { from_glib(ffi::hdy_deck_get_interpolate_size( self.as_ref().to_glib_none().0, )) } } fn transition_duration(&self) -> u32 { unsafe { ffi::hdy_deck_get_transition_duration(self.as_ref().to_glib_none().0) } } fn is_transition_running(&self) -> bool { unsafe { from_glib(ffi::hdy_deck_get_transition_running( self.as_ref().to_glib_none().0, )) } } fn transition_type(&self) -> DeckTransitionType { unsafe { from_glib(ffi::hdy_deck_get_transition_type( self.as_ref().to_glib_none().0, )) } } fn visible_child(&self) -> Option { unsafe { from_glib_none(ffi::hdy_deck_get_visible_child( self.as_ref().to_glib_none().0, )) } } fn visible_child_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_deck_get_visible_child_name( self.as_ref().to_glib_none().0, )) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn insert_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ) { unsafe { ffi::hdy_deck_insert_child_after( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } fn navigate(&self, direction: NavigationDirection) -> bool { unsafe { from_glib(ffi::hdy_deck_navigate( self.as_ref().to_glib_none().0, direction.into_glib(), )) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn prepend>(&self, child: &P) { unsafe { ffi::hdy_deck_prepend( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn reorder_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ) { unsafe { ffi::hdy_deck_reorder_child_after( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_can_swipe_back(&self, can_swipe_back: bool) { unsafe { ffi::hdy_deck_set_can_swipe_back( self.as_ref().to_glib_none().0, can_swipe_back.into_glib(), ); } } fn set_can_swipe_forward(&self, can_swipe_forward: bool) { unsafe { ffi::hdy_deck_set_can_swipe_forward( self.as_ref().to_glib_none().0, can_swipe_forward.into_glib(), ); } } fn set_homogeneous(&self, orientation: gtk::Orientation, homogeneous: bool) { unsafe { ffi::hdy_deck_set_homogeneous( self.as_ref().to_glib_none().0, orientation.into_glib(), homogeneous.into_glib(), ); } } fn set_interpolate_size(&self, interpolate_size: bool) { unsafe { ffi::hdy_deck_set_interpolate_size( self.as_ref().to_glib_none().0, interpolate_size.into_glib(), ); } } fn set_transition_duration(&self, duration: u32) { unsafe { ffi::hdy_deck_set_transition_duration(self.as_ref().to_glib_none().0, duration); } } fn set_transition_type(&self, transition: DeckTransitionType) { unsafe { ffi::hdy_deck_set_transition_type( self.as_ref().to_glib_none().0, transition.into_glib(), ); } } fn set_visible_child>(&self, visible_child: &P) { unsafe { ffi::hdy_deck_set_visible_child( self.as_ref().to_glib_none().0, visible_child.as_ref().to_glib_none().0, ); } } fn set_visible_child_name(&self, name: &str) { unsafe { ffi::hdy_deck_set_visible_child_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } fn is_hhomogeneous(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"hhomogeneous\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `hhomogeneous` getter") } } fn set_hhomogeneous(&self, hhomogeneous: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"hhomogeneous\0".as_ptr() as *const _, hhomogeneous.to_value().to_glib_none().0, ); } } fn is_vhomogeneous(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"vhomogeneous\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `vhomogeneous` getter") } } fn set_vhomogeneous(&self, vhomogeneous: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"vhomogeneous\0".as_ptr() as *const _, vhomogeneous.to_value().to_glib_none().0, ); } } fn child_name>(&self, item: &T) -> Option { unsafe { let mut value = glib::Value::from_type(::static_type()); gtk::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"name\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `name` getter") } } fn set_child_name>(&self, item: &T, name: Option<&str>) { unsafe { gtk::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"name\0".as_ptr() as *const _, name.to_value().to_glib_none().0, ); } } fn connect_can_swipe_back_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_swipe_back_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::can-swipe-back\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_can_swipe_back_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_can_swipe_forward_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_swipe_forward_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::can-swipe-forward\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_can_swipe_forward_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_hhomogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hhomogeneous_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hhomogeneous\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_hhomogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interpolate_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::interpolate-size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_interpolate_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_transition_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_duration_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_transition_running_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_running_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-running\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-type\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_vhomogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_vhomogeneous_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::vhomogeneous\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_vhomogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::visible-child\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_visible_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_visible_child_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyDeck, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Deck::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::visible-child-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_visible_child_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Deck { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Deck") } } use gtk::Widget; libhandy-0.8.0/src/auto/enum_value_object.rs000064400000000000000000000027060000000000000172000ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::translate::*; use std::fmt; glib::wrapper! { #[doc(alias = "HdyEnumValueObject")] pub struct EnumValueObject(Object); match fn { type_ => || ffi::hdy_enum_value_object_get_type(), } } impl EnumValueObject { //#[doc(alias = "hdy_enum_value_object_new")] //pub fn new(enum_value: /*Ignored*/&mut glib::EnumValue) -> EnumValueObject { // unsafe { TODO: call ffi:hdy_enum_value_object_new() } //} #[doc(alias = "hdy_enum_value_object_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_enum_value_object_get_name(self.to_glib_none().0)) } } #[doc(alias = "hdy_enum_value_object_get_nick")] #[doc(alias = "get_nick")] pub fn nick(&self) -> Option { unsafe { from_glib_none(ffi::hdy_enum_value_object_get_nick(self.to_glib_none().0)) } } #[doc(alias = "hdy_enum_value_object_get_value")] #[doc(alias = "get_value")] pub fn value(&self) -> i32 { unsafe { ffi::hdy_enum_value_object_get_value(self.to_glib_none().0) } } } impl fmt::Display for EnumValueObject { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("EnumValueObject") } } libhandy-0.8.0/src/auto/enums.rs000064400000000000000000000577600000000000000146530ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::translate::*; use glib::value::FromValue; use glib::value::ToValue; use glib::StaticType; use glib::Type; use std::fmt; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyCenteringPolicy")] pub enum CenteringPolicy { #[doc(alias = "HDY_CENTERING_POLICY_LOOSE")] Loose, #[doc(alias = "HDY_CENTERING_POLICY_STRICT")] Strict, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for CenteringPolicy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "CenteringPolicy::{}", match *self { Self::Loose => "Loose", Self::Strict => "Strict", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for CenteringPolicy { type GlibType = ffi::HdyCenteringPolicy; fn into_glib(self) -> ffi::HdyCenteringPolicy { match self { Self::Loose => ffi::HDY_CENTERING_POLICY_LOOSE, Self::Strict => ffi::HDY_CENTERING_POLICY_STRICT, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CenteringPolicy { unsafe fn from_glib(value: ffi::HdyCenteringPolicy) -> Self { skip_assert_initialized!(); match value { ffi::HDY_CENTERING_POLICY_LOOSE => Self::Loose, ffi::HDY_CENTERING_POLICY_STRICT => Self::Strict, value => Self::__Unknown(value), } } } impl StaticType for CenteringPolicy { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_centering_policy_get_type()) } } } impl glib::value::ValueType for CenteringPolicy { type Type = Self; } unsafe impl<'a> FromValue<'a> for CenteringPolicy { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for CenteringPolicy { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyDeckTransitionType")] pub enum DeckTransitionType { #[doc(alias = "HDY_DECK_TRANSITION_TYPE_OVER")] Over, #[doc(alias = "HDY_DECK_TRANSITION_TYPE_UNDER")] Under, #[doc(alias = "HDY_DECK_TRANSITION_TYPE_SLIDE")] Slide, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for DeckTransitionType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "DeckTransitionType::{}", match *self { Self::Over => "Over", Self::Under => "Under", Self::Slide => "Slide", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for DeckTransitionType { type GlibType = ffi::HdyDeckTransitionType; fn into_glib(self) -> ffi::HdyDeckTransitionType { match self { Self::Over => ffi::HDY_DECK_TRANSITION_TYPE_OVER, Self::Under => ffi::HDY_DECK_TRANSITION_TYPE_UNDER, Self::Slide => ffi::HDY_DECK_TRANSITION_TYPE_SLIDE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for DeckTransitionType { unsafe fn from_glib(value: ffi::HdyDeckTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::HDY_DECK_TRANSITION_TYPE_OVER => Self::Over, ffi::HDY_DECK_TRANSITION_TYPE_UNDER => Self::Under, ffi::HDY_DECK_TRANSITION_TYPE_SLIDE => Self::Slide, value => Self::__Unknown(value), } } } impl StaticType for DeckTransitionType { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_deck_transition_type_get_type()) } } } impl glib::value::ValueType for DeckTransitionType { type Type = Self; } unsafe impl<'a> FromValue<'a> for DeckTransitionType { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for DeckTransitionType { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyFlapFoldPolicy")] pub enum FlapFoldPolicy { #[doc(alias = "HDY_FLAP_FOLD_POLICY_NEVER")] Never, #[doc(alias = "HDY_FLAP_FOLD_POLICY_ALWAYS")] Always, #[doc(alias = "HDY_FLAP_FOLD_POLICY_AUTO")] Auto, #[doc(hidden)] __Unknown(i32), } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl fmt::Display for FlapFoldPolicy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "FlapFoldPolicy::{}", match *self { Self::Never => "Never", Self::Always => "Always", Self::Auto => "Auto", _ => "Unknown", } ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl IntoGlib for FlapFoldPolicy { type GlibType = ffi::HdyFlapFoldPolicy; fn into_glib(self) -> ffi::HdyFlapFoldPolicy { match self { Self::Never => ffi::HDY_FLAP_FOLD_POLICY_NEVER, Self::Always => ffi::HDY_FLAP_FOLD_POLICY_ALWAYS, Self::Auto => ffi::HDY_FLAP_FOLD_POLICY_AUTO, Self::__Unknown(value) => value, } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl FromGlib for FlapFoldPolicy { unsafe fn from_glib(value: ffi::HdyFlapFoldPolicy) -> Self { skip_assert_initialized!(); match value { ffi::HDY_FLAP_FOLD_POLICY_NEVER => Self::Never, ffi::HDY_FLAP_FOLD_POLICY_ALWAYS => Self::Always, ffi::HDY_FLAP_FOLD_POLICY_AUTO => Self::Auto, value => Self::__Unknown(value), } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl StaticType for FlapFoldPolicy { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_flap_fold_policy_get_type()) } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl glib::value::ValueType for FlapFoldPolicy { type Type = Self; } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] unsafe impl<'a> FromValue<'a> for FlapFoldPolicy { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl ToValue for FlapFoldPolicy { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyFlapTransitionType")] pub enum FlapTransitionType { #[doc(alias = "HDY_FLAP_TRANSITION_TYPE_OVER")] Over, #[doc(alias = "HDY_FLAP_TRANSITION_TYPE_UNDER")] Under, #[doc(alias = "HDY_FLAP_TRANSITION_TYPE_SLIDE")] Slide, #[doc(hidden)] __Unknown(i32), } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl fmt::Display for FlapTransitionType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "FlapTransitionType::{}", match *self { Self::Over => "Over", Self::Under => "Under", Self::Slide => "Slide", _ => "Unknown", } ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl IntoGlib for FlapTransitionType { type GlibType = ffi::HdyFlapTransitionType; fn into_glib(self) -> ffi::HdyFlapTransitionType { match self { Self::Over => ffi::HDY_FLAP_TRANSITION_TYPE_OVER, Self::Under => ffi::HDY_FLAP_TRANSITION_TYPE_UNDER, Self::Slide => ffi::HDY_FLAP_TRANSITION_TYPE_SLIDE, Self::__Unknown(value) => value, } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(hidden)] impl FromGlib for FlapTransitionType { unsafe fn from_glib(value: ffi::HdyFlapTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::HDY_FLAP_TRANSITION_TYPE_OVER => Self::Over, ffi::HDY_FLAP_TRANSITION_TYPE_UNDER => Self::Under, ffi::HDY_FLAP_TRANSITION_TYPE_SLIDE => Self::Slide, value => Self::__Unknown(value), } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl StaticType for FlapTransitionType { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_flap_transition_type_get_type()) } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl glib::value::ValueType for FlapTransitionType { type Type = Self; } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] unsafe impl<'a> FromValue<'a> for FlapTransitionType { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl ToValue for FlapTransitionType { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyHeaderGroupChildType")] pub enum HeaderGroupChildType { #[doc(alias = "HDY_HEADER_GROUP_CHILD_TYPE_HEADER_BAR")] HeaderBar, #[doc(alias = "HDY_HEADER_GROUP_CHILD_TYPE_GTK_HEADER_BAR")] GtkHeaderBar, #[doc(alias = "HDY_HEADER_GROUP_CHILD_TYPE_HEADER_GROUP")] HeaderGroup, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for HeaderGroupChildType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "HeaderGroupChildType::{}", match *self { Self::HeaderBar => "HeaderBar", Self::GtkHeaderBar => "GtkHeaderBar", Self::HeaderGroup => "HeaderGroup", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for HeaderGroupChildType { type GlibType = ffi::HdyHeaderGroupChildType; fn into_glib(self) -> ffi::HdyHeaderGroupChildType { match self { Self::HeaderBar => ffi::HDY_HEADER_GROUP_CHILD_TYPE_HEADER_BAR, Self::GtkHeaderBar => ffi::HDY_HEADER_GROUP_CHILD_TYPE_GTK_HEADER_BAR, Self::HeaderGroup => ffi::HDY_HEADER_GROUP_CHILD_TYPE_HEADER_GROUP, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for HeaderGroupChildType { unsafe fn from_glib(value: ffi::HdyHeaderGroupChildType) -> Self { skip_assert_initialized!(); match value { ffi::HDY_HEADER_GROUP_CHILD_TYPE_HEADER_BAR => Self::HeaderBar, ffi::HDY_HEADER_GROUP_CHILD_TYPE_GTK_HEADER_BAR => Self::GtkHeaderBar, ffi::HDY_HEADER_GROUP_CHILD_TYPE_HEADER_GROUP => Self::HeaderGroup, value => Self::__Unknown(value), } } } impl StaticType for HeaderGroupChildType { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_header_group_child_type_get_type()) } } } impl glib::value::ValueType for HeaderGroupChildType { type Type = Self; } unsafe impl<'a> FromValue<'a> for HeaderGroupChildType { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for HeaderGroupChildType { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyLeafletTransitionType")] pub enum LeafletTransitionType { #[doc(alias = "HDY_LEAFLET_TRANSITION_TYPE_OVER")] Over, #[doc(alias = "HDY_LEAFLET_TRANSITION_TYPE_UNDER")] Under, #[doc(alias = "HDY_LEAFLET_TRANSITION_TYPE_SLIDE")] Slide, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for LeafletTransitionType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "LeafletTransitionType::{}", match *self { Self::Over => "Over", Self::Under => "Under", Self::Slide => "Slide", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for LeafletTransitionType { type GlibType = ffi::HdyLeafletTransitionType; fn into_glib(self) -> ffi::HdyLeafletTransitionType { match self { Self::Over => ffi::HDY_LEAFLET_TRANSITION_TYPE_OVER, Self::Under => ffi::HDY_LEAFLET_TRANSITION_TYPE_UNDER, Self::Slide => ffi::HDY_LEAFLET_TRANSITION_TYPE_SLIDE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for LeafletTransitionType { unsafe fn from_glib(value: ffi::HdyLeafletTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::HDY_LEAFLET_TRANSITION_TYPE_OVER => Self::Over, ffi::HDY_LEAFLET_TRANSITION_TYPE_UNDER => Self::Under, ffi::HDY_LEAFLET_TRANSITION_TYPE_SLIDE => Self::Slide, value => Self::__Unknown(value), } } } impl StaticType for LeafletTransitionType { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_leaflet_transition_type_get_type()) } } } impl glib::value::ValueType for LeafletTransitionType { type Type = Self; } unsafe impl<'a> FromValue<'a> for LeafletTransitionType { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for LeafletTransitionType { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyNavigationDirection")] pub enum NavigationDirection { #[doc(alias = "HDY_NAVIGATION_DIRECTION_BACK")] Back, #[doc(alias = "HDY_NAVIGATION_DIRECTION_FORWARD")] Forward, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for NavigationDirection { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "NavigationDirection::{}", match *self { Self::Back => "Back", Self::Forward => "Forward", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for NavigationDirection { type GlibType = ffi::HdyNavigationDirection; fn into_glib(self) -> ffi::HdyNavigationDirection { match self { Self::Back => ffi::HDY_NAVIGATION_DIRECTION_BACK, Self::Forward => ffi::HDY_NAVIGATION_DIRECTION_FORWARD, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for NavigationDirection { unsafe fn from_glib(value: ffi::HdyNavigationDirection) -> Self { skip_assert_initialized!(); match value { ffi::HDY_NAVIGATION_DIRECTION_BACK => Self::Back, ffi::HDY_NAVIGATION_DIRECTION_FORWARD => Self::Forward, value => Self::__Unknown(value), } } } impl StaticType for NavigationDirection { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_navigation_direction_get_type()) } } } impl glib::value::ValueType for NavigationDirection { type Type = Self; } unsafe impl<'a> FromValue<'a> for NavigationDirection { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for NavigationDirection { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdySqueezerTransitionType")] pub enum SqueezerTransitionType { #[doc(alias = "HDY_SQUEEZER_TRANSITION_TYPE_NONE")] None, #[doc(alias = "HDY_SQUEEZER_TRANSITION_TYPE_CROSSFADE")] Crossfade, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for SqueezerTransitionType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "SqueezerTransitionType::{}", match *self { Self::None => "None", Self::Crossfade => "Crossfade", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for SqueezerTransitionType { type GlibType = ffi::HdySqueezerTransitionType; fn into_glib(self) -> ffi::HdySqueezerTransitionType { match self { Self::None => ffi::HDY_SQUEEZER_TRANSITION_TYPE_NONE, Self::Crossfade => ffi::HDY_SQUEEZER_TRANSITION_TYPE_CROSSFADE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for SqueezerTransitionType { unsafe fn from_glib(value: ffi::HdySqueezerTransitionType) -> Self { skip_assert_initialized!(); match value { ffi::HDY_SQUEEZER_TRANSITION_TYPE_NONE => Self::None, ffi::HDY_SQUEEZER_TRANSITION_TYPE_CROSSFADE => Self::Crossfade, value => Self::__Unknown(value), } } } impl StaticType for SqueezerTransitionType { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_squeezer_transition_type_get_type()) } } } impl glib::value::ValueType for SqueezerTransitionType { type Type = Self; } unsafe impl<'a> FromValue<'a> for SqueezerTransitionType { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for SqueezerTransitionType { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "HdyViewSwitcherPolicy")] pub enum ViewSwitcherPolicy { #[doc(alias = "HDY_VIEW_SWITCHER_POLICY_AUTO")] Auto, #[doc(alias = "HDY_VIEW_SWITCHER_POLICY_NARROW")] Narrow, #[doc(alias = "HDY_VIEW_SWITCHER_POLICY_WIDE")] Wide, #[doc(hidden)] __Unknown(i32), } impl fmt::Display for ViewSwitcherPolicy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "ViewSwitcherPolicy::{}", match *self { Self::Auto => "Auto", Self::Narrow => "Narrow", Self::Wide => "Wide", _ => "Unknown", } ) } } #[doc(hidden)] impl IntoGlib for ViewSwitcherPolicy { type GlibType = ffi::HdyViewSwitcherPolicy; fn into_glib(self) -> ffi::HdyViewSwitcherPolicy { match self { Self::Auto => ffi::HDY_VIEW_SWITCHER_POLICY_AUTO, Self::Narrow => ffi::HDY_VIEW_SWITCHER_POLICY_NARROW, Self::Wide => ffi::HDY_VIEW_SWITCHER_POLICY_WIDE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for ViewSwitcherPolicy { unsafe fn from_glib(value: ffi::HdyViewSwitcherPolicy) -> Self { skip_assert_initialized!(); match value { ffi::HDY_VIEW_SWITCHER_POLICY_AUTO => Self::Auto, ffi::HDY_VIEW_SWITCHER_POLICY_NARROW => Self::Narrow, ffi::HDY_VIEW_SWITCHER_POLICY_WIDE => Self::Wide, value => Self::__Unknown(value), } } } impl StaticType for ViewSwitcherPolicy { fn static_type() -> Type { unsafe { from_glib(ffi::hdy_view_switcher_policy_get_type()) } } } impl glib::value::ValueType for ViewSwitcherPolicy { type Type = Self; } unsafe impl<'a> FromValue<'a> for ViewSwitcherPolicy { type Checker = glib::value::GenericValueTypeChecker; unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for ViewSwitcherPolicy { fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } fn value_type(&self) -> glib::Type { Self::static_type() } } libhandy-0.8.0/src/auto/expander_row.rs000064400000000000000000000642620000000000000162140ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::PreferencesRow; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyExpanderRow")] pub struct ExpanderRow(Object) @extends PreferencesRow, gtk::ListBoxRow, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Actionable; match fn { type_ => || ffi::hdy_expander_row_get_type(), } } impl ExpanderRow { #[doc(alias = "hdy_expander_row_new")] pub fn new() -> ExpanderRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_expander_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ExpanderRow`] objects. /// /// This method returns an instance of [`ExpanderRowBuilder`] which can be used to create [`ExpanderRow`] objects. pub fn builder() -> ExpanderRowBuilder { ExpanderRowBuilder::default() } } impl Default for ExpanderRow { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ExpanderRow`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ExpanderRowBuilder { enable_expansion: Option, expanded: Option, icon_name: Option, show_enable_switch: Option, subtitle: Option, use_underline: Option, title: Option, activatable: Option, selectable: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, action_name: Option, action_target: Option, } impl ExpanderRowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ExpanderRowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ExpanderRow`]. pub fn build(self) -> ExpanderRow { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref enable_expansion) = self.enable_expansion { properties.push(("enable-expansion", enable_expansion)); } if let Some(ref expanded) = self.expanded { properties.push(("expanded", expanded)); } if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref show_enable_switch) = self.show_enable_switch { properties.push(("show-enable-switch", show_enable_switch)); } if let Some(ref subtitle) = self.subtitle { properties.push(("subtitle", subtitle)); } if let Some(ref use_underline) = self.use_underline { properties.push(("use-underline", use_underline)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref activatable) = self.activatable { properties.push(("activatable", activatable)); } if let Some(ref selectable) = self.selectable { properties.push(("selectable", selectable)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref action_name) = self.action_name { properties.push(("action-name", action_name)); } if let Some(ref action_target) = self.action_target { properties.push(("action-target", action_target)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ExpanderRow") } pub fn enable_expansion(mut self, enable_expansion: bool) -> Self { self.enable_expansion = Some(enable_expansion); self } pub fn expanded(mut self, expanded: bool) -> Self { self.expanded = Some(expanded); self } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn show_enable_switch(mut self, show_enable_switch: bool) -> Self { self.show_enable_switch = Some(show_enable_switch); self } pub fn subtitle(mut self, subtitle: &str) -> Self { self.subtitle = Some(subtitle.to_string()); self } pub fn use_underline(mut self, use_underline: bool) -> Self { self.use_underline = Some(use_underline); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn activatable(mut self, activatable: bool) -> Self { self.activatable = Some(activatable); self } pub fn selectable(mut self, selectable: bool) -> Self { self.selectable = Some(selectable); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn action_name(mut self, action_name: &str) -> Self { self.action_name = Some(action_name.to_string()); self } pub fn action_target(mut self, action_target: &glib::Variant) -> Self { self.action_target = Some(action_target.clone()); self } } pub const NONE_EXPANDER_ROW: Option<&ExpanderRow> = None; pub trait ExpanderRowExt: 'static { #[doc(alias = "hdy_expander_row_add_action")] fn add_action>(&self, widget: &P); #[doc(alias = "hdy_expander_row_add_prefix")] fn add_prefix>(&self, widget: &P); #[doc(alias = "hdy_expander_row_get_enable_expansion")] #[doc(alias = "get_enable_expansion")] fn enables_expansion(&self) -> bool; #[doc(alias = "hdy_expander_row_get_expanded")] #[doc(alias = "get_expanded")] fn is_expanded(&self) -> bool; #[doc(alias = "hdy_expander_row_get_icon_name")] #[doc(alias = "get_icon_name")] fn icon_name(&self) -> Option; #[doc(alias = "hdy_expander_row_get_show_enable_switch")] #[doc(alias = "get_show_enable_switch")] fn shows_enable_switch(&self) -> bool; #[doc(alias = "hdy_expander_row_get_subtitle")] #[doc(alias = "get_subtitle")] fn subtitle(&self) -> Option; #[doc(alias = "hdy_expander_row_set_enable_expansion")] fn set_enable_expansion(&self, enable_expansion: bool); #[doc(alias = "hdy_expander_row_set_expanded")] fn set_expanded(&self, expanded: bool); #[doc(alias = "hdy_expander_row_set_icon_name")] fn set_icon_name(&self, icon_name: &str); #[doc(alias = "hdy_expander_row_set_show_enable_switch")] fn set_show_enable_switch(&self, show_enable_switch: bool); #[doc(alias = "hdy_expander_row_set_subtitle")] fn set_subtitle(&self, subtitle: Option<&str>); #[doc(alias = "enable-expansion")] fn connect_enable_expansion_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "expanded")] fn connect_expanded_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "icon-name")] fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-enable-switch")] fn connect_show_enable_switch_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "subtitle")] fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "use-underline")] fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId; } impl> ExpanderRowExt for O { fn add_action>(&self, widget: &P) { unsafe { ffi::hdy_expander_row_add_action( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } fn add_prefix>(&self, widget: &P) { unsafe { ffi::hdy_expander_row_add_prefix( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, ); } } fn enables_expansion(&self) -> bool { unsafe { from_glib(ffi::hdy_expander_row_get_enable_expansion( self.as_ref().to_glib_none().0, )) } } fn is_expanded(&self) -> bool { unsafe { from_glib(ffi::hdy_expander_row_get_expanded( self.as_ref().to_glib_none().0, )) } } fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_expander_row_get_icon_name( self.as_ref().to_glib_none().0, )) } } fn shows_enable_switch(&self) -> bool { unsafe { from_glib(ffi::hdy_expander_row_get_show_enable_switch( self.as_ref().to_glib_none().0, )) } } fn subtitle(&self) -> Option { unsafe { from_glib_none(ffi::hdy_expander_row_get_subtitle( self.as_ref().to_glib_none().0, )) } } fn set_enable_expansion(&self, enable_expansion: bool) { unsafe { ffi::hdy_expander_row_set_enable_expansion( self.as_ref().to_glib_none().0, enable_expansion.into_glib(), ); } } fn set_expanded(&self, expanded: bool) { unsafe { ffi::hdy_expander_row_set_expanded( self.as_ref().to_glib_none().0, expanded.into_glib(), ); } } fn set_icon_name(&self, icon_name: &str) { unsafe { ffi::hdy_expander_row_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } fn set_show_enable_switch(&self, show_enable_switch: bool) { unsafe { ffi::hdy_expander_row_set_show_enable_switch( self.as_ref().to_glib_none().0, show_enable_switch.into_glib(), ); } } fn set_subtitle(&self, subtitle: Option<&str>) { unsafe { ffi::hdy_expander_row_set_subtitle( self.as_ref().to_glib_none().0, subtitle.to_glib_none().0, ); } } fn connect_enable_expansion_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enable_expansion_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::enable-expansion\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_enable_expansion_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_expanded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_expanded_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::expanded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_expanded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_enable_switch_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_enable_switch_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-enable-switch\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_enable_switch_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::subtitle\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyExpanderRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ExpanderRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::use-underline\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for ExpanderRow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ExpanderRow") } } libhandy-0.8.0/src/auto/flap.rs000064400000000000000000001207710000000000000144370ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::FlapFoldPolicy; use crate::FlapTransitionType; use crate::Swipeable; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyFlap")] pub struct Flap(Object) @extends gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable, Swipeable; match fn { type_ => || ffi::hdy_flap_get_type(), } } impl Flap { #[doc(alias = "hdy_flap_new")] pub fn new() -> Flap { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_flap_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Flap`] objects. /// /// This method returns an instance of [`FlapBuilder`] which can be used to create [`Flap`] objects. pub fn builder() -> FlapBuilder { FlapBuilder::default() } #[doc(alias = "hdy_flap_get_content")] #[doc(alias = "get_content")] pub fn content(&self) -> Option { unsafe { from_glib_none(ffi::hdy_flap_get_content(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_flap")] #[doc(alias = "get_flap")] pub fn flap(&self) -> Option { unsafe { from_glib_none(ffi::hdy_flap_get_flap(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_flap_position")] #[doc(alias = "get_flap_position")] pub fn flap_position(&self) -> gtk::PackType { unsafe { from_glib(ffi::hdy_flap_get_flap_position(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_fold_duration")] #[doc(alias = "get_fold_duration")] pub fn fold_duration(&self) -> u32 { unsafe { ffi::hdy_flap_get_fold_duration(self.to_glib_none().0) } } #[doc(alias = "hdy_flap_get_fold_policy")] #[doc(alias = "get_fold_policy")] pub fn fold_policy(&self) -> FlapFoldPolicy { unsafe { from_glib(ffi::hdy_flap_get_fold_policy(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_folded")] #[doc(alias = "get_folded")] pub fn is_folded(&self) -> bool { unsafe { from_glib(ffi::hdy_flap_get_folded(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_locked")] #[doc(alias = "get_locked")] pub fn is_locked(&self) -> bool { unsafe { from_glib(ffi::hdy_flap_get_locked(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_modal")] #[doc(alias = "get_modal")] pub fn is_modal(&self) -> bool { unsafe { from_glib(ffi::hdy_flap_get_modal(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_reveal_duration")] #[doc(alias = "get_reveal_duration")] pub fn reveal_duration(&self) -> u32 { unsafe { ffi::hdy_flap_get_reveal_duration(self.to_glib_none().0) } } #[doc(alias = "hdy_flap_get_reveal_flap")] #[doc(alias = "get_reveal_flap")] pub fn reveals_flap(&self) -> bool { unsafe { from_glib(ffi::hdy_flap_get_reveal_flap(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_reveal_progress")] #[doc(alias = "get_reveal_progress")] pub fn reveal_progress(&self) -> f64 { unsafe { ffi::hdy_flap_get_reveal_progress(self.to_glib_none().0) } } #[doc(alias = "hdy_flap_get_separator")] #[doc(alias = "get_separator")] pub fn separator(&self) -> Option { unsafe { from_glib_none(ffi::hdy_flap_get_separator(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_swipe_to_close")] #[doc(alias = "get_swipe_to_close")] pub fn is_swipe_to_close(&self) -> bool { unsafe { from_glib(ffi::hdy_flap_get_swipe_to_close(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_swipe_to_open")] #[doc(alias = "get_swipe_to_open")] pub fn is_swipe_to_open(&self) -> bool { unsafe { from_glib(ffi::hdy_flap_get_swipe_to_open(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_get_transition_type")] #[doc(alias = "get_transition_type")] pub fn transition_type(&self) -> FlapTransitionType { unsafe { from_glib(ffi::hdy_flap_get_transition_type(self.to_glib_none().0)) } } #[doc(alias = "hdy_flap_set_content")] pub fn set_content>(&self, content: Option<&P>) { unsafe { ffi::hdy_flap_set_content( self.to_glib_none().0, content.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_flap_set_flap")] pub fn set_flap>(&self, flap: Option<&P>) { unsafe { ffi::hdy_flap_set_flap( self.to_glib_none().0, flap.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_flap_set_flap_position")] pub fn set_flap_position(&self, position: gtk::PackType) { unsafe { ffi::hdy_flap_set_flap_position(self.to_glib_none().0, position.into_glib()); } } #[doc(alias = "hdy_flap_set_fold_duration")] pub fn set_fold_duration(&self, duration: u32) { unsafe { ffi::hdy_flap_set_fold_duration(self.to_glib_none().0, duration); } } #[doc(alias = "hdy_flap_set_fold_policy")] pub fn set_fold_policy(&self, policy: FlapFoldPolicy) { unsafe { ffi::hdy_flap_set_fold_policy(self.to_glib_none().0, policy.into_glib()); } } #[doc(alias = "hdy_flap_set_locked")] pub fn set_locked(&self, locked: bool) { unsafe { ffi::hdy_flap_set_locked(self.to_glib_none().0, locked.into_glib()); } } #[doc(alias = "hdy_flap_set_modal")] pub fn set_modal(&self, modal: bool) { unsafe { ffi::hdy_flap_set_modal(self.to_glib_none().0, modal.into_glib()); } } #[doc(alias = "hdy_flap_set_reveal_duration")] pub fn set_reveal_duration(&self, duration: u32) { unsafe { ffi::hdy_flap_set_reveal_duration(self.to_glib_none().0, duration); } } #[doc(alias = "hdy_flap_set_reveal_flap")] pub fn set_reveal_flap(&self, reveal_flap: bool) { unsafe { ffi::hdy_flap_set_reveal_flap(self.to_glib_none().0, reveal_flap.into_glib()); } } #[doc(alias = "hdy_flap_set_separator")] pub fn set_separator>(&self, separator: Option<&P>) { unsafe { ffi::hdy_flap_set_separator( self.to_glib_none().0, separator.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_flap_set_swipe_to_close")] pub fn set_swipe_to_close(&self, swipe_to_close: bool) { unsafe { ffi::hdy_flap_set_swipe_to_close(self.to_glib_none().0, swipe_to_close.into_glib()); } } #[doc(alias = "hdy_flap_set_swipe_to_open")] pub fn set_swipe_to_open(&self, swipe_to_open: bool) { unsafe { ffi::hdy_flap_set_swipe_to_open(self.to_glib_none().0, swipe_to_open.into_glib()); } } #[doc(alias = "hdy_flap_set_transition_type")] pub fn set_transition_type(&self, transition_type: FlapTransitionType) { unsafe { ffi::hdy_flap_set_transition_type(self.to_glib_none().0, transition_type.into_glib()); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "content")] pub fn connect_content_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_content_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::content\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_content_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "flap")] pub fn connect_flap_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flap_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::flap\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_flap_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "flap-position")] pub fn connect_flap_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flap_position_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::flap-position\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_flap_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "fold-duration")] pub fn connect_fold_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fold_duration_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::fold-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_fold_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "fold-policy")] pub fn connect_fold_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_fold_policy_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::fold-policy\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_fold_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "folded")] pub fn connect_folded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_folded_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::folded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_folded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "locked")] pub fn connect_locked_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_locked_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::locked\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_locked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "modal")] pub fn connect_modal_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_modal_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::modal\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_modal_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "reveal-duration")] pub fn connect_reveal_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_duration_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reveal-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_reveal_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "reveal-flap")] pub fn connect_reveal_flap_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_flap_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reveal-flap\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_reveal_flap_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "reveal-progress")] pub fn connect_reveal_progress_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_progress_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reveal-progress\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_reveal_progress_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "separator")] pub fn connect_separator_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_separator_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::separator\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_separator_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "swipe-to-close")] pub fn connect_swipe_to_close_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_swipe_to_close_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::swipe-to-close\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_swipe_to_close_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "swipe-to-open")] pub fn connect_swipe_to_open_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_swipe_to_open_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::swipe-to-open\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_swipe_to_open_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "transition-type")] pub fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline( this: *mut ffi::HdyFlap, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-type\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl Default for Flap { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Flap`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct FlapBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] content: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] flap: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] flap_position: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fold_duration: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fold_policy: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] locked: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] modal: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] reveal_duration: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] reveal_flap: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] separator: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] swipe_to_close: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] swipe_to_open: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] transition_type: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl FlapBuilder { // rustdoc-stripper-ignore-next /// Create a new [`FlapBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Flap`]. pub fn build(self) -> Flap { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref content) = self.content { properties.push(("content", content)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref flap) = self.flap { properties.push(("flap", flap)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref flap_position) = self.flap_position { properties.push(("flap-position", flap_position)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref fold_duration) = self.fold_duration { properties.push(("fold-duration", fold_duration)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref fold_policy) = self.fold_policy { properties.push(("fold-policy", fold_policy)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref locked) = self.locked { properties.push(("locked", locked)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref modal) = self.modal { properties.push(("modal", modal)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref reveal_duration) = self.reveal_duration { properties.push(("reveal-duration", reveal_duration)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref reveal_flap) = self.reveal_flap { properties.push(("reveal-flap", reveal_flap)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref separator) = self.separator { properties.push(("separator", separator)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref swipe_to_close) = self.swipe_to_close { properties.push(("swipe-to-close", swipe_to_close)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref swipe_to_open) = self.swipe_to_open { properties.push(("swipe-to-open", swipe_to_open)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref transition_type) = self.transition_type { properties.push(("transition-type", transition_type)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties).expect("Failed to create an instance of Flap") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn content>(mut self, content: &P) -> Self { self.content = Some(content.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn flap>(mut self, flap: &P) -> Self { self.flap = Some(flap.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn flap_position(mut self, flap_position: gtk::PackType) -> Self { self.flap_position = Some(flap_position); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn fold_duration(mut self, fold_duration: u32) -> Self { self.fold_duration = Some(fold_duration); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn fold_policy(mut self, fold_policy: FlapFoldPolicy) -> Self { self.fold_policy = Some(fold_policy); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn locked(mut self, locked: bool) -> Self { self.locked = Some(locked); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn modal(mut self, modal: bool) -> Self { self.modal = Some(modal); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn reveal_duration(mut self, reveal_duration: u32) -> Self { self.reveal_duration = Some(reveal_duration); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn reveal_flap(mut self, reveal_flap: bool) -> Self { self.reveal_flap = Some(reveal_flap); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn separator>(mut self, separator: &P) -> Self { self.separator = Some(separator.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn swipe_to_close(mut self, swipe_to_close: bool) -> Self { self.swipe_to_close = Some(swipe_to_close); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn swipe_to_open(mut self, swipe_to_open: bool) -> Self { self.swipe_to_open = Some(swipe_to_open); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn transition_type(mut self, transition_type: FlapTransitionType) -> Self { self.transition_type = Some(transition_type); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for Flap { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Flap") } } libhandy-0.8.0/src/auto/functions.rs000064400000000000000000000020350000000000000155150ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::IsA; use glib::translate::*; #[doc(alias = "hdy_ease_out_cubic")] pub fn ease_out_cubic(t: f64) -> f64 { assert_initialized_main_thread!(); unsafe { ffi::hdy_ease_out_cubic(t) } } //#[doc(alias = "hdy_enum_value_row_name")] //pub fn enum_value_row_name(value: &EnumValueObject, user_data: /*Unimplemented*/Option) -> Option { // unsafe { TODO: call ffi:hdy_enum_value_row_name() } //} #[doc(alias = "hdy_get_enable_animations")] #[doc(alias = "get_enable_animations")] pub fn enables_animations>(widget: &P) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::hdy_get_enable_animations( widget.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_init")] pub fn init() { assert_initialized_main_thread!(); unsafe { ffi::hdy_init(); } } libhandy-0.8.0/src/auto/header_bar.rs000064400000000000000000001126330000000000000155670ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::CenteringPolicy; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyHeaderBar")] pub struct HeaderBar(Object) @extends gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_header_bar_get_type(), } } impl HeaderBar { #[doc(alias = "hdy_header_bar_new")] pub fn new() -> HeaderBar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_header_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`HeaderBar`] objects. /// /// This method returns an instance of [`HeaderBarBuilder`] which can be used to create [`HeaderBar`] objects. pub fn builder() -> HeaderBarBuilder { HeaderBarBuilder::default() } } impl Default for HeaderBar { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`HeaderBar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct HeaderBarBuilder { centering_policy: Option, custom_title: Option, decoration_layout: Option, decoration_layout_set: Option, has_subtitle: Option, interpolate_size: Option, show_close_button: Option, spacing: Option, subtitle: Option, title: Option, transition_duration: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl HeaderBarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`HeaderBarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`HeaderBar`]. pub fn build(self) -> HeaderBar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref centering_policy) = self.centering_policy { properties.push(("centering-policy", centering_policy)); } if let Some(ref custom_title) = self.custom_title { properties.push(("custom-title", custom_title)); } if let Some(ref decoration_layout) = self.decoration_layout { properties.push(("decoration-layout", decoration_layout)); } if let Some(ref decoration_layout_set) = self.decoration_layout_set { properties.push(("decoration-layout-set", decoration_layout_set)); } if let Some(ref has_subtitle) = self.has_subtitle { properties.push(("has-subtitle", has_subtitle)); } if let Some(ref interpolate_size) = self.interpolate_size { properties.push(("interpolate-size", interpolate_size)); } if let Some(ref show_close_button) = self.show_close_button { properties.push(("show-close-button", show_close_button)); } if let Some(ref spacing) = self.spacing { properties.push(("spacing", spacing)); } if let Some(ref subtitle) = self.subtitle { properties.push(("subtitle", subtitle)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref transition_duration) = self.transition_duration { properties.push(("transition-duration", transition_duration)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of HeaderBar") } pub fn centering_policy(mut self, centering_policy: CenteringPolicy) -> Self { self.centering_policy = Some(centering_policy); self } pub fn custom_title>(mut self, custom_title: &P) -> Self { self.custom_title = Some(custom_title.clone().upcast()); self } pub fn decoration_layout(mut self, decoration_layout: &str) -> Self { self.decoration_layout = Some(decoration_layout.to_string()); self } pub fn decoration_layout_set(mut self, decoration_layout_set: bool) -> Self { self.decoration_layout_set = Some(decoration_layout_set); self } pub fn has_subtitle(mut self, has_subtitle: bool) -> Self { self.has_subtitle = Some(has_subtitle); self } pub fn interpolate_size(mut self, interpolate_size: bool) -> Self { self.interpolate_size = Some(interpolate_size); self } pub fn show_close_button(mut self, show_close_button: bool) -> Self { self.show_close_button = Some(show_close_button); self } pub fn spacing(mut self, spacing: i32) -> Self { self.spacing = Some(spacing); self } pub fn subtitle(mut self, subtitle: &str) -> Self { self.subtitle = Some(subtitle.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn transition_duration(mut self, transition_duration: u32) -> Self { self.transition_duration = Some(transition_duration); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_HEADER_BAR: Option<&HeaderBar> = None; pub trait HeaderBarExt: 'static { #[doc(alias = "hdy_header_bar_get_centering_policy")] #[doc(alias = "get_centering_policy")] fn centering_policy(&self) -> CenteringPolicy; #[doc(alias = "hdy_header_bar_get_custom_title")] #[doc(alias = "get_custom_title")] fn custom_title(&self) -> Option; #[doc(alias = "hdy_header_bar_get_decoration_layout")] #[doc(alias = "get_decoration_layout")] fn decoration_layout(&self) -> Option; #[doc(alias = "hdy_header_bar_get_has_subtitle")] #[doc(alias = "get_has_subtitle")] fn has_subtitle(&self) -> bool; #[doc(alias = "hdy_header_bar_get_interpolate_size")] #[doc(alias = "get_interpolate_size")] fn is_interpolate_size(&self) -> bool; #[doc(alias = "hdy_header_bar_get_show_close_button")] #[doc(alias = "get_show_close_button")] fn shows_close_button(&self) -> bool; #[doc(alias = "hdy_header_bar_get_subtitle")] #[doc(alias = "get_subtitle")] fn subtitle(&self) -> Option; #[doc(alias = "hdy_header_bar_get_title")] #[doc(alias = "get_title")] fn title(&self) -> Option; #[doc(alias = "hdy_header_bar_get_transition_duration")] #[doc(alias = "get_transition_duration")] fn transition_duration(&self) -> u32; #[doc(alias = "hdy_header_bar_get_transition_running")] #[doc(alias = "get_transition_running")] fn is_transition_running(&self) -> bool; #[doc(alias = "hdy_header_bar_pack_end")] fn pack_end>(&self, child: &P); #[doc(alias = "hdy_header_bar_pack_start")] fn pack_start>(&self, child: &P); #[doc(alias = "hdy_header_bar_set_centering_policy")] fn set_centering_policy(&self, centering_policy: CenteringPolicy); #[doc(alias = "hdy_header_bar_set_custom_title")] fn set_custom_title>(&self, title_widget: Option<&P>); #[doc(alias = "hdy_header_bar_set_decoration_layout")] fn set_decoration_layout(&self, layout: Option<&str>); #[doc(alias = "hdy_header_bar_set_has_subtitle")] fn set_has_subtitle(&self, setting: bool); #[doc(alias = "hdy_header_bar_set_interpolate_size")] fn set_interpolate_size(&self, interpolate_size: bool); #[doc(alias = "hdy_header_bar_set_show_close_button")] fn set_show_close_button(&self, setting: bool); #[doc(alias = "hdy_header_bar_set_subtitle")] fn set_subtitle(&self, subtitle: Option<&str>); #[doc(alias = "hdy_header_bar_set_title")] fn set_title(&self, title: Option<&str>); #[doc(alias = "hdy_header_bar_set_transition_duration")] fn set_transition_duration(&self, duration: u32); #[doc(alias = "decoration-layout-set")] fn is_decoration_layout_set(&self) -> bool; #[doc(alias = "decoration-layout-set")] fn set_decoration_layout_set(&self, decoration_layout_set: bool); fn spacing(&self) -> i32; fn set_spacing(&self, spacing: i32); #[doc(alias = "centering-policy")] fn connect_centering_policy_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "custom-title")] fn connect_custom_title_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "decoration-layout")] fn connect_decoration_layout_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "decoration-layout-set")] fn connect_decoration_layout_set_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "has-subtitle")] fn connect_has_subtitle_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "interpolate-size")] fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-close-button")] fn connect_show_close_button_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "spacing")] fn connect_spacing_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "subtitle")] fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "transition-duration")] fn connect_transition_duration_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "transition-running")] fn connect_transition_running_notify(&self, f: F) -> SignalHandlerId; } impl> HeaderBarExt for O { fn centering_policy(&self) -> CenteringPolicy { unsafe { from_glib(ffi::hdy_header_bar_get_centering_policy( self.as_ref().to_glib_none().0, )) } } fn custom_title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_bar_get_custom_title( self.as_ref().to_glib_none().0, )) } } fn decoration_layout(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_bar_get_decoration_layout( self.as_ref().to_glib_none().0, )) } } fn has_subtitle(&self) -> bool { unsafe { from_glib(ffi::hdy_header_bar_get_has_subtitle( self.as_ref().to_glib_none().0, )) } } fn is_interpolate_size(&self) -> bool { unsafe { from_glib(ffi::hdy_header_bar_get_interpolate_size( self.as_ref().to_glib_none().0, )) } } fn shows_close_button(&self) -> bool { unsafe { from_glib(ffi::hdy_header_bar_get_show_close_button( self.as_ref().to_glib_none().0, )) } } fn subtitle(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_bar_get_subtitle( self.as_ref().to_glib_none().0, )) } } fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_bar_get_title( self.as_ref().to_glib_none().0, )) } } fn transition_duration(&self) -> u32 { unsafe { ffi::hdy_header_bar_get_transition_duration(self.as_ref().to_glib_none().0) } } fn is_transition_running(&self) -> bool { unsafe { from_glib(ffi::hdy_header_bar_get_transition_running( self.as_ref().to_glib_none().0, )) } } fn pack_end>(&self, child: &P) { unsafe { ffi::hdy_header_bar_pack_end( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } fn pack_start>(&self, child: &P) { unsafe { ffi::hdy_header_bar_pack_start( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } fn set_centering_policy(&self, centering_policy: CenteringPolicy) { unsafe { ffi::hdy_header_bar_set_centering_policy( self.as_ref().to_glib_none().0, centering_policy.into_glib(), ); } } fn set_custom_title>(&self, title_widget: Option<&P>) { unsafe { ffi::hdy_header_bar_set_custom_title( self.as_ref().to_glib_none().0, title_widget.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_decoration_layout(&self, layout: Option<&str>) { unsafe { ffi::hdy_header_bar_set_decoration_layout( self.as_ref().to_glib_none().0, layout.to_glib_none().0, ); } } fn set_has_subtitle(&self, setting: bool) { unsafe { ffi::hdy_header_bar_set_has_subtitle( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_interpolate_size(&self, interpolate_size: bool) { unsafe { ffi::hdy_header_bar_set_interpolate_size( self.as_ref().to_glib_none().0, interpolate_size.into_glib(), ); } } fn set_show_close_button(&self, setting: bool) { unsafe { ffi::hdy_header_bar_set_show_close_button( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_subtitle(&self, subtitle: Option<&str>) { unsafe { ffi::hdy_header_bar_set_subtitle( self.as_ref().to_glib_none().0, subtitle.to_glib_none().0, ); } } fn set_title(&self, title: Option<&str>) { unsafe { ffi::hdy_header_bar_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0); } } fn set_transition_duration(&self, duration: u32) { unsafe { ffi::hdy_header_bar_set_transition_duration(self.as_ref().to_glib_none().0, duration); } } fn is_decoration_layout_set(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"decoration-layout-set\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `decoration-layout-set` getter") } } fn set_decoration_layout_set(&self, decoration_layout_set: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"decoration-layout-set\0".as_ptr() as *const _, decoration_layout_set.to_value().to_glib_none().0, ); } } fn spacing(&self) -> i32 { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"spacing\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `spacing` getter") } } fn set_spacing(&self, spacing: i32) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"spacing\0".as_ptr() as *const _, spacing.to_value().to_glib_none().0, ); } } fn connect_centering_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_centering_policy_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::centering-policy\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_centering_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_custom_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_custom_title_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::custom-title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_custom_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_decoration_layout_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_decoration_layout_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::decoration-layout\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_decoration_layout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_decoration_layout_set_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_decoration_layout_set_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::decoration-layout-set\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_decoration_layout_set_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_has_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_has_subtitle_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::has-subtitle\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_has_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interpolate_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::interpolate-size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_interpolate_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_close_button_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_close_button_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-close-button\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_close_button_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spacing_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::spacing\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::subtitle\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_transition_duration_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_duration_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_transition_running_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_running_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyHeaderBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(HeaderBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-running\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for HeaderBar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("HeaderBar") } } libhandy-0.8.0/src/auto/header_group.rs000064400000000000000000000162020000000000000161520ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::HeaderBar; use crate::HeaderGroupChild; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyHeaderGroup")] pub struct HeaderGroup(Object) @implements gtk::Buildable; match fn { type_ => || ffi::hdy_header_group_get_type(), } } impl HeaderGroup { #[doc(alias = "hdy_header_group_new")] pub fn new() -> HeaderGroup { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::hdy_header_group_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`HeaderGroup`] objects. /// /// This method returns an instance of [`HeaderGroupBuilder`] which can be used to create [`HeaderGroup`] objects. pub fn builder() -> HeaderGroupBuilder { HeaderGroupBuilder::default() } #[doc(alias = "hdy_header_group_add_gtk_header_bar")] pub fn add_gtk_header_bar>(&self, header_bar: &P) { unsafe { ffi::hdy_header_group_add_gtk_header_bar( self.to_glib_none().0, header_bar.as_ref().to_glib_none().0, ); } } #[doc(alias = "hdy_header_group_add_header_bar")] pub fn add_header_bar>(&self, header_bar: &P) { unsafe { ffi::hdy_header_group_add_header_bar( self.to_glib_none().0, header_bar.as_ref().to_glib_none().0, ); } } #[doc(alias = "hdy_header_group_add_header_group")] pub fn add_header_group(&self, header_group: &HeaderGroup) { unsafe { ffi::hdy_header_group_add_header_group( self.to_glib_none().0, header_group.to_glib_none().0, ); } } #[doc(alias = "hdy_header_group_get_children")] #[doc(alias = "get_children")] pub fn children(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::hdy_header_group_get_children( self.to_glib_none().0, )) } } #[doc(alias = "hdy_header_group_get_decorate_all")] #[doc(alias = "get_decorate_all")] pub fn is_decorate_all(&self) -> bool { unsafe { from_glib(ffi::hdy_header_group_get_decorate_all( self.to_glib_none().0, )) } } #[doc(alias = "hdy_header_group_remove_child")] pub fn remove_child(&self, child: &HeaderGroupChild) { unsafe { ffi::hdy_header_group_remove_child(self.to_glib_none().0, child.to_glib_none().0); } } #[doc(alias = "hdy_header_group_remove_gtk_header_bar")] pub fn remove_gtk_header_bar>(&self, header_bar: &P) { unsafe { ffi::hdy_header_group_remove_gtk_header_bar( self.to_glib_none().0, header_bar.as_ref().to_glib_none().0, ); } } #[doc(alias = "hdy_header_group_remove_header_bar")] pub fn remove_header_bar>(&self, header_bar: &P) { unsafe { ffi::hdy_header_group_remove_header_bar( self.to_glib_none().0, header_bar.as_ref().to_glib_none().0, ); } } #[doc(alias = "hdy_header_group_remove_header_group")] pub fn remove_header_group(&self, header_group: &HeaderGroup) { unsafe { ffi::hdy_header_group_remove_header_group( self.to_glib_none().0, header_group.to_glib_none().0, ); } } #[doc(alias = "hdy_header_group_set_decorate_all")] pub fn set_decorate_all(&self, decorate_all: bool) { unsafe { ffi::hdy_header_group_set_decorate_all(self.to_glib_none().0, decorate_all.into_glib()); } } #[doc(alias = "update-decoration-layouts")] pub fn connect_update_decoration_layouts( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn update_decoration_layouts_trampoline( this: *mut ffi::HdyHeaderGroup, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"update-decoration-layouts\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( update_decoration_layouts_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "decorate-all")] pub fn connect_decorate_all_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_decorate_all_trampoline( this: *mut ffi::HdyHeaderGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::decorate-all\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_decorate_all_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for HeaderGroup { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`HeaderGroup`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct HeaderGroupBuilder { decorate_all: Option, } impl HeaderGroupBuilder { // rustdoc-stripper-ignore-next /// Create a new [`HeaderGroupBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`HeaderGroup`]. pub fn build(self) -> HeaderGroup { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref decorate_all) = self.decorate_all { properties.push(("decorate-all", decorate_all)); } glib::Object::new::(&properties) .expect("Failed to create an instance of HeaderGroup") } pub fn decorate_all(mut self, decorate_all: bool) -> Self { self.decorate_all = Some(decorate_all); self } } impl fmt::Display for HeaderGroup { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("HeaderGroup") } } libhandy-0.8.0/src/auto/header_group_child.rs000064400000000000000000000036310000000000000173170ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::HeaderBar; use crate::HeaderGroup; use crate::HeaderGroupChildType; use glib::translate::*; use std::fmt; glib::wrapper! { #[doc(alias = "HdyHeaderGroupChild")] pub struct HeaderGroupChild(Object); match fn { type_ => || ffi::hdy_header_group_child_get_type(), } } impl HeaderGroupChild { #[doc(alias = "hdy_header_group_child_get_child_type")] #[doc(alias = "get_child_type")] pub fn child_type(&self) -> HeaderGroupChildType { unsafe { from_glib(ffi::hdy_header_group_child_get_child_type( self.to_glib_none().0, )) } } #[doc(alias = "hdy_header_group_child_get_gtk_header_bar")] #[doc(alias = "get_gtk_header_bar")] pub fn gtk_header_bar(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_group_child_get_gtk_header_bar( self.to_glib_none().0, )) } } #[doc(alias = "hdy_header_group_child_get_header_bar")] #[doc(alias = "get_header_bar")] pub fn header_bar(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_group_child_get_header_bar( self.to_glib_none().0, )) } } #[doc(alias = "hdy_header_group_child_get_header_group")] #[doc(alias = "get_header_group")] pub fn header_group(&self) -> Option { unsafe { from_glib_none(ffi::hdy_header_group_child_get_header_group( self.to_glib_none().0, )) } } } impl fmt::Display for HeaderGroupChild { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("HeaderGroupChild") } } libhandy-0.8.0/src/auto/keypad.rs000064400000000000000000000641410000000000000147700ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyKeypad")] pub struct Keypad(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_keypad_get_type(), } } impl Keypad { #[doc(alias = "hdy_keypad_new")] pub fn new(symbols_visible: bool, letters_visible: bool) -> Keypad { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_keypad_new( symbols_visible.into_glib(), letters_visible.into_glib(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Keypad`] objects. /// /// This method returns an instance of [`KeypadBuilder`] which can be used to create [`Keypad`] objects. pub fn builder() -> KeypadBuilder { KeypadBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Keypad`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct KeypadBuilder { column_spacing: Option, end_action: Option, entry: Option, letters_visible: Option, row_spacing: Option, start_action: Option, symbols_visible: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl KeypadBuilder { // rustdoc-stripper-ignore-next /// Create a new [`KeypadBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Keypad`]. pub fn build(self) -> Keypad { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref column_spacing) = self.column_spacing { properties.push(("column-spacing", column_spacing)); } if let Some(ref end_action) = self.end_action { properties.push(("end-action", end_action)); } if let Some(ref entry) = self.entry { properties.push(("entry", entry)); } if let Some(ref letters_visible) = self.letters_visible { properties.push(("letters-visible", letters_visible)); } if let Some(ref row_spacing) = self.row_spacing { properties.push(("row-spacing", row_spacing)); } if let Some(ref start_action) = self.start_action { properties.push(("start-action", start_action)); } if let Some(ref symbols_visible) = self.symbols_visible { properties.push(("symbols-visible", symbols_visible)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties).expect("Failed to create an instance of Keypad") } pub fn column_spacing(mut self, column_spacing: u32) -> Self { self.column_spacing = Some(column_spacing); self } pub fn end_action>(mut self, end_action: &P) -> Self { self.end_action = Some(end_action.clone().upcast()); self } pub fn entry>(mut self, entry: &P) -> Self { self.entry = Some(entry.clone().upcast()); self } pub fn letters_visible(mut self, letters_visible: bool) -> Self { self.letters_visible = Some(letters_visible); self } pub fn row_spacing(mut self, row_spacing: u32) -> Self { self.row_spacing = Some(row_spacing); self } pub fn start_action>(mut self, start_action: &P) -> Self { self.start_action = Some(start_action.clone().upcast()); self } pub fn symbols_visible(mut self, symbols_visible: bool) -> Self { self.symbols_visible = Some(symbols_visible); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_KEYPAD: Option<&Keypad> = None; pub trait KeypadExt: 'static { #[doc(alias = "hdy_keypad_get_column_spacing")] #[doc(alias = "get_column_spacing")] fn column_spacing(&self) -> u32; #[doc(alias = "hdy_keypad_get_end_action")] #[doc(alias = "get_end_action")] fn end_action(&self) -> Option; #[doc(alias = "hdy_keypad_get_entry")] #[doc(alias = "get_entry")] fn entry(&self) -> Option; #[doc(alias = "hdy_keypad_get_letters_visible")] #[doc(alias = "get_letters_visible")] fn is_letters_visible(&self) -> bool; #[doc(alias = "hdy_keypad_get_row_spacing")] #[doc(alias = "get_row_spacing")] fn row_spacing(&self) -> u32; #[doc(alias = "hdy_keypad_get_start_action")] #[doc(alias = "get_start_action")] fn start_action(&self) -> Option; #[doc(alias = "hdy_keypad_get_symbols_visible")] #[doc(alias = "get_symbols_visible")] fn is_symbols_visible(&self) -> bool; #[doc(alias = "hdy_keypad_set_column_spacing")] fn set_column_spacing(&self, spacing: u32); #[doc(alias = "hdy_keypad_set_end_action")] fn set_end_action>(&self, end_action: Option<&P>); #[doc(alias = "hdy_keypad_set_entry")] fn set_entry>(&self, entry: Option<&P>); #[doc(alias = "hdy_keypad_set_letters_visible")] fn set_letters_visible(&self, letters_visible: bool); #[doc(alias = "hdy_keypad_set_row_spacing")] fn set_row_spacing(&self, spacing: u32); #[doc(alias = "hdy_keypad_set_start_action")] fn set_start_action>(&self, start_action: Option<&P>); #[doc(alias = "hdy_keypad_set_symbols_visible")] fn set_symbols_visible(&self, symbols_visible: bool); #[doc(alias = "column-spacing")] fn connect_column_spacing_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "end-action")] fn connect_end_action_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "entry")] fn connect_entry_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "letters-visible")] fn connect_letters_visible_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "row-spacing")] fn connect_row_spacing_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "start-action")] fn connect_start_action_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "symbols-visible")] fn connect_symbols_visible_notify(&self, f: F) -> SignalHandlerId; } impl> KeypadExt for O { fn column_spacing(&self) -> u32 { unsafe { ffi::hdy_keypad_get_column_spacing(self.as_ref().to_glib_none().0) } } fn end_action(&self) -> Option { unsafe { from_glib_none(ffi::hdy_keypad_get_end_action( self.as_ref().to_glib_none().0, )) } } fn entry(&self) -> Option { unsafe { from_glib_none(ffi::hdy_keypad_get_entry(self.as_ref().to_glib_none().0)) } } fn is_letters_visible(&self) -> bool { unsafe { from_glib(ffi::hdy_keypad_get_letters_visible( self.as_ref().to_glib_none().0, )) } } fn row_spacing(&self) -> u32 { unsafe { ffi::hdy_keypad_get_row_spacing(self.as_ref().to_glib_none().0) } } fn start_action(&self) -> Option { unsafe { from_glib_none(ffi::hdy_keypad_get_start_action( self.as_ref().to_glib_none().0, )) } } fn is_symbols_visible(&self) -> bool { unsafe { from_glib(ffi::hdy_keypad_get_symbols_visible( self.as_ref().to_glib_none().0, )) } } fn set_column_spacing(&self, spacing: u32) { unsafe { ffi::hdy_keypad_set_column_spacing(self.as_ref().to_glib_none().0, spacing); } } fn set_end_action>(&self, end_action: Option<&P>) { unsafe { ffi::hdy_keypad_set_end_action( self.as_ref().to_glib_none().0, end_action.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_entry>(&self, entry: Option<&P>) { unsafe { ffi::hdy_keypad_set_entry( self.as_ref().to_glib_none().0, entry.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_letters_visible(&self, letters_visible: bool) { unsafe { ffi::hdy_keypad_set_letters_visible( self.as_ref().to_glib_none().0, letters_visible.into_glib(), ); } } fn set_row_spacing(&self, spacing: u32) { unsafe { ffi::hdy_keypad_set_row_spacing(self.as_ref().to_glib_none().0, spacing); } } fn set_start_action>(&self, start_action: Option<&P>) { unsafe { ffi::hdy_keypad_set_start_action( self.as_ref().to_glib_none().0, start_action.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_symbols_visible(&self, symbols_visible: bool) { unsafe { ffi::hdy_keypad_set_symbols_visible( self.as_ref().to_glib_none().0, symbols_visible.into_glib(), ); } } fn connect_column_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_column_spacing_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::column-spacing\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_column_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_end_action_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_end_action_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::end-action\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_end_action_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_entry_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_entry_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::entry\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_entry_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_letters_visible_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_letters_visible_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::letters-visible\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_letters_visible_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_row_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_row_spacing_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::row-spacing\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_row_spacing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_start_action_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_start_action_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::start-action\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_start_action_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_symbols_visible_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_symbols_visible_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyKeypad, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Keypad::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::symbols-visible\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_symbols_visible_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Keypad { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Keypad") } } libhandy-0.8.0/src/auto/leaflet.rs000064400000000000000000001513350000000000000151310ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::LeafletTransitionType; use crate::NavigationDirection; use crate::Swipeable; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyLeaflet")] pub struct Leaflet(Object) @extends gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable, Swipeable; match fn { type_ => || ffi::hdy_leaflet_get_type(), } } impl Leaflet { #[doc(alias = "hdy_leaflet_new")] pub fn new() -> Leaflet { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_leaflet_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Leaflet`] objects. /// /// This method returns an instance of [`LeafletBuilder`] which can be used to create [`Leaflet`] objects. pub fn builder() -> LeafletBuilder { LeafletBuilder::default() } } impl Default for Leaflet { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Leaflet`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct LeafletBuilder { can_swipe_back: Option, can_swipe_forward: Option, child_transition_duration: Option, hhomogeneous_folded: Option, hhomogeneous_unfolded: Option, interpolate_size: Option, mode_transition_duration: Option, transition_type: Option, vhomogeneous_folded: Option, vhomogeneous_unfolded: Option, visible_child: Option, visible_child_name: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl LeafletBuilder { // rustdoc-stripper-ignore-next /// Create a new [`LeafletBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Leaflet`]. pub fn build(self) -> Leaflet { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref can_swipe_back) = self.can_swipe_back { properties.push(("can-swipe-back", can_swipe_back)); } if let Some(ref can_swipe_forward) = self.can_swipe_forward { properties.push(("can-swipe-forward", can_swipe_forward)); } if let Some(ref child_transition_duration) = self.child_transition_duration { properties.push(("child-transition-duration", child_transition_duration)); } if let Some(ref hhomogeneous_folded) = self.hhomogeneous_folded { properties.push(("hhomogeneous-folded", hhomogeneous_folded)); } if let Some(ref hhomogeneous_unfolded) = self.hhomogeneous_unfolded { properties.push(("hhomogeneous-unfolded", hhomogeneous_unfolded)); } if let Some(ref interpolate_size) = self.interpolate_size { properties.push(("interpolate-size", interpolate_size)); } if let Some(ref mode_transition_duration) = self.mode_transition_duration { properties.push(("mode-transition-duration", mode_transition_duration)); } if let Some(ref transition_type) = self.transition_type { properties.push(("transition-type", transition_type)); } if let Some(ref vhomogeneous_folded) = self.vhomogeneous_folded { properties.push(("vhomogeneous-folded", vhomogeneous_folded)); } if let Some(ref vhomogeneous_unfolded) = self.vhomogeneous_unfolded { properties.push(("vhomogeneous-unfolded", vhomogeneous_unfolded)); } if let Some(ref visible_child) = self.visible_child { properties.push(("visible-child", visible_child)); } if let Some(ref visible_child_name) = self.visible_child_name { properties.push(("visible-child-name", visible_child_name)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties).expect("Failed to create an instance of Leaflet") } pub fn can_swipe_back(mut self, can_swipe_back: bool) -> Self { self.can_swipe_back = Some(can_swipe_back); self } pub fn can_swipe_forward(mut self, can_swipe_forward: bool) -> Self { self.can_swipe_forward = Some(can_swipe_forward); self } pub fn child_transition_duration(mut self, child_transition_duration: u32) -> Self { self.child_transition_duration = Some(child_transition_duration); self } pub fn hhomogeneous_folded(mut self, hhomogeneous_folded: bool) -> Self { self.hhomogeneous_folded = Some(hhomogeneous_folded); self } pub fn hhomogeneous_unfolded(mut self, hhomogeneous_unfolded: bool) -> Self { self.hhomogeneous_unfolded = Some(hhomogeneous_unfolded); self } pub fn interpolate_size(mut self, interpolate_size: bool) -> Self { self.interpolate_size = Some(interpolate_size); self } pub fn mode_transition_duration(mut self, mode_transition_duration: u32) -> Self { self.mode_transition_duration = Some(mode_transition_duration); self } pub fn transition_type(mut self, transition_type: LeafletTransitionType) -> Self { self.transition_type = Some(transition_type); self } pub fn vhomogeneous_folded(mut self, vhomogeneous_folded: bool) -> Self { self.vhomogeneous_folded = Some(vhomogeneous_folded); self } pub fn vhomogeneous_unfolded(mut self, vhomogeneous_unfolded: bool) -> Self { self.vhomogeneous_unfolded = Some(vhomogeneous_unfolded); self } pub fn visible_child>(mut self, visible_child: &P) -> Self { self.visible_child = Some(visible_child.clone().upcast()); self } pub fn visible_child_name(mut self, visible_child_name: &str) -> Self { self.visible_child_name = Some(visible_child_name.to_string()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } pub const NONE_LEAFLET: Option<&Leaflet> = None; pub trait LeafletExt: 'static { #[doc(alias = "hdy_leaflet_get_adjacent_child")] #[doc(alias = "get_adjacent_child")] fn adjacent_child(&self, direction: NavigationDirection) -> Option; #[doc(alias = "hdy_leaflet_get_can_swipe_back")] #[doc(alias = "get_can_swipe_back")] fn can_swipe_back(&self) -> bool; #[doc(alias = "hdy_leaflet_get_can_swipe_forward")] #[doc(alias = "get_can_swipe_forward")] fn can_swipe_forward(&self) -> bool; #[doc(alias = "hdy_leaflet_get_child_by_name")] #[doc(alias = "get_child_by_name")] fn child_by_name(&self, name: &str) -> Option; #[doc(alias = "hdy_leaflet_get_child_transition_duration")] #[doc(alias = "get_child_transition_duration")] fn child_transition_duration(&self) -> u32; #[doc(alias = "hdy_leaflet_get_child_transition_running")] #[doc(alias = "get_child_transition_running")] fn is_child_transition_running(&self) -> bool; #[doc(alias = "hdy_leaflet_get_folded")] #[doc(alias = "get_folded")] fn is_folded(&self) -> bool; #[doc(alias = "hdy_leaflet_get_homogeneous")] #[doc(alias = "get_homogeneous")] fn is_homogeneous(&self, folded: bool, orientation: gtk::Orientation) -> bool; #[doc(alias = "hdy_leaflet_get_interpolate_size")] #[doc(alias = "get_interpolate_size")] fn is_interpolate_size(&self) -> bool; #[doc(alias = "hdy_leaflet_get_mode_transition_duration")] #[doc(alias = "get_mode_transition_duration")] fn mode_transition_duration(&self) -> u32; #[doc(alias = "hdy_leaflet_get_transition_type")] #[doc(alias = "get_transition_type")] fn transition_type(&self) -> LeafletTransitionType; #[doc(alias = "hdy_leaflet_get_visible_child")] #[doc(alias = "get_visible_child")] fn visible_child(&self) -> Option; #[doc(alias = "hdy_leaflet_get_visible_child_name")] #[doc(alias = "get_visible_child_name")] fn visible_child_name(&self) -> Option; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_leaflet_insert_child_after")] fn insert_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ); #[doc(alias = "hdy_leaflet_navigate")] fn navigate(&self, direction: NavigationDirection) -> bool; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_leaflet_prepend")] fn prepend>(&self, child: &P); #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_leaflet_reorder_child_after")] fn reorder_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ); #[doc(alias = "hdy_leaflet_set_can_swipe_back")] fn set_can_swipe_back(&self, can_swipe_back: bool); #[doc(alias = "hdy_leaflet_set_can_swipe_forward")] fn set_can_swipe_forward(&self, can_swipe_forward: bool); #[doc(alias = "hdy_leaflet_set_child_transition_duration")] fn set_child_transition_duration(&self, duration: u32); #[doc(alias = "hdy_leaflet_set_homogeneous")] fn set_homogeneous(&self, folded: bool, orientation: gtk::Orientation, homogeneous: bool); #[doc(alias = "hdy_leaflet_set_interpolate_size")] fn set_interpolate_size(&self, interpolate_size: bool); #[doc(alias = "hdy_leaflet_set_mode_transition_duration")] fn set_mode_transition_duration(&self, duration: u32); #[doc(alias = "hdy_leaflet_set_transition_type")] fn set_transition_type(&self, transition: LeafletTransitionType); #[doc(alias = "hdy_leaflet_set_visible_child")] fn set_visible_child>(&self, visible_child: &P); #[doc(alias = "hdy_leaflet_set_visible_child_name")] fn set_visible_child_name(&self, name: &str); #[doc(alias = "hhomogeneous-folded")] fn is_hhomogeneous_folded(&self) -> bool; #[doc(alias = "hhomogeneous-folded")] fn set_hhomogeneous_folded(&self, hhomogeneous_folded: bool); #[doc(alias = "hhomogeneous-unfolded")] fn is_hhomogeneous_unfolded(&self) -> bool; #[doc(alias = "hhomogeneous-unfolded")] fn set_hhomogeneous_unfolded(&self, hhomogeneous_unfolded: bool); #[doc(alias = "vhomogeneous-folded")] fn is_vhomogeneous_folded(&self) -> bool; #[doc(alias = "vhomogeneous-folded")] fn set_vhomogeneous_folded(&self, vhomogeneous_folded: bool); #[doc(alias = "vhomogeneous-unfolded")] fn is_vhomogeneous_unfolded(&self) -> bool; #[doc(alias = "vhomogeneous-unfolded")] fn set_vhomogeneous_unfolded(&self, vhomogeneous_unfolded: bool); #[doc(alias = "child.icon-name")] fn child_icon_name>(&self, item: &T) -> Option; #[doc(alias = "child.icon-name")] fn set_child_icon_name>(&self, item: &T, icon_name: Option<&str>); fn child_name>(&self, item: &T) -> Option; fn set_child_name>(&self, item: &T, name: Option<&str>); #[doc(alias = "child.needs-attention")] fn child_needs_attention>(&self, item: &T) -> bool; #[doc(alias = "child.needs-attention")] fn set_child_needs_attention>(&self, item: &T, needs_attention: bool); fn child_position>(&self, item: &T) -> i32; fn set_child_position>(&self, item: &T, position: i32); fn child_title>(&self, item: &T) -> Option; fn set_child_title>(&self, item: &T, title: Option<&str>); #[doc(alias = "can-swipe-back")] fn connect_can_swipe_back_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "can-swipe-forward")] fn connect_can_swipe_forward_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "child-transition-duration")] fn connect_child_transition_duration_notify( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "child-transition-running")] fn connect_child_transition_running_notify( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "folded")] fn connect_folded_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "hhomogeneous-folded")] fn connect_hhomogeneous_folded_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "hhomogeneous-unfolded")] fn connect_hhomogeneous_unfolded_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "interpolate-size")] fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "mode-transition-duration")] fn connect_mode_transition_duration_notify( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "transition-type")] fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "vhomogeneous-folded")] fn connect_vhomogeneous_folded_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "vhomogeneous-unfolded")] fn connect_vhomogeneous_unfolded_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "visible-child")] fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "visible-child-name")] fn connect_visible_child_name_notify(&self, f: F) -> SignalHandlerId; } impl> LeafletExt for O { fn adjacent_child(&self, direction: NavigationDirection) -> Option { unsafe { from_glib_none(ffi::hdy_leaflet_get_adjacent_child( self.as_ref().to_glib_none().0, direction.into_glib(), )) } } fn can_swipe_back(&self) -> bool { unsafe { from_glib(ffi::hdy_leaflet_get_can_swipe_back( self.as_ref().to_glib_none().0, )) } } fn can_swipe_forward(&self) -> bool { unsafe { from_glib(ffi::hdy_leaflet_get_can_swipe_forward( self.as_ref().to_glib_none().0, )) } } fn child_by_name(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::hdy_leaflet_get_child_by_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, )) } } fn child_transition_duration(&self) -> u32 { unsafe { ffi::hdy_leaflet_get_child_transition_duration(self.as_ref().to_glib_none().0) } } fn is_child_transition_running(&self) -> bool { unsafe { from_glib(ffi::hdy_leaflet_get_child_transition_running( self.as_ref().to_glib_none().0, )) } } fn is_folded(&self) -> bool { unsafe { from_glib(ffi::hdy_leaflet_get_folded(self.as_ref().to_glib_none().0)) } } fn is_homogeneous(&self, folded: bool, orientation: gtk::Orientation) -> bool { unsafe { from_glib(ffi::hdy_leaflet_get_homogeneous( self.as_ref().to_glib_none().0, folded.into_glib(), orientation.into_glib(), )) } } fn is_interpolate_size(&self) -> bool { unsafe { from_glib(ffi::hdy_leaflet_get_interpolate_size( self.as_ref().to_glib_none().0, )) } } fn mode_transition_duration(&self) -> u32 { unsafe { ffi::hdy_leaflet_get_mode_transition_duration(self.as_ref().to_glib_none().0) } } fn transition_type(&self) -> LeafletTransitionType { unsafe { from_glib(ffi::hdy_leaflet_get_transition_type( self.as_ref().to_glib_none().0, )) } } fn visible_child(&self) -> Option { unsafe { from_glib_none(ffi::hdy_leaflet_get_visible_child( self.as_ref().to_glib_none().0, )) } } fn visible_child_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_leaflet_get_visible_child_name( self.as_ref().to_glib_none().0, )) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn insert_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ) { unsafe { ffi::hdy_leaflet_insert_child_after( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } fn navigate(&self, direction: NavigationDirection) -> bool { unsafe { from_glib(ffi::hdy_leaflet_navigate( self.as_ref().to_glib_none().0, direction.into_glib(), )) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn prepend>(&self, child: &P) { unsafe { ffi::hdy_leaflet_prepend( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] fn reorder_child_after, Q: IsA>( &self, child: &P, sibling: Option<&Q>, ) { unsafe { ffi::hdy_leaflet_reorder_child_after( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, sibling.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_can_swipe_back(&self, can_swipe_back: bool) { unsafe { ffi::hdy_leaflet_set_can_swipe_back( self.as_ref().to_glib_none().0, can_swipe_back.into_glib(), ); } } fn set_can_swipe_forward(&self, can_swipe_forward: bool) { unsafe { ffi::hdy_leaflet_set_can_swipe_forward( self.as_ref().to_glib_none().0, can_swipe_forward.into_glib(), ); } } fn set_child_transition_duration(&self, duration: u32) { unsafe { ffi::hdy_leaflet_set_child_transition_duration( self.as_ref().to_glib_none().0, duration, ); } } fn set_homogeneous(&self, folded: bool, orientation: gtk::Orientation, homogeneous: bool) { unsafe { ffi::hdy_leaflet_set_homogeneous( self.as_ref().to_glib_none().0, folded.into_glib(), orientation.into_glib(), homogeneous.into_glib(), ); } } fn set_interpolate_size(&self, interpolate_size: bool) { unsafe { ffi::hdy_leaflet_set_interpolate_size( self.as_ref().to_glib_none().0, interpolate_size.into_glib(), ); } } fn set_mode_transition_duration(&self, duration: u32) { unsafe { ffi::hdy_leaflet_set_mode_transition_duration(self.as_ref().to_glib_none().0, duration); } } fn set_transition_type(&self, transition: LeafletTransitionType) { unsafe { ffi::hdy_leaflet_set_transition_type( self.as_ref().to_glib_none().0, transition.into_glib(), ); } } fn set_visible_child>(&self, visible_child: &P) { unsafe { ffi::hdy_leaflet_set_visible_child( self.as_ref().to_glib_none().0, visible_child.as_ref().to_glib_none().0, ); } } fn set_visible_child_name(&self, name: &str) { unsafe { ffi::hdy_leaflet_set_visible_child_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } fn is_hhomogeneous_folded(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"hhomogeneous-folded\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `hhomogeneous-folded` getter") } } fn set_hhomogeneous_folded(&self, hhomogeneous_folded: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"hhomogeneous-folded\0".as_ptr() as *const _, hhomogeneous_folded.to_value().to_glib_none().0, ); } } fn is_hhomogeneous_unfolded(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"hhomogeneous-unfolded\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `hhomogeneous-unfolded` getter") } } fn set_hhomogeneous_unfolded(&self, hhomogeneous_unfolded: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"hhomogeneous-unfolded\0".as_ptr() as *const _, hhomogeneous_unfolded.to_value().to_glib_none().0, ); } } fn is_vhomogeneous_folded(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"vhomogeneous-folded\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `vhomogeneous-folded` getter") } } fn set_vhomogeneous_folded(&self, vhomogeneous_folded: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"vhomogeneous-folded\0".as_ptr() as *const _, vhomogeneous_folded.to_value().to_glib_none().0, ); } } fn is_vhomogeneous_unfolded(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"vhomogeneous-unfolded\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `vhomogeneous-unfolded` getter") } } fn set_vhomogeneous_unfolded(&self, vhomogeneous_unfolded: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"vhomogeneous-unfolded\0".as_ptr() as *const _, vhomogeneous_unfolded.to_value().to_glib_none().0, ); } } fn child_icon_name>(&self, item: &T) -> Option { unsafe { let mut value = glib::Value::from_type(::static_type()); gtk::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"icon-name\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `icon-name` getter") } } fn set_child_icon_name>(&self, item: &T, icon_name: Option<&str>) { unsafe { gtk::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"icon-name\0".as_ptr() as *const _, icon_name.to_value().to_glib_none().0, ); } } fn child_name>(&self, item: &T) -> Option { unsafe { let mut value = glib::Value::from_type(::static_type()); gtk::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"name\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `name` getter") } } fn set_child_name>(&self, item: &T, name: Option<&str>) { unsafe { gtk::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"name\0".as_ptr() as *const _, name.to_value().to_glib_none().0, ); } } fn child_needs_attention>(&self, item: &T) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); gtk::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"needs-attention\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `needs-attention` getter") } } fn set_child_needs_attention>(&self, item: &T, needs_attention: bool) { unsafe { gtk::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"needs-attention\0".as_ptr() as *const _, needs_attention.to_value().to_glib_none().0, ); } } fn child_position>(&self, item: &T) -> i32 { unsafe { let mut value = glib::Value::from_type(::static_type()); gtk::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"position\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `position` getter") } } fn set_child_position>(&self, item: &T, position: i32) { unsafe { gtk::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"position\0".as_ptr() as *const _, position.to_value().to_glib_none().0, ); } } fn child_title>(&self, item: &T) -> Option { unsafe { let mut value = glib::Value::from_type(::static_type()); gtk::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"title\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `title` getter") } } fn set_child_title>(&self, item: &T, title: Option<&str>) { unsafe { gtk::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut gtk::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"title\0".as_ptr() as *const _, title.to_value().to_glib_none().0, ); } } fn connect_can_swipe_back_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_swipe_back_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::can-swipe-back\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_can_swipe_back_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_can_swipe_forward_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_swipe_forward_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::can-swipe-forward\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_can_swipe_forward_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_child_transition_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_child_transition_duration_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::child-transition-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_child_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_child_transition_running_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_child_transition_running_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::child-transition-running\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_child_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_folded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_folded_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::folded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_folded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_hhomogeneous_folded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hhomogeneous_folded_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hhomogeneous-folded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_hhomogeneous_folded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_hhomogeneous_unfolded_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_hhomogeneous_unfolded_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hhomogeneous-unfolded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_hhomogeneous_unfolded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interpolate_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::interpolate-size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_interpolate_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_mode_transition_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_mode_transition_duration_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::mode-transition-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_mode_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-type\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_vhomogeneous_folded_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_vhomogeneous_folded_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::vhomogeneous-folded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_vhomogeneous_folded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_vhomogeneous_unfolded_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_vhomogeneous_unfolded_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::vhomogeneous-unfolded\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_vhomogeneous_unfolded_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::visible-child\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_visible_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_visible_child_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyLeaflet, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Leaflet::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::visible-child-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_visible_child_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Leaflet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Leaflet") } } libhandy-0.8.0/src/auto/mod.rs000064400000000000000000000154710000000000000142740ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT mod action_row; pub use self::action_row::ActionRowBuilder; pub use self::action_row::{ActionRow, NONE_ACTION_ROW}; mod application_window; pub use self::application_window::ApplicationWindowBuilder; pub use self::application_window::{ApplicationWindow, NONE_APPLICATION_WINDOW}; mod avatar; pub use self::avatar::Avatar; pub use self::avatar::AvatarBuilder; mod carousel; pub use self::carousel::Carousel; pub use self::carousel::CarouselBuilder; mod carousel_indicator_dots; pub use self::carousel_indicator_dots::CarouselIndicatorDots; pub use self::carousel_indicator_dots::CarouselIndicatorDotsBuilder; mod carousel_indicator_lines; pub use self::carousel_indicator_lines::CarouselIndicatorLines; pub use self::carousel_indicator_lines::CarouselIndicatorLinesBuilder; mod clamp; pub use self::clamp::Clamp; pub use self::clamp::ClampBuilder; mod combo_row; pub use self::combo_row::ComboRowBuilder; pub use self::combo_row::{ComboRow, NONE_COMBO_ROW}; mod deck; pub use self::deck::DeckBuilder; pub use self::deck::{Deck, NONE_DECK}; mod enum_value_object; pub use self::enum_value_object::EnumValueObject; mod expander_row; pub use self::expander_row::ExpanderRowBuilder; pub use self::expander_row::{ExpanderRow, NONE_EXPANDER_ROW}; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] mod flap; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::flap::Flap; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::flap::FlapBuilder; mod header_bar; pub use self::header_bar::HeaderBarBuilder; pub use self::header_bar::{HeaderBar, NONE_HEADER_BAR}; mod header_group; pub use self::header_group::HeaderGroup; pub use self::header_group::HeaderGroupBuilder; mod header_group_child; pub use self::header_group_child::HeaderGroupChild; mod keypad; pub use self::keypad::KeypadBuilder; pub use self::keypad::{Keypad, NONE_KEYPAD}; mod leaflet; pub use self::leaflet::LeafletBuilder; pub use self::leaflet::{Leaflet, NONE_LEAFLET}; mod preferences_group; pub use self::preferences_group::PreferencesGroupBuilder; pub use self::preferences_group::{PreferencesGroup, NONE_PREFERENCES_GROUP}; mod preferences_page; pub use self::preferences_page::PreferencesPageBuilder; pub use self::preferences_page::{PreferencesPage, NONE_PREFERENCES_PAGE}; mod preferences_row; pub use self::preferences_row::PreferencesRowBuilder; pub use self::preferences_row::{PreferencesRow, NONE_PREFERENCES_ROW}; mod preferences_window; pub use self::preferences_window::PreferencesWindowBuilder; pub use self::preferences_window::{PreferencesWindow, NONE_PREFERENCES_WINDOW}; mod search_bar; pub use self::search_bar::SearchBarBuilder; pub use self::search_bar::{SearchBar, NONE_SEARCH_BAR}; mod squeezer; pub use self::squeezer::Squeezer; pub use self::squeezer::SqueezerBuilder; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] mod status_page; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::status_page::StatusPage; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::status_page::StatusPageBuilder; mod swipe_group; pub use self::swipe_group::SwipeGroup; mod swipe_tracker; pub use self::swipe_tracker::SwipeTracker; pub use self::swipe_tracker::SwipeTrackerBuilder; mod swipeable; pub use self::swipeable::{Swipeable, NONE_SWIPEABLE}; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] mod tab_bar; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::tab_bar::TabBar; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::tab_bar::TabBarBuilder; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] mod tab_page; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::tab_page::TabPage; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::tab_page::TabPageBuilder; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] mod tab_view; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::tab_view::TabView; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::tab_view::TabViewBuilder; mod title_bar; pub use self::title_bar::TitleBar; pub use self::title_bar::TitleBarBuilder; mod value_object; pub use self::value_object::ValueObject; mod view_switcher; pub use self::view_switcher::ViewSwitcher; pub use self::view_switcher::ViewSwitcherBuilder; mod view_switcher_bar; pub use self::view_switcher_bar::ViewSwitcherBar; pub use self::view_switcher_bar::ViewSwitcherBarBuilder; mod view_switcher_title; pub use self::view_switcher_title::ViewSwitcherTitle; pub use self::view_switcher_title::ViewSwitcherTitleBuilder; mod window; pub use self::window::WindowBuilder; pub use self::window::{Window, NONE_WINDOW}; mod window_handle; pub use self::window_handle::WindowHandle; pub use self::window_handle::WindowHandleBuilder; mod enums; pub use self::enums::CenteringPolicy; pub use self::enums::DeckTransitionType; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::enums::FlapFoldPolicy; #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub use self::enums::FlapTransitionType; pub use self::enums::HeaderGroupChildType; pub use self::enums::LeafletTransitionType; pub use self::enums::NavigationDirection; pub use self::enums::SqueezerTransitionType; pub use self::enums::ViewSwitcherPolicy; pub mod functions; #[doc(hidden)] pub mod traits { pub use super::action_row::ActionRowExt; pub use super::combo_row::ComboRowExt; pub use super::deck::DeckExt; pub use super::expander_row::ExpanderRowExt; pub use super::header_bar::HeaderBarExt; pub use super::keypad::KeypadExt; pub use super::leaflet::LeafletExt; pub use super::preferences_group::PreferencesGroupExt; pub use super::preferences_page::PreferencesPageExt; pub use super::preferences_row::PreferencesRowExt; pub use super::preferences_window::PreferencesWindowExt; pub use super::search_bar::SearchBarExt; pub use super::swipeable::SwipeableExt; } libhandy-0.8.0/src/auto/preferences_group.rs000064400000000000000000000414560000000000000172340ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyPreferencesGroup")] pub struct PreferencesGroup(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_preferences_group_get_type(), } } impl PreferencesGroup { #[doc(alias = "hdy_preferences_group_new")] pub fn new() -> PreferencesGroup { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_preferences_group_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesGroup`] objects. /// /// This method returns an instance of [`PreferencesGroupBuilder`] which can be used to create [`PreferencesGroup`] objects. pub fn builder() -> PreferencesGroupBuilder { PreferencesGroupBuilder::default() } } impl Default for PreferencesGroup { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesGroup`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct PreferencesGroupBuilder { description: Option, title: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl PreferencesGroupBuilder { // rustdoc-stripper-ignore-next /// Create a new [`PreferencesGroupBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`PreferencesGroup`]. pub fn build(self) -> PreferencesGroup { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref description) = self.description { properties.push(("description", description)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of PreferencesGroup") } pub fn description(mut self, description: &str) -> Self { self.description = Some(description.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_PREFERENCES_GROUP: Option<&PreferencesGroup> = None; pub trait PreferencesGroupExt: 'static { #[doc(alias = "hdy_preferences_group_get_description")] #[doc(alias = "get_description")] fn description(&self) -> Option; #[doc(alias = "hdy_preferences_group_get_title")] #[doc(alias = "get_title")] fn title(&self) -> Option; #[doc(alias = "hdy_preferences_group_set_description")] fn set_description(&self, description: &str); #[doc(alias = "hdy_preferences_group_set_title")] fn set_title(&self, title: &str); #[doc(alias = "description")] fn connect_description_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId; } impl> PreferencesGroupExt for O { fn description(&self) -> Option { unsafe { from_glib_none(ffi::hdy_preferences_group_get_description( self.as_ref().to_glib_none().0, )) } } fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_preferences_group_get_title( self.as_ref().to_glib_none().0, )) } } fn set_description(&self, description: &str) { unsafe { ffi::hdy_preferences_group_set_description( self.as_ref().to_glib_none().0, description.to_glib_none().0, ); } } fn set_title(&self, title: &str) { unsafe { ffi::hdy_preferences_group_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } fn connect_description_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_description_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::description\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_description_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for PreferencesGroup { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("PreferencesGroup") } } libhandy-0.8.0/src/auto/preferences_page.rs000064400000000000000000000413540000000000000170110ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyPreferencesPage")] pub struct PreferencesPage(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_preferences_page_get_type(), } } impl PreferencesPage { #[doc(alias = "hdy_preferences_page_new")] pub fn new() -> PreferencesPage { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_preferences_page_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesPage`] objects. /// /// This method returns an instance of [`PreferencesPageBuilder`] which can be used to create [`PreferencesPage`] objects. pub fn builder() -> PreferencesPageBuilder { PreferencesPageBuilder::default() } } impl Default for PreferencesPage { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesPage`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct PreferencesPageBuilder { icon_name: Option, title: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl PreferencesPageBuilder { // rustdoc-stripper-ignore-next /// Create a new [`PreferencesPageBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`PreferencesPage`]. pub fn build(self) -> PreferencesPage { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of PreferencesPage") } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_PREFERENCES_PAGE: Option<&PreferencesPage> = None; pub trait PreferencesPageExt: 'static { #[doc(alias = "hdy_preferences_page_get_icon_name")] #[doc(alias = "get_icon_name")] fn icon_name(&self) -> Option; #[doc(alias = "hdy_preferences_page_get_title")] #[doc(alias = "get_title")] fn title(&self) -> Option; #[doc(alias = "hdy_preferences_page_set_icon_name")] fn set_icon_name(&self, icon_name: Option<&str>); #[doc(alias = "hdy_preferences_page_set_title")] fn set_title(&self, title: Option<&str>); #[doc(alias = "icon-name")] fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId; } impl> PreferencesPageExt for O { fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_preferences_page_get_icon_name( self.as_ref().to_glib_none().0, )) } } fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_preferences_page_get_title( self.as_ref().to_glib_none().0, )) } } fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::hdy_preferences_page_set_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } fn set_title(&self, title: Option<&str>) { unsafe { ffi::hdy_preferences_page_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for PreferencesPage { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("PreferencesPage") } } libhandy-0.8.0/src/auto/preferences_row.rs000064400000000000000000000436600000000000000167060ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyPreferencesRow")] pub struct PreferencesRow(Object) @extends gtk::ListBoxRow, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Actionable; match fn { type_ => || ffi::hdy_preferences_row_get_type(), } } impl PreferencesRow { #[doc(alias = "hdy_preferences_row_new")] pub fn new() -> PreferencesRow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_preferences_row_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesRow`] objects. /// /// This method returns an instance of [`PreferencesRowBuilder`] which can be used to create [`PreferencesRow`] objects. pub fn builder() -> PreferencesRowBuilder { PreferencesRowBuilder::default() } } impl Default for PreferencesRow { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesRow`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct PreferencesRowBuilder { title: Option, use_underline: Option, activatable: Option, selectable: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, action_name: Option, action_target: Option, } impl PreferencesRowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`PreferencesRowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`PreferencesRow`]. pub fn build(self) -> PreferencesRow { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref use_underline) = self.use_underline { properties.push(("use-underline", use_underline)); } if let Some(ref activatable) = self.activatable { properties.push(("activatable", activatable)); } if let Some(ref selectable) = self.selectable { properties.push(("selectable", selectable)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref action_name) = self.action_name { properties.push(("action-name", action_name)); } if let Some(ref action_target) = self.action_target { properties.push(("action-target", action_target)); } glib::Object::new::(&properties) .expect("Failed to create an instance of PreferencesRow") } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn use_underline(mut self, use_underline: bool) -> Self { self.use_underline = Some(use_underline); self } pub fn activatable(mut self, activatable: bool) -> Self { self.activatable = Some(activatable); self } pub fn selectable(mut self, selectable: bool) -> Self { self.selectable = Some(selectable); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn action_name(mut self, action_name: &str) -> Self { self.action_name = Some(action_name.to_string()); self } pub fn action_target(mut self, action_target: &glib::Variant) -> Self { self.action_target = Some(action_target.clone()); self } } pub const NONE_PREFERENCES_ROW: Option<&PreferencesRow> = None; pub trait PreferencesRowExt: 'static { #[doc(alias = "hdy_preferences_row_get_title")] #[doc(alias = "get_title")] fn title(&self) -> Option; #[doc(alias = "hdy_preferences_row_get_use_underline")] #[doc(alias = "get_use_underline")] fn uses_underline(&self) -> bool; #[doc(alias = "hdy_preferences_row_set_title")] fn set_title(&self, title: Option<&str>); #[doc(alias = "hdy_preferences_row_set_use_underline")] fn set_use_underline(&self, use_underline: bool); #[doc(alias = "title")] fn connect_title_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "use-underline")] fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId; } impl> PreferencesRowExt for O { fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_preferences_row_get_title( self.as_ref().to_glib_none().0, )) } } fn uses_underline(&self) -> bool { unsafe { from_glib(ffi::hdy_preferences_row_get_use_underline( self.as_ref().to_glib_none().0, )) } } fn set_title(&self, title: Option<&str>) { unsafe { ffi::hdy_preferences_row_set_title( self.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } fn set_use_underline(&self, use_underline: bool) { unsafe { ffi::hdy_preferences_row_set_use_underline( self.as_ref().to_glib_none().0, use_underline.into_glib(), ); } } fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_use_underline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_use_underline_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesRow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::use-underline\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_use_underline_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for PreferencesRow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("PreferencesRow") } } libhandy-0.8.0/src/auto/preferences_window.rs000064400000000000000000000613150000000000000174030ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::Window; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyPreferencesWindow")] pub struct PreferencesWindow(Object) @extends Window, gtk::Window, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_preferences_window_get_type(), } } impl PreferencesWindow { #[doc(alias = "hdy_preferences_window_new")] pub fn new() -> PreferencesWindow { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_preferences_window_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`PreferencesWindow`] objects. /// /// This method returns an instance of [`PreferencesWindowBuilder`] which can be used to create [`PreferencesWindow`] objects. pub fn builder() -> PreferencesWindowBuilder { PreferencesWindowBuilder::default() } } impl Default for PreferencesWindow { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`PreferencesWindow`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct PreferencesWindowBuilder { can_swipe_back: Option, search_enabled: Option, accept_focus: Option, //application: /*Unknown type*/, attached_to: Option, decorated: Option, default_height: Option, default_width: Option, deletable: Option, destroy_with_parent: Option, focus_on_map: Option, focus_visible: Option, //gravity: /*Unknown type*/, has_resize_grip: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, //screen: /*Unknown type*/, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, //type: /*Unknown type*/, //type-hint: /*Unknown type*/, urgency_hint: Option, //window-position: /*Unknown type*/, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl PreferencesWindowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`PreferencesWindowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`PreferencesWindow`]. pub fn build(self) -> PreferencesWindow { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref can_swipe_back) = self.can_swipe_back { properties.push(("can-swipe-back", can_swipe_back)); } if let Some(ref search_enabled) = self.search_enabled { properties.push(("search-enabled", search_enabled)); } if let Some(ref accept_focus) = self.accept_focus { properties.push(("accept-focus", accept_focus)); } if let Some(ref attached_to) = self.attached_to { properties.push(("attached-to", attached_to)); } if let Some(ref decorated) = self.decorated { properties.push(("decorated", decorated)); } if let Some(ref default_height) = self.default_height { properties.push(("default-height", default_height)); } if let Some(ref default_width) = self.default_width { properties.push(("default-width", default_width)); } if let Some(ref deletable) = self.deletable { properties.push(("deletable", deletable)); } if let Some(ref destroy_with_parent) = self.destroy_with_parent { properties.push(("destroy-with-parent", destroy_with_parent)); } if let Some(ref focus_on_map) = self.focus_on_map { properties.push(("focus-on-map", focus_on_map)); } if let Some(ref focus_visible) = self.focus_visible { properties.push(("focus-visible", focus_visible)); } if let Some(ref has_resize_grip) = self.has_resize_grip { properties.push(("has-resize-grip", has_resize_grip)); } if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized { properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized)); } if let Some(ref icon) = self.icon { properties.push(("icon", icon)); } if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref mnemonics_visible) = self.mnemonics_visible { properties.push(("mnemonics-visible", mnemonics_visible)); } if let Some(ref modal) = self.modal { properties.push(("modal", modal)); } if let Some(ref resizable) = self.resizable { properties.push(("resizable", resizable)); } if let Some(ref role) = self.role { properties.push(("role", role)); } if let Some(ref skip_pager_hint) = self.skip_pager_hint { properties.push(("skip-pager-hint", skip_pager_hint)); } if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint { properties.push(("skip-taskbar-hint", skip_taskbar_hint)); } if let Some(ref startup_id) = self.startup_id { properties.push(("startup-id", startup_id)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref transient_for) = self.transient_for { properties.push(("transient-for", transient_for)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of PreferencesWindow") } pub fn can_swipe_back(mut self, can_swipe_back: bool) -> Self { self.can_swipe_back = Some(can_swipe_back); self } pub fn search_enabled(mut self, search_enabled: bool) -> Self { self.search_enabled = Some(search_enabled); self } pub fn accept_focus(mut self, accept_focus: bool) -> Self { self.accept_focus = Some(accept_focus); self } pub fn attached_to>(mut self, attached_to: &P) -> Self { self.attached_to = Some(attached_to.clone().upcast()); self } pub fn decorated(mut self, decorated: bool) -> Self { self.decorated = Some(decorated); self } pub fn default_height(mut self, default_height: i32) -> Self { self.default_height = Some(default_height); self } pub fn default_width(mut self, default_width: i32) -> Self { self.default_width = Some(default_width); self } pub fn deletable(mut self, deletable: bool) -> Self { self.deletable = Some(deletable); self } pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self { self.destroy_with_parent = Some(destroy_with_parent); self } pub fn focus_on_map(mut self, focus_on_map: bool) -> Self { self.focus_on_map = Some(focus_on_map); self } pub fn focus_visible(mut self, focus_visible: bool) -> Self { self.focus_visible = Some(focus_visible); self } pub fn has_resize_grip(mut self, has_resize_grip: bool) -> Self { self.has_resize_grip = Some(has_resize_grip); self } pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self { self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized); self } pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self { self.icon = Some(icon.clone()); self } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self { self.mnemonics_visible = Some(mnemonics_visible); self } pub fn modal(mut self, modal: bool) -> Self { self.modal = Some(modal); self } pub fn resizable(mut self, resizable: bool) -> Self { self.resizable = Some(resizable); self } pub fn role(mut self, role: &str) -> Self { self.role = Some(role.to_string()); self } pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self { self.skip_pager_hint = Some(skip_pager_hint); self } pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self { self.skip_taskbar_hint = Some(skip_taskbar_hint); self } pub fn startup_id(mut self, startup_id: &str) -> Self { self.startup_id = Some(startup_id.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn transient_for>(mut self, transient_for: &P) -> Self { self.transient_for = Some(transient_for.clone().upcast()); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_PREFERENCES_WINDOW: Option<&PreferencesWindow> = None; pub trait PreferencesWindowExt: 'static { #[doc(alias = "hdy_preferences_window_close_subpage")] fn close_subpage(&self); #[doc(alias = "hdy_preferences_window_get_can_swipe_back")] #[doc(alias = "get_can_swipe_back")] fn can_swipe_back(&self) -> bool; #[doc(alias = "hdy_preferences_window_get_search_enabled")] #[doc(alias = "get_search_enabled")] fn is_search_enabled(&self) -> bool; #[doc(alias = "hdy_preferences_window_present_subpage")] fn present_subpage>(&self, subpage: &P); #[doc(alias = "hdy_preferences_window_set_can_swipe_back")] fn set_can_swipe_back(&self, can_swipe_back: bool); #[doc(alias = "hdy_preferences_window_set_search_enabled")] fn set_search_enabled(&self, search_enabled: bool); #[doc(alias = "can-swipe-back")] fn connect_can_swipe_back_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "search-enabled")] fn connect_search_enabled_notify(&self, f: F) -> SignalHandlerId; } impl> PreferencesWindowExt for O { fn close_subpage(&self) { unsafe { ffi::hdy_preferences_window_close_subpage(self.as_ref().to_glib_none().0); } } fn can_swipe_back(&self) -> bool { unsafe { from_glib(ffi::hdy_preferences_window_get_can_swipe_back( self.as_ref().to_glib_none().0, )) } } fn is_search_enabled(&self) -> bool { unsafe { from_glib(ffi::hdy_preferences_window_get_search_enabled( self.as_ref().to_glib_none().0, )) } } fn present_subpage>(&self, subpage: &P) { unsafe { ffi::hdy_preferences_window_present_subpage( self.as_ref().to_glib_none().0, subpage.as_ref().to_glib_none().0, ); } } fn set_can_swipe_back(&self, can_swipe_back: bool) { unsafe { ffi::hdy_preferences_window_set_can_swipe_back( self.as_ref().to_glib_none().0, can_swipe_back.into_glib(), ); } } fn set_search_enabled(&self, search_enabled: bool) { unsafe { ffi::hdy_preferences_window_set_search_enabled( self.as_ref().to_glib_none().0, search_enabled.into_glib(), ); } } fn connect_can_swipe_back_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_can_swipe_back_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::can-swipe-back\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_can_swipe_back_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_search_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_enabled_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdyPreferencesWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(PreferencesWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::search-enabled\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_search_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for PreferencesWindow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("PreferencesWindow") } } libhandy-0.8.0/src/auto/search_bar.rs000064400000000000000000000451440000000000000156060ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdySearchBar")] pub struct SearchBar(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_search_bar_get_type(), } } impl SearchBar { #[doc(alias = "hdy_search_bar_new")] pub fn new() -> SearchBar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_search_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SearchBar`] objects. /// /// This method returns an instance of [`SearchBarBuilder`] which can be used to create [`SearchBar`] objects. pub fn builder() -> SearchBarBuilder { SearchBarBuilder::default() } } impl Default for SearchBar { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SearchBar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct SearchBarBuilder { search_mode_enabled: Option, show_close_button: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl SearchBarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`SearchBarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`SearchBar`]. pub fn build(self) -> SearchBar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref search_mode_enabled) = self.search_mode_enabled { properties.push(("search-mode-enabled", search_mode_enabled)); } if let Some(ref show_close_button) = self.show_close_button { properties.push(("show-close-button", show_close_button)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of SearchBar") } pub fn search_mode_enabled(mut self, search_mode_enabled: bool) -> Self { self.search_mode_enabled = Some(search_mode_enabled); self } pub fn show_close_button(mut self, show_close_button: bool) -> Self { self.show_close_button = Some(show_close_button); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_SEARCH_BAR: Option<&SearchBar> = None; pub trait SearchBarExt: 'static { #[doc(alias = "hdy_search_bar_connect_entry")] fn connect_entry>(&self, entry: &P); #[doc(alias = "hdy_search_bar_get_search_mode")] #[doc(alias = "get_search_mode")] fn is_search_mode(&self) -> bool; #[doc(alias = "hdy_search_bar_get_show_close_button")] #[doc(alias = "get_show_close_button")] fn shows_close_button(&self) -> bool; #[doc(alias = "hdy_search_bar_handle_event")] fn handle_event(&self, event: &mut gdk::Event) -> bool; #[doc(alias = "hdy_search_bar_set_search_mode")] fn set_search_mode(&self, search_mode: bool); #[doc(alias = "hdy_search_bar_set_show_close_button")] fn set_show_close_button(&self, visible: bool); #[doc(alias = "search-mode-enabled")] fn is_search_mode_enabled(&self) -> bool; #[doc(alias = "search-mode-enabled")] fn set_search_mode_enabled(&self, search_mode_enabled: bool); #[doc(alias = "search-mode-enabled")] fn connect_search_mode_enabled_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-close-button")] fn connect_show_close_button_notify(&self, f: F) -> SignalHandlerId; } impl> SearchBarExt for O { fn connect_entry>(&self, entry: &P) { unsafe { ffi::hdy_search_bar_connect_entry( self.as_ref().to_glib_none().0, entry.as_ref().to_glib_none().0, ); } } fn is_search_mode(&self) -> bool { unsafe { from_glib(ffi::hdy_search_bar_get_search_mode( self.as_ref().to_glib_none().0, )) } } fn shows_close_button(&self) -> bool { unsafe { from_glib(ffi::hdy_search_bar_get_show_close_button( self.as_ref().to_glib_none().0, )) } } fn handle_event(&self, event: &mut gdk::Event) -> bool { unsafe { from_glib(ffi::hdy_search_bar_handle_event( self.as_ref().to_glib_none().0, event.to_glib_none_mut().0, )) } } fn set_search_mode(&self, search_mode: bool) { unsafe { ffi::hdy_search_bar_set_search_mode( self.as_ref().to_glib_none().0, search_mode.into_glib(), ); } } fn set_show_close_button(&self, visible: bool) { unsafe { ffi::hdy_search_bar_set_show_close_button( self.as_ref().to_glib_none().0, visible.into_glib(), ); } } fn is_search_mode_enabled(&self) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"search-mode-enabled\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `search-mode-enabled` getter") } } fn set_search_mode_enabled(&self, search_mode_enabled: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"search-mode-enabled\0".as_ptr() as *const _, search_mode_enabled.to_value().to_glib_none().0, ); } } fn connect_search_mode_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_search_mode_enabled_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdySearchBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::search-mode-enabled\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_search_mode_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_close_button_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_close_button_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::HdySearchBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(SearchBar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-close-button\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_close_button_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for SearchBar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("SearchBar") } } libhandy-0.8.0/src/auto/squeezer.rs000064400000000000000000000627570000000000000153710ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::SqueezerTransitionType; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdySqueezer")] pub struct Squeezer(Object) @extends gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable; match fn { type_ => || ffi::hdy_squeezer_get_type(), } } impl Squeezer { #[doc(alias = "hdy_squeezer_new")] pub fn new() -> Squeezer { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_squeezer_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Squeezer`] objects. /// /// This method returns an instance of [`SqueezerBuilder`] which can be used to create [`Squeezer`] objects. pub fn builder() -> SqueezerBuilder { SqueezerBuilder::default() } #[doc(alias = "hdy_squeezer_get_child_enabled")] #[doc(alias = "get_child_enabled")] pub fn is_child_enabled>(&self, child: &P) -> bool { unsafe { from_glib(ffi::hdy_squeezer_get_child_enabled( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_squeezer_get_homogeneous")] #[doc(alias = "get_homogeneous")] pub fn is_homogeneous(&self) -> bool { unsafe { from_glib(ffi::hdy_squeezer_get_homogeneous(self.to_glib_none().0)) } } #[doc(alias = "hdy_squeezer_get_interpolate_size")] #[doc(alias = "get_interpolate_size")] pub fn is_interpolate_size(&self) -> bool { unsafe { from_glib(ffi::hdy_squeezer_get_interpolate_size( self.to_glib_none().0, )) } } #[doc(alias = "hdy_squeezer_get_transition_duration")] #[doc(alias = "get_transition_duration")] pub fn transition_duration(&self) -> u32 { unsafe { ffi::hdy_squeezer_get_transition_duration(self.to_glib_none().0) } } #[doc(alias = "hdy_squeezer_get_transition_running")] #[doc(alias = "get_transition_running")] pub fn is_transition_running(&self) -> bool { unsafe { from_glib(ffi::hdy_squeezer_get_transition_running( self.to_glib_none().0, )) } } #[doc(alias = "hdy_squeezer_get_transition_type")] #[doc(alias = "get_transition_type")] pub fn transition_type(&self) -> SqueezerTransitionType { unsafe { from_glib(ffi::hdy_squeezer_get_transition_type(self.to_glib_none().0)) } } #[doc(alias = "hdy_squeezer_get_visible_child")] #[doc(alias = "get_visible_child")] pub fn visible_child(&self) -> Option { unsafe { from_glib_none(ffi::hdy_squeezer_get_visible_child(self.to_glib_none().0)) } } #[doc(alias = "hdy_squeezer_get_xalign")] #[doc(alias = "get_xalign")] pub fn xalign(&self) -> f32 { unsafe { ffi::hdy_squeezer_get_xalign(self.to_glib_none().0) } } #[doc(alias = "hdy_squeezer_get_yalign")] #[doc(alias = "get_yalign")] pub fn yalign(&self) -> f32 { unsafe { ffi::hdy_squeezer_get_yalign(self.to_glib_none().0) } } #[doc(alias = "hdy_squeezer_set_child_enabled")] pub fn set_child_enabled>(&self, child: &P, enabled: bool) { unsafe { ffi::hdy_squeezer_set_child_enabled( self.to_glib_none().0, child.as_ref().to_glib_none().0, enabled.into_glib(), ); } } #[doc(alias = "hdy_squeezer_set_homogeneous")] pub fn set_homogeneous(&self, homogeneous: bool) { unsafe { ffi::hdy_squeezer_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib()); } } #[doc(alias = "hdy_squeezer_set_interpolate_size")] pub fn set_interpolate_size(&self, interpolate_size: bool) { unsafe { ffi::hdy_squeezer_set_interpolate_size( self.to_glib_none().0, interpolate_size.into_glib(), ); } } #[doc(alias = "hdy_squeezer_set_transition_duration")] pub fn set_transition_duration(&self, duration: u32) { unsafe { ffi::hdy_squeezer_set_transition_duration(self.to_glib_none().0, duration); } } #[doc(alias = "hdy_squeezer_set_transition_type")] pub fn set_transition_type(&self, transition: SqueezerTransitionType) { unsafe { ffi::hdy_squeezer_set_transition_type(self.to_glib_none().0, transition.into_glib()); } } #[doc(alias = "hdy_squeezer_set_xalign")] pub fn set_xalign(&self, xalign: f32) { unsafe { ffi::hdy_squeezer_set_xalign(self.to_glib_none().0, xalign); } } #[doc(alias = "hdy_squeezer_set_yalign")] pub fn set_yalign(&self, yalign: f32) { unsafe { ffi::hdy_squeezer_set_yalign(self.to_glib_none().0, yalign); } } #[doc(alias = "homogeneous")] pub fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_homogeneous_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::homogeneous\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_homogeneous_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "interpolate-size")] pub fn connect_interpolate_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_interpolate_size_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::interpolate-size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_interpolate_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "transition-duration")] pub fn connect_transition_duration_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_transition_duration_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-duration\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_duration_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "transition-running")] pub fn connect_transition_running_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_transition_running_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-running\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_running_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "transition-type")] pub fn connect_transition_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_transition_type_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::transition-type\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_transition_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "visible-child")] pub fn connect_visible_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_visible_child_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::visible-child\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_visible_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "xalign")] pub fn connect_xalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_xalign_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::xalign\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_xalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "yalign")] pub fn connect_yalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_yalign_trampoline( this: *mut ffi::HdySqueezer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::yalign\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_yalign_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Squeezer { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Squeezer`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct SqueezerBuilder { homogeneous: Option, interpolate_size: Option, transition_duration: Option, transition_type: Option, xalign: Option, yalign: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl SqueezerBuilder { // rustdoc-stripper-ignore-next /// Create a new [`SqueezerBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Squeezer`]. pub fn build(self) -> Squeezer { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref homogeneous) = self.homogeneous { properties.push(("homogeneous", homogeneous)); } if let Some(ref interpolate_size) = self.interpolate_size { properties.push(("interpolate-size", interpolate_size)); } if let Some(ref transition_duration) = self.transition_duration { properties.push(("transition-duration", transition_duration)); } if let Some(ref transition_type) = self.transition_type { properties.push(("transition-type", transition_type)); } if let Some(ref xalign) = self.xalign { properties.push(("xalign", xalign)); } if let Some(ref yalign) = self.yalign { properties.push(("yalign", yalign)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties) .expect("Failed to create an instance of Squeezer") } pub fn homogeneous(mut self, homogeneous: bool) -> Self { self.homogeneous = Some(homogeneous); self } pub fn interpolate_size(mut self, interpolate_size: bool) -> Self { self.interpolate_size = Some(interpolate_size); self } pub fn transition_duration(mut self, transition_duration: u32) -> Self { self.transition_duration = Some(transition_duration); self } pub fn transition_type(mut self, transition_type: SqueezerTransitionType) -> Self { self.transition_type = Some(transition_type); self } pub fn xalign(mut self, xalign: f32) -> Self { self.xalign = Some(xalign); self } pub fn yalign(mut self, yalign: f32) -> Self { self.yalign = Some(yalign); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for Squeezer { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Squeezer") } } libhandy-0.8.0/src/auto/status_page.rs000064400000000000000000000451530000000000000160340ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyStatusPage")] pub struct StatusPage(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_status_page_get_type(), } } impl StatusPage { #[doc(alias = "hdy_status_page_new")] pub fn new() -> StatusPage { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_status_page_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`StatusPage`] objects. /// /// This method returns an instance of [`StatusPageBuilder`] which can be used to create [`StatusPage`] objects. pub fn builder() -> StatusPageBuilder { StatusPageBuilder::default() } #[doc(alias = "hdy_status_page_get_description")] #[doc(alias = "get_description")] pub fn description(&self) -> Option { unsafe { from_glib_none(ffi::hdy_status_page_get_description(self.to_glib_none().0)) } } #[doc(alias = "hdy_status_page_get_icon_name")] #[doc(alias = "get_icon_name")] pub fn icon_name(&self) -> Option { unsafe { from_glib_none(ffi::hdy_status_page_get_icon_name(self.to_glib_none().0)) } } #[doc(alias = "hdy_status_page_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_status_page_get_title(self.to_glib_none().0)) } } #[doc(alias = "hdy_status_page_set_description")] pub fn set_description(&self, description: Option<&str>) { unsafe { ffi::hdy_status_page_set_description( self.to_glib_none().0, description.to_glib_none().0, ); } } #[doc(alias = "hdy_status_page_set_icon_name")] pub fn set_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::hdy_status_page_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0); } } #[doc(alias = "hdy_status_page_set_title")] pub fn set_title(&self, title: Option<&str>) { unsafe { ffi::hdy_status_page_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "description")] pub fn connect_description_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_description_trampoline( this: *mut ffi::HdyStatusPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::description\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_description_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "icon-name")] pub fn connect_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_name_trampoline( this: *mut ffi::HdyStatusPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::HdyStatusPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl Default for StatusPage { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`StatusPage`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct StatusPageBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] description: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] icon_name: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] title: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl StatusPageBuilder { // rustdoc-stripper-ignore-next /// Create a new [`StatusPageBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`StatusPage`]. pub fn build(self) -> StatusPage { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref description) = self.description { properties.push(("description", description)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of StatusPage") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn description(mut self, description: &str) -> Self { self.description = Some(description.to_string()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for StatusPage { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("StatusPage") } } libhandy-0.8.0/src/auto/swipe_group.rs000064400000000000000000000034610000000000000160540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::Swipeable; use glib::object::IsA; use glib::translate::*; use std::fmt; glib::wrapper! { #[doc(alias = "HdySwipeGroup")] pub struct SwipeGroup(Object) @implements gtk::Buildable; match fn { type_ => || ffi::hdy_swipe_group_get_type(), } } impl SwipeGroup { #[doc(alias = "hdy_swipe_group_new")] pub fn new() -> SwipeGroup { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::hdy_swipe_group_new()) } } #[doc(alias = "hdy_swipe_group_add_swipeable")] pub fn add_swipeable>(&self, swipeable: &P) { unsafe { ffi::hdy_swipe_group_add_swipeable( self.to_glib_none().0, swipeable.as_ref().to_glib_none().0, ); } } #[doc(alias = "hdy_swipe_group_get_swipeables")] #[doc(alias = "get_swipeables")] pub fn swipeables(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::hdy_swipe_group_get_swipeables( self.to_glib_none().0, )) } } #[doc(alias = "hdy_swipe_group_remove_swipeable")] pub fn remove_swipeable>(&self, swipeable: &P) { unsafe { ffi::hdy_swipe_group_remove_swipeable( self.to_glib_none().0, swipeable.as_ref().to_glib_none().0, ); } } } impl Default for SwipeGroup { fn default() -> Self { Self::new() } } impl fmt::Display for SwipeGroup { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("SwipeGroup") } } libhandy-0.8.0/src/auto/swipe_tracker.rs000064400000000000000000000324130000000000000163520ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::NavigationDirection; use crate::Swipeable; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdySwipeTracker")] pub struct SwipeTracker(Object) @implements gtk::Orientable; match fn { type_ => || ffi::hdy_swipe_tracker_get_type(), } } impl SwipeTracker { #[doc(alias = "hdy_swipe_tracker_new")] pub fn new>(swipeable: &P) -> SwipeTracker { skip_assert_initialized!(); unsafe { from_glib_full(ffi::hdy_swipe_tracker_new( swipeable.as_ref().to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`SwipeTracker`] objects. /// /// This method returns an instance of [`SwipeTrackerBuilder`] which can be used to create [`SwipeTracker`] objects. pub fn builder() -> SwipeTrackerBuilder { SwipeTrackerBuilder::default() } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_swipe_tracker_get_allow_long_swipes")] #[doc(alias = "get_allow_long_swipes")] pub fn allows_long_swipes(&self) -> bool { unsafe { from_glib(ffi::hdy_swipe_tracker_get_allow_long_swipes( self.to_glib_none().0, )) } } #[doc(alias = "hdy_swipe_tracker_get_allow_mouse_drag")] #[doc(alias = "get_allow_mouse_drag")] pub fn allows_mouse_drag(&self) -> bool { unsafe { from_glib(ffi::hdy_swipe_tracker_get_allow_mouse_drag( self.to_glib_none().0, )) } } #[doc(alias = "hdy_swipe_tracker_get_enabled")] #[doc(alias = "get_enabled")] pub fn is_enabled(&self) -> bool { unsafe { from_glib(ffi::hdy_swipe_tracker_get_enabled(self.to_glib_none().0)) } } #[doc(alias = "hdy_swipe_tracker_get_reversed")] #[doc(alias = "get_reversed")] pub fn is_reversed(&self) -> bool { unsafe { from_glib(ffi::hdy_swipe_tracker_get_reversed(self.to_glib_none().0)) } } #[doc(alias = "hdy_swipe_tracker_get_swipeable")] #[doc(alias = "get_swipeable")] pub fn swipeable(&self) -> Option { unsafe { from_glib_none(ffi::hdy_swipe_tracker_get_swipeable(self.to_glib_none().0)) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "hdy_swipe_tracker_set_allow_long_swipes")] pub fn set_allow_long_swipes(&self, allow_long_swipes: bool) { unsafe { ffi::hdy_swipe_tracker_set_allow_long_swipes( self.to_glib_none().0, allow_long_swipes.into_glib(), ); } } #[doc(alias = "hdy_swipe_tracker_set_allow_mouse_drag")] pub fn set_allow_mouse_drag(&self, allow_mouse_drag: bool) { unsafe { ffi::hdy_swipe_tracker_set_allow_mouse_drag( self.to_glib_none().0, allow_mouse_drag.into_glib(), ); } } #[doc(alias = "hdy_swipe_tracker_set_enabled")] pub fn set_enabled(&self, enabled: bool) { unsafe { ffi::hdy_swipe_tracker_set_enabled(self.to_glib_none().0, enabled.into_glib()); } } #[doc(alias = "hdy_swipe_tracker_set_reversed")] pub fn set_reversed(&self, reversed: bool) { unsafe { ffi::hdy_swipe_tracker_set_reversed(self.to_glib_none().0, reversed.into_glib()); } } #[doc(alias = "hdy_swipe_tracker_shift_position")] pub fn shift_position(&self, delta: f64) { unsafe { ffi::hdy_swipe_tracker_shift_position(self.to_glib_none().0, delta); } } #[doc(alias = "begin-swipe")] pub fn connect_begin_swipe( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn begin_swipe_trampoline< F: Fn(&SwipeTracker, NavigationDirection, bool) + 'static, >( this: *mut ffi::HdySwipeTracker, direction: ffi::HdyNavigationDirection, direct: glib::ffi::gboolean, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), from_glib(direction), from_glib(direct), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"begin-swipe\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( begin_swipe_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "end-swipe")] pub fn connect_end_swipe(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn end_swipe_trampoline( this: *mut ffi::HdySwipeTracker, duration: i64, to: libc::c_double, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), duration, to) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"end-swipe\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( end_swipe_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "update-swipe")] pub fn connect_update_swipe(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn update_swipe_trampoline( this: *mut ffi::HdySwipeTracker, progress: libc::c_double, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), progress) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"update-swipe\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( update_swipe_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "allow-long-swipes")] pub fn connect_allow_long_swipes_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_allow_long_swipes_trampoline( this: *mut ffi::HdySwipeTracker, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::allow-long-swipes\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_allow_long_swipes_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "allow-mouse-drag")] pub fn connect_allow_mouse_drag_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_allow_mouse_drag_trampoline( this: *mut ffi::HdySwipeTracker, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::allow-mouse-drag\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_allow_mouse_drag_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "enabled")] pub fn connect_enabled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_enabled_trampoline( this: *mut ffi::HdySwipeTracker, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::enabled\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reversed")] pub fn connect_reversed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reversed_trampoline( this: *mut ffi::HdySwipeTracker, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reversed\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_reversed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`SwipeTracker`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct SwipeTrackerBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] allow_long_swipes: Option, allow_mouse_drag: Option, enabled: Option, reversed: Option, swipeable: Option, orientation: Option, } impl SwipeTrackerBuilder { // rustdoc-stripper-ignore-next /// Create a new [`SwipeTrackerBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`SwipeTracker`]. pub fn build(self) -> SwipeTracker { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref allow_long_swipes) = self.allow_long_swipes { properties.push(("allow-long-swipes", allow_long_swipes)); } if let Some(ref allow_mouse_drag) = self.allow_mouse_drag { properties.push(("allow-mouse-drag", allow_mouse_drag)); } if let Some(ref enabled) = self.enabled { properties.push(("enabled", enabled)); } if let Some(ref reversed) = self.reversed { properties.push(("reversed", reversed)); } if let Some(ref swipeable) = self.swipeable { properties.push(("swipeable", swipeable)); } if let Some(ref orientation) = self.orientation { properties.push(("orientation", orientation)); } glib::Object::new::(&properties) .expect("Failed to create an instance of SwipeTracker") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn allow_long_swipes(mut self, allow_long_swipes: bool) -> Self { self.allow_long_swipes = Some(allow_long_swipes); self } pub fn allow_mouse_drag(mut self, allow_mouse_drag: bool) -> Self { self.allow_mouse_drag = Some(allow_mouse_drag); self } pub fn enabled(mut self, enabled: bool) -> Self { self.enabled = Some(enabled); self } pub fn reversed(mut self, reversed: bool) -> Self { self.reversed = Some(reversed); self } pub fn swipeable>(mut self, swipeable: &P) -> Self { self.swipeable = Some(swipeable.clone().upcast()); self } pub fn orientation(mut self, orientation: gtk::Orientation) -> Self { self.orientation = Some(orientation); self } } impl fmt::Display for SwipeTracker { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("SwipeTracker") } } libhandy-0.8.0/src/auto/swipeable.rs000064400000000000000000000117350000000000000154670ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::NavigationDirection; use crate::SwipeTracker; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use std::boxed::Box as Box_; use std::fmt; use std::mem; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdySwipeable")] pub struct Swipeable(Interface) @requires gtk::Widget, gtk::Buildable; match fn { type_ => || ffi::hdy_swipeable_get_type(), } } pub const NONE_SWIPEABLE: Option<&Swipeable> = None; pub trait SwipeableExt: 'static { #[doc(alias = "hdy_swipeable_emit_child_switched")] fn emit_child_switched(&self, index: u32, duration: i64); #[doc(alias = "hdy_swipeable_get_cancel_progress")] #[doc(alias = "get_cancel_progress")] fn cancel_progress(&self) -> f64; #[doc(alias = "hdy_swipeable_get_distance")] #[doc(alias = "get_distance")] fn distance(&self) -> f64; #[doc(alias = "hdy_swipeable_get_progress")] #[doc(alias = "get_progress")] fn progress(&self) -> f64; #[doc(alias = "hdy_swipeable_get_snap_points")] #[doc(alias = "get_snap_points")] fn snap_points(&self) -> Vec; #[doc(alias = "hdy_swipeable_get_swipe_area")] #[doc(alias = "get_swipe_area")] fn swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool, ) -> gdk::Rectangle; #[doc(alias = "hdy_swipeable_get_swipe_tracker")] #[doc(alias = "get_swipe_tracker")] fn swipe_tracker(&self) -> Option; #[doc(alias = "hdy_swipeable_switch_child")] fn switch_child(&self, index: u32, duration: i64); #[doc(alias = "child-switched")] fn connect_child_switched(&self, f: F) -> SignalHandlerId; } impl> SwipeableExt for O { fn emit_child_switched(&self, index: u32, duration: i64) { unsafe { ffi::hdy_swipeable_emit_child_switched(self.as_ref().to_glib_none().0, index, duration); } } fn cancel_progress(&self) -> f64 { unsafe { ffi::hdy_swipeable_get_cancel_progress(self.as_ref().to_glib_none().0) } } fn distance(&self) -> f64 { unsafe { ffi::hdy_swipeable_get_distance(self.as_ref().to_glib_none().0) } } fn progress(&self) -> f64 { unsafe { ffi::hdy_swipeable_get_progress(self.as_ref().to_glib_none().0) } } fn snap_points(&self) -> Vec { unsafe { let mut n_snap_points = mem::MaybeUninit::uninit(); let ret = FromGlibContainer::from_glib_full_num( ffi::hdy_swipeable_get_snap_points( self.as_ref().to_glib_none().0, n_snap_points.as_mut_ptr(), ), n_snap_points.assume_init() as usize, ); ret } } fn swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool, ) -> gdk::Rectangle { unsafe { let mut rect = gdk::Rectangle::uninitialized(); ffi::hdy_swipeable_get_swipe_area( self.as_ref().to_glib_none().0, navigation_direction.into_glib(), is_drag.into_glib(), rect.to_glib_none_mut().0, ); rect } } fn swipe_tracker(&self) -> Option { unsafe { from_glib_none(ffi::hdy_swipeable_get_swipe_tracker( self.as_ref().to_glib_none().0, )) } } fn switch_child(&self, index: u32, duration: i64) { unsafe { ffi::hdy_swipeable_switch_child(self.as_ref().to_glib_none().0, index, duration); } } fn connect_child_switched(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn child_switched_trampoline< P: IsA, F: Fn(&P, u32, i64) + 'static, >( this: *mut ffi::HdySwipeable, index: libc::c_uint, duration: i64, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Swipeable::from_glib_borrow(this).unsafe_cast_ref(), index, duration, ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"child-switched\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( child_switched_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Swipeable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Swipeable") } } libhandy-0.8.0/src/auto/tab_bar.rs000064400000000000000000000734570000000000000151170ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::TabView; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyTabBar")] pub struct TabBar(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_tab_bar_get_type(), } } impl TabBar { #[doc(alias = "hdy_tab_bar_new")] pub fn new() -> TabBar { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::hdy_tab_bar_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabBar`] objects. /// /// This method returns an instance of [`TabBarBuilder`] which can be used to create [`TabBar`] objects. pub fn builder() -> TabBarBuilder { TabBarBuilder::default() } #[doc(alias = "hdy_tab_bar_get_autohide")] #[doc(alias = "get_autohide")] pub fn is_autohide(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_bar_get_autohide(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_bar_get_end_action_widget")] #[doc(alias = "get_end_action_widget")] pub fn end_action_widget(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_bar_get_end_action_widget( self.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_bar_get_expand_tabs")] #[doc(alias = "get_expand_tabs")] pub fn expands_tabs(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_bar_get_expand_tabs(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_bar_get_extra_drag_dest_targets")] #[doc(alias = "get_extra_drag_dest_targets")] pub fn extra_drag_dest_targets(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_bar_get_extra_drag_dest_targets( self.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_bar_get_inverted")] #[doc(alias = "get_inverted")] pub fn is_inverted(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_bar_get_inverted(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_bar_get_is_overflowing")] #[doc(alias = "get_is_overflowing")] pub fn is_overflowing(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_bar_get_is_overflowing(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_bar_get_start_action_widget")] #[doc(alias = "get_start_action_widget")] pub fn start_action_widget(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_bar_get_start_action_widget( self.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_bar_get_tabs_revealed")] #[doc(alias = "get_tabs_revealed")] pub fn is_tabs_revealed(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_bar_get_tabs_revealed(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_bar_get_view")] #[doc(alias = "get_view")] pub fn view(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_bar_get_view(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_bar_set_autohide")] pub fn set_autohide(&self, autohide: bool) { unsafe { ffi::hdy_tab_bar_set_autohide(self.to_glib_none().0, autohide.into_glib()); } } #[doc(alias = "hdy_tab_bar_set_end_action_widget")] pub fn set_end_action_widget>(&self, widget: Option<&P>) { unsafe { ffi::hdy_tab_bar_set_end_action_widget( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_tab_bar_set_expand_tabs")] pub fn set_expand_tabs(&self, expand_tabs: bool) { unsafe { ffi::hdy_tab_bar_set_expand_tabs(self.to_glib_none().0, expand_tabs.into_glib()); } } #[doc(alias = "hdy_tab_bar_set_extra_drag_dest_targets")] pub fn set_extra_drag_dest_targets(&self, extra_drag_dest_targets: Option<>k::TargetList>) { unsafe { ffi::hdy_tab_bar_set_extra_drag_dest_targets( self.to_glib_none().0, extra_drag_dest_targets.to_glib_none().0, ); } } #[doc(alias = "hdy_tab_bar_set_inverted")] pub fn set_inverted(&self, inverted: bool) { unsafe { ffi::hdy_tab_bar_set_inverted(self.to_glib_none().0, inverted.into_glib()); } } #[doc(alias = "hdy_tab_bar_set_start_action_widget")] pub fn set_start_action_widget>(&self, widget: Option<&P>) { unsafe { ffi::hdy_tab_bar_set_start_action_widget( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_tab_bar_set_view")] pub fn set_view(&self, view: Option<&TabView>) { unsafe { ffi::hdy_tab_bar_set_view(self.to_glib_none().0, view.to_glib_none().0); } } //#[cfg(any(feature = "v1_2", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] //#[doc(alias = "extra-drag-data-received")] //pub fn connect_extra_drag_data_received(&self, f: F) -> SignalHandlerId { // Ignored context: Gdk.DragContext // Ignored data: Gtk.SelectionData //} #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "autohide")] pub fn connect_autohide_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_autohide_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::autohide\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_autohide_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "end-action-widget")] pub fn connect_end_action_widget_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_end_action_widget_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::end-action-widget\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_end_action_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "expand-tabs")] pub fn connect_expand_tabs_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_expand_tabs_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::expand-tabs\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_expand_tabs_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "extra-drag-dest-targets")] pub fn connect_extra_drag_dest_targets_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_extra_drag_dest_targets_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::extra-drag-dest-targets\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_extra_drag_dest_targets_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "inverted")] pub fn connect_inverted_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_inverted_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::inverted\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_inverted_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "is-overflowing")] pub fn connect_is_overflowing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_overflowing_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-overflowing\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_is_overflowing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "start-action-widget")] pub fn connect_start_action_widget_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_start_action_widget_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::start-action-widget\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_start_action_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "tabs-revealed")] pub fn connect_tabs_revealed_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tabs_revealed_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tabs-revealed\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_tabs_revealed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "view")] pub fn connect_view_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_view_trampoline( this: *mut ffi::HdyTabBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::view\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_view_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl Default for TabBar { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabBar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct TabBarBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] autohide: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] end_action_widget: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] expand_tabs: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] extra_drag_dest_targets: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] inverted: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] start_action_widget: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] view: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl TabBarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`TabBarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`TabBar`]. pub fn build(self) -> TabBar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref autohide) = self.autohide { properties.push(("autohide", autohide)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref end_action_widget) = self.end_action_widget { properties.push(("end-action-widget", end_action_widget)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref expand_tabs) = self.expand_tabs { properties.push(("expand-tabs", expand_tabs)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref extra_drag_dest_targets) = self.extra_drag_dest_targets { properties.push(("extra-drag-dest-targets", extra_drag_dest_targets)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref inverted) = self.inverted { properties.push(("inverted", inverted)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref start_action_widget) = self.start_action_widget { properties.push(("start-action-widget", start_action_widget)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref view) = self.view { properties.push(("view", view)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties).expect("Failed to create an instance of TabBar") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn autohide(mut self, autohide: bool) -> Self { self.autohide = Some(autohide); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn end_action_widget>(mut self, end_action_widget: &P) -> Self { self.end_action_widget = Some(end_action_widget.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn expand_tabs(mut self, expand_tabs: bool) -> Self { self.expand_tabs = Some(expand_tabs); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn extra_drag_dest_targets(mut self, extra_drag_dest_targets: >k::TargetList) -> Self { self.extra_drag_dest_targets = Some(extra_drag_dest_targets.clone()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn inverted(mut self, inverted: bool) -> Self { self.inverted = Some(inverted); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn start_action_widget>(mut self, start_action_widget: &P) -> Self { self.start_action_widget = Some(start_action_widget.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn view(mut self, view: &TabView) -> Self { self.view = Some(view.clone()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for TabBar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("TabBar") } } libhandy-0.8.0/src/auto/tab_page.rs000064400000000000000000000467700000000000000152650ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyTabPage")] pub struct TabPage(Object); match fn { type_ => || ffi::hdy_tab_page_get_type(), } } impl TabPage { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabPage`] objects. /// /// This method returns an instance of [`TabPageBuilder`] which can be used to create [`TabPage`] objects. pub fn builder() -> TabPageBuilder { TabPageBuilder::default() } #[doc(alias = "hdy_tab_page_get_child")] #[doc(alias = "get_child")] pub fn child(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_page_get_child(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_icon")] #[doc(alias = "get_icon")] pub fn icon(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_page_get_icon(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_indicator_activatable")] #[doc(alias = "get_indicator_activatable")] pub fn is_indicator_activatable(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_page_get_indicator_activatable( self.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_page_get_indicator_icon")] #[doc(alias = "get_indicator_icon")] pub fn indicator_icon(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_page_get_indicator_icon(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_loading")] #[doc(alias = "get_loading")] pub fn is_loading(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_page_get_loading(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_needs_attention")] #[doc(alias = "get_needs_attention")] pub fn needs_attention(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_page_get_needs_attention(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_parent")] #[doc(alias = "get_parent")] pub fn parent(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_page_get_parent(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_pinned")] #[doc(alias = "get_pinned")] pub fn is_pinned(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_page_get_pinned(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_selected")] #[doc(alias = "get_selected")] pub fn is_selected(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_page_get_selected(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_page_get_title(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_get_tooltip")] #[doc(alias = "get_tooltip")] pub fn tooltip(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_page_get_tooltip(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_page_set_icon")] pub fn set_icon>(&self, icon: Option<&P>) { unsafe { ffi::hdy_tab_page_set_icon( self.to_glib_none().0, icon.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_tab_page_set_indicator_activatable")] pub fn set_indicator_activatable(&self, activatable: bool) { unsafe { ffi::hdy_tab_page_set_indicator_activatable( self.to_glib_none().0, activatable.into_glib(), ); } } #[doc(alias = "hdy_tab_page_set_indicator_icon")] pub fn set_indicator_icon>(&self, indicator_icon: Option<&P>) { unsafe { ffi::hdy_tab_page_set_indicator_icon( self.to_glib_none().0, indicator_icon.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_tab_page_set_loading")] pub fn set_loading(&self, loading: bool) { unsafe { ffi::hdy_tab_page_set_loading(self.to_glib_none().0, loading.into_glib()); } } #[doc(alias = "hdy_tab_page_set_needs_attention")] pub fn set_needs_attention(&self, needs_attention: bool) { unsafe { ffi::hdy_tab_page_set_needs_attention( self.to_glib_none().0, needs_attention.into_glib(), ); } } #[doc(alias = "hdy_tab_page_set_title")] pub fn set_title(&self, title: Option<&str>) { unsafe { ffi::hdy_tab_page_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "hdy_tab_page_set_tooltip")] pub fn set_tooltip(&self, tooltip: Option<&str>) { unsafe { ffi::hdy_tab_page_set_tooltip(self.to_glib_none().0, tooltip.to_glib_none().0); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "icon")] pub fn connect_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_icon_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::icon\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "indicator-activatable")] pub fn connect_indicator_activatable_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_indicator_activatable_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::indicator-activatable\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_indicator_activatable_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "indicator-icon")] pub fn connect_indicator_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_indicator_icon_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::indicator-icon\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_indicator_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "loading")] pub fn connect_loading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_loading_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::loading\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_loading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "needs-attention")] pub fn connect_needs_attention_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_needs_attention_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::needs-attention\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_needs_attention_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "pinned")] pub fn connect_pinned_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_pinned_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::pinned\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_pinned_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "selected")] pub fn connect_selected_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::selected\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_selected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "tooltip")] pub fn connect_tooltip_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tooltip_trampoline( this: *mut ffi::HdyTabPage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tooltip\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_tooltip_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabPage`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct TabPageBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] child: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] icon: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] indicator_activatable: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] indicator_icon: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] loading: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] needs_attention: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] parent: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] title: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] tooltip: Option, } impl TabPageBuilder { // rustdoc-stripper-ignore-next /// Create a new [`TabPageBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`TabPage`]. pub fn build(self) -> TabPage { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref child) = self.child { properties.push(("child", child)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref icon) = self.icon { properties.push(("icon", icon)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref indicator_activatable) = self.indicator_activatable { properties.push(("indicator-activatable", indicator_activatable)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref indicator_icon) = self.indicator_icon { properties.push(("indicator-icon", indicator_icon)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref loading) = self.loading { properties.push(("loading", loading)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref needs_attention) = self.needs_attention { properties.push(("needs-attention", needs_attention)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref title) = self.title { properties.push(("title", title)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref tooltip) = self.tooltip { properties.push(("tooltip", tooltip)); } glib::Object::new::(&properties).expect("Failed to create an instance of TabPage") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn icon>(mut self, icon: &P) -> Self { self.icon = Some(icon.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn indicator_activatable(mut self, indicator_activatable: bool) -> Self { self.indicator_activatable = Some(indicator_activatable); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn indicator_icon>(mut self, indicator_icon: &P) -> Self { self.indicator_icon = Some(indicator_icon.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn loading(mut self, loading: bool) -> Self { self.loading = Some(loading); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn needs_attention(mut self, needs_attention: bool) -> Self { self.needs_attention = Some(needs_attention); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn parent(mut self, parent: &TabPage) -> Self { self.parent = Some(parent.clone()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn tooltip(mut self, tooltip: &str) -> Self { self.tooltip = Some(tooltip.to_string()); self } } impl fmt::Display for TabPage { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("TabPage") } } libhandy-0.8.0/src/auto/tab_view.rs000064400000000000000000001160620000000000000153130ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::TabPage; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyTabView")] pub struct TabView(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_tab_view_get_type(), } } impl TabView { #[doc(alias = "hdy_tab_view_new")] pub fn new() -> TabView { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::hdy_tab_view_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TabView`] objects. /// /// This method returns an instance of [`TabViewBuilder`] which can be used to create [`TabView`] objects. pub fn builder() -> TabViewBuilder { TabViewBuilder::default() } #[doc(alias = "hdy_tab_view_add_page")] pub fn add_page>( &self, child: &P, parent: Option<&TabPage>, ) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_add_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, parent.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_append")] pub fn append>(&self, child: &P) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_append( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_append_pinned")] pub fn append_pinned>(&self, child: &P) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_append_pinned( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_close_other_pages")] pub fn close_other_pages(&self, page: &TabPage) { unsafe { ffi::hdy_tab_view_close_other_pages(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "hdy_tab_view_close_page")] pub fn close_page(&self, page: &TabPage) { unsafe { ffi::hdy_tab_view_close_page(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "hdy_tab_view_close_page_finish")] pub fn close_page_finish(&self, page: &TabPage, confirm: bool) { unsafe { ffi::hdy_tab_view_close_page_finish( self.to_glib_none().0, page.to_glib_none().0, confirm.into_glib(), ); } } #[doc(alias = "hdy_tab_view_close_pages_after")] pub fn close_pages_after(&self, page: &TabPage) { unsafe { ffi::hdy_tab_view_close_pages_after(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "hdy_tab_view_close_pages_before")] pub fn close_pages_before(&self, page: &TabPage) { unsafe { ffi::hdy_tab_view_close_pages_before(self.to_glib_none().0, page.to_glib_none().0); } } #[doc(alias = "hdy_tab_view_get_default_icon")] #[doc(alias = "get_default_icon")] pub fn default_icon(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_default_icon(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_view_get_is_transferring_page")] #[doc(alias = "get_is_transferring_page")] pub fn is_transferring_page(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_view_get_is_transferring_page( self.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_get_menu_model")] #[doc(alias = "get_menu_model")] pub fn menu_model(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_menu_model(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_view_get_n_pages")] #[doc(alias = "get_n_pages")] pub fn n_pages(&self) -> i32 { unsafe { ffi::hdy_tab_view_get_n_pages(self.to_glib_none().0) } } #[doc(alias = "hdy_tab_view_get_n_pinned_pages")] #[doc(alias = "get_n_pinned_pages")] pub fn n_pinned_pages(&self) -> i32 { unsafe { ffi::hdy_tab_view_get_n_pinned_pages(self.to_glib_none().0) } } #[doc(alias = "hdy_tab_view_get_nth_page")] #[doc(alias = "get_nth_page")] pub fn nth_page(&self, position: i32) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_nth_page( self.to_glib_none().0, position, )) } } #[doc(alias = "hdy_tab_view_get_page")] #[doc(alias = "get_page")] pub fn page>(&self, child: &P) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_page( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_get_page_position")] #[doc(alias = "get_page_position")] pub fn page_position(&self, page: &TabPage) -> i32 { unsafe { ffi::hdy_tab_view_get_page_position(self.to_glib_none().0, page.to_glib_none().0) } } #[doc(alias = "hdy_tab_view_get_pages")] #[doc(alias = "get_pages")] pub fn pages(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_pages(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_view_get_selected_page")] #[doc(alias = "get_selected_page")] pub fn selected_page(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_selected_page(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_view_get_shortcut_widget")] #[doc(alias = "get_shortcut_widget")] pub fn shortcut_widget(&self) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_get_shortcut_widget(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_view_insert")] pub fn insert>(&self, child: &P, position: i32) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_insert( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, )) } } #[doc(alias = "hdy_tab_view_insert_pinned")] pub fn insert_pinned>(&self, child: &P, position: i32) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_insert_pinned( self.to_glib_none().0, child.as_ref().to_glib_none().0, position, )) } } #[doc(alias = "hdy_tab_view_prepend")] pub fn prepend>(&self, child: &P) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_prepend( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_prepend_pinned")] pub fn prepend_pinned>(&self, child: &P) -> Option { unsafe { from_glib_none(ffi::hdy_tab_view_prepend_pinned( self.to_glib_none().0, child.as_ref().to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_reorder_backward")] pub fn reorder_backward(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::hdy_tab_view_reorder_backward( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_reorder_first")] pub fn reorder_first(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::hdy_tab_view_reorder_first( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_reorder_forward")] pub fn reorder_forward(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::hdy_tab_view_reorder_forward( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_reorder_last")] pub fn reorder_last(&self, page: &TabPage) -> bool { unsafe { from_glib(ffi::hdy_tab_view_reorder_last( self.to_glib_none().0, page.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_reorder_page")] pub fn reorder_page(&self, page: &TabPage, position: i32) -> bool { unsafe { from_glib(ffi::hdy_tab_view_reorder_page( self.to_glib_none().0, page.to_glib_none().0, position, )) } } #[doc(alias = "hdy_tab_view_select_next_page")] pub fn select_next_page(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_view_select_next_page(self.to_glib_none().0)) } } #[doc(alias = "hdy_tab_view_select_previous_page")] pub fn select_previous_page(&self) -> bool { unsafe { from_glib(ffi::hdy_tab_view_select_previous_page( self.to_glib_none().0, )) } } #[doc(alias = "hdy_tab_view_set_default_icon")] pub fn set_default_icon>(&self, default_icon: &P) { unsafe { ffi::hdy_tab_view_set_default_icon( self.to_glib_none().0, default_icon.as_ref().to_glib_none().0, ); } } #[doc(alias = "hdy_tab_view_set_menu_model")] pub fn set_menu_model>(&self, menu_model: Option<&P>) { unsafe { ffi::hdy_tab_view_set_menu_model( self.to_glib_none().0, menu_model.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_tab_view_set_page_pinned")] pub fn set_page_pinned(&self, page: &TabPage, pinned: bool) { unsafe { ffi::hdy_tab_view_set_page_pinned( self.to_glib_none().0, page.to_glib_none().0, pinned.into_glib(), ); } } #[doc(alias = "hdy_tab_view_set_selected_page")] pub fn set_selected_page(&self, selected_page: &TabPage) { unsafe { ffi::hdy_tab_view_set_selected_page( self.to_glib_none().0, selected_page.to_glib_none().0, ); } } #[doc(alias = "hdy_tab_view_set_shortcut_widget")] pub fn set_shortcut_widget>(&self, widget: Option<&P>) { unsafe { ffi::hdy_tab_view_set_shortcut_widget( self.to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_tab_view_transfer_page")] pub fn transfer_page(&self, page: &TabPage, other_view: &TabView, position: i32) { unsafe { ffi::hdy_tab_view_transfer_page( self.to_glib_none().0, page.to_glib_none().0, other_view.to_glib_none().0, position, ); } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "close-page")] pub fn connect_close_page bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn close_page_trampoline bool + 'static>( this: *mut ffi::HdyTabView, page: *mut ffi::HdyTabPage, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page)).into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"close-page\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( close_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "create-window")] pub fn connect_create_window Option + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn create_window_trampoline< F: Fn(&TabView) -> Option + 'static, >( this: *mut ffi::HdyTabView, f: glib::ffi::gpointer, ) -> *mut ffi::HdyTabView { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) /*Not checked*/ .to_glib_none() .0 } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"create-window\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( create_window_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "indicator-activated")] pub fn connect_indicator_activated( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn indicator_activated_trampoline( this: *mut ffi::HdyTabView, page: *mut ffi::HdyTabPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"indicator-activated\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( indicator_activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "page-attached")] pub fn connect_page_attached( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn page_attached_trampoline( this: *mut ffi::HdyTabView, page: *mut ffi::HdyTabPage, position: libc::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page), position) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"page-attached\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( page_attached_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "page-detached")] pub fn connect_page_detached( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn page_detached_trampoline( this: *mut ffi::HdyTabView, page: *mut ffi::HdyTabPage, position: libc::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page), position) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"page-detached\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( page_detached_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "page-reordered")] pub fn connect_page_reordered( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn page_reordered_trampoline( this: *mut ffi::HdyTabView, page: *mut ffi::HdyTabPage, position: libc::c_int, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page), position) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"page-reordered\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( page_reordered_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "setup-menu")] pub fn connect_setup_menu(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn setup_menu_trampoline( this: *mut ffi::HdyTabView, page: *mut ffi::HdyTabPage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(page)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"setup-menu\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( setup_menu_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "default-icon")] pub fn connect_default_icon_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_default_icon_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::default-icon\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_default_icon_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "is-transferring-page")] pub fn connect_is_transferring_page_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_is_transferring_page_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-transferring-page\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_is_transferring_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "menu-model")] pub fn connect_menu_model_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_menu_model_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::menu-model\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_menu_model_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "n-pages")] pub fn connect_n_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pages_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::n-pages\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_n_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "n-pinned-pages")] pub fn connect_n_pinned_pages_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_n_pinned_pages_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::n-pinned-pages\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_n_pinned_pages_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "selected-page")] pub fn connect_selected_page_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selected_page_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::selected-page\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_selected_page_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "shortcut-widget")] pub fn connect_shortcut_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_shortcut_widget_trampoline( this: *mut ffi::HdyTabView, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::shortcut-widget\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_shortcut_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] impl Default for TabView { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TabView`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct TabViewBuilder { #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] default_icon: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] menu_model: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] selected_page: Option, #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] shortcut_widget: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl TabViewBuilder { // rustdoc-stripper-ignore-next /// Create a new [`TabViewBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`TabView`]. pub fn build(self) -> TabView { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref default_icon) = self.default_icon { properties.push(("default-icon", default_icon)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref menu_model) = self.menu_model { properties.push(("menu-model", menu_model)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref selected_page) = self.selected_page { properties.push(("selected-page", selected_page)); } #[cfg(any(feature = "v1_2", feature = "dox"))] if let Some(ref shortcut_widget) = self.shortcut_widget { properties.push(("shortcut-widget", shortcut_widget)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties).expect("Failed to create an instance of TabView") } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn default_icon>(mut self, default_icon: &P) -> Self { self.default_icon = Some(default_icon.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn menu_model>(mut self, menu_model: &P) -> Self { self.menu_model = Some(menu_model.clone().upcast()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn selected_page(mut self, selected_page: &TabPage) -> Self { self.selected_page = Some(selected_page.clone()); self } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] pub fn shortcut_widget>(mut self, shortcut_widget: &P) -> Self { self.shortcut_widget = Some(shortcut_widget.clone().upcast()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for TabView { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("TabView") } } libhandy-0.8.0/src/auto/title_bar.rs000064400000000000000000000344110000000000000154550ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyTitleBar")] pub struct TitleBar(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_title_bar_get_type(), } } impl TitleBar { #[doc(alias = "hdy_title_bar_new")] pub fn new() -> TitleBar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_title_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`TitleBar`] objects. /// /// This method returns an instance of [`TitleBarBuilder`] which can be used to create [`TitleBar`] objects. pub fn builder() -> TitleBarBuilder { TitleBarBuilder::default() } #[doc(alias = "hdy_title_bar_get_selection_mode")] #[doc(alias = "get_selection_mode")] pub fn is_selection_mode(&self) -> bool { unsafe { from_glib(ffi::hdy_title_bar_get_selection_mode(self.to_glib_none().0)) } } #[doc(alias = "hdy_title_bar_set_selection_mode")] pub fn set_selection_mode(&self, selection_mode: bool) { unsafe { ffi::hdy_title_bar_set_selection_mode( self.to_glib_none().0, selection_mode.into_glib(), ); } } #[doc(alias = "selection-mode")] pub fn connect_selection_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_selection_mode_trampoline( this: *mut ffi::HdyTitleBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::selection-mode\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_selection_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for TitleBar { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`TitleBar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct TitleBarBuilder { selection_mode: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl TitleBarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`TitleBarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`TitleBar`]. pub fn build(self) -> TitleBar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref selection_mode) = self.selection_mode { properties.push(("selection-mode", selection_mode)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of TitleBar") } pub fn selection_mode(mut self, selection_mode: bool) -> Self { self.selection_mode = Some(selection_mode); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for TitleBar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("TitleBar") } } libhandy-0.8.0/src/auto/value_object.rs000064400000000000000000000027530000000000000161560ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::translate::*; use std::fmt; glib::wrapper! { #[doc(alias = "HdyValueObject")] pub struct ValueObject(Object); match fn { type_ => || ffi::hdy_value_object_get_type(), } } impl ValueObject { #[doc(alias = "hdy_value_object_new")] pub fn new(value: &glib::Value) -> ValueObject { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::hdy_value_object_new(value.to_glib_none().0)) } } //#[doc(alias = "hdy_value_object_new_collect")] //pub fn new_collect(type_: glib::types::Type, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> ValueObject { // unsafe { TODO: call ffi:hdy_value_object_new_collect() } //} #[doc(alias = "hdy_value_object_get_string")] #[doc(alias = "get_string")] pub fn string(&self) -> Option { unsafe { from_glib_none(ffi::hdy_value_object_get_string(self.to_glib_none().0)) } } #[doc(alias = "hdy_value_object_get_value")] #[doc(alias = "get_value")] pub fn value(&self) -> Option { unsafe { from_glib_none(ffi::hdy_value_object_get_value(self.to_glib_none().0)) } } } impl fmt::Display for ValueObject { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ValueObject") } } libhandy-0.8.0/src/auto/versions.txt000064400000000000000000000002040000000000000155440ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ 1bef39f) from from gir-files (https://github.com/gtk-rs/gir-files.git @ 7d95377) libhandy-0.8.0/src/auto/view_switcher.rs000064400000000000000000000432000000000000000163660ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ViewSwitcherPolicy; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyViewSwitcher")] pub struct ViewSwitcher(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_view_switcher_get_type(), } } impl ViewSwitcher { #[doc(alias = "hdy_view_switcher_new")] pub fn new() -> ViewSwitcher { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_view_switcher_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewSwitcher`] objects. /// /// This method returns an instance of [`ViewSwitcherBuilder`] which can be used to create [`ViewSwitcher`] objects. pub fn builder() -> ViewSwitcherBuilder { ViewSwitcherBuilder::default() } #[doc(alias = "hdy_view_switcher_get_narrow_ellipsize")] #[doc(alias = "get_narrow_ellipsize")] pub fn narrow_ellipsize(&self) -> pango::EllipsizeMode { unsafe { from_glib(ffi::hdy_view_switcher_get_narrow_ellipsize( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_get_policy")] #[doc(alias = "get_policy")] pub fn policy(&self) -> ViewSwitcherPolicy { unsafe { from_glib(ffi::hdy_view_switcher_get_policy(self.to_glib_none().0)) } } #[doc(alias = "hdy_view_switcher_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::hdy_view_switcher_get_stack(self.to_glib_none().0)) } } #[doc(alias = "hdy_view_switcher_set_narrow_ellipsize")] pub fn set_narrow_ellipsize(&self, mode: pango::EllipsizeMode) { unsafe { ffi::hdy_view_switcher_set_narrow_ellipsize(self.to_glib_none().0, mode.into_glib()); } } #[doc(alias = "hdy_view_switcher_set_policy")] pub fn set_policy(&self, policy: ViewSwitcherPolicy) { unsafe { ffi::hdy_view_switcher_set_policy(self.to_glib_none().0, policy.into_glib()); } } #[doc(alias = "hdy_view_switcher_set_stack")] pub fn set_stack>(&self, stack: Option<&P>) { unsafe { ffi::hdy_view_switcher_set_stack( self.to_glib_none().0, stack.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "narrow-ellipsize")] pub fn connect_narrow_ellipsize_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_narrow_ellipsize_trampoline( this: *mut ffi::HdyViewSwitcher, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::narrow-ellipsize\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_narrow_ellipsize_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "policy")] pub fn connect_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_policy_trampoline( this: *mut ffi::HdyViewSwitcher, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::policy\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::HdyViewSwitcher, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::stack\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewSwitcher { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewSwitcher`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ViewSwitcherBuilder { narrow_ellipsize: Option, policy: Option, stack: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl ViewSwitcherBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ViewSwitcherBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ViewSwitcher`]. pub fn build(self) -> ViewSwitcher { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref narrow_ellipsize) = self.narrow_ellipsize { properties.push(("narrow-ellipsize", narrow_ellipsize)); } if let Some(ref policy) = self.policy { properties.push(("policy", policy)); } if let Some(ref stack) = self.stack { properties.push(("stack", stack)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ViewSwitcher") } pub fn narrow_ellipsize(mut self, narrow_ellipsize: pango::EllipsizeMode) -> Self { self.narrow_ellipsize = Some(narrow_ellipsize); self } pub fn policy(mut self, policy: ViewSwitcherPolicy) -> Self { self.policy = Some(policy); self } pub fn stack>(mut self, stack: &P) -> Self { self.stack = Some(stack.clone().upcast()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for ViewSwitcher { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ViewSwitcher") } } libhandy-0.8.0/src/auto/view_switcher_bar.rs000064400000000000000000000427200000000000000172200ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ViewSwitcherPolicy; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyViewSwitcherBar")] pub struct ViewSwitcherBar(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_view_switcher_bar_get_type(), } } impl ViewSwitcherBar { #[doc(alias = "hdy_view_switcher_bar_new")] pub fn new() -> ViewSwitcherBar { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_none(ffi::hdy_view_switcher_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewSwitcherBar`] objects. /// /// This method returns an instance of [`ViewSwitcherBarBuilder`] which can be used to create [`ViewSwitcherBar`] objects. pub fn builder() -> ViewSwitcherBarBuilder { ViewSwitcherBarBuilder::default() } #[doc(alias = "hdy_view_switcher_bar_get_policy")] #[doc(alias = "get_policy")] pub fn policy(&self) -> ViewSwitcherPolicy { unsafe { from_glib(ffi::hdy_view_switcher_bar_get_policy(self.to_glib_none().0)) } } #[doc(alias = "hdy_view_switcher_bar_get_reveal")] #[doc(alias = "get_reveal")] pub fn reveals(&self) -> bool { unsafe { from_glib(ffi::hdy_view_switcher_bar_get_reveal(self.to_glib_none().0)) } } #[doc(alias = "hdy_view_switcher_bar_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::hdy_view_switcher_bar_get_stack(self.to_glib_none().0)) } } #[doc(alias = "hdy_view_switcher_bar_set_policy")] pub fn set_policy(&self, policy: ViewSwitcherPolicy) { unsafe { ffi::hdy_view_switcher_bar_set_policy(self.to_glib_none().0, policy.into_glib()); } } #[doc(alias = "hdy_view_switcher_bar_set_reveal")] pub fn set_reveal(&self, reveal: bool) { unsafe { ffi::hdy_view_switcher_bar_set_reveal(self.to_glib_none().0, reveal.into_glib()); } } #[doc(alias = "hdy_view_switcher_bar_set_stack")] pub fn set_stack>(&self, stack: Option<&P>) { unsafe { ffi::hdy_view_switcher_bar_set_stack( self.to_glib_none().0, stack.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "policy")] pub fn connect_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_policy_trampoline( this: *mut ffi::HdyViewSwitcherBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::policy\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reveal")] pub fn connect_reveal_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reveal_trampoline( this: *mut ffi::HdyViewSwitcherBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reveal\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_reveal_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::HdyViewSwitcherBar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::stack\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewSwitcherBar { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewSwitcherBar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ViewSwitcherBarBuilder { policy: Option, reveal: Option, stack: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl ViewSwitcherBarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ViewSwitcherBarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ViewSwitcherBar`]. pub fn build(self) -> ViewSwitcherBar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref policy) = self.policy { properties.push(("policy", policy)); } if let Some(ref reveal) = self.reveal { properties.push(("reveal", reveal)); } if let Some(ref stack) = self.stack { properties.push(("stack", stack)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ViewSwitcherBar") } pub fn policy(mut self, policy: ViewSwitcherPolicy) -> Self { self.policy = Some(policy); self } pub fn reveal(mut self, reveal: bool) -> Self { self.reveal = Some(reveal); self } pub fn stack>(mut self, stack: &P) -> Self { self.stack = Some(stack.clone().upcast()); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for ViewSwitcherBar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ViewSwitcherBar") } } libhandy-0.8.0/src/auto/view_switcher_title.rs000064400000000000000000000550200000000000000175720ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use crate::ViewSwitcherPolicy; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "HdyViewSwitcherTitle")] pub struct ViewSwitcherTitle(Object) @extends gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_view_switcher_title_get_type(), } } impl ViewSwitcherTitle { #[doc(alias = "hdy_view_switcher_title_new")] pub fn new() -> ViewSwitcherTitle { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::hdy_view_switcher_title_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ViewSwitcherTitle`] objects. /// /// This method returns an instance of [`ViewSwitcherTitleBuilder`] which can be used to create [`ViewSwitcherTitle`] objects. pub fn builder() -> ViewSwitcherTitleBuilder { ViewSwitcherTitleBuilder::default() } #[doc(alias = "hdy_view_switcher_title_get_policy")] #[doc(alias = "get_policy")] pub fn policy(&self) -> ViewSwitcherPolicy { unsafe { from_glib(ffi::hdy_view_switcher_title_get_policy( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_title_get_stack")] #[doc(alias = "get_stack")] pub fn stack(&self) -> Option { unsafe { from_glib_none(ffi::hdy_view_switcher_title_get_stack( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_title_get_subtitle")] #[doc(alias = "get_subtitle")] pub fn subtitle(&self) -> Option { unsafe { from_glib_none(ffi::hdy_view_switcher_title_get_subtitle( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_title_get_title")] #[doc(alias = "get_title")] pub fn title(&self) -> Option { unsafe { from_glib_none(ffi::hdy_view_switcher_title_get_title( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_title_get_title_visible")] #[doc(alias = "get_title_visible")] pub fn is_title_visible(&self) -> bool { unsafe { from_glib(ffi::hdy_view_switcher_title_get_title_visible( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_title_get_view_switcher_enabled")] #[doc(alias = "get_view_switcher_enabled")] pub fn is_view_switcher_enabled(&self) -> bool { unsafe { from_glib(ffi::hdy_view_switcher_title_get_view_switcher_enabled( self.to_glib_none().0, )) } } #[doc(alias = "hdy_view_switcher_title_set_policy")] pub fn set_policy(&self, policy: ViewSwitcherPolicy) { unsafe { ffi::hdy_view_switcher_title_set_policy(self.to_glib_none().0, policy.into_glib()); } } #[doc(alias = "hdy_view_switcher_title_set_stack")] pub fn set_stack>(&self, stack: Option<&P>) { unsafe { ffi::hdy_view_switcher_title_set_stack( self.to_glib_none().0, stack.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "hdy_view_switcher_title_set_subtitle")] pub fn set_subtitle(&self, subtitle: Option<&str>) { unsafe { ffi::hdy_view_switcher_title_set_subtitle( self.to_glib_none().0, subtitle.to_glib_none().0, ); } } #[doc(alias = "hdy_view_switcher_title_set_title")] pub fn set_title(&self, title: Option<&str>) { unsafe { ffi::hdy_view_switcher_title_set_title(self.to_glib_none().0, title.to_glib_none().0); } } #[doc(alias = "hdy_view_switcher_title_set_view_switcher_enabled")] pub fn set_view_switcher_enabled(&self, enabled: bool) { unsafe { ffi::hdy_view_switcher_title_set_view_switcher_enabled( self.to_glib_none().0, enabled.into_glib(), ); } } #[doc(alias = "policy")] pub fn connect_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_policy_trampoline( this: *mut ffi::HdyViewSwitcherTitle, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::policy\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "stack")] pub fn connect_stack_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_stack_trampoline( this: *mut ffi::HdyViewSwitcherTitle, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::stack\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_stack_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "subtitle")] pub fn connect_subtitle_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_subtitle_trampoline( this: *mut ffi::HdyViewSwitcherTitle, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::subtitle\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_subtitle_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title")] pub fn connect_title_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_trampoline( this: *mut ffi::HdyViewSwitcherTitle, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "title-visible")] pub fn connect_title_visible_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_title_visible_trampoline< F: Fn(&ViewSwitcherTitle) + 'static, >( this: *mut ffi::HdyViewSwitcherTitle, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::title-visible\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_title_visible_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "view-switcher-enabled")] pub fn connect_view_switcher_enabled_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_view_switcher_enabled_trampoline< F: Fn(&ViewSwitcherTitle) + 'static, >( this: *mut ffi::HdyViewSwitcherTitle, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::view-switcher-enabled\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_view_switcher_enabled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for ViewSwitcherTitle { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ViewSwitcherTitle`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ViewSwitcherTitleBuilder { policy: Option, stack: Option, subtitle: Option, title: Option, view_switcher_enabled: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl ViewSwitcherTitleBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ViewSwitcherTitleBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ViewSwitcherTitle`]. pub fn build(self) -> ViewSwitcherTitle { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref policy) = self.policy { properties.push(("policy", policy)); } if let Some(ref stack) = self.stack { properties.push(("stack", stack)); } if let Some(ref subtitle) = self.subtitle { properties.push(("subtitle", subtitle)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref view_switcher_enabled) = self.view_switcher_enabled { properties.push(("view-switcher-enabled", view_switcher_enabled)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of ViewSwitcherTitle") } pub fn policy(mut self, policy: ViewSwitcherPolicy) -> Self { self.policy = Some(policy); self } pub fn stack>(mut self, stack: &P) -> Self { self.stack = Some(stack.clone().upcast()); self } pub fn subtitle(mut self, subtitle: &str) -> Self { self.subtitle = Some(subtitle.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn view_switcher_enabled(mut self, view_switcher_enabled: bool) -> Self { self.view_switcher_enabled = Some(view_switcher_enabled); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for ViewSwitcherTitle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ViewSwitcherTitle") } } libhandy-0.8.0/src/auto/window.rs000064400000000000000000000466410000000000000150270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::fmt; glib::wrapper! { #[doc(alias = "HdyWindow")] pub struct Window(Object) @extends gtk::Window, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_window_get_type(), } } impl Window { #[doc(alias = "hdy_window_new")] pub fn new() -> Window { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_full(ffi::hdy_window_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Window`] objects. /// /// This method returns an instance of [`WindowBuilder`] which can be used to create [`Window`] objects. pub fn builder() -> WindowBuilder { WindowBuilder::default() } } impl Default for Window { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Window`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct WindowBuilder { accept_focus: Option, //application: /*Unknown type*/, attached_to: Option, decorated: Option, default_height: Option, default_width: Option, deletable: Option, destroy_with_parent: Option, focus_on_map: Option, focus_visible: Option, //gravity: /*Unknown type*/, has_resize_grip: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, //screen: /*Unknown type*/, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, //type: /*Unknown type*/, //type-hint: /*Unknown type*/, urgency_hint: Option, //window-position: /*Unknown type*/, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl WindowBuilder { // rustdoc-stripper-ignore-next /// Create a new [`WindowBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Window`]. pub fn build(self) -> Window { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref accept_focus) = self.accept_focus { properties.push(("accept-focus", accept_focus)); } if let Some(ref attached_to) = self.attached_to { properties.push(("attached-to", attached_to)); } if let Some(ref decorated) = self.decorated { properties.push(("decorated", decorated)); } if let Some(ref default_height) = self.default_height { properties.push(("default-height", default_height)); } if let Some(ref default_width) = self.default_width { properties.push(("default-width", default_width)); } if let Some(ref deletable) = self.deletable { properties.push(("deletable", deletable)); } if let Some(ref destroy_with_parent) = self.destroy_with_parent { properties.push(("destroy-with-parent", destroy_with_parent)); } if let Some(ref focus_on_map) = self.focus_on_map { properties.push(("focus-on-map", focus_on_map)); } if let Some(ref focus_visible) = self.focus_visible { properties.push(("focus-visible", focus_visible)); } if let Some(ref has_resize_grip) = self.has_resize_grip { properties.push(("has-resize-grip", has_resize_grip)); } if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized { properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized)); } if let Some(ref icon) = self.icon { properties.push(("icon", icon)); } if let Some(ref icon_name) = self.icon_name { properties.push(("icon-name", icon_name)); } if let Some(ref mnemonics_visible) = self.mnemonics_visible { properties.push(("mnemonics-visible", mnemonics_visible)); } if let Some(ref modal) = self.modal { properties.push(("modal", modal)); } if let Some(ref resizable) = self.resizable { properties.push(("resizable", resizable)); } if let Some(ref role) = self.role { properties.push(("role", role)); } if let Some(ref skip_pager_hint) = self.skip_pager_hint { properties.push(("skip-pager-hint", skip_pager_hint)); } if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint { properties.push(("skip-taskbar-hint", skip_taskbar_hint)); } if let Some(ref startup_id) = self.startup_id { properties.push(("startup-id", startup_id)); } if let Some(ref title) = self.title { properties.push(("title", title)); } if let Some(ref transient_for) = self.transient_for { properties.push(("transient-for", transient_for)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties).expect("Failed to create an instance of Window") } pub fn accept_focus(mut self, accept_focus: bool) -> Self { self.accept_focus = Some(accept_focus); self } pub fn attached_to>(mut self, attached_to: &P) -> Self { self.attached_to = Some(attached_to.clone().upcast()); self } pub fn decorated(mut self, decorated: bool) -> Self { self.decorated = Some(decorated); self } pub fn default_height(mut self, default_height: i32) -> Self { self.default_height = Some(default_height); self } pub fn default_width(mut self, default_width: i32) -> Self { self.default_width = Some(default_width); self } pub fn deletable(mut self, deletable: bool) -> Self { self.deletable = Some(deletable); self } pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self { self.destroy_with_parent = Some(destroy_with_parent); self } pub fn focus_on_map(mut self, focus_on_map: bool) -> Self { self.focus_on_map = Some(focus_on_map); self } pub fn focus_visible(mut self, focus_visible: bool) -> Self { self.focus_visible = Some(focus_visible); self } pub fn has_resize_grip(mut self, has_resize_grip: bool) -> Self { self.has_resize_grip = Some(has_resize_grip); self } pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self { self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized); self } pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self { self.icon = Some(icon.clone()); self } pub fn icon_name(mut self, icon_name: &str) -> Self { self.icon_name = Some(icon_name.to_string()); self } pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self { self.mnemonics_visible = Some(mnemonics_visible); self } pub fn modal(mut self, modal: bool) -> Self { self.modal = Some(modal); self } pub fn resizable(mut self, resizable: bool) -> Self { self.resizable = Some(resizable); self } pub fn role(mut self, role: &str) -> Self { self.role = Some(role.to_string()); self } pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self { self.skip_pager_hint = Some(skip_pager_hint); self } pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self { self.skip_taskbar_hint = Some(skip_taskbar_hint); self } pub fn startup_id(mut self, startup_id: &str) -> Self { self.startup_id = Some(startup_id.to_string()); self } pub fn title(mut self, title: &str) -> Self { self.title = Some(title.to_string()); self } pub fn transient_for>(mut self, transient_for: &P) -> Self { self.transient_for = Some(transient_for.clone().upcast()); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } pub const NONE_WINDOW: Option<&Window> = None; impl fmt::Display for Window { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Window") } } libhandy-0.8.0/src/auto/window_handle.rs000064400000000000000000000321710000000000000163330ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::fmt; glib::wrapper! { #[doc(alias = "HdyWindowHandle")] pub struct WindowHandle(Object) @extends gtk::EventBox, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable; match fn { type_ => || ffi::hdy_window_handle_get_type(), } } impl WindowHandle { #[doc(alias = "hdy_window_handle_new")] pub fn new() -> WindowHandle { assert_initialized_main_thread!(); unsafe { gtk::Widget::from_glib_full(ffi::hdy_window_handle_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`WindowHandle`] objects. /// /// This method returns an instance of [`WindowHandleBuilder`] which can be used to create [`WindowHandle`] objects. pub fn builder() -> WindowHandleBuilder { WindowHandleBuilder::default() } } impl Default for WindowHandle { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`WindowHandle`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct WindowHandleBuilder { above_child: Option, visible_window: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, double_buffered: Option, events: Option, expand: Option, focus_on_click: Option, halign: Option, has_default: Option, has_focus: Option, has_tooltip: Option, height_request: Option, hexpand: Option, hexpand_set: Option, is_focus: Option, margin: Option, margin_bottom: Option, margin_end: Option, margin_left: Option, margin_right: Option, margin_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, //style: /*Unknown type*/, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl WindowHandleBuilder { // rustdoc-stripper-ignore-next /// Create a new [`WindowHandleBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`WindowHandle`]. pub fn build(self) -> WindowHandle { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref above_child) = self.above_child { properties.push(("above-child", above_child)); } if let Some(ref visible_window) = self.visible_window { properties.push(("visible-window", visible_window)); } if let Some(ref border_width) = self.border_width { properties.push(("border-width", border_width)); } if let Some(ref child) = self.child { properties.push(("child", child)); } if let Some(ref resize_mode) = self.resize_mode { properties.push(("resize-mode", resize_mode)); } if let Some(ref app_paintable) = self.app_paintable { properties.push(("app-paintable", app_paintable)); } if let Some(ref can_default) = self.can_default { properties.push(("can-default", can_default)); } if let Some(ref can_focus) = self.can_focus { properties.push(("can-focus", can_focus)); } if let Some(ref double_buffered) = self.double_buffered { properties.push(("double-buffered", double_buffered)); } if let Some(ref events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } if let Some(ref focus_on_click) = self.focus_on_click { properties.push(("focus-on-click", focus_on_click)); } if let Some(ref halign) = self.halign { properties.push(("halign", halign)); } if let Some(ref has_default) = self.has_default { properties.push(("has-default", has_default)); } if let Some(ref has_focus) = self.has_focus { properties.push(("has-focus", has_focus)); } if let Some(ref has_tooltip) = self.has_tooltip { properties.push(("has-tooltip", has_tooltip)); } if let Some(ref height_request) = self.height_request { properties.push(("height-request", height_request)); } if let Some(ref hexpand) = self.hexpand { properties.push(("hexpand", hexpand)); } if let Some(ref hexpand_set) = self.hexpand_set { properties.push(("hexpand-set", hexpand_set)); } if let Some(ref is_focus) = self.is_focus { properties.push(("is-focus", is_focus)); } if let Some(ref margin) = self.margin { properties.push(("margin", margin)); } if let Some(ref margin_bottom) = self.margin_bottom { properties.push(("margin-bottom", margin_bottom)); } if let Some(ref margin_end) = self.margin_end { properties.push(("margin-end", margin_end)); } if let Some(ref margin_left) = self.margin_left { properties.push(("margin-left", margin_left)); } if let Some(ref margin_right) = self.margin_right { properties.push(("margin-right", margin_right)); } if let Some(ref margin_start) = self.margin_start { properties.push(("margin-start", margin_start)); } if let Some(ref margin_top) = self.margin_top { properties.push(("margin-top", margin_top)); } if let Some(ref name) = self.name { properties.push(("name", name)); } if let Some(ref no_show_all) = self.no_show_all { properties.push(("no-show-all", no_show_all)); } if let Some(ref opacity) = self.opacity { properties.push(("opacity", opacity)); } if let Some(ref parent) = self.parent { properties.push(("parent", parent)); } if let Some(ref receives_default) = self.receives_default { properties.push(("receives-default", receives_default)); } if let Some(ref sensitive) = self.sensitive { properties.push(("sensitive", sensitive)); } if let Some(ref tooltip_markup) = self.tooltip_markup { properties.push(("tooltip-markup", tooltip_markup)); } if let Some(ref tooltip_text) = self.tooltip_text { properties.push(("tooltip-text", tooltip_text)); } if let Some(ref valign) = self.valign { properties.push(("valign", valign)); } if let Some(ref vexpand) = self.vexpand { properties.push(("vexpand", vexpand)); } if let Some(ref vexpand_set) = self.vexpand_set { properties.push(("vexpand-set", vexpand_set)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } if let Some(ref width_request) = self.width_request { properties.push(("width-request", width_request)); } glib::Object::new::(&properties) .expect("Failed to create an instance of WindowHandle") } pub fn above_child(mut self, above_child: bool) -> Self { self.above_child = Some(above_child); self } pub fn visible_window(mut self, visible_window: bool) -> Self { self.visible_window = Some(visible_window); self } pub fn border_width(mut self, border_width: u32) -> Self { self.border_width = Some(border_width); self } pub fn child>(mut self, child: &P) -> Self { self.child = Some(child.clone().upcast()); self } pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self { self.resize_mode = Some(resize_mode); self } pub fn app_paintable(mut self, app_paintable: bool) -> Self { self.app_paintable = Some(app_paintable); self } pub fn can_default(mut self, can_default: bool) -> Self { self.can_default = Some(can_default); self } pub fn can_focus(mut self, can_focus: bool) -> Self { self.can_focus = Some(can_focus); self } pub fn double_buffered(mut self, double_buffered: bool) -> Self { self.double_buffered = Some(double_buffered); self } pub fn events(mut self, events: gdk::EventMask) -> Self { self.events = Some(events); self } pub fn expand(mut self, expand: bool) -> Self { self.expand = Some(expand); self } pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { self.focus_on_click = Some(focus_on_click); self } pub fn halign(mut self, halign: gtk::Align) -> Self { self.halign = Some(halign); self } pub fn has_default(mut self, has_default: bool) -> Self { self.has_default = Some(has_default); self } pub fn has_focus(mut self, has_focus: bool) -> Self { self.has_focus = Some(has_focus); self } pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { self.has_tooltip = Some(has_tooltip); self } pub fn height_request(mut self, height_request: i32) -> Self { self.height_request = Some(height_request); self } pub fn hexpand(mut self, hexpand: bool) -> Self { self.hexpand = Some(hexpand); self } pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { self.hexpand_set = Some(hexpand_set); self } pub fn is_focus(mut self, is_focus: bool) -> Self { self.is_focus = Some(is_focus); self } pub fn margin(mut self, margin: i32) -> Self { self.margin = Some(margin); self } pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { self.margin_bottom = Some(margin_bottom); self } pub fn margin_end(mut self, margin_end: i32) -> Self { self.margin_end = Some(margin_end); self } pub fn margin_left(mut self, margin_left: i32) -> Self { self.margin_left = Some(margin_left); self } pub fn margin_right(mut self, margin_right: i32) -> Self { self.margin_right = Some(margin_right); self } pub fn margin_start(mut self, margin_start: i32) -> Self { self.margin_start = Some(margin_start); self } pub fn margin_top(mut self, margin_top: i32) -> Self { self.margin_top = Some(margin_top); self } pub fn name(mut self, name: &str) -> Self { self.name = Some(name.to_string()); self } pub fn no_show_all(mut self, no_show_all: bool) -> Self { self.no_show_all = Some(no_show_all); self } pub fn opacity(mut self, opacity: f64) -> Self { self.opacity = Some(opacity); self } pub fn parent>(mut self, parent: &P) -> Self { self.parent = Some(parent.clone().upcast()); self } pub fn receives_default(mut self, receives_default: bool) -> Self { self.receives_default = Some(receives_default); self } pub fn sensitive(mut self, sensitive: bool) -> Self { self.sensitive = Some(sensitive); self } pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { self.tooltip_markup = Some(tooltip_markup.to_string()); self } pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { self.tooltip_text = Some(tooltip_text.to_string()); self } pub fn valign(mut self, valign: gtk::Align) -> Self { self.valign = Some(valign); self } pub fn vexpand(mut self, vexpand: bool) -> Self { self.vexpand = Some(vexpand); self } pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { self.vexpand_set = Some(vexpand_set); self } pub fn visible(mut self, visible: bool) -> Self { self.visible = Some(visible); self } pub fn width_request(mut self, width_request: i32) -> Self { self.width_request = Some(width_request); self } } impl fmt::Display for WindowHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("WindowHandle") } } libhandy-0.8.0/src/lib.rs000064400000000000000000000065200000000000000133060ustar 00000000000000// Copyright 2018–2021, The libhandy-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the LGPL-2.1-only, see the LICENSE file or #![allow(clippy::needless_doctest_main)] //! # Rust Handy bindings //! //! This library contains safe Rust bindings for Handy, a library that offers //! building blocks for modern adaptive GNOME applications. //! //! See also //! //! - [GTK 3 Rust bindings documentation](mod@gtk) //! - [Libhandy documentation](https://gnome.pages.gitlab.gnome.org/libhandy/) //! - [gtk-rs project overview](https://gtk-rs.org/) //! //! # Example //! //! ```no_run //! use gtk::prelude::*; //! use gtk::{Application, Box, ListBox, Orientation}; //! use libhandy::prelude::*; //! use libhandy::{ActionRow, ApplicationWindow, HeaderBar}; //! //! fn main() { //! let application = Application::builder() //! .application_id("com.example.FirstHandyApp") //! .build(); //! //! application.connect_activate(|app| { //! libhandy::init(); //! //! // ActionRows are only available in Handy //! let row = ActionRow::builder() //! .activatable(true) //! .selectable(false) //! .margin(32) //! .title("Click me") //! .build(); //! row.connect_activated(|_| { //! eprintln!("Clicked!"); //! }); //! //! let list = ListBox::builder().child(&row).build(); //! // the content class makes the list look nicer //! list.style_context().add_class("content"); //! //! // Combine the content in a box //! let content = Box::new(Orientation::Vertical, 0); //! // Handy's ApplicationWindow does not include a HeaderBar //! content.add( //! &HeaderBar::builder() //! .show_close_button(true) //! .title("First Handy Program") //! .build(), //! ); //! content.add(&list); //! //! let window = ApplicationWindow::builder() //! .default_width(350) //! .default_height(70) //! // add content to window //! .child(&content) //! .build(); //! window.set_application(Some(app)); //! window.show_all(); //! }); //! //! application.run(); //! } //! ``` #![cfg_attr(feature = "dox", feature(doc_cfg))] #![allow(deprecated)] #![allow(dead_code)] /// Asserts that this is the main thread and `gtk::init` has been called. macro_rules! assert_initialized_main_thread { () => { if !::gtk::is_initialized_main_thread() { if ::gtk::is_initialized() { panic!("Libhandy may only be used from the main thread."); } else { panic!("Gtk has to be initialized before using libhandy."); } } }; } macro_rules! skip_assert_initialized { () => {}; } #[doc(hidden)] pub use gdk; #[doc(hidden)] pub use gio; #[doc(hidden)] pub use glib; #[doc(hidden)] pub use gtk; #[doc(hidden)] pub use pango; #[allow(clippy::let_and_return)] #[allow(clippy::type_complexity)] #[allow(clippy::wrong_self_convention)] #[allow(unused_imports)] mod auto; mod value_object; #[macro_use] pub mod subclass; pub mod prelude; pub use auto::*; pub use value_object::*; pub use auto::functions::*; libhandy-0.8.0/src/prelude.rs000064400000000000000000000001570000000000000142000ustar 00000000000000#[doc(hidden)] pub use gtk::prelude::*; pub use crate::auto::traits::*; pub use crate::ValueObjectExtManual; libhandy-0.8.0/src/subclass/application_window.rs000064400000000000000000000010460000000000000202470ustar 00000000000000use glib::subclass::prelude::*; use crate::ApplicationWindow; pub trait ApplicationWindowImpl: gtk::subclass::application_window::ApplicationWindowImpl + 'static { } unsafe impl IsSubclassable for ApplicationWindow { fn class_init(class: &mut glib::Class) { >::class_init(class); } fn instance_init(instance: &mut glib::subclass::InitializingObject) { >::instance_init(instance); } } libhandy-0.8.0/src/subclass/mod.rs000064400000000000000000000002760000000000000151400ustar 00000000000000pub mod application_window; pub mod prelude { pub use super::application_window::ApplicationWindowImpl; pub use gio::subclass::prelude::*; pub use glib::subclass::prelude::*; } libhandy-0.8.0/src/value_object.rs000064400000000000000000000014000000000000000151720ustar 00000000000000use crate::ValueObject; use glib::translate::*; impl ValueObject { pub fn new_string(string: &str) -> ValueObject { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::hdy_value_object_new_take_string(string.to_glib_full())) } } } pub trait ValueObjectExtManual { fn copy_value(&self) -> glib::Value; } // impl + IsA> ValueObjectExtManual for O { // #[cfg(any(feature = "v0_0_8", feature = "dox"))] // fn copy_value(&self) -> glib::Value { // unsafe { // let mut dest = glib::Value::uninitialized(); // ffi::hdy_value_object_copy_value(self.as_ref().to_glib_none().0, dest.to_glib_none_mut().0); // dest // } // } // } libhandy-0.8.0/tests/main.rs000064400000000000000000000002640000000000000140360ustar 00000000000000#[test] fn check_build() { assert!(gtk::init().is_ok()); let column = libhandy::Clamp::new(); column.set_maximum_size(800); column.set_tightening_threshold(600); }