gtk-0.14.3/.cargo_vcs_info.json0000644000000001120000000000100117000ustar { "git": { "sha1": "fb38b379bfdf9634f7fc1600da4b7fb546ee9eb7" } } gtk-0.14.3/COPYRIGHT000064400000000000000000000012130072674642500120160ustar 00000000000000The gtk-rs Project is licensed under the MIT license, see the LICENSE file or . Copyrights in the gtk-rs Project project are retained by their contributors. No copyright assignment is required to contribute to the gtk-rs Project project. For full authorship information, see the version control history. This project provides interoperability with various GNOME libraries but doesn't distribute any parts of them. Distributing compiled libraries and executables that link to those libraries may be subject to terms of the GNU LGPL or other licenses. For more information check the license of each GNOME library. gtk-0.14.3/Cargo.toml0000644000000041100000000000100077000ustar # 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 are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "gtk" version = "0.14.3" authors = ["The gtk-rs Project Developers"] build = "build.rs" exclude = ["gir-files/*"] description = "Rust bindings for the GTK+ 3 library" homepage = "https://gtk-rs.org/" documentation = "https://gtk-rs.org/gtk3-rs/stable/latest/docs/gtk/" readme = "README.md" keywords = ["gtk", "gtk-rs", "gnome", "GUI"] categories = ["api-bindings", "gui"] license = "MIT" repository = "https://github.com/gtk-rs/gtk3-rs" [package.metadata.docs.rs] features = ["dox"] [lib] name = "gtk" [dependencies.atk] version = "0.14.0" [dependencies.bitflags] version = "1.0" [dependencies.cairo-rs] version = "0.14.0" [dependencies.ffi] version = "0.14.0" package = "gtk-sys" [dependencies.field-offset] version = "0.3" [dependencies.futures-channel] version = "0.3" [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.gtk3-macros] version = "0.14.0" [dependencies.libc] version = "0.2" [dependencies.once_cell] version = "1.0" [dependencies.pango] version = "0.14.0" [dev-dependencies.gir-format-check] version = "^0.1" [build-dependencies.pkg-config] version = "0.3.7" [features] dox = ["gdk/dox", "ffi/dox"] v3_20 = ["ffi/v3_20"] v3_22 = ["v3_20", "ffi/v3_22", "gdk/v3_22"] v3_22_20 = ["v3_22", "ffi/v3_22"] v3_22_26 = ["v3_22_20", "ffi/v3_22_26"] v3_22_27 = ["v3_22_26", "ffi/v3_22_27"] v3_22_29 = ["v3_22_27", "ffi/v3_22_29"] v3_22_30 = ["v3_22_29", "ffi/v3_22_30"] v3_24 = ["v3_22_30", "ffi/v3_24"] v3_24_8 = ["v3_24", "ffi/v3_24_8"] v3_24_9 = ["v3_24_8", "ffi/v3_24_9"] gtk-0.14.3/Cargo.toml.orig000064400000000000000000000026620072674642500134230ustar 00000000000000[package] documentation = "https://gtk-rs.org/gtk3-rs/stable/latest/docs/gtk/" categories = ["api-bindings", "gui"] license = "MIT" description = "Rust bindings for the GTK+ 3 library" name = "gtk" homepage = "https://gtk-rs.org/" authors = ["The gtk-rs Project Developers"] readme = "README.md" version = "0.14.3" keywords = ["gtk", "gtk-rs", "gnome", "GUI"] repository = "https://github.com/gtk-rs/gtk3-rs" build = "build.rs" exclude = [ "gir-files/*", ] edition = "2018" [lib] name = "gtk" [features] v3_20 = ["ffi/v3_20"] v3_22 = ["v3_20", "ffi/v3_22", "gdk/v3_22"] v3_22_20 = ["v3_22", "ffi/v3_22"] v3_22_26 = ["v3_22_20", "ffi/v3_22_26"] v3_22_27 = ["v3_22_26", "ffi/v3_22_27"] v3_22_29 = ["v3_22_27", "ffi/v3_22_29"] v3_22_30 = ["v3_22_29", "ffi/v3_22_30"] v3_24 = ["v3_22_30", "ffi/v3_24"] v3_24_8 = ["v3_24", "ffi/v3_24_8"] v3_24_9 = ["v3_24_8", "ffi/v3_24_9"] dox = ["gdk/dox", "ffi/dox"] [package.metadata.docs.rs] features = ["dox"] [build-dependencies] pkg-config = "0.3.7" [dependencies] libc = "0.2" bitflags = "1.0" field-offset = "0.3" futures-channel = "0.3" once_cell = "1.0" atk = {version = "0.14.0", path = "../atk" } ffi = {package = "gtk-sys", path = "./sys", version = "0.14.0"} gtk3-macros = {version = "0.14.0", path = "./../gtk3-macros"} cairo-rs = "0.14.0" gio = "0.14.0" glib = "0.14.0" gdk = {version = "0.14.0", path = "./../gdk" } gdk-pixbuf = "0.14.0" pango = "0.14.0" [dev-dependencies] gir-format-check = "^0.1" gtk-0.14.3/Gir.toml000064400000000000000000002031070072674642500121470ustar 00000000000000[options] girs_directories = ["../gir-files"] library = "Gtk" version = "3.0" min_cfg_version = "3.18" target_path = "." work_mode = "normal" generate_safety_asserts = true deprecate_by_min_version = true single_version_file = true generate = [ "Gtk.AccelFlags", "Gtk.Align", "Gtk.ApplicationInhibitFlags", "Gtk.ArrowType", "Gtk.AssistantPageType", "Gtk.BaselinePosition", "Gtk.Bin", "Gtk.BorderStyle", "Gtk.BuilderError", "Gtk.ButtonBoxStyle", "Gtk.ButtonRole", "Gtk.ButtonsType", "Gtk.CalendarDisplayOptions", "Gtk.CellAreaContext", "Gtk.CellLayout", "Gtk.CellRendererAccelMode", "Gtk.CellRendererMode", "Gtk.CellRendererState", "Gtk.CornerType", "Gtk.CssProvider", "Gtk.CssProviderError", "Gtk.CssSection", "Gtk.CssSectionType", "Gtk.DeleteType", "Gtk.DestDefaults", "Gtk.DialogFlags", "Gtk.DirectionType", "Gtk.DragResult", "Gtk.EntryIconPosition", "Gtk.EventController", "Gtk.EventSequenceState", "Gtk.FileChooserAction", "Gtk.FileChooserConfirmation", "Gtk.FileChooserError", "Gtk.FileFilter", "Gtk.FileFilterFlags", "Gtk.GestureSingle", "Gtk.IconInfo", "Gtk.IconLookupFlags", "Gtk.IconSize", "Gtk.IconThemeError", "Gtk.IconViewDropPosition", "Gtk.ImageType", "Gtk.InputPurpose", "Gtk.JunctionSides", "Gtk.Justification", "Gtk.LevelBarMode", "Gtk.License", "Gtk.MenuDirectionType", "Gtk.MessageType", "Gtk.Misc", "Gtk.MovementStep", "Gtk.NotebookTab", "Gtk.NumberUpLayout", "Gtk.Orientable", "Gtk.Orientation", "Gtk.PackDirection", "Gtk.PackType", "Gtk.PageOrientation", "Gtk.PageSet", "Gtk.PanDirection", "Gtk.PlacesOpenFlags", "Gtk.PolicyType", "Gtk.PopoverConstraint", "Gtk.PositionType", "Gtk.PrintDuplex", "Gtk.PrintError", "Gtk.PrintOperationAction", "Gtk.PrintOperationPreview", "Gtk.PrintOperationResult", "Gtk.PrintPages", "Gtk.PrintQuality", "Gtk.PrintStatus", "Gtk.PropagationPhase", "Gtk.RecentChooser", "Gtk.RecentChooserError", "Gtk.RecentFilter", "Gtk.RecentFilterFlags", "Gtk.RecentInfo", "Gtk.RecentManagerError", "Gtk.RecentSortType", "Gtk.RegionFlags", "Gtk.ReliefStyle", "Gtk.ResizeMode", "Gtk.RevealerTransitionType", "Gtk.Scrollable", "Gtk.ScrollablePolicy", "Gtk.ScrollStep", "Gtk.ScrollType", "Gtk.SelectionMode", "Gtk.SensitivityType", "Gtk.ShadowType", "Gtk.SizeGroupMode", "Gtk.SizeRequestMode", "Gtk.SortType", "Gtk.SpinButtonUpdatePolicy", "Gtk.SpinType", "Gtk.StackTransitionType", "Gtk.StateFlags", "Gtk.StyleProperties", "Gtk.StyleProvider", "Gtk.TargetFlags", "Gtk.TextAttributes", "Gtk.TextChildAnchor", "Gtk.TextDirection", "Gtk.TextExtendSelection", "Gtk.TextSearchFlags", "Gtk.TextTagTable", "Gtk.TextViewLayer", "Gtk.TextWindowType", "Gtk.ToolbarStyle", "Gtk.ToolPaletteDragTargets", "Gtk.ToolShell", "Gtk.Tooltip", "Gtk.TreeDragDest", "Gtk.TreeDragSource", "Gtk.TreeModelFlags", "Gtk.TreeViewColumnSizing", "Gtk.TreeViewDropPosition", "Gtk.TreeViewGridLines", "Gtk.Unit", "Gtk.WidgetHelpType", "Gtk.WidgetPath", "Gtk.WindowGroup", "Gtk.WindowPosition", "Gtk.WindowType", "Gtk.WrapMode", ] ignore = [ "Gtk.Activatable", #deprecated since 3.14 "Gtk.Alignment", #deprecated since 3.14 "Gtk.Arrow", #deprecated since 3.10 "Gtk.IconFactory", #deprecated since 3.10 "Gtk.IconSet", #deprecated since 3.10 "Gtk.IconSource", #deprecated since 3.10 "Gtk.ImageMenuItem", #deprecated since 3.10 "Gtk.IMPreeditStyle", #deprecated since 3.10 "Gtk.IMStatusStyle", #deprecated since 3.14 "Gtk.StateType", #deprecated since 3.14 "Gtk.StatusIcon", #deprecated since 3.8 "Gtk.SymbolicColor", ] manual = [ "Atk.Object", "cairo.Context", "cairo.FontOptions", "cairo.RectangleInt", "cairo.Region", "cairo.Surface", "Gdk.AnchorHints", "Gdk.Atom", "Gdk.AxisUse", "Gdk.Device", "Gdk.DeviceTool", "Gdk.Display", "Gdk.DragAction", "Gdk.DragContext", "Gdk.DragProtocol", "Gdk.Event", "Gdk.EventButton", "Gdk.EventConfigure", "Gdk.EventCrossing", "Gdk.EventExpose", "Gdk.EventFocus", "Gdk.EventGrabBroken", "Gdk.EventKey", "Gdk.EventMask", "Gdk.EventMotion", "Gdk.EventProperty", "Gdk.EventProximity", "Gdk.EventScroll", "Gdk.EventSelection", "Gdk.EventSequence", "Gdk.EventVisibility", "Gdk.EventWindowState", "Gdk.FrameClock", "Gdk.Geometry", "Gdk.GLContext", "Gdk.Gravity", "Gdk.ModifierIntent", "Gdk.ModifierType", "Gdk.Monitor", "Gdk.Rectangle", "Gdk.RGBA", "Gdk.Screen", "Gdk.Visual", "Gdk.Window", "Gdk.WindowEdge", "Gdk.WindowHints", "Gdk.WindowTypeHint", "GdkPixbuf.Pixbuf", "GdkPixbuf.PixbufAnimation", "Gio.ActionGroup", "Gio.ActionMap", "Gio.AppInfo", "Gio.Application", "Gio.ApplicationFlags", "Gio.Cancellable", "Gio.File", "Gio.Icon", "Gio.ListModel", "Gio.Menu", "Gio.MenuModel", "Gio.MountOperation", "Gio.Permission", "GLib.Error", "GLib.KeyFile", "GLib.Quark", "GLib.Variant", "GLib.VariantType", "GObject.Closure", "GObject.Object", "GObject.Value", "Gtk.Allocation", "Gtk.AppChooser", "Gtk.Border", "Gtk.PadActionEntry", "Gtk.PageRange", "Gtk.RecentData", "Gtk.Requisition", "Gtk.ResponseType", "Gtk.TargetEntry", "Pango.Alignment", "Pango.AttrList", "Pango.Context", "Pango.Direction", "Pango.EllipsizeMode", "Pango.FontDescription", "Pango.FontFace", "Pango.FontFamily", "Pango.FontMap", "Pango.Language", "Pango.Layout", "Pango.Stretch", "Pango.Style", "Pango.TabArray", "Pango.Underline", "Pango.Variant", "Pango.WrapMode", "xlib.Window", ] [[object]] name = "GObject.ParamSpec" status = "manual" final_type = true [[object]] name = "Gtk.*" status = "generate" [[object.function]] pattern = ".+" [[object.function.parameter]] name = "cr" const = true [[object.function.parameter]] name = "surface" const = true [[object.function]] pattern = "tree_[gs]et_row_drag_data" [[object.function.parameter]] name = "selection_data" const = true [[object.function]] name = "selection_add_targets" #array as pointer ignore = true [[object.function]] name = "target_table_free" #array as pointer ignore = true [[object.function]] name = "target_table_new_from_list" #array as pointer ignore = true [[object.function]] name = "init" #manual ignore = true [[object.function]] name = "main_quit" #manual ignore = true [[object.function]] pattern = "get_(major|minor|micro)_version" assertion = "skip" [[object.function]] pattern = "get_(binary|interface)_age" assertion = "skip" [[object.function]] name = "check_version" assertion = "skip" [[object.function]] pattern = "drag_.+" #manual trait ignore = true [[object.function]] name = "disable_setlocale" assertion = "not-initialized" [[object]] name = "Gtk.AboutDialog" status = "generate" generate_builder = true [[object.function]] name = "set_website_label" [[object.function.parameter]] name = "website_label" # Passing `NULL` here seems to influence the rendering code nullable = true [[object.signal]] name = "activate-link" inhibit = true [[object]] name = "Gtk.AccelGroup" status = "generate" manual_traits = ["AccelGroupExtManual"] [[object.function]] name = "query" # It's not a part of public API # See https://mail.gnome.org/archives/commits-list/2012-May/msg07052.html ignore = true [[object.function]] name = "connect" # More convenient implementation manual = true [[object.function]] name = "connect_by_path" # More convenient implementation manual = true [[object]] name = "Gtk.AccelLabel" status = "generate" generate_builder = true [[object]] name = "Gtk.Actionable" status = "generate" [[object.property]] name = "action-target" #has get/set function generate = ["notify"] [[object]] name = "Gtk.ActionBar" status = "generate" generate_builder = true [[object.child_prop]] name = "pack-type" type = "Gtk.PackType" [[object.child_prop]] name = "position" type = "gint" [[object]] name = "Gtk.Adjustment" status = "generate" generate_builder = true [[object]] name = "Gtk.AppChooserButton" status = "generate" generate_builder = true [[object]] name = "Gtk.AppChooserDialog" status = "generate" generate_builder = true [[object.function]] name = "get_widget" [object.function.return] nullable = false [[object]] name = "Gtk.AppChooserWidget" status = "generate" generate_builder = true [[object]] name = "Gtk.Application" status = "generate" generate_builder = true builder_postprocess = "Application::register_startup_hook(&ret);" trait_name = "GtkApplicationExt" manual_traits = ["gio::ApplicationExtManual"] [[object.function]] name = "new" ignore = true [[object]] name = "Gtk.ApplicationWindow" status = "generate" generate_builder = true [[object.function]] name = "new" ignore = true [[object]] name = "Gtk.AspectFrame" status = "generate" generate_builder = true [[object]] name = "Gtk.Assistant" status = "generate" generate_builder = true [[object.child_prop]] name = "complete" type = "gboolean" [[object.child_prop]] name = "has-padding" type = "gboolean" [[object.child_prop]] name = "page-type" type = "Gtk.AssistantPageType" [[object.child_prop]] name = "title" type = "utf8" [[object.function]] name = "get_page_has_padding" rename = "page_has_padding" [[object.function]] name = "get_page_complete" rename = "page_is_complete" [[object]] name = "Gtk.Box" status = "generate" generate_builder = true [[object.child_prop]] name = "expand" type = "gboolean" doc_hidden = true [[object.child_prop]] name = "fill" type = "gboolean" doc_hidden = true [[object.child_prop]] name = "pack-type" type = "Gtk.PackType" doc_hidden = true [[object.child_prop]] name = "padding" type = "guint" doc_hidden = true [[object.child_prop]] name = "position" type = "gint" [[object.function]] name = "get_child_non_homogeneous" rename = "child_is_non_homogeneous" [[object.function]] name = "get_child_secondary" rename = "child_is_secondary" [[object]] name = "Gtk.Buildable" status = "generate" manual_traits = ["BuildableExtManual"] [[object.function]] pattern = "[gs]et_name" ignore = true doc_trait_name = "BuildableExtManual" [[object]] name = "Gtk.Builder" status = "generate" manual_traits = ["BuilderExtManual"] [[object.function]] pattern = ".+_from_file" #path ignore = true doc_trait_name = "BuilderExtManual" [[object.function]] name = "connect_signals_full" # Connect object and swapped signal not supported manual = true [[object.function]] name = "get_object" #downcast ignore = true doc_trait_name = "BuilderExtManual" [[object]] name = "Gtk.Button" status = "generate" generate_builder = true [[object]] name = "Gtk.ButtonBox" status = "generate" generate_builder = true [[object.function]] name = "get_child_non_homogeneous" rename = "child_is_non_homogeneous" [[object.function]] name = "get_child_secondary" rename = "child_is_secondary" [[object]] name = "Gtk.Calendar" status = "generate" generate_builder = true [[object.function]] name = "get_day_is_marked" rename = "day_is_marked" [[object]] name = "Gtk.CellArea" status = "generate" [[object.function]] name = "render" [[object.function.parameter]] name = "cr" # cairo::Context is reference-counted const = true [[object.function]] name = "apply_attributes" [[object.function.parameter]] name = "iter" const = true [[object.function]] name = "activate_cell" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "event" [[object.function.parameter]] name = "event" const = true [[object.signal]] name = "add-editable" [[object.signal.parameter]] name = "path" transformation = "treepath" [[object.signal]] name = "apply-attributes" [[object.signal.parameter]] name = "iter" transformation = "borrow" [[object.signal]] name = "focus-changed" [[object.signal.parameter]] name = "path" transformation = "treepath" [[object]] name = "Gtk.CellAreaBox" status = "generate" generate_builder = true [[object]] name = "Gtk.CellEditable" status = "generate" [[object.function]] name = "start_editing" [[object.function.parameter]] name = "event" const = true [[object]] name = "Gtk.CellRenderer" status = "generate" generate_builder = true [[object.function]] name = "render" [[object.function.parameter]] name = "cr" # cairo::Context is reference-counted const = true [[object.function]] name = "activate" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "start_editing" [[object.function.parameter]] name = "event" const = true [[object.signal]] name = "editing-started" [[object.signal.parameter]] name = "path" transformation = "treepath" [[object]] name = "Gtk.CellRendererAccel" status = "generate" generate_builder = true [[object.signal]] name = "accel-cleared" [[object.signal.parameter]] name = "path_string" transformation = "treepath" new_name = "path" [[object.signal]] name = "accel-edited" [[object.signal.parameter]] name = "path_string" transformation = "treepath" new_name = "path" [[object]] name = "Gtk.CellRendererCombo" status = "generate" generate_builder = true [[object.signal]] name = "changed" [[object.signal.parameter]] name = "new_iter" transformation = "borrow" [[object.signal.parameter]] name = "path_string" transformation = "treepath" new_name = "path" [[object]] name = "Gtk.CellRendererPixbuf" status = "generate" generate_builder = true manual_traits = ["CellRendererPixbufExtManual"] [[object.property]] name = "surface" [[object.property]] name = "stock-size" #value ImageSize generate = ["notify"] doc_trait_name = "CellRendererPixbufExtManual" [[object]] name = "Gtk.CellRendererProgress" status = "generate" generate_builder = true [[object]] name = "Gtk.CellRendererSpin" status = "generate" generate_builder = true [[object]] name = "Gtk.CellRendererSpinner" status = "generate" generate_builder = true [[object]] name = "Gtk.CellRendererText" status = "generate" generate_builder = true [[object.signal]] name = "edited" [[object.signal.parameter]] name = "path" transformation = "treepath" [[object]] name = "Gtk.CellRendererToggle" status = "generate" generate_builder = true [[object.signal]] name = "toggled" [[object.signal.parameter]] name = "path" transformation = "treepath" [[object]] name = "Gtk.CellView" status = "generate" generate_builder = true [[object.function]] name = "set_displayed_row" [[object.function.parameter]] name = "path" nullable = false [[object]] name = "Gtk.CheckButton" status = "generate" generate_builder = true [[object]] name = "Gtk.CheckMenuItem" status = "generate" generate_builder = true [[object]] name = "Gtk.Clipboard" status = "generate" [[object.function]] name = "get" [object.function.return] nullable = false [[object.function]] name = "get_for_display" [object.function.return] nullable = false [[object.function]] name = "set_can_store" #array with size ignore = true [[object.function]] name = "request_targets" #array with size ignore = true [[object.function]] name = "request_uris" #array with size ignore = true [[object.function]] name = "set_with_data" #array with size ignore = true [[object.function]] name = "set_with_owner" #array with size ignore = true [[object]] name = "Gtk.ColorButton" status = "generate" generate_builder = true manual_traits = ["ColorButtonExtManual"] [[object.function]] name = "new_with_color" #totally doc_trait_name = "ColorButtonExtManual" [[object.function]] name = "get_color" manual = true doc_trait_name = "ColorButtonExtManual" [[object.function]] name = "set_color" manual = true doc_trait_name = "ColorButtonExtManual" [[object]] name = "Gtk.ColorChooser" status = "generate" manual_traits = ["ColorChooserExtManual"] [[object.function]] name = "add_palette" #array with size manual = true doc_trait_name = "ColorChooserExtManual" [[object]] name = "Gtk.ColorChooserDialog" status = "generate" generate_builder = true [[object]] name = "Gtk.ColorChooserWidget" status = "generate" generate_builder = true [[object]] name = "Gtk.ComboBox" status = "generate" generate_builder = true manual_traits = ["ComboBoxExtManual"] [[object.function]] name = "set_active_iter" [[object.function.parameter]] name = "iter" const = true [[object.function]] name = "set_active" manual = true doc_trait_name = "ComboBoxExtManual" [[object.function]] name = "get_active" manual = true doc_trait_name = "ComboBoxExtManual" [[object.property]] name = "active" #manual Option generate = ["notify"] [[object]] name = "Gtk.ComboBoxText" status = "generate" generate_builder = true [[object]] name = "Gtk.Container" status = "generate" [[object.function]] pattern = "child_[gs]et_property" ignore = true [[object.function]] name = "propagate_draw" [[object.function.parameter]] name = "cr" # cairo::Context is reference-counted const = true [[object]] name = "Gtk.Dialog" status = "generate" generate_builder = true manual_traits = ["DialogExtManual"] [[object.function]] name = "add_button" [object.function.return] nullable = false [[object.function]] name = "get_action_area" [object.function.return] nullable = false [[object.function]] name = "get_content_area" [object.function.return] nullable = false [[object.function]] name = "run" [object.function.return] type = "Gtk.ResponseType" [[object.function]] name = "get_response_for_widget" [object.function.return] type = "Gtk.ResponseType" [[object]] name = "Gtk.DrawingArea" status = "generate" generate_builder = true [[object]] name = "Gtk.Editable" status = "generate" manual_traits = ["EditableSignals"] [[object.signal]] pattern = ".+" ignore = true #out #manual doc_trait_name = "EditableSignals" [[object]] name = "Gtk.Entry" status = "generate" generate_builder = true manual_traits = ["EntryExtManual"] [[object.function]] name = "get_buffer" [object.function.return] nullable = false [[object.function]] name = "get_icon_activatable" rename = "icon_is_activatable" [[object.function]] name = "get_icon_sensitive" rename = "icon_is_sensitive" [[object.function]] name = "get_invisible_char" manual = true doc_trait_name = "EntryExtManual" [[object.function]] name = "get_text" [object.function.return] nullable = false [[object.function]] name = "set_invisible_char" [[object.function.parameter]] name = "ch" nullable = true [[object.function]] name = "set_placeholder_text" [[object.function.parameter]] name = "text" nullable = true [[object.function]] name = "im_context_filter_keypress" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "set_tabs" [[object.function.parameter]] name = "tabs" const = true [[object]] name = "Gtk.EntryBuffer" status = "manual" generate_builder = true [[object]] name = "Gtk.EntryCompletion" status = "generate" generate_builder = true manual_traits = ["EntryCompletionExtManual"] [[object.signal]] name = "insert-prefix" inhibit = true [[object.signal]] name = "match-selected" inhibit = true [[object.signal]] name = "cursor-on-match" inhibit = true [[object.function]] name = "get_entry" manual = true doc_trait_name = "EntryCompletionExtManual" [[object]] name = "Gtk.EventBox" status = "generate" generate_builder = true [[object]] name = "Gtk.EventControllerKey" status = "generate" version = "3.24" [[object]] name = "Gtk.EventControllerMotion" status = "generate" version = "3.24" [[object]] name = "Gtk.EventControllerScroll" status = "generate" version = "3.24" [[object]] name = "Gtk.EventControllerScrollFlags" status = "generate" version = "3.24" [[object]] name = "Gtk.Expander" status = "generate" generate_builder = true [[object.function]] name = "new" [[object.function.parameter]] name = "label" nullable = true [[object.function]] name = "new_with_mnemonic" [[object.function.parameter]] name = "label" nullable = false [[object]] name = "Gtk.FileChooser" status = "generate" [[object.function]] name = "add_choice" ignore = true #strange type of options and option_labels [[object]] name = "Gtk.FileChooserButton" status = "generate" generate_builder = true [[object]] name = "Gtk.FileChooserDialog" status = "generate" generate_builder = true [[object]] name = "Gtk.FileChooserNative" status = "generate" generate_builder = true [[object]] name = "Gtk.FileChooserWidget" status = "generate" generate_builder = true [[object]] name = "Gtk.Fixed" status = "generate" generate_builder = true manual_traits = ["FixedExtManual"] [[object]] name = "Gtk.FlowBox" status = "generate" generate_builder = true manual_traits = ["FlowBoxExtManual"] [[object.function]] name = "bind_model" [[object.function.parameter]] name = "create_widget_func" # we add a manual unbind() function instead nullable = false [[object]] name = "Gtk.FlowBoxChild" status = "generate" generate_builder = true [[object]] name = "Gtk.FontButton" status = "generate" generate_builder = true [[object]] name = "Gtk.FontChooser" status = "generate" [[object.property]] name = "level" version = "3.24" [[object.property]] name = "font-features" version = "3.24" [[object.property]] name = "language" version = "3.24" [[object]] name = "Gtk.FontChooserDialog" status = "generate" generate_builder = true [[object]] name = "Gtk.FontChooserLevel" status = "generate" version = "3.24" [[object]] name = "Gtk.FontChooserWidget" status = "generate" generate_builder = true [[object]] name = "Gtk.Frame" status = "generate" generate_builder = true [[object]] name = "Gtk.Gesture" status = "generate" [[object.function]] pattern = ".+" [[object.function.parameter]] name = "sequence" const = true [[object.function]] name = "group" # Precise the purpose and avoid clash with `get_group`. rename = "group_with" [[object.signal]] name = "begin" [[object.signal.parameter]] name = "sequence" nullable = true [[object.signal]] name = "end" [[object.signal.parameter]] name = "sequence" nullable = true [[object.signal]] name = "update" [[object.signal.parameter]] name = "sequence" nullable = true [[object.signal]] name = "cancel" [[object.signal.parameter]] name = "sequence" nullable = true [[object.signal]] name = "sequence-state-changed" [[object.signal.parameter]] name = "sequence" nullable = true [[object]] name = "Gtk.GestureDrag" status = "generate" generate_builder = true [[object]] name = "Gtk.GestureLongPress" status = "generate" generate_builder = true [[object]] name = "Gtk.GestureMultiPress" status = "generate" generate_builder = true [[object]] name = "Gtk.GesturePan" status = "generate" generate_builder = true [[object]] name = "Gtk.GestureRotate" status = "generate" generate_builder = true [[object]] name = "Gtk.GestureStylus" status = "generate" version = "3.24" manual_traits = ["GestureStylusExtManual"] [[object.function]] name = "get_axes" manual = true [[object]] name = "Gtk.GestureSwipe" status = "generate" generate_builder = true [[object]] name = "Gtk.GestureZoom" status = "generate" generate_builder = true [[object]] name = "Gtk.GLArea" status = "generate" generate_builder = true module_name = "gl_area" [[object.signal]] pattern = "render" inhibit = true [[object.signal]] name = "create-context" [object.signal.return] nullable = true [[object]] name = "Gtk.Grid" status = "generate" generate_builder = true child_name = "cell" [[object.child_prop]] name = "height" type = "gint" [[object.child_prop]] name = "width" type = "gint" [[object.child_prop]] name = "left-attach" type = "gint" [[object.child_prop]] name = "top-attach" type = "gint" [[object]] name = "Gtk.HeaderBar" status = "generate" generate_builder = true [[object.child_prop]] name = "pack-type" type = "Gtk.PackType" [[object.child_prop]] name = "position" type = "gint" [[object]] name = "Gtk.IconTheme" status = "generate" [[object.function]] name = "set_search_path" ignore = true [[object.function]] name = "choose_icon" ignore = true [[object.function]] name = "choose_icon_for_scale" ignore = true [[object.function]] name = "get_icon_sizes" #array ignore = true [[object.function]] name = "get_search_path" #array ignore = true [[object]] name = "Gtk.IconView" status = "generate" generate_builder = true [[object.function]] name = "enable_model_drag_dest" #array with size ignore = true [[object.function]] name = "enable_model_drag_source" #array with size ignore = true [[object.function]] pattern = ".+" [[object.function.parameter]] name = "path" const = true [[object]] name = "Gtk.Image" status = "generate" generate_builder = false # "icon-size" field should be gint manual_traits = ["ImageExtManual"] [[object.function]] name = "new_from_surface" [[object.function.parameter]] name = "surface" # cairo::Surface is reference-counted const = true [[object.function]] name = "set_from_surface" [[object.function.parameter]] name = "surface" # cairo::Surface is reference-counted const = true [[object.function]] name = "get_icon_name" #can return NULL string ignore = true [[object.property]] name = "icon-size" ignore = true # Has to call conversions to int [[object.property]] name = "surface" [[object.property]] name = "icon-set" #value IconSet ignore = true [[object.function]] name = "get_stock" # wrong out parameter mutability and deprecated anyway ignore = true [[object]] name = "Gtk.IMContext" status = "generate" [[object.function]] name = "filter_keypress" [[object.function.parameter]] name = "event" const = true [[object]] name = "Gtk.IMContextSimple" status = "generate" generate_builder = true manual_traits = ["IMContextSimpleExtManual"] [[object.function]] name = "add_compose_file" manual = true doc_trait_name = "IMContextSimpleExtManual" [[object.function]] name = "add_table" ignore = true # We don't understand API [[object]] name = "Gtk.IMMulticontext" status = "generate" generate_builder = true [[object]] name = "Gtk.InfoBar" status = "generate" generate_builder = true [[object.property]] name = "revealed" version = "3.22.29" [[object.function]] name = "get_content_area" [object.function.return] nullable = false [[object.function]] name = "get_action_area" [[object]] name = "Gtk.InputHints" status = "generate" [[object.member]] name = "emoji" version = "3.22.20" [[object.member]] name = "no_emoji" version = "3.22.20" [[object]] name = "Gtk.Invisible" status = "generate" generate_builder = true manual_traits = ["InvisibleExtManual"] [[object.function]] name = "get_screen" manual = true doc_trait_name = "InvisibleExtManual" [[object]] name = "Gtk.Label" status = "generate" generate_builder = true [[object.function]] name = "new_with_mnemonic" [[object.function.parameter]] name = "str" nullable = false [[object.function]] name = "get_label" [object.function.return] nullable = false [[object.function]] name = "get_text" [object.function.return] nullable = false [[object.signal]] name = "activate-link" inhibit = true [[object]] name = "Gtk.Layout" status = "generate" generate_builder = true [[object.child_prop]] name = "x" type = "gint" [[object.child_prop]] name = "y" type = "gint" [[object]] name = "Gtk.LevelBar" status = "generate" generate_builder = true [[object]] name = "Gtk.LinkButton" status = "generate" generate_builder = true [[object.function]] name = "new_with_label" [[object.function.parameter]] name = "label" nullable = false [[object.signal]] name = "activate-link" inhibit = true [[object]] name = "Gtk.ListBox" status = "generate" generate_builder = true manual_traits = ["ListBoxExtManual"] [[object.function]] name = "bind_model" [[object.function.parameter]] name = "create_widget_func" # we add a manual unbind() function instead nullable = false [[object]] name = "Gtk.ListBoxRow" status = "generate" generate_builder = true [[object]] name = "Gtk.ListStore" status = "generate" trait_name = "GtkListStoreExt" manual_traits = ["GtkListStoreExtManual"] [[object.function]] pattern = ".+" [[object.function.parameter]] name = "iter" const = true [[object.function.parameter]] name = "sibling" const = true [[object.function.parameter]] name = "position" const = true [[object.function]] name = "swap" [[object.function.parameter]] name = "a" const = true [[object.function.parameter]] name = "b" const = true [[object.function]] name = "reorder" manual = true doc_trait_name = "GtkListStoreExtManual" [[object.function]] name = "set_value" manual = true doc_trait_name = "GtkListStoreExtManual" [[object]] name = "Gtk.LockButton" status = "generate" generate_builder = true [[object]] name = "Gtk.Menu" status = "generate" generate_builder = true child_type = "Gtk.MenuItem" child_name = "item" trait_name = "GtkMenuExt" manual_traits = ["GtkMenuExtManual"] [[object.child_prop]] name = "bottom-attach" type = "gint" [[object.child_prop]] name = "left-attach" type = "gint" [[object.child_prop]] name = "right-attach" type = "gint" [[object.child_prop]] name = "top-attach" type = "gint" [[object.function]] name = "place_on_monitor" version = "3.22" [[object]] name = "Gtk.MenuBar" status = "generate" generate_builder = true [[object]] name = "Gtk.MenuButton" status = "generate" generate_builder = true [[object]] name = "Gtk.MenuItem" status = "generate" generate_builder = true trait_name = "GtkMenuItemExt" [[object.function]] name = "activate" ignore = true [[object]] name = "Gtk.MenuShell" status = "generate" [[object.signal]] name = "move-selected" inhibit = true [[object]] name = "Gtk.MenuToolButton" status = "generate" generate_builder = true [[object]] name = "Gtk.MessageDialog" status = "generate" generate_builder = true [[object.function]] name = "get_message_area" [object.function.return] nullable = false [[object]] name = "Gtk.ModelButton" status = "generate" generate_builder = true [[object]] name = "Gtk.MountOperation" status = "generate" generate_builder = true [[object]] name = "Gtk.NativeDialog" status = "generate" manual_traits = ["NativeDialogExtManual"] [[object.function]] name = "run" [object.function.return] type = "Gtk.ResponseType" [[object]] name = "Gtk.Notebook" status = "generate" generate_builder = true manual_traits = ["NotebookExtManual"] # The following functions need integer type adjustments [[object.function]] name = "append_page" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "append_page_menu" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "get_current_page" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "get_n_pages" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "get_nth_page" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "get_tab_detachable" rename = "tab_is_detachable" [[object.function]] name = "get_tab_reorderable" rename = "tab_is_reorderable" [[object.function]] name = "insert_page" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "insert_page_menu" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "page_num" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "prepend_page" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "prepend_page_menu" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "remove_page" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "reorder_child" manual = true doc_trait_name = "NotebookExtManual" [[object.function]] name = "set_current_page" manual = true doc_trait_name = "NotebookExtManual" [[object.child_prop]] name = "detachable" type = "gboolean" doc_hidden=true [[object.child_prop]] name = "menu-label" type = "utf8" doc_hidden=true [[object.child_prop]] name = "position" type = "gint" doc_hidden=true [[object.child_prop]] name = "reorderable" type = "gboolean" doc_hidden=true [[object.child_prop]] name = "tab-expand" rename_getter = "tab_expands" type = "gboolean" doc_hidden=true [[object.child_prop]] name = "tab-fill" rename_getter = "tab_fills" type = "gboolean" doc_hidden=true [[object.child_prop]] name = "tab-label" type = "utf8" doc_hidden=true [[object]] name = "Gtk.OffscreenWindow" status = "generate" generate_builder = true [[object]] name = "Gtk.Overlay" status = "generate" generate_builder = true manual_traits = ["OverlaySignals"] [[object.child_prop]] name = "index" type = "gint" #[[object]] #name = "Gtk.PadActionEntry" <- Missing memory management functions #status = "generate" #version = "3.22" [[object]] name = "Gtk.PadActionType" status = "generate" version = "3.22" [[object]] name = "Gtk.PadController" status = "generate" generate_builder = true version = "3.22" [[object.function]] name = "set_action_entries" manual = true [[object]] name = "Gtk.PageSetup" status = "generate" [[object.function]] name = "get_paper_size" [object.function.return] nullable = false [[object.function]] pattern = "set_paper_size.*" [[object.function.parameter]] name = "size" const = true [[object]] name = "Gtk.Paned" status = "generate" generate_builder = true [[object.child_prop]] name = "resize" type = "gboolean" [[object.child_prop]] name = "shrink" type = "gboolean" [[object]] name = "Gtk.PaperSize" status = "generate" [[object.function]] pattern = "(get|is)_.*" [[object.function.parameter]] name = "size" const = true [[object.function]] name = "is_equal" [[object.function.parameter]] name = "size1" const = true [[object.function.parameter]] name = "size2" const = true [[object]] name = "Gtk.PlacesSidebar" status = "generate" generate_builder = true [[object.signal]] name = "drag-action-requested" #[gio::File] ignore = true [[object.signal]] name = "drag-perform-drop" #[gio::File] ignore = true [[object.property]] name = "show-starred-location" version = "3.22.26" [[object]] name = "Gtk.Plug" status = "generate" generate_builder = true cfg_condition = "gdk_backend = \"x11\"" [[object]] name = "Gtk.Popover" status = "generate" generate_builder = true [[object]] name = "Gtk.PopoverMenu" status = "generate" generate_builder = true [[object.child_prop]] name = "position" type = "gint" [[object.child_prop]] name = "submenu" type = "utf8" [[object]] name = "Gtk.PrintContext" status = "generate" [[object.function]] name = "set_cairo_context" [[object.function.parameter]] name = "cr" # cairo::Context is reference-counted const = true [[object]] name = "Gtk.PrintOperation" status = "generate" generate_builder = true [[object]] name = "Gtk.PrintSettings" status = "generate" [[object.function]] name = "get_bool" # Retrieves the bool value of a setting rename = "bool" [[object.function]] name = "get_paper_size" [object.function.return] nullable = false [[object.function]] name = "set_page_ranges" manual = true [[object.function]] name = "set_paper_size" [[object.function.parameter]] name = "paper_size" const = true [[object]] name = "Gtk.ProgressBar" status = "generate" generate_builder = true [[object]] name = "Gtk.RadioButton" status = "generate" generate_builder = true [[object.function]] pattern = ".+_from_widget" [[object.function.parameter]] name = "radio_group_member" nullable = false [[object.function]] name = "new" manual = true [[object.function]] name = "new_with_label" manual = true [[object.function]] name = "new_with_mnemonic" manual = true [[object.function]] name = "set_group" ignore = true [[object.property]] name = "group" ignore = true [[object]] name = "Gtk.RadioMenuItem" status = "generate" generate_builder = true [[object.function]] pattern = ".+_from_widget" [[object.function.parameter]] name = "group" nullable = false [[object.function]] name = "new" manual = true [[object.function]] name = "new_with_label" manual = true [[object.function]] name = "new_with_mnemonic" manual = true [[object.function]] name = "set_group" ignore = true [[object.property]] name = "group" ignore = true [[object]] name = "Gtk.RadioToolButton" status = "generate" generate_builder = true [[object.function]] pattern = ".+_from_widget" [[object.function.parameter]] name = "group" nullable = false [[object.function]] name = "new" manual = true [[object.function]] name = "new_from_stock" manual = true [[object.function]] name = "set_group" ignore = true [[object.property]] name = "group" ignore = true [[object]] name = "Gtk.Range" status = "generate" [[object.function]] name = "get_adjustment" [object.function.return] nullable = false [[object.signal]] name = "change-value" inhibit = true [[object]] name = "Gtk.RecentChooserDialog" status = "generate" generate_builder = true [[object]] name = "Gtk.RecentChooserMenu" status = "generate" generate_builder = true [[object]] name = "Gtk.RecentChooserWidget" status = "generate" generate_builder = true [[object]] name = "Gtk.RecentManager" status = "generate" generate_builder = true [[object]] name = "Gtk.Revealer" status = "generate" generate_builder = true [[object]] name = "Gtk.Scale" status = "generate" generate_builder = true [[object]] name = "Gtk.ScaleButton" status = "generate" generate_builder = true [[object.function]] name = "get_adjustment" [object.function.return] nullable = false [[object]] name = "Gtk.Scrollbar" status = "generate" generate_builder = true [[object]] name = "Gtk.ScrolledWindow" status = "generate" generate_builder = true [[object.function]] name = "get_hadjustment" [object.function.return] nullable = false [[object.function]] name = "get_vadjustment" [object.function.return] nullable = false [[object]] name = "Gtk.SearchBar" status = "generate" generate_builder = true [[object.function]] name = "handle_event" [[object.function.parameter]] name = "event" const = true [[object]] name = "Gtk.SearchEntry" status = "generate" generate_builder = true [[object.function]] name = "handle_event" [[object.function.parameter]] name = "event" const = true [[object]] name = "Gtk.SelectionData" status = "generate" [[object.function]] name = "get_data_type" [object.function.return] nullable = false [[object.function]] name = "get_selection" [object.function.return] nullable = false [[object.function]] name = "get_target" [object.function.return] nullable = false [[object.function]] name = "set_pixbuf" [[object.function.parameter]] name = "selection_data" const = true [[object.function]] name = "set_text" [[object.function.parameter]] name = "selection_data" const = true [[object.function]] name = "set" [[object.function.parameter]] name = "selection_data" const = true [[object.function]] name = "set_uris" [[object.function.parameter]] name = "selection_data" const = true [[object.function]] name = "get_data" #array without length manual = true [[object.function]] name = "get_data_with_length" ignore = true [[object]] name = "Gtk.Separator" status = "generate" generate_builder = true [[object]] name = "Gtk.SeparatorMenuItem" status = "generate" generate_builder = true [[object]] name = "Gtk.SeparatorToolItem" status = "generate" generate_builder = true [[object]] name = "Gtk.Settings" status = "generate" [[object.function]] pattern = "install_property.*" #deprecated in 3.16 ignore = true [[object.property]] name = "gtk-cursor-aspect-ratio" version = "3.24" [[object]] name = "Gtk.ShortcutLabel" status = "generate" generate_builder = true version = "3.22" [[object]] name = "Gtk.ShortcutsGroup" status = "generate" generate_builder = true version = "3.20" [[object]] name = "Gtk.ShortcutsSection" status = "generate" generate_builder = true version = "3.20" [[object]] name = "Gtk.ShortcutsShortcut" status = "generate" generate_builder = true version = "3.20" [[object]] name = "Gtk.ShortcutsWindow" status = "generate" generate_builder = true version = "3.20" [[object]] name = "Gtk.ShortcutType" status = "generate" version = "3.20" [[object]] name = "Gtk.SizeGroup" status = "generate" generate_builder = true [[object]] name = "Gtk.Socket" status = "generate" generate_builder = true cfg_condition = "gdk_backend = \"x11\"" trait_name = "GtkSocketExt" [[object]] name = "Gtk.SpinButton" status = "generate" generate_builder = true manual_traits = ["SpinButtonSignals"] [[object.function]] name = "get_adjustment" [object.function.return] nullable = false [[object.signal]] pattern = ".+" #manual #out #not_standard_return ignore = true [[object]] name = "Gtk.Spinner" status = "generate" generate_builder = true [[object]] name = "Gtk.Stack" status = "generate" generate_builder = true [[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.function]] name = "get_interpolate_size" rename = "interpolates_size" [[object]] name = "Gtk.StackSidebar" status = "generate" generate_builder = true [[object]] name = "Gtk.StackSwitcher" status = "generate" generate_builder = false # "icon-size" property needs to be int internally manual_traits = ["StackSwitcherExtManual"] [[object.property]] name = "icon-size" ignore = true # "icon-size" needs conversion between IconSize and integer [[object]] name = "Gtk.Statusbar" status = "generate" generate_builder = true [[object]] name = "Gtk.StyleContext" status = "generate" generate_builder = true manual_traits = ["StyleContextExtManual"] [[object.function]] name = "get_property" rename = "style_property_for_state" # avoid collision with ObjectExt::property [[object]] name = "Gtk.StyleContextPrintFlags" status = "generate" version = "3.20" [[object]] name = "Gtk.Switch" status = "generate" generate_builder = true manual_traits = ["SwitchExtManual"] [[object.signal]] name = "state-set" inhibit = true [[object]] name = "Gtk.TargetList" status = "generate" [[object.function]] name = "add_table" #array with size ignore = true [[object.function]] name = "new" #array with size manual = true [[object]] name = "Gtk.TextBuffer" status = "generate" generate_builder = true manual_traits = ["TextBufferExtManual"] [[object.function]] name = "get_insert" # Avoid clash with the `insert` operation. # This one retrieves the insert mark. bypass_auto_rename = true [[object.function]] name = "register_deserialize_tagset" [object.function.return] nullable = false [[object.function]] name = "register_serialize_tagset" [object.function.return] nullable = false [[object.function]] name = "paste_clipboard" [[object.function.parameter]] name = "override_location" const = true [[object.function]] name = "register_serialize_format" # actually returns an array of bytes, not a single byte ignore = true [[object.signal]] name = "apply-tag" # needs mutable TextIters ignore = true doc_trait_name = "TextBufferExtManual" [[object.signal]] name = "delete-range" # needs mutable TextIters ignore = true doc_trait_name = "TextBufferExtManual" [[object.signal]] name = "insert-child-anchor" # needs mutable TextIters ignore = true doc_trait_name = "TextBufferExtManual" [[object.signal]] name = "insert-pixbuf" # needs mutable TextIters ignore = true doc_trait_name = "TextBufferExtManual" [[object.signal]] name = "insert-text" # needs mutable TextIters ignore = true doc_trait_name = "TextBufferExtManual" [[object.signal]] name = "remove-tag" # needs mutable TextIters ignore = true doc_trait_name = "TextBufferExtManual" [[object]] name = "Gtk.TextIter" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object.function]] name = "get_attributes" manual = true [[object.function]] name = "get_char" manual = true [[object]] name = "Gtk.TextMark" status = "generate" generate_builder = true [[object]] name = "Gtk.TextTag" status = "generate" generate_builder = true [[object.function]] name = "event" [[object.function.parameter]] name = "event" const = true [[object.signal]] name = "event" inhibit = true [[object]] name = "Gtk.TextView" status = "generate" generate_builder = true [[object.function]] name = "get_default_attributes" [object.function.return] nullable = false [[object.function]] name = "im_context_filter_keypress" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "set_tabs" [[object.function.parameter]] name = "tabs" const = true [[object.signal]] name = "extend-selection" inhibit = true [[object.signal]] name = "insert-emoji" #actually Since 3.22.27 version = "3.22.26" [[object]] name = "Gtk.ToggleButton" status = "generate" generate_builder = true [[object]] name = "Gtk.ToggleToolButton" status = "generate" generate_builder = true [[object]] name = "Gtk.Toolbar" status = "generate" generate_builder = true child_name = "item" [[object.signal]] name = "popup-context-menu" inhibit = true [[object.child_prop]] name = "expand" type = "gboolean" [[object.child_prop]] name = "homogeneous" type = "gboolean" [[object]] name = "Gtk.ToolButton" status = "generate" generate_builder = true [[object]] name = "Gtk.ToolItem" status = "generate" generate_builder = true [[object.signal]] name = "create-menu-proxy" inhibit = true [[object]] name = "Gtk.ToolItemGroup" status = "generate" generate_builder = true child_type = "Gtk.ToolItem" child_name = "item" [[object.child_prop]] name = "expand" type = "gboolean" [[object.child_prop]] name = "fill" type = "gboolean" [[object.child_prop]] name = "homogeneous" type = "gboolean" [[object.child_prop]] name = "new-row" type = "gboolean" [[object]] name = "Gtk.ToolPalette" status = "generate" generate_builder = true [[object]] name = "Gtk.TreeIter" status = "generate" init_function_expression = "|_ptr| ()" clear_function_expression = "|_ptr| ()" [[object]] name = "Gtk.TreeModel" status = "generate" [[object.function]] pattern = ".+" [[object.function.parameter]] name = "path" const = true [[object.function.parameter]] name = "iter" const = true [[object.function]] name = "filter_new" # Replaced by TreeModelFilter::new ignore = true [[object.function]] name = " sort_new_with_model" # Replaced by TreeModelSort::new ignore = true [[object.function]] name = "iter_children" [[object.function.parameter]] name = "parent" const = true [[object.function]] name = "iter_nth_child" [[object.function.parameter]] name = "parent" const = true [[object.function]] name = "iter_parent" [[object.function.parameter]] name = "child" const = true [[object.function]] name = 'ref_node' ignore = true [[object.function]] name = "rows_reordered" ignore = true [[object.function]] name = 'unref_node' ignore = true [[object]] name = "Gtk.TreeModelFilter" status = "generate" [[object.function]] name = "convert_child_path_to_path" [[object.function.parameter]] name = "child_path" const = true [[object.function]] name = "convert_path_to_child_path" [[object.function.parameter]] name = "filter_path" const = true [[object.function]] name = "convert_iter_to_child_iter" [[object.function.parameter]] name = "filter_iter" const = true [[object.function]] name = "convert_child_iter_to_iter" [[object.function.parameter]] name = "child_iter" const = true [[object.property]] name = "virtual-root" #value recordboxed ignore = true [[object]] name = "Gtk.TreeModelSort" status = "generate" [[object.function]] name = "convert_child_path_to_path" [[object.function.parameter]] name = "child_path" const = true [[object.function]] name = "convert_path_to_child_path" [[object.function.parameter]] name = "sorted_path" const = true [[object.function]] name = "convert_iter_to_child_iter" [[object.function.parameter]] name = "sorted_iter" const = true [[object.function]] name = "convert_child_iter_to_iter" [[object.function.parameter]] name = "child_iter" const = true [[object.function]] name = "iter_is_valid" # Bypass auto-rename so as to avoid automatic is prefixing bypass_auto_rename = true [[object.function.parameter]] name = "iter" const = true [[object.function]] name = "get_model" [object.function.return] nullable = false [[object.function]] name = "new_with_model" rename = "new" [[object]] name = "Gtk.TreePath" status = "generate" [[object.function]] name = "get_depth" [[object.function.parameter]] name = "path" const = true [[object.function]] name = "is_ancestor" [[object.function.parameter]] name = "path" const = true [[object.function.parameter]] name = "descendant" const = true [[object.function]] name = "is_descendant" [[object.function.parameter]] name = "path" const = true [[object.function.parameter]] name = "ancestor" const = true [[object.function]] name = "get_indices" manual = true [[object.function]] name = "to_string" [[object.function.parameter]] name = "path" const = true [[object]] name = "Gtk.TreeRowReference" status = "generate" [[object.function]] name = "new" [[object.function.parameter]] name = "path" const = true [object.function.return] nullable = true [[object.function]] name = "new_proxy" [[object.function.parameter]] name = "path" const = true [object.function.return] nullable = true [[object.function]] name = "get_model" [[object.function.parameter]] name = "reference" const = true [object.function.return] nullable = false [[object.function]] name = "get_path" [[object.function.parameter]] name = "reference" const = true [[object.function]] name = "valid" [[object.function.parameter]] name = "reference" const = true [[object.function]] name = "inserted" [[object.function.parameter]] name = "path" const = true [[object.function]] name = "deleted" [[object.function.parameter]] name = "path" const = true [[object]] name = "Gtk.TreeSelection" status = "generate" [[object.function]] pattern = ".+" [[object.function.parameter]] name = "iter" const = true [[object.function.parameter]] name = "path" const = true [[object.function]] pattern = "(un)?select_range" [[object.function.parameter]] name = "start_path" const = true [[object.function.parameter]] name = "end_path" const = true [[object]] name = "Gtk.TreeSortable" status = "generate" manual_traits = ["TreeSortableExtManual"] [[object.function]] pattern = "[gs]et_sort_column_id" manual = true doc_trait_name = "TreeSortableExtManual" [[object.function]] pattern = "set_sort_func" # return type u32 -> Ordering manual = true doc_trait_name = "TreeSortableExtManual" [[object.function]] pattern = "set_default_sort_func" # return type u32 -> Ordering manual = true doc_trait_name = "TreeSortableExtManual" [[object]] name = "Gtk.TreeStore" status = "generate" manual_traits = ["TreeStoreExtManual"] [[object.function]] pattern = ".+" [[object.function.parameter]] name = "iter" const = true [[object.function.parameter]] name = "parent" const = true [[object.function.parameter]] name = "sibling" const = true [[object.function]] name = "is_ancestor" [[object.function.parameter]] name = "descendant" const = true [[object.function]] name = "move_after" [[object.function.parameter]] name = "position" const = true [[object.function]] name = "move_before" [[object.function.parameter]] name = "position" const = true [[object.function]] name = "reorder" manual = true doc_trait_name = "TreeStoreExtManual" [[object.function]] name = "set_value" manual = true doc_trait_name = "TreeStoreExtManual" [[object.function]] name = "swap" [[object.function.parameter]] name = "a" const = true [[object.function.parameter]] name = "b" const = true [[object]] name = "Gtk.TreeView" status = "generate" generate_builder = true [[object.function]] name = "enable_model_drag_dest" #array with size ignore = true [[object.function]] name = "enable_model_drag_source" #array with size ignore = true [[object.function]] pattern = ".+" [[object.function.parameter]] name = "path" const = true [[object.function]] name = "get_selection" [object.function.return] nullable = false [[object.function]] name = "get_hover_expand" rename = "hover_expands" [[object.signal]] pattern = ".+" [[object.signal.parameter]] name = "iter" transformation = "borrow" [[object.signal.parameter]] name = "path" transformation = "borrow" [[object.signal]] pattern = "test-.+" inhibit = true [[object]] name = "Gtk.TreeViewColumn" status = "generate" generate_builder = true [[object.function]] name = "cell_set_cell_data" [[object.function.parameter]] name = "iter" const = true [[object]] name = "Gtk.Viewport" status = "generate" generate_builder = true [[object]] name = "Gtk.VolumeButton" status = "generate" generate_builder = true [[object]] name = "Gtk.Widget" status = "generate" manual_traits = ["WidgetExtManual"] [[object.function]] name = "drag_dest_set" #array with size manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "drag_source_set" #array with size manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "enable_model_drag_source" #array with size ignore = true [[object.function]] name = "draw" [[object.function.parameter]] name = "cr" # cairo::Context is reference-counted const = true [[object.function]] name = "get_clipboard" [object.function.return] nullable = false [[object.function]] name = "get_device_enabled" rename = "device_is_enabled" [[object.function]] name = "intersect" manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "override_font" [[object.function.parameter]] name = "font_desc" nullable = false [[object.function]] pattern = ".+" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "get_path" [object.function.return] nullable = false [[object.function]] name = "add_tick_callback" manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "remove_tick_callback" ignore = true [[object.function]] name = "add_events" manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "get_events" manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "set_events" manual = true doc_trait_name = "WidgetExtManual" [[object.function]] name = "get_sensitive" # Avoid clash with `is_sensitive`. Differences: # - `get_sensitive`: returns the widget `sensitive` property. # - `is_sensitive`: returns whether the widget’s is effectively sensitivity. # meaning that the widget and all its parents are `sensitive`. bypass_auto_rename = true [[object.function]] name = "get_visible" # Avoid clash with `is_visible`. Differences: # - `get_visible`: returns the widget `visible` property. # - `is_visible`: returns whether the widget’s is effectively visibility. # meaning that the widget and all its parents are `visible`. bypass_auto_rename = true [[object.function]] name = "get_hexpand" rename = "hexpands" [[object.function]] name = "get_style_context" [object.function.return] nullable = false [[object.function]] name = "get_vexpand" rename = "vexpands" [[object.function]] name = "size_allocate" [[object.function.parameter]] name = "allocation" const = true [[object.function]] name = "hide_on_delete" # return Inhibit instead of bool manual = true doc_trait_name = "WidgetExtManual" [[object.signal]] name = "button-press-event" inhibit = true [[object.signal]] name = "button-release-event" inhibit = true [[object.signal]] name = "delete-event" inhibit = true [[object.signal]] name = "destroy-event" inhibit = true [[object.signal]] name = "drag-data-get" [[object.signal.parameter]] name = "data" transformation = "borrow" [[object.signal]] name = "drag-failed" inhibit = true [[object.signal]] name = "draw" inhibit = true [[object.signal]] name = "enter-notify-event" inhibit = true [[object.signal]] name = "event" inhibit = true [[object.signal]] name = "focus" inhibit = true [[object.signal]] name = "focus-in-event" inhibit = true [[object.signal]] name = "focus-out-event" inhibit = true [[object.signal]] name = "grab-broken-event" inhibit = true [[object.signal]] name = "key-press-event" inhibit = true [[object.signal]] name = "key-release-event" inhibit = true [[object.signal]] name = "keynav-failed" inhibit = true [[object.signal]] name = "leave-notify-event" inhibit = true [[object.signal]] name = "map-event" inhibit = true ignore = true #manual EventAny doc_trait_name = "WidgetExtManual" [[object.signal]] name = "mnemonic-activate" inhibit = true [[object.signal]] name = "motion-notify-event" inhibit = true [[object.signal]] name = "property-notify-event" inhibit = true [[object.signal]] name = "proximity-in-event" inhibit = true [[object.signal]] name = "proximity-out-event" inhibit = true [[object.signal]] name = "scroll-event" inhibit = true [[object.signal]] name = "selection-clear-event" inhibit = true [[object.signal]] name = "selection-notify-event" inhibit = true [[object.signal]] name = "selection-request-event" inhibit = true [[object.signal]] name = "touch-event" inhibit = true [[object.signal]] name = "unmap-event" inhibit = true ignore = true #manual EventAny doc_trait_name = "WidgetExtManual" [[object.signal]] name = "visibility-notify-event" inhibit = true [[object.signal]] name = "window-state-event" inhibit = true [[object.property]] name = "style" #deprecated ignore = true [[object.property]] name = "events" generate = ["notify"] [[object.function]] name = "input_shape_combine_region" [[object.function.parameter]] name = "region" const = true [[object.function]] name = "shape_combine_region" [[object.function.parameter]] name = "region" const = true [[object.function]] name = "set_name" rename = "set_widget_name" [[object.function]] name = "get_name" rename = "widget_name" [object.function.return] nullable = false [[object.function]] name = "destroy" # needs to be marked as unsafe manual = true [[object.function]] name = "create_pango_context" [object.function.return] nullable = false [[object.function]] name = "create_pango_layout" [object.function.return] nullable = false [[object.function]] name = "get_display" [object.function.return] nullable = false [[object.function]] name = "get_pango_context" [object.function.return] nullable = false [[object]] name = "Gtk.Window" status = "generate" generate_builder = true trait_name = "GtkWindowExt" manual_traits = ["GtkWindowExtManual"] [[object.function]] name = "activate_key" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "propagate_key_event" [[object.function.parameter]] name = "event" const = true [[object.function]] name = "set_geometry_hints" [[object.function.parameter]] name = "geometry" const = true [[object.signal]] # workaround for https://github.com/gtk-rs/gtk/issues/985 name = "set-focus" [[object.signal.parameter]] name = "object" nullable = true gtk-0.14.3/LICENSE000064400000000000000000000020000072674642500115230ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. gtk-0.14.3/README.md000064400000000000000000000044320072674642500120100ustar 00000000000000# gtk [Project site](http://gtk-rs.org/) __Rust__ bindings and wrappers for __GTK 3__, part of [gtk3-rs](https://github.com/gtk-rs/gtk3-rs). ## Minimum supported Rust version Currently, the minimum supported Rust version is `1.51.0`. ## Building __gtk__ expects __GTK__, __GLib__ and __Cairo__ development files to be installed on your system. See the [GTK installation page](https://www.gtk.org/docs/installations/). ## Using We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs), as [demonstrated here](http://gtk-rs.org/#using). If you want to track the bleeding edge, use the git dependency instead: ```toml [dependencies] gtk = { git = "https://github.com/gtk-rs/gtk3-rs.git" } ``` Avoid mixing versioned and git crates like this: ```toml # This will not compile [dependencies] gtk = "0.13" gtk = { git = "https://github.com/gtk-rs/gtk3-rs.git" } ``` ## Documentation * [Rust API - Stable](https://gtk-rs.org/gtk3-rs/stable/latest/docs/gtk/) * [Rust API - Development](https://gtk-rs.org/gtk3-rs/git/docs/gtk) * [C API](https://developer.gnome.org/gtk/stable/) * [GTK Installation instructions](https://www.gtk.org/docs/installations/) Generate the docs: ```shell > cargo doc --features dox ``` (if the installed GTK+ version is lower than 3.16, adjust the feature name accordingly). ## Contribute Contributor you're welcome! See the general [bindings documentation](https://gtk-rs.org/gtk-rs-core/stable/latest/docs/glib/). Most of the bindings ([`src/auto`](src/auto)) are generated by [gir](https://github.com/gtk-rs/gir) using [this configuration file](Gir.toml). After editing `Gir.toml` the sources can be regenerated with ```shell > make gir ``` When opening a PR please put the changes to the `src/auto` directory in a separate commit. You may also wish to run `cargo clippy -- -D warnings` and check that you're clean because otherwise you may be surprised when CI fails. ## See Also * [atk](https://crates.io/crates/atk) * [cairo](https://crates.io/crates/cairo-rs) * [gdk](https://crates.io/crates/gdk) * [gdk-pixbuf](https://crates.io/crates/gdk-pixbuf) * [gio](https://crates.io/crates/gio) * [glib](https://crates.io/crates/glib) * [pango](https://crates.io/crates/pango) ## License __gtk__ is available under the MIT License, please refer to it. gtk-0.14.3/build.rs000064400000000000000000000011440072674642500121730ustar 00000000000000fn main() { check_features(); } fn check_features() { // The pkg-config file defines a `targets` variable listing the // various backends that gdk (yes, gdk) was compiled for. // We extract that and create gdk_backend="x11" and the like // as configuration variables. // For reference, the backend set at time of writing consists of: // x11 win32 quartz broadway wayland if let Ok(targets) = pkg_config::get_variable("gtk+-3.0", "targets") { for target in targets.split_whitespace() { println!("cargo:rustc-cfg=gdk_backend=\"{}\"", target); } } } gtk-0.14.3/release_process.md000064400000000000000000000020430072674642500142250ustar 00000000000000# Release process Since gtk-rs has multiple crates which have inter-dependencies, it's a bit painful to make a new release. So here are the multiple steps: * Merge `master` branch into `crate` branch in every repository (starting with `sys` and ending with `gtk`). (/!\ `cairo-sys` is in `cairo` repository, not `sys` /!\) * Update crate version in `Cargo.toml` and the number of its `gtk-rs` dependencies. * Open pull requests to `crate` branches to corresponding repositories. * Once pull requests have been merged, publish all crates to `crates.io` (using the `cargo publish` command). * Merge `pending` branch into `master` in the `gtk-rs/examples` repository (by opening a pull request of course). * Update badges version number in the `_data/crates.json` in the `gtk-rs/gtk-rs.github.io` repository. * Write a blog post (add the file into `_posts` folder in `gtk-rs.github.io` repository) announcing the new release. * Update crate version of the `master` branches on every repository. NOTE: Pull requests on the `crate` branch aren't build. gtk-0.14.3/src/accel_group.rs000064400000000000000000000070730072674642500141550ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::AccelFlags; use crate::AccelGroup; use glib::object::{Cast, IsA}; use glib::translate::*; use glib::ToValue; pub trait AccelGroupExtManual: 'static { fn connect_accel_group( &self, accel_key: u32, accel_mods: gdk::ModifierType, accel_flags: AccelFlags, func: F, ) -> glib::Closure where F: Fn(&Self, &glib::Object, u32, gdk::ModifierType) -> bool + 'static; fn connect_accel_group_by_path(&self, accel_path: &str, func: F) -> glib::Closure where F: Fn(&Self, &glib::Object, u32, gdk::ModifierType) -> bool + 'static; } impl> AccelGroupExtManual for O { fn connect_accel_group( &self, accel_key: u32, accel_mods: gdk::ModifierType, accel_flags: AccelFlags, func: F, ) -> glib::Closure where F: Fn(&Self, &glib::Object, u32, gdk::ModifierType) -> bool + 'static, { let closure = glib::Closure::new_local(move |values| { assert_eq!(values.len(), 4); let s = values[0] .get::() .expect("Wrong argument type for first closure argument"); let s = s .downcast::() .expect("Wrong argument type for first closure argument"); let obj = values[1] .get::() .expect("Wrong argument type for second closure argument"); let accel_key = values[2] .get::() .expect("Wrong argument type for third closure argument"); let accel_mods = values[3] .get::() .expect("Wrong argument type for fourth closure argument"); let ret = func(&s, &obj, accel_key, accel_mods); Some(ret.to_value()) }); unsafe { ffi::gtk_accel_group_connect( self.as_ref().to_glib_none().0, accel_key, accel_mods.into_glib(), accel_flags.into_glib(), closure.to_glib_none().0, ); } closure } fn connect_accel_group_by_path(&self, accel_path: &str, func: F) -> glib::Closure where F: Fn(&Self, &glib::Object, u32, gdk::ModifierType) -> bool + 'static, { let closure = glib::Closure::new_local(move |values| { assert_eq!(values.len(), 4); let s = values[0] .get::() .expect("Wrong argument type for first closure argument"); let s = s .downcast::() .expect("Wrong argument type for first closure argument"); let obj = values[1] .get::() .expect("Wrong argument type for second closure argument"); let accel_key = values[2] .get::() .expect("Wrong argument type for third closure argument"); let accel_mods = values[3] .get::() .expect("Wrong argument type for fourth closure argument"); let ret = func(&s, &obj, accel_key, accel_mods); Some(ret.to_value()) }); unsafe { ffi::gtk_accel_group_connect_by_path( self.as_ref().to_glib_none().0, accel_path.to_glib_none().0, closure.to_glib_none().0, ); } closure } } gtk-0.14.3/src/app_chooser.rs000064400000000000000000000024060072674642500141670ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Widget; use gio::AppInfo; use glib::object::IsA; use glib::translate::*; glib::wrapper! { pub struct AppChooser(Interface) @requires Widget; match fn { type_ => || ffi::gtk_app_chooser_get_type(), } } pub trait AppChooserExt: 'static { #[doc(alias = "gtk_app_chooser_get_app_info")] #[doc(alias = "get_app_info")] fn app_info(&self) -> Option; #[doc(alias = "gtk_app_chooser_get_content_type")] #[doc(alias = "get_content_type")] fn content_type(&self) -> Option; #[doc(alias = "gtk_app_chooser_refresh")] fn refresh(&self); } impl> AppChooserExt for O { fn app_info(&self) -> Option { unsafe { from_glib_full(ffi::gtk_app_chooser_get_app_info( self.as_ref().to_glib_none().0, )) } } fn content_type(&self) -> Option { unsafe { from_glib_full(ffi::gtk_app_chooser_get_content_type( self.as_ref().to_glib_none().0, )) } } fn refresh(&self) { unsafe { ffi::gtk_app_chooser_refresh(self.as_ref().to_glib_none().0) } } } gtk-0.14.3/src/application.rs000064400000000000000000000025240072674642500141710ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::rt; use crate::Application; use gio::prelude::*; use gio::ApplicationFlags; use glib::signal::SignalHandlerId; use glib::translate::*; use std::cell::RefCell; use std::rc::Rc; impl Application { #[doc(alias = "gtk_application_new")] pub fn new(application_id: Option<&str>, flags: ApplicationFlags) -> Application { skip_assert_initialized!(); let app: Application = unsafe { from_glib_full(ffi::gtk_application_new( application_id.to_glib_none().0, flags.into_glib(), )) }; Application::register_startup_hook(&app); app } pub(crate) fn register_startup_hook(app: &Application) { skip_assert_initialized!(); let signalid: Rc>> = Rc::new(RefCell::new(None)); { let signalid_ = signalid.clone(); let id = app.connect_startup(move |app| { app.disconnect( signalid_ .borrow_mut() .take() .expect("Signal ID went missing"), ); unsafe { rt::set_initialized() } }); *signalid.borrow_mut() = Some(id); } } } gtk-0.14.3/src/application_window.rs000064400000000000000000000011440072674642500155550ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. use crate::Application; use crate::ApplicationWindow; use crate::Widget; use glib::object::Cast; use glib::object::IsA; use glib::translate::*; impl ApplicationWindow { #[doc(alias = "gtk_application_window_new")] pub fn new>(application: &P) -> ApplicationWindow { skip_assert_initialized!(); unsafe { Widget::from_glib_none(ffi::gtk_application_window_new( application.as_ref().to_glib_none().0, )) .unsafe_cast() } } } gtk-0.14.3/src/auto/about_dialog.rs000064400000000000000000001473540072674642500153020ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::Application; use crate::Bin; use crate::Buildable; use crate::Container; use crate::Dialog; use crate::License; use crate::ResizeMode; use crate::Widget; use crate::Window; use crate::WindowPosition; use crate::WindowType; 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 = "GtkAboutDialog")] pub struct AboutDialog(Object) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable; match fn { type_ => || ffi::gtk_about_dialog_get_type(), } } impl AboutDialog { #[doc(alias = "gtk_about_dialog_new")] pub fn new() -> AboutDialog { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_about_dialog_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AboutDialog`] objects. /// /// This method returns an instance of [`AboutDialogBuilder`] which can be used to create [`AboutDialog`] objects. pub fn builder() -> AboutDialogBuilder { AboutDialogBuilder::default() } } impl Default for AboutDialog { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AboutDialog`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AboutDialogBuilder { artists: Option>, authors: Option>, comments: Option, copyright: Option, documenters: Option>, license: Option, license_type: Option, logo: Option, logo_icon_name: Option, program_name: Option, translator_credits: Option, version: Option, website: Option, website_label: Option, wrap_license: Option, use_header_bar: Option, accept_focus: Option, application: Option, 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: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, screen: Option, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, type_: Option, type_hint: Option, urgency_hint: Option, window_position: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl AboutDialogBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AboutDialogBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`AboutDialog`]. pub fn build(self) -> AboutDialog { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref artists) = self.artists { properties.push(("artists", artists)); } if let Some(ref authors) = self.authors { properties.push(("authors", authors)); } if let Some(ref comments) = self.comments { properties.push(("comments", comments)); } if let Some(ref copyright) = self.copyright { properties.push(("copyright", copyright)); } if let Some(ref documenters) = self.documenters { properties.push(("documenters", documenters)); } if let Some(ref license) = self.license { properties.push(("license", license)); } if let Some(ref license_type) = self.license_type { properties.push(("license-type", license_type)); } if let Some(ref logo) = self.logo { properties.push(("logo", logo)); } if let Some(ref logo_icon_name) = self.logo_icon_name { properties.push(("logo-icon-name", logo_icon_name)); } if let Some(ref program_name) = self.program_name { properties.push(("program-name", program_name)); } if let Some(ref translator_credits) = self.translator_credits { properties.push(("translator-credits", translator_credits)); } if let Some(ref version) = self.version { properties.push(("version", version)); } if let Some(ref website) = self.website { properties.push(("website", website)); } if let Some(ref website_label) = self.website_label { properties.push(("website-label", website_label)); } if let Some(ref wrap_license) = self.wrap_license { properties.push(("wrap-license", wrap_license)); } if let Some(ref use_header_bar) = self.use_header_bar { properties.push(("use-header-bar", use_header_bar)); } if let Some(ref accept_focus) = self.accept_focus { properties.push(("accept-focus", accept_focus)); } if let Some(ref application) = self.application { properties.push(("application", application)); } 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 gravity) = self.gravity { properties.push(("gravity", gravity)); } 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 screen) = self.screen { properties.push(("screen", screen)); } 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 type_) = self.type_ { properties.push(("type", type_)); } if let Some(ref type_hint) = self.type_hint { properties.push(("type-hint", type_hint)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref window_position) = self.window_position { properties.push(("window-position", window_position)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 AboutDialog") } pub fn artists(mut self, artists: Vec) -> Self { self.artists = Some(artists); self } pub fn authors(mut self, authors: Vec) -> Self { self.authors = Some(authors); self } pub fn comments(mut self, comments: &str) -> Self { self.comments = Some(comments.to_string()); self } pub fn copyright(mut self, copyright: &str) -> Self { self.copyright = Some(copyright.to_string()); self } pub fn documenters(mut self, documenters: Vec) -> Self { self.documenters = Some(documenters); self } pub fn license(mut self, license: &str) -> Self { self.license = Some(license.to_string()); self } pub fn license_type(mut self, license_type: License) -> Self { self.license_type = Some(license_type); self } pub fn logo(mut self, logo: &gdk_pixbuf::Pixbuf) -> Self { self.logo = Some(logo.clone()); self } pub fn logo_icon_name(mut self, logo_icon_name: &str) -> Self { self.logo_icon_name = Some(logo_icon_name.to_string()); self } pub fn program_name(mut self, program_name: &str) -> Self { self.program_name = Some(program_name.to_string()); self } pub fn translator_credits(mut self, translator_credits: &str) -> Self { self.translator_credits = Some(translator_credits.to_string()); self } pub fn version(mut self, version: &str) -> Self { self.version = Some(version.to_string()); self } pub fn website(mut self, website: &str) -> Self { self.website = Some(website.to_string()); self } pub fn website_label(mut self, website_label: &str) -> Self { self.website_label = Some(website_label.to_string()); self } pub fn wrap_license(mut self, wrap_license: bool) -> Self { self.wrap_license = Some(wrap_license); self } pub fn use_header_bar(mut self, use_header_bar: i32) -> Self { self.use_header_bar = Some(use_header_bar); self } pub fn accept_focus(mut self, accept_focus: bool) -> Self { self.accept_focus = Some(accept_focus); self } pub fn application>(mut self, application: &P) -> Self { self.application = Some(application.clone().upcast()); 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 gravity(mut self, gravity: gdk::Gravity) -> Self { self.gravity = Some(gravity); 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 screen(mut self, screen: &gdk::Screen) -> Self { self.screen = Some(screen.clone()); 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 type_(mut self, type_: WindowType) -> Self { self.type_ = Some(type_); self } pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self { self.type_hint = Some(type_hint); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn window_position(mut self, window_position: WindowPosition) -> Self { self.window_position = Some(window_position); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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_ABOUT_DIALOG: Option<&AboutDialog> = None; pub trait AboutDialogExt: 'static { #[doc(alias = "gtk_about_dialog_add_credit_section")] fn add_credit_section(&self, section_name: &str, people: &[&str]); #[doc(alias = "gtk_about_dialog_get_artists")] #[doc(alias = "get_artists")] fn artists(&self) -> Vec; #[doc(alias = "gtk_about_dialog_get_authors")] #[doc(alias = "get_authors")] fn authors(&self) -> Vec; #[doc(alias = "gtk_about_dialog_get_comments")] #[doc(alias = "get_comments")] fn comments(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_copyright")] #[doc(alias = "get_copyright")] fn copyright(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_documenters")] #[doc(alias = "get_documenters")] fn documenters(&self) -> Vec; #[doc(alias = "gtk_about_dialog_get_license")] #[doc(alias = "get_license")] fn license(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_license_type")] #[doc(alias = "get_license_type")] fn license_type(&self) -> License; #[doc(alias = "gtk_about_dialog_get_logo")] #[doc(alias = "get_logo")] fn logo(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_logo_icon_name")] #[doc(alias = "get_logo_icon_name")] fn logo_icon_name(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_program_name")] #[doc(alias = "get_program_name")] fn program_name(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_translator_credits")] #[doc(alias = "get_translator_credits")] fn translator_credits(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_version")] #[doc(alias = "get_version")] fn version(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_website")] #[doc(alias = "get_website")] fn website(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_website_label")] #[doc(alias = "get_website_label")] fn website_label(&self) -> Option; #[doc(alias = "gtk_about_dialog_get_wrap_license")] #[doc(alias = "get_wrap_license")] fn wraps_license(&self) -> bool; #[doc(alias = "gtk_about_dialog_set_artists")] fn set_artists(&self, artists: &[&str]); #[doc(alias = "gtk_about_dialog_set_authors")] fn set_authors(&self, authors: &[&str]); #[doc(alias = "gtk_about_dialog_set_comments")] fn set_comments(&self, comments: Option<&str>); #[doc(alias = "gtk_about_dialog_set_copyright")] fn set_copyright(&self, copyright: Option<&str>); #[doc(alias = "gtk_about_dialog_set_documenters")] fn set_documenters(&self, documenters: &[&str]); #[doc(alias = "gtk_about_dialog_set_license")] fn set_license(&self, license: Option<&str>); #[doc(alias = "gtk_about_dialog_set_license_type")] fn set_license_type(&self, license_type: License); #[doc(alias = "gtk_about_dialog_set_logo")] fn set_logo(&self, logo: Option<&gdk_pixbuf::Pixbuf>); #[doc(alias = "gtk_about_dialog_set_logo_icon_name")] fn set_logo_icon_name(&self, icon_name: Option<&str>); #[doc(alias = "gtk_about_dialog_set_program_name")] fn set_program_name(&self, name: &str); #[doc(alias = "gtk_about_dialog_set_translator_credits")] fn set_translator_credits(&self, translator_credits: Option<&str>); #[doc(alias = "gtk_about_dialog_set_version")] fn set_version(&self, version: Option<&str>); #[doc(alias = "gtk_about_dialog_set_website")] fn set_website(&self, website: Option<&str>); #[doc(alias = "gtk_about_dialog_set_website_label")] fn set_website_label(&self, website_label: Option<&str>); #[doc(alias = "gtk_about_dialog_set_wrap_license")] fn set_wrap_license(&self, wrap_license: bool); #[doc(alias = "activate-link")] fn connect_activate_link glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "artists")] fn connect_artists_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "authors")] fn connect_authors_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "comments")] fn connect_comments_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "copyright")] fn connect_copyright_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "documenters")] fn connect_documenters_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "license")] fn connect_license_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "license-type")] fn connect_license_type_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "logo")] fn connect_logo_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "logo-icon-name")] fn connect_logo_icon_name_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "program-name")] fn connect_program_name_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "translator-credits")] fn connect_translator_credits_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "version")] fn connect_version_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "website")] fn connect_website_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "website-label")] fn connect_website_label_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "wrap-license")] fn connect_wrap_license_notify(&self, f: F) -> SignalHandlerId; } impl> AboutDialogExt for O { fn add_credit_section(&self, section_name: &str, people: &[&str]) { unsafe { ffi::gtk_about_dialog_add_credit_section( self.as_ref().to_glib_none().0, section_name.to_glib_none().0, people.to_glib_none().0, ); } } fn artists(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_about_dialog_get_artists( self.as_ref().to_glib_none().0, )) } } fn authors(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_about_dialog_get_authors( self.as_ref().to_glib_none().0, )) } } fn comments(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_comments( self.as_ref().to_glib_none().0, )) } } fn copyright(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_copyright( self.as_ref().to_glib_none().0, )) } } fn documenters(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_about_dialog_get_documenters( self.as_ref().to_glib_none().0, )) } } fn license(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_license( self.as_ref().to_glib_none().0, )) } } fn license_type(&self) -> License { unsafe { from_glib(ffi::gtk_about_dialog_get_license_type( self.as_ref().to_glib_none().0, )) } } fn logo(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_logo( self.as_ref().to_glib_none().0, )) } } fn logo_icon_name(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_logo_icon_name( self.as_ref().to_glib_none().0, )) } } fn program_name(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_program_name( self.as_ref().to_glib_none().0, )) } } fn translator_credits(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_translator_credits( self.as_ref().to_glib_none().0, )) } } fn version(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_version( self.as_ref().to_glib_none().0, )) } } fn website(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_website( self.as_ref().to_glib_none().0, )) } } fn website_label(&self) -> Option { unsafe { from_glib_none(ffi::gtk_about_dialog_get_website_label( self.as_ref().to_glib_none().0, )) } } fn wraps_license(&self) -> bool { unsafe { from_glib(ffi::gtk_about_dialog_get_wrap_license( self.as_ref().to_glib_none().0, )) } } fn set_artists(&self, artists: &[&str]) { unsafe { ffi::gtk_about_dialog_set_artists( self.as_ref().to_glib_none().0, artists.to_glib_none().0, ); } } fn set_authors(&self, authors: &[&str]) { unsafe { ffi::gtk_about_dialog_set_authors( self.as_ref().to_glib_none().0, authors.to_glib_none().0, ); } } fn set_comments(&self, comments: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_comments( self.as_ref().to_glib_none().0, comments.to_glib_none().0, ); } } fn set_copyright(&self, copyright: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_copyright( self.as_ref().to_glib_none().0, copyright.to_glib_none().0, ); } } fn set_documenters(&self, documenters: &[&str]) { unsafe { ffi::gtk_about_dialog_set_documenters( self.as_ref().to_glib_none().0, documenters.to_glib_none().0, ); } } fn set_license(&self, license: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_license( self.as_ref().to_glib_none().0, license.to_glib_none().0, ); } } fn set_license_type(&self, license_type: License) { unsafe { ffi::gtk_about_dialog_set_license_type( self.as_ref().to_glib_none().0, license_type.into_glib(), ); } } fn set_logo(&self, logo: Option<&gdk_pixbuf::Pixbuf>) { unsafe { ffi::gtk_about_dialog_set_logo(self.as_ref().to_glib_none().0, logo.to_glib_none().0); } } fn set_logo_icon_name(&self, icon_name: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_logo_icon_name( self.as_ref().to_glib_none().0, icon_name.to_glib_none().0, ); } } fn set_program_name(&self, name: &str) { unsafe { ffi::gtk_about_dialog_set_program_name( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } fn set_translator_credits(&self, translator_credits: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_translator_credits( self.as_ref().to_glib_none().0, translator_credits.to_glib_none().0, ); } } fn set_version(&self, version: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_version( self.as_ref().to_glib_none().0, version.to_glib_none().0, ); } } fn set_website(&self, website: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_website( self.as_ref().to_glib_none().0, website.to_glib_none().0, ); } } fn set_website_label(&self, website_label: Option<&str>) { unsafe { ffi::gtk_about_dialog_set_website_label( self.as_ref().to_glib_none().0, website_label.to_glib_none().0, ); } } fn set_wrap_license(&self, wrap_license: bool) { unsafe { ffi::gtk_about_dialog_set_wrap_license( self.as_ref().to_glib_none().0, wrap_license.into_glib(), ); } } fn connect_activate_link glib::signal::Inhibit + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn activate_link_trampoline< P: IsA, F: Fn(&P, &str) -> glib::signal::Inhibit + 'static, >( this: *mut ffi::GtkAboutDialog, uri: *mut libc::c_char, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( AboutDialog::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(uri), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"activate-link\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( activate_link_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_artists_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_artists_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::artists\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_artists_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_authors_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_authors_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::authors\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_authors_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_comments_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_comments_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::comments\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_comments_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_copyright_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_copyright_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::copyright\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_copyright_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_documenters_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_documenters_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::documenters\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_documenters_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_license_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::license\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_license_type_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_license_type_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::license-type\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_license_type_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_logo_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_logo_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::logo\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_logo_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_logo_icon_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_logo_icon_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::logo-icon-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_logo_icon_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_program_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_program_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::program-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_program_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_translator_credits_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_translator_credits_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::translator-credits\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_translator_credits_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_version_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_version_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::version\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_website_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_website_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::website\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_website_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_website_label_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_website_label_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::website-label\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_website_label_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_wrap_license_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wrap_license_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAboutDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AboutDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::wrap-license\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_wrap_license_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AboutDialog { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AboutDialog") } } gtk-0.14.3/src/auto/accel_group.rs000064400000000000000000000236440072674642500151270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT 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::transmute; glib::wrapper! { #[doc(alias = "GtkAccelGroup")] pub struct AccelGroup(Object); match fn { type_ => || ffi::gtk_accel_group_get_type(), } } impl AccelGroup { #[doc(alias = "gtk_accel_group_new")] pub fn new() -> AccelGroup { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_accel_group_new()) } } #[doc(alias = "gtk_accel_group_from_accel_closure")] pub fn from_accel_closure(closure: &glib::Closure) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_accel_group_from_accel_closure( closure.to_glib_none().0, )) } } } impl Default for AccelGroup { fn default() -> Self { Self::new() } } pub const NONE_ACCEL_GROUP: Option<&AccelGroup> = None; pub trait AccelGroupExt: 'static { #[doc(alias = "gtk_accel_group_activate")] fn activate>( &self, accel_quark: glib::Quark, acceleratable: &P, accel_key: u32, accel_mods: gdk::ModifierType, ) -> bool; #[doc(alias = "gtk_accel_group_disconnect")] fn disconnect(&self, closure: Option<&glib::Closure>) -> bool; #[doc(alias = "gtk_accel_group_disconnect_key")] fn disconnect_key(&self, accel_key: u32, accel_mods: gdk::ModifierType) -> bool; //#[doc(alias = "gtk_accel_group_find")] //fn find(&self, find_func: /*Unimplemented*/FnMut(/*Ignored*/AccelKey, &glib::Closure) -> bool, data: /*Unimplemented*/Option) -> /*Ignored*/Option; #[doc(alias = "gtk_accel_group_get_is_locked")] #[doc(alias = "get_is_locked")] fn is_locked(&self) -> bool; #[doc(alias = "gtk_accel_group_get_modifier_mask")] #[doc(alias = "get_modifier_mask")] fn modifier_mask(&self) -> gdk::ModifierType; #[doc(alias = "gtk_accel_group_lock")] fn lock(&self); #[doc(alias = "gtk_accel_group_unlock")] fn unlock(&self); #[doc(alias = "accel-activate")] fn connect_accel_activate< F: Fn(&Self, &glib::Object, u32, gdk::ModifierType) -> bool + 'static, >( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId; #[doc(alias = "accel-changed")] fn connect_accel_changed( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId; #[doc(alias = "is-locked")] fn connect_is_locked_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "modifier-mask")] fn connect_modifier_mask_notify(&self, f: F) -> SignalHandlerId; } impl> AccelGroupExt for O { fn activate>( &self, accel_quark: glib::Quark, acceleratable: &P, accel_key: u32, accel_mods: gdk::ModifierType, ) -> bool { unsafe { from_glib(ffi::gtk_accel_group_activate( self.as_ref().to_glib_none().0, accel_quark.into_glib(), acceleratable.as_ref().to_glib_none().0, accel_key, accel_mods.into_glib(), )) } } fn disconnect(&self, closure: Option<&glib::Closure>) -> bool { unsafe { from_glib(ffi::gtk_accel_group_disconnect( self.as_ref().to_glib_none().0, closure.to_glib_none().0, )) } } fn disconnect_key(&self, accel_key: u32, accel_mods: gdk::ModifierType) -> bool { unsafe { from_glib(ffi::gtk_accel_group_disconnect_key( self.as_ref().to_glib_none().0, accel_key, accel_mods.into_glib(), )) } } //fn find(&self, find_func: /*Unimplemented*/FnMut(/*Ignored*/AccelKey, &glib::Closure) -> bool, data: /*Unimplemented*/Option) -> /*Ignored*/Option { // unsafe { TODO: call ffi:gtk_accel_group_find() } //} fn is_locked(&self) -> bool { unsafe { from_glib(ffi::gtk_accel_group_get_is_locked( self.as_ref().to_glib_none().0, )) } } fn modifier_mask(&self) -> gdk::ModifierType { unsafe { from_glib(ffi::gtk_accel_group_get_modifier_mask( self.as_ref().to_glib_none().0, )) } } fn lock(&self) { unsafe { ffi::gtk_accel_group_lock(self.as_ref().to_glib_none().0); } } fn unlock(&self) { unsafe { ffi::gtk_accel_group_unlock(self.as_ref().to_glib_none().0); } } fn connect_accel_activate< F: Fn(&Self, &glib::Object, u32, gdk::ModifierType) -> bool + 'static, >( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { unsafe extern "C" fn accel_activate_trampoline< P: IsA, F: Fn(&P, &glib::Object, u32, gdk::ModifierType) -> bool + 'static, >( this: *mut ffi::GtkAccelGroup, acceleratable: *mut glib::gobject_ffi::GObject, keyval: libc::c_uint, modifier: gdk::ffi::GdkModifierType, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( AccelGroup::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(acceleratable), keyval, from_glib(modifier), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); let detailed_signal_name = detail.map(|name| format!("accel-activate::{}\0", name)); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(&b"accel-activate\0"[..], |n| n.as_bytes()); connect_raw( self.as_ptr() as *mut _, signal_name.as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( accel_activate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_accel_changed( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { unsafe extern "C" fn accel_changed_trampoline< P: IsA, F: Fn(&P, u32, gdk::ModifierType, &glib::Closure) + 'static, >( this: *mut ffi::GtkAccelGroup, keyval: libc::c_uint, modifier: gdk::ffi::GdkModifierType, accel_closure: *mut glib::gobject_ffi::GClosure, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( AccelGroup::from_glib_borrow(this).unsafe_cast_ref(), keyval, from_glib(modifier), &from_glib_borrow(accel_closure), ) } unsafe { let f: Box_ = Box_::new(f); let detailed_signal_name = detail.map(|name| format!("accel-changed::{}\0", name)); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(&b"accel-changed\0"[..], |n| n.as_bytes()); connect_raw( self.as_ptr() as *mut _, signal_name.as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( accel_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_is_locked_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_locked_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAccelGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AccelGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-locked\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_is_locked_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_modifier_mask_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_modifier_mask_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAccelGroup, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AccelGroup::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::modifier-mask\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_modifier_mask_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AccelGroup { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AccelGroup") } } gtk-0.14.3/src/auto/accel_label.rs000064400000000000000000000550510072674642500150470ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::Buildable; use crate::Container; use crate::Justification; use crate::Label; use crate::Misc; use crate::Widget; 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; use std::mem::transmute; glib::wrapper! { #[doc(alias = "GtkAccelLabel")] pub struct AccelLabel(Object) @extends Label, Misc, Widget, @implements Buildable; match fn { type_ => || ffi::gtk_accel_label_get_type(), } } impl AccelLabel { #[doc(alias = "gtk_accel_label_new")] pub fn new(string: &str) -> AccelLabel { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_accel_label_new(string.to_glib_none().0)).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AccelLabel`] objects. /// /// This method returns an instance of [`AccelLabelBuilder`] which can be used to create [`AccelLabel`] objects. pub fn builder() -> AccelLabelBuilder { AccelLabelBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AccelLabel`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AccelLabelBuilder { accel_closure: Option, accel_widget: Option, angle: Option, attributes: Option, ellipsize: Option, justify: Option, label: Option, lines: Option, max_width_chars: Option, mnemonic_widget: Option, pattern: Option, selectable: Option, single_line_mode: Option, track_visited_links: Option, use_markup: Option, use_underline: Option, width_chars: Option, wrap: Option, wrap_mode: Option, xalign: Option, yalign: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl AccelLabelBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AccelLabelBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`AccelLabel`]. pub fn build(self) -> AccelLabel { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref accel_closure) = self.accel_closure { properties.push(("accel-closure", accel_closure)); } if let Some(ref accel_widget) = self.accel_widget { properties.push(("accel-widget", accel_widget)); } if let Some(ref angle) = self.angle { properties.push(("angle", angle)); } if let Some(ref attributes) = self.attributes { properties.push(("attributes", attributes)); } if let Some(ref ellipsize) = self.ellipsize { properties.push(("ellipsize", ellipsize)); } if let Some(ref justify) = self.justify { properties.push(("justify", justify)); } if let Some(ref label) = self.label { properties.push(("label", label)); } if let Some(ref lines) = self.lines { properties.push(("lines", lines)); } if let Some(ref max_width_chars) = self.max_width_chars { properties.push(("max-width-chars", max_width_chars)); } if let Some(ref mnemonic_widget) = self.mnemonic_widget { properties.push(("mnemonic-widget", mnemonic_widget)); } if let Some(ref pattern) = self.pattern { properties.push(("pattern", pattern)); } if let Some(ref selectable) = self.selectable { properties.push(("selectable", selectable)); } if let Some(ref single_line_mode) = self.single_line_mode { properties.push(("single-line-mode", single_line_mode)); } if let Some(ref track_visited_links) = self.track_visited_links { properties.push(("track-visited-links", track_visited_links)); } if let Some(ref use_markup) = self.use_markup { properties.push(("use-markup", use_markup)); } if let Some(ref use_underline) = self.use_underline { properties.push(("use-underline", use_underline)); } if let Some(ref width_chars) = self.width_chars { properties.push(("width-chars", width_chars)); } if let Some(ref wrap) = self.wrap { properties.push(("wrap", wrap)); } if let Some(ref wrap_mode) = self.wrap_mode { properties.push(("wrap-mode", wrap_mode)); } 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 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 AccelLabel") } pub fn accel_closure(mut self, accel_closure: &glib::Closure) -> Self { self.accel_closure = Some(accel_closure.clone()); self } pub fn accel_widget>(mut self, accel_widget: &P) -> Self { self.accel_widget = Some(accel_widget.clone().upcast()); self } pub fn angle(mut self, angle: f64) -> Self { self.angle = Some(angle); self } pub fn attributes(mut self, attributes: &pango::AttrList) -> Self { self.attributes = Some(attributes.clone()); self } pub fn ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self { self.ellipsize = Some(ellipsize); self } pub fn justify(mut self, justify: Justification) -> Self { self.justify = Some(justify); self } pub fn label(mut self, label: &str) -> Self { self.label = Some(label.to_string()); self } pub fn lines(mut self, lines: i32) -> Self { self.lines = Some(lines); self } pub fn max_width_chars(mut self, max_width_chars: i32) -> Self { self.max_width_chars = Some(max_width_chars); self } pub fn mnemonic_widget>(mut self, mnemonic_widget: &P) -> Self { self.mnemonic_widget = Some(mnemonic_widget.clone().upcast()); self } pub fn pattern(mut self, pattern: &str) -> Self { self.pattern = Some(pattern.to_string()); self } pub fn selectable(mut self, selectable: bool) -> Self { self.selectable = Some(selectable); self } pub fn single_line_mode(mut self, single_line_mode: bool) -> Self { self.single_line_mode = Some(single_line_mode); self } pub fn track_visited_links(mut self, track_visited_links: bool) -> Self { self.track_visited_links = Some(track_visited_links); self } pub fn use_markup(mut self, use_markup: bool) -> Self { self.use_markup = Some(use_markup); self } pub fn use_underline(mut self, use_underline: bool) -> Self { self.use_underline = Some(use_underline); self } pub fn width_chars(mut self, width_chars: i32) -> Self { self.width_chars = Some(width_chars); self } pub fn wrap(mut self, wrap: bool) -> Self { self.wrap = Some(wrap); self } pub fn wrap_mode(mut self, wrap_mode: pango::WrapMode) -> Self { self.wrap_mode = Some(wrap_mode); 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 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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_ACCEL_LABEL: Option<&AccelLabel> = None; pub trait AccelLabelExt: 'static { #[doc(alias = "gtk_accel_label_get_accel")] #[doc(alias = "get_accel")] fn accel(&self) -> (u32, gdk::ModifierType); #[doc(alias = "gtk_accel_label_get_accel_widget")] #[doc(alias = "get_accel_widget")] fn accel_widget(&self) -> Option; #[doc(alias = "gtk_accel_label_get_accel_width")] #[doc(alias = "get_accel_width")] fn accel_width(&self) -> u32; #[doc(alias = "gtk_accel_label_refetch")] fn refetch(&self) -> bool; #[doc(alias = "gtk_accel_label_set_accel")] fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType); #[doc(alias = "gtk_accel_label_set_accel_closure")] fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>); #[doc(alias = "gtk_accel_label_set_accel_widget")] fn set_accel_widget>(&self, accel_widget: Option<&P>); #[doc(alias = "accel-closure")] fn accel_closure(&self) -> Option; #[doc(alias = "accel-closure")] fn connect_accel_closure_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "accel-widget")] fn connect_accel_widget_notify(&self, f: F) -> SignalHandlerId; } impl> AccelLabelExt for O { fn accel(&self) -> (u32, gdk::ModifierType) { unsafe { let mut accelerator_key = mem::MaybeUninit::uninit(); let mut accelerator_mods = mem::MaybeUninit::uninit(); ffi::gtk_accel_label_get_accel( self.as_ref().to_glib_none().0, accelerator_key.as_mut_ptr(), accelerator_mods.as_mut_ptr(), ); let accelerator_key = accelerator_key.assume_init(); let accelerator_mods = accelerator_mods.assume_init(); (accelerator_key, from_glib(accelerator_mods)) } } fn accel_widget(&self) -> Option { unsafe { from_glib_none(ffi::gtk_accel_label_get_accel_widget( self.as_ref().to_glib_none().0, )) } } fn accel_width(&self) -> u32 { unsafe { ffi::gtk_accel_label_get_accel_width(self.as_ref().to_glib_none().0) } } fn refetch(&self) -> bool { unsafe { from_glib(ffi::gtk_accel_label_refetch(self.as_ref().to_glib_none().0)) } } fn set_accel(&self, accelerator_key: u32, accelerator_mods: gdk::ModifierType) { unsafe { ffi::gtk_accel_label_set_accel( self.as_ref().to_glib_none().0, accelerator_key, accelerator_mods.into_glib(), ); } } fn set_accel_closure(&self, accel_closure: Option<&glib::Closure>) { unsafe { ffi::gtk_accel_label_set_accel_closure( self.as_ref().to_glib_none().0, accel_closure.to_glib_none().0, ); } } fn set_accel_widget>(&self, accel_widget: Option<&P>) { unsafe { ffi::gtk_accel_label_set_accel_widget( self.as_ref().to_glib_none().0, accel_widget.map(|p| p.as_ref()).to_glib_none().0, ); } } fn accel_closure(&self) -> Option { 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"accel-closure\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `accel-closure` getter") } } fn connect_accel_closure_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_accel_closure_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAccelLabel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AccelLabel::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::accel-closure\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_accel_closure_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_accel_widget_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_accel_widget_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAccelLabel, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AccelLabel::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::accel-widget\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_accel_widget_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AccelLabel { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AccelLabel") } } gtk-0.14.3/src/auto/action_bar.rs000064400000000000000000000374140072674642500147450ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::Bin; use crate::Buildable; use crate::Container; use crate::PackType; use crate::ResizeMode; use crate::Widget; use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::fmt; glib::wrapper! { #[doc(alias = "GtkActionBar")] pub struct ActionBar(Object) @extends Bin, Container, Widget, @implements Buildable; match fn { type_ => || ffi::gtk_action_bar_get_type(), } } impl ActionBar { #[doc(alias = "gtk_action_bar_new")] pub fn new() -> ActionBar { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_action_bar_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`ActionBar`] objects. /// /// This method returns an instance of [`ActionBarBuilder`] which can be used to create [`ActionBar`] objects. pub fn builder() -> ActionBarBuilder { ActionBarBuilder::default() } } impl Default for ActionBar { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`ActionBar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ActionBarBuilder { border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl ActionBarBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ActionBarBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`ActionBar`]. pub fn build(self) -> ActionBar { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 ActionBar") } 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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_ACTION_BAR: Option<&ActionBar> = None; pub trait ActionBarExt: 'static { #[doc(alias = "gtk_action_bar_get_center_widget")] #[doc(alias = "get_center_widget")] fn center_widget(&self) -> Option; #[doc(alias = "gtk_action_bar_pack_end")] fn pack_end>(&self, child: &P); #[doc(alias = "gtk_action_bar_pack_start")] fn pack_start>(&self, child: &P); #[doc(alias = "gtk_action_bar_set_center_widget")] fn set_center_widget>(&self, center_widget: Option<&P>); #[doc(alias = "child.pack-type")] fn child_pack_type>(&self, item: &T) -> PackType; #[doc(alias = "child.pack-type")] fn set_child_pack_type>(&self, item: &T, pack_type: PackType); fn child_position>(&self, item: &T) -> i32; fn set_child_position>(&self, item: &T, position: i32); } impl> ActionBarExt for O { fn center_widget(&self) -> Option { unsafe { from_glib_none(ffi::gtk_action_bar_get_center_widget( self.as_ref().to_glib_none().0, )) } } fn pack_end>(&self, child: &P) { unsafe { ffi::gtk_action_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::gtk_action_bar_pack_start( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } fn set_center_widget>(&self, center_widget: Option<&P>) { unsafe { ffi::gtk_action_bar_set_center_widget( self.as_ref().to_glib_none().0, center_widget.map(|p| p.as_ref()).to_glib_none().0, ); } } fn child_pack_type>(&self, item: &T) -> PackType { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"pack-type\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `pack-type` getter") } } fn set_child_pack_type>(&self, item: &T, pack_type: PackType) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"pack-type\0".as_ptr() as *const _, pack_type.to_value().to_glib_none().0, ); } } fn child_position>(&self, item: &T) -> i32 { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::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 { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"position\0".as_ptr() as *const _, position.to_value().to_glib_none().0, ); } } } impl fmt::Display for ActionBar { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ActionBar") } } gtk-0.14.3/src/auto/actionable.rs000064400000000000000000000122520072674642500147360ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Buildable; use crate::Widget; 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::transmute; glib::wrapper! { #[doc(alias = "GtkActionable")] pub struct Actionable(Interface) @requires Widget, Buildable; match fn { type_ => || ffi::gtk_actionable_get_type(), } } pub const NONE_ACTIONABLE: Option<&Actionable> = None; pub trait ActionableExt: 'static { #[doc(alias = "gtk_actionable_get_action_name")] #[doc(alias = "get_action_name")] fn action_name(&self) -> Option; #[doc(alias = "gtk_actionable_get_action_target_value")] #[doc(alias = "get_action_target_value")] fn action_target_value(&self) -> Option; #[doc(alias = "gtk_actionable_set_action_name")] fn set_action_name(&self, action_name: Option<&str>); //#[doc(alias = "gtk_actionable_set_action_target")] //fn set_action_target(&self, format_string: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); #[doc(alias = "gtk_actionable_set_action_target_value")] fn set_action_target_value(&self, target_value: Option<&glib::Variant>); #[doc(alias = "gtk_actionable_set_detailed_action_name")] fn set_detailed_action_name(&self, detailed_action_name: &str); #[doc(alias = "action-name")] fn connect_action_name_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "action-target")] fn connect_action_target_notify(&self, f: F) -> SignalHandlerId; } impl> ActionableExt for O { fn action_name(&self) -> Option { unsafe { from_glib_none(ffi::gtk_actionable_get_action_name( self.as_ref().to_glib_none().0, )) } } fn action_target_value(&self) -> Option { unsafe { from_glib_none(ffi::gtk_actionable_get_action_target_value( self.as_ref().to_glib_none().0, )) } } fn set_action_name(&self, action_name: Option<&str>) { unsafe { ffi::gtk_actionable_set_action_name( self.as_ref().to_glib_none().0, action_name.to_glib_none().0, ); } } //fn set_action_target(&self, format_string: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call ffi:gtk_actionable_set_action_target() } //} fn set_action_target_value(&self, target_value: Option<&glib::Variant>) { unsafe { ffi::gtk_actionable_set_action_target_value( self.as_ref().to_glib_none().0, target_value.to_glib_none().0, ); } } fn set_detailed_action_name(&self, detailed_action_name: &str) { unsafe { ffi::gtk_actionable_set_detailed_action_name( self.as_ref().to_glib_none().0, detailed_action_name.to_glib_none().0, ); } } fn connect_action_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_action_name_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkActionable, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Actionable::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::action-name\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_action_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_action_target_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_action_target_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkActionable, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Actionable::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::action-target\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_action_target_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Actionable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Actionable") } } gtk-0.14.3/src/auto/adjustment.rs000064400000000000000000000373640072674642500150260ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // 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 = "GtkAdjustment")] pub struct Adjustment(Object); match fn { type_ => || ffi::gtk_adjustment_get_type(), } } impl Adjustment { #[doc(alias = "gtk_adjustment_new")] pub fn new( value: f64, lower: f64, upper: f64, step_increment: f64, page_increment: f64, page_size: f64, ) -> Adjustment { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::gtk_adjustment_new( value, lower, upper, step_increment, page_increment, page_size, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Adjustment`] objects. /// /// This method returns an instance of [`AdjustmentBuilder`] which can be used to create [`Adjustment`] objects. pub fn builder() -> AdjustmentBuilder { AdjustmentBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Adjustment`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AdjustmentBuilder { lower: Option, page_increment: Option, page_size: Option, step_increment: Option, upper: Option, value: Option, } impl AdjustmentBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AdjustmentBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Adjustment`]. pub fn build(self) -> Adjustment { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref lower) = self.lower { properties.push(("lower", lower)); } if let Some(ref page_increment) = self.page_increment { properties.push(("page-increment", page_increment)); } if let Some(ref page_size) = self.page_size { properties.push(("page-size", page_size)); } if let Some(ref step_increment) = self.step_increment { properties.push(("step-increment", step_increment)); } if let Some(ref upper) = self.upper { properties.push(("upper", upper)); } if let Some(ref value) = self.value { properties.push(("value", value)); } glib::Object::new::(&properties) .expect("Failed to create an instance of Adjustment") } pub fn lower(mut self, lower: f64) -> Self { self.lower = Some(lower); self } pub fn page_increment(mut self, page_increment: f64) -> Self { self.page_increment = Some(page_increment); self } pub fn page_size(mut self, page_size: f64) -> Self { self.page_size = Some(page_size); self } pub fn step_increment(mut self, step_increment: f64) -> Self { self.step_increment = Some(step_increment); self } pub fn upper(mut self, upper: f64) -> Self { self.upper = Some(upper); self } pub fn value(mut self, value: f64) -> Self { self.value = Some(value); self } } pub const NONE_ADJUSTMENT: Option<&Adjustment> = None; pub trait AdjustmentExt: 'static { #[doc(alias = "gtk_adjustment_clamp_page")] fn clamp_page(&self, lower: f64, upper: f64); #[doc(alias = "gtk_adjustment_configure")] fn configure( &self, value: f64, lower: f64, upper: f64, step_increment: f64, page_increment: f64, page_size: f64, ); #[doc(alias = "gtk_adjustment_get_lower")] #[doc(alias = "get_lower")] fn lower(&self) -> f64; #[doc(alias = "gtk_adjustment_get_minimum_increment")] #[doc(alias = "get_minimum_increment")] fn minimum_increment(&self) -> f64; #[doc(alias = "gtk_adjustment_get_page_increment")] #[doc(alias = "get_page_increment")] fn page_increment(&self) -> f64; #[doc(alias = "gtk_adjustment_get_page_size")] #[doc(alias = "get_page_size")] fn page_size(&self) -> f64; #[doc(alias = "gtk_adjustment_get_step_increment")] #[doc(alias = "get_step_increment")] fn step_increment(&self) -> f64; #[doc(alias = "gtk_adjustment_get_upper")] #[doc(alias = "get_upper")] fn upper(&self) -> f64; #[doc(alias = "gtk_adjustment_get_value")] #[doc(alias = "get_value")] fn value(&self) -> f64; #[doc(alias = "gtk_adjustment_set_lower")] fn set_lower(&self, lower: f64); #[doc(alias = "gtk_adjustment_set_page_increment")] fn set_page_increment(&self, page_increment: f64); #[doc(alias = "gtk_adjustment_set_page_size")] fn set_page_size(&self, page_size: f64); #[doc(alias = "gtk_adjustment_set_step_increment")] fn set_step_increment(&self, step_increment: f64); #[doc(alias = "gtk_adjustment_set_upper")] fn set_upper(&self, upper: f64); #[doc(alias = "gtk_adjustment_set_value")] fn set_value(&self, value: f64); #[doc(alias = "changed")] fn connect_changed(&self, f: F) -> SignalHandlerId; #[doc(alias = "value-changed")] fn connect_value_changed(&self, f: F) -> SignalHandlerId; #[doc(alias = "lower")] fn connect_lower_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "page-increment")] fn connect_page_increment_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "page-size")] fn connect_page_size_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "step-increment")] fn connect_step_increment_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "upper")] fn connect_upper_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "value")] fn connect_value_notify(&self, f: F) -> SignalHandlerId; } impl> AdjustmentExt for O { fn clamp_page(&self, lower: f64, upper: f64) { unsafe { ffi::gtk_adjustment_clamp_page(self.as_ref().to_glib_none().0, lower, upper); } } fn configure( &self, value: f64, lower: f64, upper: f64, step_increment: f64, page_increment: f64, page_size: f64, ) { unsafe { ffi::gtk_adjustment_configure( self.as_ref().to_glib_none().0, value, lower, upper, step_increment, page_increment, page_size, ); } } fn lower(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_lower(self.as_ref().to_glib_none().0) } } fn minimum_increment(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_minimum_increment(self.as_ref().to_glib_none().0) } } fn page_increment(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_page_increment(self.as_ref().to_glib_none().0) } } fn page_size(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_page_size(self.as_ref().to_glib_none().0) } } fn step_increment(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_step_increment(self.as_ref().to_glib_none().0) } } fn upper(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_upper(self.as_ref().to_glib_none().0) } } fn value(&self) -> f64 { unsafe { ffi::gtk_adjustment_get_value(self.as_ref().to_glib_none().0) } } fn set_lower(&self, lower: f64) { unsafe { ffi::gtk_adjustment_set_lower(self.as_ref().to_glib_none().0, lower); } } fn set_page_increment(&self, page_increment: f64) { unsafe { ffi::gtk_adjustment_set_page_increment(self.as_ref().to_glib_none().0, page_increment); } } fn set_page_size(&self, page_size: f64) { unsafe { ffi::gtk_adjustment_set_page_size(self.as_ref().to_glib_none().0, page_size); } } fn set_step_increment(&self, step_increment: f64) { unsafe { ffi::gtk_adjustment_set_step_increment(self.as_ref().to_glib_none().0, step_increment); } } fn set_upper(&self, upper: f64) { unsafe { ffi::gtk_adjustment_set_upper(self.as_ref().to_glib_none().0, upper); } } fn set_value(&self, value: f64) { unsafe { ffi::gtk_adjustment_set_value(self.as_ref().to_glib_none().0, value); } } fn connect_changed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn changed_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAdjustment, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_value_changed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn value_changed_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAdjustment, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"value-changed\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( value_changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_lower_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_lower_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAdjustment, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::lower\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_lower_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_page_increment_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_page_increment_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAdjustment, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::page-increment\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_page_increment_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_page_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_page_size_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAdjustment, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::page-size\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_page_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_step_increment_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_step_increment_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAdjustment, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::step-increment\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_step_increment_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_upper_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_upper_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAdjustment, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::upper\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_upper_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_value_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_value_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAdjustment, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Adjustment::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::value\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_value_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Adjustment { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Adjustment") } } gtk-0.14.3/src/auto/app_chooser_button.rs000064400000000000000000000633030072674642500165350ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::AppChooser; use crate::Bin; use crate::Buildable; use crate::CellArea; use crate::CellEditable; use crate::CellLayout; use crate::ComboBox; use crate::Container; use crate::ResizeMode; use crate::SensitivityType; use crate::TreeModel; use crate::Widget; 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 = "GtkAppChooserButton")] pub struct AppChooserButton(Object) @extends ComboBox, Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout, AppChooser; match fn { type_ => || ffi::gtk_app_chooser_button_get_type(), } } impl AppChooserButton { #[doc(alias = "gtk_app_chooser_button_new")] pub fn new(content_type: &str) -> AppChooserButton { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_app_chooser_button_new( content_type.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AppChooserButton`] objects. /// /// This method returns an instance of [`AppChooserButtonBuilder`] which can be used to create [`AppChooserButton`] objects. pub fn builder() -> AppChooserButtonBuilder { AppChooserButtonBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AppChooserButton`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AppChooserButtonBuilder { heading: Option, show_default_item: Option, show_dialog_item: Option, active: Option, active_id: Option, button_sensitivity: Option, cell_area: Option, column_span_column: Option, entry_text_column: Option, has_entry: Option, has_frame: Option, id_column: Option, model: Option, popup_fixed_width: Option, row_span_column: Option, wrap_width: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, editing_canceled: Option, content_type: Option, } impl AppChooserButtonBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AppChooserButtonBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`AppChooserButton`]. pub fn build(self) -> AppChooserButton { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref heading) = self.heading { properties.push(("heading", heading)); } if let Some(ref show_default_item) = self.show_default_item { properties.push(("show-default-item", show_default_item)); } if let Some(ref show_dialog_item) = self.show_dialog_item { properties.push(("show-dialog-item", show_dialog_item)); } if let Some(ref active) = self.active { properties.push(("active", active)); } if let Some(ref active_id) = self.active_id { properties.push(("active-id", active_id)); } if let Some(ref button_sensitivity) = self.button_sensitivity { properties.push(("button-sensitivity", button_sensitivity)); } if let Some(ref cell_area) = self.cell_area { properties.push(("cell-area", cell_area)); } if let Some(ref column_span_column) = self.column_span_column { properties.push(("column-span-column", column_span_column)); } if let Some(ref entry_text_column) = self.entry_text_column { properties.push(("entry-text-column", entry_text_column)); } if let Some(ref has_entry) = self.has_entry { properties.push(("has-entry", has_entry)); } if let Some(ref has_frame) = self.has_frame { properties.push(("has-frame", has_frame)); } if let Some(ref id_column) = self.id_column { properties.push(("id-column", id_column)); } if let Some(ref model) = self.model { properties.push(("model", model)); } if let Some(ref popup_fixed_width) = self.popup_fixed_width { properties.push(("popup-fixed-width", popup_fixed_width)); } if let Some(ref row_span_column) = self.row_span_column { properties.push(("row-span-column", row_span_column)); } if let Some(ref wrap_width) = self.wrap_width { properties.push(("wrap-width", wrap_width)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 editing_canceled) = self.editing_canceled { properties.push(("editing-canceled", editing_canceled)); } if let Some(ref content_type) = self.content_type { properties.push(("content-type", content_type)); } glib::Object::new::(&properties) .expect("Failed to create an instance of AppChooserButton") } pub fn heading(mut self, heading: &str) -> Self { self.heading = Some(heading.to_string()); self } pub fn show_default_item(mut self, show_default_item: bool) -> Self { self.show_default_item = Some(show_default_item); self } pub fn show_dialog_item(mut self, show_dialog_item: bool) -> Self { self.show_dialog_item = Some(show_dialog_item); self } pub fn active(mut self, active: i32) -> Self { self.active = Some(active); self } pub fn active_id(mut self, active_id: &str) -> Self { self.active_id = Some(active_id.to_string()); self } pub fn button_sensitivity(mut self, button_sensitivity: SensitivityType) -> Self { self.button_sensitivity = Some(button_sensitivity); self } pub fn cell_area>(mut self, cell_area: &P) -> Self { self.cell_area = Some(cell_area.clone().upcast()); self } pub fn column_span_column(mut self, column_span_column: i32) -> Self { self.column_span_column = Some(column_span_column); self } pub fn entry_text_column(mut self, entry_text_column: i32) -> Self { self.entry_text_column = Some(entry_text_column); self } pub fn has_entry(mut self, has_entry: bool) -> Self { self.has_entry = Some(has_entry); self } pub fn has_frame(mut self, has_frame: bool) -> Self { self.has_frame = Some(has_frame); self } pub fn id_column(mut self, id_column: i32) -> Self { self.id_column = Some(id_column); self } pub fn model>(mut self, model: &P) -> Self { self.model = Some(model.clone().upcast()); self } pub fn popup_fixed_width(mut self, popup_fixed_width: bool) -> Self { self.popup_fixed_width = Some(popup_fixed_width); self } pub fn row_span_column(mut self, row_span_column: i32) -> Self { self.row_span_column = Some(row_span_column); self } pub fn wrap_width(mut self, wrap_width: i32) -> Self { self.wrap_width = Some(wrap_width); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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 editing_canceled(mut self, editing_canceled: bool) -> Self { self.editing_canceled = Some(editing_canceled); self } pub fn content_type(mut self, content_type: &str) -> Self { self.content_type = Some(content_type.to_string()); self } } pub const NONE_APP_CHOOSER_BUTTON: Option<&AppChooserButton> = None; pub trait AppChooserButtonExt: 'static { #[doc(alias = "gtk_app_chooser_button_append_custom_item")] fn append_custom_item>(&self, name: &str, label: &str, icon: &P); #[doc(alias = "gtk_app_chooser_button_append_separator")] fn append_separator(&self); #[doc(alias = "gtk_app_chooser_button_get_heading")] #[doc(alias = "get_heading")] fn heading(&self) -> Option; #[doc(alias = "gtk_app_chooser_button_get_show_default_item")] #[doc(alias = "get_show_default_item")] fn shows_default_item(&self) -> bool; #[doc(alias = "gtk_app_chooser_button_get_show_dialog_item")] #[doc(alias = "get_show_dialog_item")] fn shows_dialog_item(&self) -> bool; #[doc(alias = "gtk_app_chooser_button_set_active_custom_item")] fn set_active_custom_item(&self, name: &str); #[doc(alias = "gtk_app_chooser_button_set_heading")] fn set_heading(&self, heading: &str); #[doc(alias = "gtk_app_chooser_button_set_show_default_item")] fn set_show_default_item(&self, setting: bool); #[doc(alias = "gtk_app_chooser_button_set_show_dialog_item")] fn set_show_dialog_item(&self, setting: bool); #[doc(alias = "custom-item-activated")] fn connect_custom_item_activated( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId; #[doc(alias = "heading")] fn connect_heading_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-default-item")] fn connect_show_default_item_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-dialog-item")] fn connect_show_dialog_item_notify(&self, f: F) -> SignalHandlerId; } impl> AppChooserButtonExt for O { fn append_custom_item>(&self, name: &str, label: &str, icon: &P) { unsafe { ffi::gtk_app_chooser_button_append_custom_item( self.as_ref().to_glib_none().0, name.to_glib_none().0, label.to_glib_none().0, icon.as_ref().to_glib_none().0, ); } } fn append_separator(&self) { unsafe { ffi::gtk_app_chooser_button_append_separator(self.as_ref().to_glib_none().0); } } fn heading(&self) -> Option { unsafe { from_glib_none(ffi::gtk_app_chooser_button_get_heading( self.as_ref().to_glib_none().0, )) } } fn shows_default_item(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_button_get_show_default_item( self.as_ref().to_glib_none().0, )) } } fn shows_dialog_item(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_button_get_show_dialog_item( self.as_ref().to_glib_none().0, )) } } fn set_active_custom_item(&self, name: &str) { unsafe { ffi::gtk_app_chooser_button_set_active_custom_item( self.as_ref().to_glib_none().0, name.to_glib_none().0, ); } } fn set_heading(&self, heading: &str) { unsafe { ffi::gtk_app_chooser_button_set_heading( self.as_ref().to_glib_none().0, heading.to_glib_none().0, ); } } fn set_show_default_item(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_button_set_show_default_item( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_show_dialog_item(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_button_set_show_dialog_item( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn connect_custom_item_activated( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { unsafe extern "C" fn custom_item_activated_trampoline< P: IsA, F: Fn(&P, &str) + 'static, >( this: *mut ffi::GtkAppChooserButton, item_name: *mut libc::c_char, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( AppChooserButton::from_glib_borrow(this).unsafe_cast_ref(), &glib::GString::from_glib_borrow(item_name), ) } unsafe { let f: Box_ = Box_::new(f); let detailed_signal_name = detail.map(|name| format!("custom-item-activated::{}\0", name)); let signal_name: &[u8] = detailed_signal_name .as_ref() .map_or(&b"custom-item-activated\0"[..], |n| n.as_bytes()); connect_raw( self.as_ptr() as *mut _, signal_name.as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( custom_item_activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_heading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_heading_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserButton, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::heading\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_heading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_default_item_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_default_item_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserButton, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-default-item\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_default_item_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_dialog_item_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_dialog_item_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserButton, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserButton::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-dialog-item\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_dialog_item_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AppChooserButton { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AppChooserButton") } } gtk-0.14.3/src/auto/app_chooser_dialog.rs000064400000000000000000000621510072674642500164610ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::AppChooser; use crate::Application; use crate::Bin; use crate::Buildable; use crate::Container; use crate::Dialog; use crate::DialogFlags; use crate::ResizeMode; use crate::Widget; use crate::Window; use crate::WindowPosition; use crate::WindowType; 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 = "GtkAppChooserDialog")] pub struct AppChooserDialog(Object) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, AppChooser; match fn { type_ => || ffi::gtk_app_chooser_dialog_get_type(), } } impl AppChooserDialog { #[doc(alias = "gtk_app_chooser_dialog_new")] pub fn new, Q: IsA>( parent: Option<&P>, flags: DialogFlags, file: &Q, ) -> AppChooserDialog { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new( parent.map(|p| p.as_ref()).to_glib_none().0, flags.into_glib(), file.as_ref().to_glib_none().0, )) .unsafe_cast() } } #[doc(alias = "gtk_app_chooser_dialog_new_for_content_type")] #[doc(alias = "new_for_content_type")] pub fn for_content_type>( parent: Option<&P>, flags: DialogFlags, content_type: &str, ) -> AppChooserDialog { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new_for_content_type( parent.map(|p| p.as_ref()).to_glib_none().0, flags.into_glib(), content_type.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AppChooserDialog`] objects. /// /// This method returns an instance of [`AppChooserDialogBuilder`] which can be used to create [`AppChooserDialog`] objects. pub fn builder() -> AppChooserDialogBuilder { AppChooserDialogBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AppChooserDialog`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AppChooserDialogBuilder { gfile: Option, heading: Option, use_header_bar: Option, accept_focus: Option, application: Option, 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: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, screen: Option, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, type_: Option, type_hint: Option, urgency_hint: Option, window_position: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, content_type: Option, } impl AppChooserDialogBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AppChooserDialogBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`AppChooserDialog`]. pub fn build(self) -> AppChooserDialog { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref gfile) = self.gfile { properties.push(("gfile", gfile)); } if let Some(ref heading) = self.heading { properties.push(("heading", heading)); } if let Some(ref use_header_bar) = self.use_header_bar { properties.push(("use-header-bar", use_header_bar)); } if let Some(ref accept_focus) = self.accept_focus { properties.push(("accept-focus", accept_focus)); } if let Some(ref application) = self.application { properties.push(("application", application)); } 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 gravity) = self.gravity { properties.push(("gravity", gravity)); } 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 screen) = self.screen { properties.push(("screen", screen)); } 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 type_) = self.type_ { properties.push(("type", type_)); } if let Some(ref type_hint) = self.type_hint { properties.push(("type-hint", type_hint)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref window_position) = self.window_position { properties.push(("window-position", window_position)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 content_type) = self.content_type { properties.push(("content-type", content_type)); } glib::Object::new::(&properties) .expect("Failed to create an instance of AppChooserDialog") } pub fn gfile>(mut self, gfile: &P) -> Self { self.gfile = Some(gfile.clone().upcast()); self } pub fn heading(mut self, heading: &str) -> Self { self.heading = Some(heading.to_string()); self } pub fn use_header_bar(mut self, use_header_bar: i32) -> Self { self.use_header_bar = Some(use_header_bar); self } pub fn accept_focus(mut self, accept_focus: bool) -> Self { self.accept_focus = Some(accept_focus); self } pub fn application>(mut self, application: &P) -> Self { self.application = Some(application.clone().upcast()); 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 gravity(mut self, gravity: gdk::Gravity) -> Self { self.gravity = Some(gravity); 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 screen(mut self, screen: &gdk::Screen) -> Self { self.screen = Some(screen.clone()); 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 type_(mut self, type_: WindowType) -> Self { self.type_ = Some(type_); self } pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self { self.type_hint = Some(type_hint); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn window_position(mut self, window_position: WindowPosition) -> Self { self.window_position = Some(window_position); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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 content_type(mut self, content_type: &str) -> Self { self.content_type = Some(content_type.to_string()); self } } pub const NONE_APP_CHOOSER_DIALOG: Option<&AppChooserDialog> = None; pub trait AppChooserDialogExt: 'static { #[doc(alias = "gtk_app_chooser_dialog_get_heading")] #[doc(alias = "get_heading")] fn heading(&self) -> Option; #[doc(alias = "gtk_app_chooser_dialog_get_widget")] #[doc(alias = "get_widget")] fn widget(&self) -> Widget; #[doc(alias = "gtk_app_chooser_dialog_set_heading")] fn set_heading(&self, heading: &str); fn gfile(&self) -> Option; #[doc(alias = "heading")] fn connect_heading_notify(&self, f: F) -> SignalHandlerId; } impl> AppChooserDialogExt for O { fn heading(&self) -> Option { unsafe { from_glib_none(ffi::gtk_app_chooser_dialog_get_heading( self.as_ref().to_glib_none().0, )) } } fn widget(&self) -> Widget { unsafe { from_glib_none(ffi::gtk_app_chooser_dialog_get_widget( self.as_ref().to_glib_none().0, )) } } fn set_heading(&self, heading: &str) { unsafe { ffi::gtk_app_chooser_dialog_set_heading( self.as_ref().to_glib_none().0, heading.to_glib_none().0, ); } } fn gfile(&self) -> Option { 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"gfile\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `gfile` getter") } } fn connect_heading_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_heading_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserDialog, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserDialog::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::heading\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_heading_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AppChooserDialog { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AppChooserDialog") } } gtk-0.14.3/src/auto/app_chooser_widget.rs000064400000000000000000000730700072674642500165070ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::AppChooser; use crate::BaselinePosition; use crate::Box; use crate::Buildable; use crate::Container; use crate::Menu; use crate::Orientable; use crate::Orientation; use crate::ResizeMode; use crate::Widget; 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 = "GtkAppChooserWidget")] pub struct AppChooserWidget(Object) @extends Box, Container, Widget, @implements Buildable, Orientable, AppChooser; match fn { type_ => || ffi::gtk_app_chooser_widget_get_type(), } } impl AppChooserWidget { #[doc(alias = "gtk_app_chooser_widget_new")] pub fn new(content_type: &str) -> AppChooserWidget { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_app_chooser_widget_new( content_type.to_glib_none().0, )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AppChooserWidget`] objects. /// /// This method returns an instance of [`AppChooserWidgetBuilder`] which can be used to create [`AppChooserWidget`] objects. pub fn builder() -> AppChooserWidgetBuilder { AppChooserWidgetBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AppChooserWidget`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AppChooserWidgetBuilder { default_text: Option, show_all: Option, show_default: Option, show_fallback: Option, show_other: Option, show_recommended: Option, baseline_position: Option, homogeneous: Option, spacing: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, content_type: Option, } impl AppChooserWidgetBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AppChooserWidgetBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`AppChooserWidget`]. pub fn build(self) -> AppChooserWidget { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref default_text) = self.default_text { properties.push(("default-text", default_text)); } if let Some(ref show_all) = self.show_all { properties.push(("show-all", show_all)); } if let Some(ref show_default) = self.show_default { properties.push(("show-default", show_default)); } if let Some(ref show_fallback) = self.show_fallback { properties.push(("show-fallback", show_fallback)); } if let Some(ref show_other) = self.show_other { properties.push(("show-other", show_other)); } if let Some(ref show_recommended) = self.show_recommended { properties.push(("show-recommended", show_recommended)); } if let Some(ref baseline_position) = self.baseline_position { properties.push(("baseline-position", baseline_position)); } if let Some(ref homogeneous) = self.homogeneous { properties.push(("homogeneous", homogeneous)); } if let Some(ref spacing) = self.spacing { properties.push(("spacing", spacing)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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)); } if let Some(ref content_type) = self.content_type { properties.push(("content-type", content_type)); } glib::Object::new::(&properties) .expect("Failed to create an instance of AppChooserWidget") } pub fn default_text(mut self, default_text: &str) -> Self { self.default_text = Some(default_text.to_string()); self } pub fn show_all(mut self, show_all: bool) -> Self { self.show_all = Some(show_all); self } pub fn show_default(mut self, show_default: bool) -> Self { self.show_default = Some(show_default); self } pub fn show_fallback(mut self, show_fallback: bool) -> Self { self.show_fallback = Some(show_fallback); self } pub fn show_other(mut self, show_other: bool) -> Self { self.show_other = Some(show_other); self } pub fn show_recommended(mut self, show_recommended: bool) -> Self { self.show_recommended = Some(show_recommended); self } pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self { self.baseline_position = Some(baseline_position); self } pub fn homogeneous(mut self, homogeneous: bool) -> Self { self.homogeneous = Some(homogeneous); self } pub fn spacing(mut self, spacing: i32) -> Self { self.spacing = Some(spacing); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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: Orientation) -> Self { self.orientation = Some(orientation); self } pub fn content_type(mut self, content_type: &str) -> Self { self.content_type = Some(content_type.to_string()); self } } pub const NONE_APP_CHOOSER_WIDGET: Option<&AppChooserWidget> = None; pub trait AppChooserWidgetExt: 'static { #[doc(alias = "gtk_app_chooser_widget_get_default_text")] #[doc(alias = "get_default_text")] fn default_text(&self) -> Option; #[doc(alias = "gtk_app_chooser_widget_get_show_all")] #[doc(alias = "get_show_all")] fn shows_all(&self) -> bool; #[doc(alias = "gtk_app_chooser_widget_get_show_default")] #[doc(alias = "get_show_default")] fn shows_default(&self) -> bool; #[doc(alias = "gtk_app_chooser_widget_get_show_fallback")] #[doc(alias = "get_show_fallback")] fn shows_fallback(&self) -> bool; #[doc(alias = "gtk_app_chooser_widget_get_show_other")] #[doc(alias = "get_show_other")] fn shows_other(&self) -> bool; #[doc(alias = "gtk_app_chooser_widget_get_show_recommended")] #[doc(alias = "get_show_recommended")] fn shows_recommended(&self) -> bool; #[doc(alias = "gtk_app_chooser_widget_set_default_text")] fn set_default_text(&self, text: &str); #[doc(alias = "gtk_app_chooser_widget_set_show_all")] fn set_show_all(&self, setting: bool); #[doc(alias = "gtk_app_chooser_widget_set_show_default")] fn set_show_default(&self, setting: bool); #[doc(alias = "gtk_app_chooser_widget_set_show_fallback")] fn set_show_fallback(&self, setting: bool); #[doc(alias = "gtk_app_chooser_widget_set_show_other")] fn set_show_other(&self, setting: bool); #[doc(alias = "gtk_app_chooser_widget_set_show_recommended")] fn set_show_recommended(&self, setting: bool); #[doc(alias = "application-activated")] fn connect_application_activated( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "application-selected")] fn connect_application_selected( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "populate-popup")] fn connect_populate_popup( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "default-text")] fn connect_default_text_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-all")] fn connect_show_all_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-default")] fn connect_show_default_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-fallback")] fn connect_show_fallback_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-other")] fn connect_show_other_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "show-recommended")] fn connect_show_recommended_notify(&self, f: F) -> SignalHandlerId; } impl> AppChooserWidgetExt for O { fn default_text(&self) -> Option { unsafe { from_glib_none(ffi::gtk_app_chooser_widget_get_default_text( self.as_ref().to_glib_none().0, )) } } fn shows_all(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_widget_get_show_all( self.as_ref().to_glib_none().0, )) } } fn shows_default(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_widget_get_show_default( self.as_ref().to_glib_none().0, )) } } fn shows_fallback(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_widget_get_show_fallback( self.as_ref().to_glib_none().0, )) } } fn shows_other(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_widget_get_show_other( self.as_ref().to_glib_none().0, )) } } fn shows_recommended(&self) -> bool { unsafe { from_glib(ffi::gtk_app_chooser_widget_get_show_recommended( self.as_ref().to_glib_none().0, )) } } fn set_default_text(&self, text: &str) { unsafe { ffi::gtk_app_chooser_widget_set_default_text( self.as_ref().to_glib_none().0, text.to_glib_none().0, ); } } fn set_show_all(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_widget_set_show_all( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_show_default(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_widget_set_show_default( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_show_fallback(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_widget_set_show_fallback( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_show_other(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_widget_set_show_other( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn set_show_recommended(&self, setting: bool) { unsafe { ffi::gtk_app_chooser_widget_set_show_recommended( self.as_ref().to_glib_none().0, setting.into_glib(), ); } } fn connect_application_activated( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn application_activated_trampoline< P: IsA, F: Fn(&P, &gio::AppInfo) + 'static, >( this: *mut ffi::GtkAppChooserWidget, application: *mut gio::ffi::GAppInfo, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(application), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"application-activated\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( application_activated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_application_selected( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn application_selected_trampoline< P: IsA, F: Fn(&P, &gio::AppInfo) + 'static, >( this: *mut ffi::GtkAppChooserWidget, application: *mut gio::ffi::GAppInfo, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(application), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"application-selected\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( application_selected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_populate_popup( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn populate_popup_trampoline< P: IsA, F: Fn(&P, &Menu, &gio::AppInfo) + 'static, >( this: *mut ffi::GtkAppChooserWidget, menu: *mut ffi::GtkMenu, application: *mut gio::ffi::GAppInfo, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(menu), &from_glib_borrow(application), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"populate-popup\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( populate_popup_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_default_text_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_default_text_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserWidget, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::default-text\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_default_text_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_all_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_all_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserWidget, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-all\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_all_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_default_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_default_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserWidget, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-default\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_default_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_fallback_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_fallback_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserWidget, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-fallback\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_fallback_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_other_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_other_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserWidget, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-other\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_other_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_show_recommended_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_recommended_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAppChooserWidget, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AppChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-recommended\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_recommended_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AppChooserWidget { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AppChooserWidget") } } gtk-0.14.3/src/auto/application.rs000064400000000000000000000537720072674642500151540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ApplicationInhibitFlags; 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 = "GtkApplication")] pub struct Application(Object) @extends gio::Application, @implements gio::ActionGroup, gio::ActionMap; match fn { type_ => || ffi::gtk_application_get_type(), } } impl Application { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Application`] objects. /// /// This method returns an instance of [`ApplicationBuilder`] which can be used to create [`Application`] objects. pub fn builder() -> ApplicationBuilder { ApplicationBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Application`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ApplicationBuilder { app_menu: Option, menubar: Option, register_session: Option, action_group: Option, application_id: Option, flags: Option, inactivity_timeout: Option, resource_base_path: Option, } impl ApplicationBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ApplicationBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Application`]. pub fn build(self) -> Application { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref app_menu) = self.app_menu { properties.push(("app-menu", app_menu)); } if let Some(ref menubar) = self.menubar { properties.push(("menubar", menubar)); } if let Some(ref register_session) = self.register_session { properties.push(("register-session", register_session)); } if let Some(ref action_group) = self.action_group { properties.push(("action-group", action_group)); } if let Some(ref application_id) = self.application_id { properties.push(("application-id", application_id)); } if let Some(ref flags) = self.flags { properties.push(("flags", flags)); } if let Some(ref inactivity_timeout) = self.inactivity_timeout { properties.push(("inactivity-timeout", inactivity_timeout)); } if let Some(ref resource_base_path) = self.resource_base_path { properties.push(("resource-base-path", resource_base_path)); } let ret = glib::Object::new::(&properties) .expect("Failed to create an instance of Application"); { Application::register_startup_hook(&ret); } ret } pub fn app_menu>(mut self, app_menu: &P) -> Self { self.app_menu = Some(app_menu.clone().upcast()); self } pub fn menubar>(mut self, menubar: &P) -> Self { self.menubar = Some(menubar.clone().upcast()); self } pub fn register_session(mut self, register_session: bool) -> Self { self.register_session = Some(register_session); self } pub fn action_group>(mut self, action_group: &P) -> Self { self.action_group = Some(action_group.clone().upcast()); self } pub fn application_id(mut self, application_id: &str) -> Self { self.application_id = Some(application_id.to_string()); self } pub fn flags(mut self, flags: gio::ApplicationFlags) -> Self { self.flags = Some(flags); self } pub fn inactivity_timeout(mut self, inactivity_timeout: u32) -> Self { self.inactivity_timeout = Some(inactivity_timeout); self } pub fn resource_base_path(mut self, resource_base_path: &str) -> Self { self.resource_base_path = Some(resource_base_path.to_string()); self } } pub const NONE_APPLICATION: Option<&Application> = None; pub trait GtkApplicationExt: 'static { #[doc(alias = "gtk_application_add_window")] fn add_window>(&self, window: &P); #[doc(alias = "gtk_application_get_accels_for_action")] #[doc(alias = "get_accels_for_action")] fn accels_for_action(&self, detailed_action_name: &str) -> Vec; #[doc(alias = "gtk_application_get_actions_for_accel")] #[doc(alias = "get_actions_for_accel")] fn actions_for_accel(&self, accel: &str) -> Vec; #[doc(alias = "gtk_application_get_active_window")] #[doc(alias = "get_active_window")] fn active_window(&self) -> Option; #[doc(alias = "gtk_application_get_app_menu")] #[doc(alias = "get_app_menu")] fn app_menu(&self) -> Option; #[doc(alias = "gtk_application_get_menu_by_id")] #[doc(alias = "get_menu_by_id")] fn menu_by_id(&self, id: &str) -> Option; #[doc(alias = "gtk_application_get_menubar")] #[doc(alias = "get_menubar")] fn menubar(&self) -> Option; #[doc(alias = "gtk_application_get_window_by_id")] #[doc(alias = "get_window_by_id")] fn window_by_id(&self, id: u32) -> Option; #[doc(alias = "gtk_application_get_windows")] #[doc(alias = "get_windows")] fn windows(&self) -> Vec; #[doc(alias = "gtk_application_inhibit")] fn inhibit>( &self, window: Option<&P>, flags: ApplicationInhibitFlags, reason: Option<&str>, ) -> u32; #[doc(alias = "gtk_application_is_inhibited")] fn is_inhibited(&self, flags: ApplicationInhibitFlags) -> bool; #[doc(alias = "gtk_application_list_action_descriptions")] fn list_action_descriptions(&self) -> Vec; #[doc(alias = "gtk_application_prefers_app_menu")] fn prefers_app_menu(&self) -> bool; #[doc(alias = "gtk_application_remove_window")] fn remove_window>(&self, window: &P); #[doc(alias = "gtk_application_set_accels_for_action")] fn set_accels_for_action(&self, detailed_action_name: &str, accels: &[&str]); #[doc(alias = "gtk_application_set_app_menu")] fn set_app_menu>(&self, app_menu: Option<&P>); #[doc(alias = "gtk_application_set_menubar")] fn set_menubar>(&self, menubar: Option<&P>); #[doc(alias = "gtk_application_uninhibit")] fn uninhibit(&self, cookie: u32); #[doc(alias = "register-session")] fn is_register_session(&self) -> bool; #[doc(alias = "register-session")] fn set_register_session(&self, register_session: bool); #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] #[doc(alias = "screensaver-active")] fn is_screensaver_active(&self) -> bool; #[cfg(any(feature = "v3_24_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24_8")))] #[doc(alias = "query-end")] fn connect_query_end(&self, f: F) -> SignalHandlerId; #[doc(alias = "window-added")] fn connect_window_added(&self, f: F) -> SignalHandlerId; #[doc(alias = "window-removed")] fn connect_window_removed(&self, f: F) -> SignalHandlerId; #[doc(alias = "active-window")] fn connect_active_window_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "app-menu")] fn connect_app_menu_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "menubar")] fn connect_menubar_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "register-session")] fn connect_register_session_notify(&self, f: F) -> SignalHandlerId; #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] #[doc(alias = "screensaver-active")] fn connect_screensaver_active_notify(&self, f: F) -> SignalHandlerId; } impl> GtkApplicationExt for O { fn add_window>(&self, window: &P) { unsafe { ffi::gtk_application_add_window( self.as_ref().to_glib_none().0, window.as_ref().to_glib_none().0, ); } } fn accels_for_action(&self, detailed_action_name: &str) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gtk_application_get_accels_for_action( self.as_ref().to_glib_none().0, detailed_action_name.to_glib_none().0, )) } } fn actions_for_accel(&self, accel: &str) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gtk_application_get_actions_for_accel( self.as_ref().to_glib_none().0, accel.to_glib_none().0, )) } } fn active_window(&self) -> Option { unsafe { from_glib_none(ffi::gtk_application_get_active_window( self.as_ref().to_glib_none().0, )) } } fn app_menu(&self) -> Option { unsafe { from_glib_none(ffi::gtk_application_get_app_menu( self.as_ref().to_glib_none().0, )) } } fn menu_by_id(&self, id: &str) -> Option { unsafe { from_glib_none(ffi::gtk_application_get_menu_by_id( self.as_ref().to_glib_none().0, id.to_glib_none().0, )) } } fn menubar(&self) -> Option { unsafe { from_glib_none(ffi::gtk_application_get_menubar( self.as_ref().to_glib_none().0, )) } } fn window_by_id(&self, id: u32) -> Option { unsafe { from_glib_none(ffi::gtk_application_get_window_by_id( self.as_ref().to_glib_none().0, id, )) } } fn windows(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::gtk_application_get_windows( self.as_ref().to_glib_none().0, )) } } fn inhibit>( &self, window: Option<&P>, flags: ApplicationInhibitFlags, reason: Option<&str>, ) -> u32 { unsafe { ffi::gtk_application_inhibit( self.as_ref().to_glib_none().0, window.map(|p| p.as_ref()).to_glib_none().0, flags.into_glib(), reason.to_glib_none().0, ) } } fn is_inhibited(&self, flags: ApplicationInhibitFlags) -> bool { unsafe { from_glib(ffi::gtk_application_is_inhibited( self.as_ref().to_glib_none().0, flags.into_glib(), )) } } fn list_action_descriptions(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::gtk_application_list_action_descriptions( self.as_ref().to_glib_none().0, )) } } fn prefers_app_menu(&self) -> bool { unsafe { from_glib(ffi::gtk_application_prefers_app_menu( self.as_ref().to_glib_none().0, )) } } fn remove_window>(&self, window: &P) { unsafe { ffi::gtk_application_remove_window( self.as_ref().to_glib_none().0, window.as_ref().to_glib_none().0, ); } } fn set_accels_for_action(&self, detailed_action_name: &str, accels: &[&str]) { unsafe { ffi::gtk_application_set_accels_for_action( self.as_ref().to_glib_none().0, detailed_action_name.to_glib_none().0, accels.to_glib_none().0, ); } } fn set_app_menu>(&self, app_menu: Option<&P>) { unsafe { ffi::gtk_application_set_app_menu( self.as_ref().to_glib_none().0, app_menu.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_menubar>(&self, menubar: Option<&P>) { unsafe { ffi::gtk_application_set_menubar( self.as_ref().to_glib_none().0, menubar.map(|p| p.as_ref()).to_glib_none().0, ); } } fn uninhibit(&self, cookie: u32) { unsafe { ffi::gtk_application_uninhibit(self.as_ref().to_glib_none().0, cookie); } } fn is_register_session(&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"register-session\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `register-session` getter") } } fn set_register_session(&self, register_session: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"register-session\0".as_ptr() as *const _, register_session.to_value().to_glib_none().0, ); } } #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] fn is_screensaver_active(&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"screensaver-active\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `screensaver-active` getter") } } #[cfg(any(feature = "v3_24_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24_8")))] fn connect_query_end(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn query_end_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkApplication, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"query-end\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( query_end_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_window_added(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn window_added_trampoline< P: IsA, F: Fn(&P, &Window) + 'static, >( this: *mut ffi::GtkApplication, window: *mut ffi::GtkWindow, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Application::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(window), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"window-added\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( window_added_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_window_removed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn window_removed_trampoline< P: IsA, F: Fn(&P, &Window) + 'static, >( this: *mut ffi::GtkApplication, window: *mut ffi::GtkWindow, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Application::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(window), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"window-removed\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( window_removed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_active_window_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_active_window_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkApplication, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::active-window\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_active_window_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_app_menu_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_app_menu_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkApplication, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::app-menu\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_app_menu_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_menubar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_menubar_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkApplication, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::menubar\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_menubar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_register_session_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_register_session_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkApplication, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::register-session\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_register_session_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v3_24", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_24")))] fn connect_screensaver_active_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_screensaver_active_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkApplication, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Application::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::screensaver-active\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_screensaver_active_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Application { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Application") } } gtk-0.14.3/src/auto/application_window.rs000064400000000000000000000576570072674642500165510ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::Application; use crate::Bin; use crate::Buildable; use crate::Container; use crate::ResizeMode; #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] use crate::ShortcutsWindow; use crate::Widget; use crate::Window; use crate::WindowPosition; use crate::WindowType; 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 = "GtkApplicationWindow")] pub struct ApplicationWindow(Object) @extends Window, Bin, Container, Widget, @implements Buildable, gio::ActionGroup, gio::ActionMap; match fn { type_ => || ffi::gtk_application_window_get_type(), } } impl ApplicationWindow { // 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() } } #[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: Option, 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: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, screen: Option, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, type_: Option, type_hint: Option, urgency_hint: Option, window_position: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, 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 application) = self.application { properties.push(("application", application)); } 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 gravity) = self.gravity { properties.push(("gravity", gravity)); } 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 screen) = self.screen { properties.push(("screen", screen)); } 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 type_) = self.type_ { properties.push(("type", type_)); } if let Some(ref type_hint) = self.type_hint { properties.push(("type-hint", type_hint)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref window_position) = self.window_position { properties.push(("window-position", window_position)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 application>(mut self, application: &P) -> Self { self.application = Some(application.clone().upcast()); 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 gravity(mut self, gravity: gdk::Gravity) -> Self { self.gravity = Some(gravity); 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 screen(mut self, screen: &gdk::Screen) -> Self { self.screen = Some(screen.clone()); 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 type_(mut self, type_: WindowType) -> Self { self.type_ = Some(type_); self } pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self { self.type_hint = Some(type_hint); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn window_position(mut self, window_position: WindowPosition) -> Self { self.window_position = Some(window_position); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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; pub trait ApplicationWindowExt: 'static { #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] #[doc(alias = "gtk_application_window_get_help_overlay")] #[doc(alias = "get_help_overlay")] fn help_overlay(&self) -> Option; #[doc(alias = "gtk_application_window_get_id")] #[doc(alias = "get_id")] fn id(&self) -> u32; #[doc(alias = "gtk_application_window_get_show_menubar")] #[doc(alias = "get_show_menubar")] fn shows_menubar(&self) -> bool; #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] #[doc(alias = "gtk_application_window_set_help_overlay")] fn set_help_overlay>(&self, help_overlay: Option<&P>); #[doc(alias = "gtk_application_window_set_show_menubar")] fn set_show_menubar(&self, show_menubar: bool); #[doc(alias = "show-menubar")] fn connect_show_menubar_notify(&self, f: F) -> SignalHandlerId; } impl> ApplicationWindowExt for O { #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] fn help_overlay(&self) -> Option { unsafe { from_glib_none(ffi::gtk_application_window_get_help_overlay( self.as_ref().to_glib_none().0, )) } } fn id(&self) -> u32 { unsafe { ffi::gtk_application_window_get_id(self.as_ref().to_glib_none().0) } } fn shows_menubar(&self) -> bool { unsafe { from_glib(ffi::gtk_application_window_get_show_menubar( self.as_ref().to_glib_none().0, )) } } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] fn set_help_overlay>(&self, help_overlay: Option<&P>) { unsafe { ffi::gtk_application_window_set_help_overlay( self.as_ref().to_glib_none().0, help_overlay.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_show_menubar(&self, show_menubar: bool) { unsafe { ffi::gtk_application_window_set_show_menubar( self.as_ref().to_glib_none().0, show_menubar.into_glib(), ); } } fn connect_show_menubar_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_show_menubar_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkApplicationWindow, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::show-menubar\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_show_menubar_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for ApplicationWindow { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("ApplicationWindow") } } gtk-0.14.3/src/auto/aspect_frame.rs000064400000000000000000000552020072674642500152700ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::Bin; use crate::Buildable; use crate::Container; use crate::Frame; use crate::ResizeMode; use crate::ShadowType; use crate::Widget; 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 = "GtkAspectFrame")] pub struct AspectFrame(Object) @extends Frame, Bin, Container, Widget, @implements Buildable; match fn { type_ => || ffi::gtk_aspect_frame_get_type(), } } impl AspectFrame { #[doc(alias = "gtk_aspect_frame_new")] pub fn new( label: Option<&str>, xalign: f32, yalign: f32, ratio: f32, obey_child: bool, ) -> AspectFrame { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_aspect_frame_new( label.to_glib_none().0, xalign, yalign, ratio, obey_child.into_glib(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AspectFrame`] objects. /// /// This method returns an instance of [`AspectFrameBuilder`] which can be used to create [`AspectFrame`] objects. pub fn builder() -> AspectFrameBuilder { AspectFrameBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AspectFrame`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AspectFrameBuilder { obey_child: Option, ratio: Option, xalign: Option, yalign: Option, label: Option, label_widget: Option, label_xalign: Option, label_yalign: Option, shadow_type: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl AspectFrameBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AspectFrameBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`AspectFrame`]. pub fn build(self) -> AspectFrame { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref obey_child) = self.obey_child { properties.push(("obey-child", obey_child)); } if let Some(ref ratio) = self.ratio { properties.push(("ratio", ratio)); } 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 label) = self.label { properties.push(("label", label)); } if let Some(ref label_widget) = self.label_widget { properties.push(("label-widget", label_widget)); } if let Some(ref label_xalign) = self.label_xalign { properties.push(("label-xalign", label_xalign)); } if let Some(ref label_yalign) = self.label_yalign { properties.push(("label-yalign", label_yalign)); } if let Some(ref shadow_type) = self.shadow_type { properties.push(("shadow-type", shadow_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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 AspectFrame") } pub fn obey_child(mut self, obey_child: bool) -> Self { self.obey_child = Some(obey_child); self } pub fn ratio(mut self, ratio: f32) -> Self { self.ratio = Some(ratio); 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 label(mut self, label: &str) -> Self { self.label = Some(label.to_string()); self } pub fn label_widget>(mut self, label_widget: &P) -> Self { self.label_widget = Some(label_widget.clone().upcast()); self } pub fn label_xalign(mut self, label_xalign: f32) -> Self { self.label_xalign = Some(label_xalign); self } pub fn label_yalign(mut self, label_yalign: f32) -> Self { self.label_yalign = Some(label_yalign); self } pub fn shadow_type(mut self, shadow_type: ShadowType) -> Self { self.shadow_type = Some(shadow_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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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_ASPECT_FRAME: Option<&AspectFrame> = None; pub trait AspectFrameExt: 'static { #[doc(alias = "gtk_aspect_frame_set")] fn set(&self, xalign: f32, yalign: f32, ratio: f32, obey_child: bool); #[doc(alias = "obey-child")] fn is_obey_child(&self) -> bool; #[doc(alias = "obey-child")] fn set_obey_child(&self, obey_child: bool); fn ratio(&self) -> f32; fn set_ratio(&self, ratio: f32); fn xalign(&self) -> f32; fn set_xalign(&self, xalign: f32); fn yalign(&self) -> f32; fn set_yalign(&self, yalign: f32); #[doc(alias = "obey-child")] fn connect_obey_child_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "ratio")] fn connect_ratio_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "xalign")] fn connect_xalign_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "yalign")] fn connect_yalign_notify(&self, f: F) -> SignalHandlerId; } impl> AspectFrameExt for O { fn set(&self, xalign: f32, yalign: f32, ratio: f32, obey_child: bool) { unsafe { ffi::gtk_aspect_frame_set( self.as_ref().to_glib_none().0, xalign, yalign, ratio, obey_child.into_glib(), ); } } fn is_obey_child(&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"obey-child\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `obey-child` getter") } } fn set_obey_child(&self, obey_child: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"obey-child\0".as_ptr() as *const _, obey_child.to_value().to_glib_none().0, ); } } fn ratio(&self) -> f32 { 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"ratio\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `ratio` getter") } } fn set_ratio(&self, ratio: f32) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"ratio\0".as_ptr() as *const _, ratio.to_value().to_glib_none().0, ); } } fn xalign(&self) -> f32 { 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"xalign\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `xalign` getter") } } fn set_xalign(&self, xalign: f32) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"xalign\0".as_ptr() as *const _, xalign.to_value().to_glib_none().0, ); } } fn yalign(&self) -> f32 { 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"yalign\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `yalign` getter") } } fn set_yalign(&self, yalign: f32) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"yalign\0".as_ptr() as *const _, yalign.to_value().to_glib_none().0, ); } } fn connect_obey_child_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_obey_child_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkAspectFrame, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AspectFrame::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::obey-child\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_obey_child_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_ratio_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_ratio_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAspectFrame, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AspectFrame::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::ratio\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_ratio_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_xalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_xalign_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAspectFrame, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AspectFrame::from_glib_borrow(this).unsafe_cast_ref()) } 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), ) } } fn connect_yalign_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_yalign_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAspectFrame, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AspectFrame::from_glib_borrow(this).unsafe_cast_ref()) } 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 fmt::Display for AspectFrame { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AspectFrame") } } gtk-0.14.3/src/auto/assistant.rs000064400000000000000000001173650072674642500146610ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::Application; use crate::AssistantPageType; use crate::Bin; use crate::Buildable; use crate::Container; use crate::ResizeMode; use crate::Widget; use crate::Window; use crate::WindowPosition; use crate::WindowType; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectExt; 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 = "GtkAssistant")] pub struct Assistant(Object) @extends Window, Bin, Container, Widget, @implements Buildable; match fn { type_ => || ffi::gtk_assistant_get_type(), } } impl Assistant { #[doc(alias = "gtk_assistant_new")] pub fn new() -> Assistant { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_assistant_new()).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Assistant`] objects. /// /// This method returns an instance of [`AssistantBuilder`] which can be used to create [`Assistant`] objects. pub fn builder() -> AssistantBuilder { AssistantBuilder::default() } } impl Default for Assistant { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Assistant`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct AssistantBuilder { use_header_bar: Option, accept_focus: Option, application: Option, 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: Option, hide_titlebar_when_maximized: Option, icon: Option, icon_name: Option, mnemonics_visible: Option, modal: Option, resizable: Option, role: Option, screen: Option, skip_pager_hint: Option, skip_taskbar_hint: Option, startup_id: Option, title: Option, transient_for: Option, type_: Option, type_hint: Option, urgency_hint: Option, window_position: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, } impl AssistantBuilder { // rustdoc-stripper-ignore-next /// Create a new [`AssistantBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Assistant`]. pub fn build(self) -> Assistant { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref use_header_bar) = self.use_header_bar { properties.push(("use-header-bar", use_header_bar)); } if let Some(ref accept_focus) = self.accept_focus { properties.push(("accept-focus", accept_focus)); } if let Some(ref application) = self.application { properties.push(("application", application)); } 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 gravity) = self.gravity { properties.push(("gravity", gravity)); } 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 screen) = self.screen { properties.push(("screen", screen)); } 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 type_) = self.type_ { properties.push(("type", type_)); } if let Some(ref type_hint) = self.type_hint { properties.push(("type-hint", type_hint)); } if let Some(ref urgency_hint) = self.urgency_hint { properties.push(("urgency-hint", urgency_hint)); } if let Some(ref window_position) = self.window_position { properties.push(("window-position", window_position)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 Assistant") } pub fn use_header_bar(mut self, use_header_bar: i32) -> Self { self.use_header_bar = Some(use_header_bar); self } pub fn accept_focus(mut self, accept_focus: bool) -> Self { self.accept_focus = Some(accept_focus); self } pub fn application>(mut self, application: &P) -> Self { self.application = Some(application.clone().upcast()); 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 gravity(mut self, gravity: gdk::Gravity) -> Self { self.gravity = Some(gravity); 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 screen(mut self, screen: &gdk::Screen) -> Self { self.screen = Some(screen.clone()); 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 type_(mut self, type_: WindowType) -> Self { self.type_ = Some(type_); self } pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self { self.type_hint = Some(type_hint); self } pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { self.urgency_hint = Some(urgency_hint); self } pub fn window_position(mut self, window_position: WindowPosition) -> Self { self.window_position = Some(window_position); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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_ASSISTANT: Option<&Assistant> = None; pub trait AssistantExt: 'static { #[doc(alias = "gtk_assistant_add_action_widget")] fn add_action_widget>(&self, child: &P); #[doc(alias = "gtk_assistant_append_page")] fn append_page>(&self, page: &P) -> i32; #[doc(alias = "gtk_assistant_commit")] fn commit(&self); #[doc(alias = "gtk_assistant_get_current_page")] #[doc(alias = "get_current_page")] fn current_page(&self) -> i32; #[doc(alias = "gtk_assistant_get_n_pages")] #[doc(alias = "get_n_pages")] fn n_pages(&self) -> i32; #[doc(alias = "gtk_assistant_get_nth_page")] #[doc(alias = "get_nth_page")] fn nth_page(&self, page_num: i32) -> Option; #[doc(alias = "gtk_assistant_get_page_complete")] #[doc(alias = "get_page_complete")] fn page_is_complete>(&self, page: &P) -> bool; #[doc(alias = "gtk_assistant_get_page_has_padding")] #[doc(alias = "get_page_has_padding")] fn page_has_padding>(&self, page: &P) -> bool; #[doc(alias = "gtk_assistant_get_page_title")] #[doc(alias = "get_page_title")] fn page_title>(&self, page: &P) -> Option; #[doc(alias = "gtk_assistant_get_page_type")] #[doc(alias = "get_page_type")] fn page_type>(&self, page: &P) -> AssistantPageType; #[doc(alias = "gtk_assistant_insert_page")] fn insert_page>(&self, page: &P, position: i32) -> i32; #[doc(alias = "gtk_assistant_next_page")] fn next_page(&self); #[doc(alias = "gtk_assistant_prepend_page")] fn prepend_page>(&self, page: &P) -> i32; #[doc(alias = "gtk_assistant_previous_page")] fn previous_page(&self); #[doc(alias = "gtk_assistant_remove_action_widget")] fn remove_action_widget>(&self, child: &P); #[doc(alias = "gtk_assistant_remove_page")] fn remove_page(&self, page_num: i32); #[doc(alias = "gtk_assistant_set_current_page")] fn set_current_page(&self, page_num: i32); #[doc(alias = "gtk_assistant_set_forward_page_func")] fn set_forward_page_func(&self, page_func: Option i32 + 'static>>); #[doc(alias = "gtk_assistant_set_page_complete")] fn set_page_complete>(&self, page: &P, complete: bool); #[doc(alias = "gtk_assistant_set_page_has_padding")] fn set_page_has_padding>(&self, page: &P, has_padding: bool); #[doc(alias = "gtk_assistant_set_page_title")] fn set_page_title>(&self, page: &P, title: &str); #[doc(alias = "gtk_assistant_set_page_type")] fn set_page_type>(&self, page: &P, type_: AssistantPageType); #[doc(alias = "gtk_assistant_update_buttons_state")] fn update_buttons_state(&self); #[doc(alias = "use-header-bar")] fn use_header_bar(&self) -> i32; fn child_is_complete>(&self, item: &T) -> bool; fn set_child_complete>(&self, item: &T, complete: bool); #[doc(alias = "child.has-padding")] fn child_has_padding>(&self, item: &T) -> bool; #[doc(alias = "child.has-padding")] fn set_child_has_padding>(&self, item: &T, has_padding: bool); #[doc(alias = "child.page-type")] fn child_page_type>(&self, item: &T) -> AssistantPageType; #[doc(alias = "child.page-type")] fn set_child_page_type>(&self, item: &T, page_type: AssistantPageType); fn child_title>(&self, item: &T) -> Option; fn set_child_title>(&self, item: &T, title: Option<&str>); #[doc(alias = "apply")] fn connect_apply(&self, f: F) -> SignalHandlerId; #[doc(alias = "cancel")] fn connect_cancel(&self, f: F) -> SignalHandlerId; #[doc(alias = "close")] fn connect_close(&self, f: F) -> SignalHandlerId; #[doc(alias = "escape")] fn connect_escape(&self, f: F) -> SignalHandlerId; fn emit_escape(&self); #[doc(alias = "prepare")] fn connect_prepare(&self, f: F) -> SignalHandlerId; } impl> AssistantExt for O { fn add_action_widget>(&self, child: &P) { unsafe { ffi::gtk_assistant_add_action_widget( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } fn append_page>(&self, page: &P) -> i32 { unsafe { ffi::gtk_assistant_append_page( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ) } } fn commit(&self) { unsafe { ffi::gtk_assistant_commit(self.as_ref().to_glib_none().0); } } fn current_page(&self) -> i32 { unsafe { ffi::gtk_assistant_get_current_page(self.as_ref().to_glib_none().0) } } fn n_pages(&self) -> i32 { unsafe { ffi::gtk_assistant_get_n_pages(self.as_ref().to_glib_none().0) } } fn nth_page(&self, page_num: i32) -> Option { unsafe { from_glib_none(ffi::gtk_assistant_get_nth_page( self.as_ref().to_glib_none().0, page_num, )) } } fn page_is_complete>(&self, page: &P) -> bool { unsafe { from_glib(ffi::gtk_assistant_get_page_complete( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, )) } } fn page_has_padding>(&self, page: &P) -> bool { unsafe { from_glib(ffi::gtk_assistant_get_page_has_padding( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, )) } } fn page_title>(&self, page: &P) -> Option { unsafe { from_glib_none(ffi::gtk_assistant_get_page_title( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, )) } } fn page_type>(&self, page: &P) -> AssistantPageType { unsafe { from_glib(ffi::gtk_assistant_get_page_type( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, )) } } fn insert_page>(&self, page: &P, position: i32) -> i32 { unsafe { ffi::gtk_assistant_insert_page( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, position, ) } } fn next_page(&self) { unsafe { ffi::gtk_assistant_next_page(self.as_ref().to_glib_none().0); } } fn prepend_page>(&self, page: &P) -> i32 { unsafe { ffi::gtk_assistant_prepend_page( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, ) } } fn previous_page(&self) { unsafe { ffi::gtk_assistant_previous_page(self.as_ref().to_glib_none().0); } } fn remove_action_widget>(&self, child: &P) { unsafe { ffi::gtk_assistant_remove_action_widget( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, ); } } fn remove_page(&self, page_num: i32) { unsafe { ffi::gtk_assistant_remove_page(self.as_ref().to_glib_none().0, page_num); } } fn set_current_page(&self, page_num: i32) { unsafe { ffi::gtk_assistant_set_current_page(self.as_ref().to_glib_none().0, page_num); } } fn set_forward_page_func(&self, page_func: Option i32 + 'static>>) { let page_func_data: Box_ i32 + 'static>>> = Box_::new(page_func); unsafe extern "C" fn page_func_func( current_page: libc::c_int, data: glib::ffi::gpointer, ) -> libc::c_int { let callback: &Option i32 + 'static>> = &*(data as *mut _); let res = if let Some(ref callback) = *callback { callback(current_page) } else { panic!("cannot get closure...") }; res } let page_func = if page_func_data.is_some() { Some(page_func_func as _) } else { None }; unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) { let _callback: Box_ i32 + 'static>>> = Box_::from_raw(data as *mut _); } let destroy_call3 = Some(destroy_func as _); let super_callback0: Box_ i32 + 'static>>> = page_func_data; unsafe { ffi::gtk_assistant_set_forward_page_func( self.as_ref().to_glib_none().0, page_func, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } fn set_page_complete>(&self, page: &P, complete: bool) { unsafe { ffi::gtk_assistant_set_page_complete( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, complete.into_glib(), ); } } fn set_page_has_padding>(&self, page: &P, has_padding: bool) { unsafe { ffi::gtk_assistant_set_page_has_padding( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, has_padding.into_glib(), ); } } fn set_page_title>(&self, page: &P, title: &str) { unsafe { ffi::gtk_assistant_set_page_title( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, title.to_glib_none().0, ); } } fn set_page_type>(&self, page: &P, type_: AssistantPageType) { unsafe { ffi::gtk_assistant_set_page_type( self.as_ref().to_glib_none().0, page.as_ref().to_glib_none().0, type_.into_glib(), ); } } fn update_buttons_state(&self) { unsafe { ffi::gtk_assistant_update_buttons_state(self.as_ref().to_glib_none().0); } } fn use_header_bar(&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"use-header-bar\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `use-header-bar` getter") } } fn child_is_complete>(&self, item: &T) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"complete\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `complete` getter") } } fn set_child_complete>(&self, item: &T, complete: bool) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"complete\0".as_ptr() as *const _, complete.to_value().to_glib_none().0, ); } } fn child_has_padding>(&self, item: &T) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"has-padding\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `has-padding` getter") } } fn set_child_has_padding>(&self, item: &T, has_padding: bool) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"has-padding\0".as_ptr() as *const _, has_padding.to_value().to_glib_none().0, ); } } fn child_page_type>(&self, item: &T) -> AssistantPageType { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"page-type\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `page-type` getter") } } fn set_child_page_type>(&self, item: &T, page_type: AssistantPageType) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"page-type\0".as_ptr() as *const _, page_type.to_value().to_glib_none().0, ); } } fn child_title>(&self, item: &T) -> Option { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::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 { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::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_apply(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn apply_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAssistant, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Assistant::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"apply\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( apply_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_cancel(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn cancel_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAssistant, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Assistant::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"cancel\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( cancel_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_close(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn close_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAssistant, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Assistant::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"close\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( close_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_escape(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn escape_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkAssistant, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Assistant::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"escape\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( escape_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn emit_escape(&self) { let _ = unsafe { glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) .emit_by_name("escape", &[]) .unwrap() }; } fn connect_prepare(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn prepare_trampoline, F: Fn(&P, &Widget) + 'static>( this: *mut ffi::GtkAssistant, page: *mut ffi::GtkWidget, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Assistant::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(page), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"prepare\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( prepare_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Assistant { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Assistant") } } gtk-0.14.3/src/auto/bin.rs000064400000000000000000000017060072674642500134070ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Buildable; use crate::Container; use crate::Widget; use glib::object::IsA; use glib::translate::*; use std::fmt; glib::wrapper! { #[doc(alias = "GtkBin")] pub struct Bin(Object) @extends Container, Widget, @implements Buildable; match fn { type_ => || ffi::gtk_bin_get_type(), } } pub const NONE_BIN: Option<&Bin> = None; pub trait BinExt: 'static { #[doc(alias = "gtk_bin_get_child")] #[doc(alias = "get_child")] fn child(&self) -> Option; } impl> BinExt for O { fn child(&self) -> Option { unsafe { from_glib_none(ffi::gtk_bin_get_child(self.as_ref().to_glib_none().0)) } } } impl fmt::Display for Bin { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Bin") } } gtk-0.14.3/src/auto/box_.rs000064400000000000000000000671320072674642500135730ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Align; use crate::BaselinePosition; use crate::Buildable; use crate::Container; use crate::Orientable; use crate::Orientation; use crate::PackType; use crate::ResizeMode; use crate::Widget; 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; use std::mem::transmute; glib::wrapper! { #[doc(alias = "GtkBox")] pub struct Box(Object) @extends Container, Widget, @implements Buildable, Orientable; match fn { type_ => || ffi::gtk_box_get_type(), } } impl Box { #[doc(alias = "gtk_box_new")] pub fn new(orientation: Orientation, spacing: i32) -> Box { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_box_new(orientation.into_glib(), spacing)).unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Box`] objects. /// /// This method returns an instance of [`BoxBuilder`] which can be used to create [`Box`] objects. pub fn builder() -> BoxBuilder { BoxBuilder::default() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Box`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct BoxBuilder { baseline_position: Option, homogeneous: Option, spacing: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, tooltip_markup: Option, tooltip_text: Option, valign: Option, vexpand: Option, vexpand_set: Option, visible: Option, width_request: Option, orientation: Option, } impl BoxBuilder { // rustdoc-stripper-ignore-next /// Create a new [`BoxBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Box`]. pub fn build(self) -> Box { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref baseline_position) = self.baseline_position { properties.push(("baseline-position", baseline_position)); } if let Some(ref homogeneous) = self.homogeneous { properties.push(("homogeneous", homogeneous)); } if let Some(ref spacing) = self.spacing { properties.push(("spacing", spacing)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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 Box") } pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self { self.baseline_position = Some(baseline_position); self } pub fn homogeneous(mut self, homogeneous: bool) -> Self { self.homogeneous = Some(homogeneous); self } pub fn spacing(mut self, spacing: i32) -> Self { self.spacing = Some(spacing); 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: 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 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 } #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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: 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_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: 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: Orientation) -> Self { self.orientation = Some(orientation); self } } pub const NONE_BOX: Option<&Box> = None; pub trait BoxExt: 'static { #[doc(alias = "gtk_box_get_baseline_position")] #[doc(alias = "get_baseline_position")] fn baseline_position(&self) -> BaselinePosition; #[doc(alias = "gtk_box_get_center_widget")] #[doc(alias = "get_center_widget")] fn center_widget(&self) -> Option; #[doc(alias = "gtk_box_get_homogeneous")] #[doc(alias = "get_homogeneous")] fn is_homogeneous(&self) -> bool; #[doc(alias = "gtk_box_get_spacing")] #[doc(alias = "get_spacing")] fn spacing(&self) -> i32; #[doc(alias = "gtk_box_pack_end")] fn pack_end>(&self, child: &P, expand: bool, fill: bool, padding: u32); #[doc(alias = "gtk_box_pack_start")] fn pack_start>(&self, child: &P, expand: bool, fill: bool, padding: u32); #[doc(alias = "gtk_box_query_child_packing")] fn query_child_packing>(&self, child: &P) -> (bool, bool, u32, PackType); #[doc(alias = "gtk_box_reorder_child")] fn reorder_child>(&self, child: &P, position: i32); #[doc(alias = "gtk_box_set_baseline_position")] fn set_baseline_position(&self, position: BaselinePosition); #[doc(alias = "gtk_box_set_center_widget")] fn set_center_widget>(&self, widget: Option<&P>); #[doc(alias = "gtk_box_set_child_packing")] fn set_child_packing>( &self, child: &P, expand: bool, fill: bool, padding: u32, pack_type: PackType, ); #[doc(alias = "gtk_box_set_homogeneous")] fn set_homogeneous(&self, homogeneous: bool); #[doc(alias = "gtk_box_set_spacing")] fn set_spacing(&self, spacing: i32); #[doc(hidden)] fn child_expands>(&self, item: &T) -> bool; #[doc(hidden)] fn set_child_expand>(&self, item: &T, expand: bool); #[doc(hidden)] fn child_fills>(&self, item: &T) -> bool; #[doc(hidden)] fn set_child_fill>(&self, item: &T, fill: bool); #[doc(hidden)] #[doc(alias = "child.pack-type")] fn child_pack_type>(&self, item: &T) -> PackType; #[doc(hidden)] #[doc(alias = "child.pack-type")] fn set_child_pack_type>(&self, item: &T, pack_type: PackType); #[doc(hidden)] fn child_padding>(&self, item: &T) -> u32; #[doc(hidden)] fn set_child_padding>(&self, item: &T, padding: u32); fn child_position>(&self, item: &T) -> i32; fn set_child_position>(&self, item: &T, position: i32); #[doc(alias = "baseline-position")] fn connect_baseline_position_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "homogeneous")] fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId; #[doc(alias = "spacing")] fn connect_spacing_notify(&self, f: F) -> SignalHandlerId; } impl> BoxExt for O { fn baseline_position(&self) -> BaselinePosition { unsafe { from_glib(ffi::gtk_box_get_baseline_position( self.as_ref().to_glib_none().0, )) } } fn center_widget(&self) -> Option { unsafe { from_glib_none(ffi::gtk_box_get_center_widget( self.as_ref().to_glib_none().0, )) } } fn is_homogeneous(&self) -> bool { unsafe { from_glib(ffi::gtk_box_get_homogeneous(self.as_ref().to_glib_none().0)) } } fn spacing(&self) -> i32 { unsafe { ffi::gtk_box_get_spacing(self.as_ref().to_glib_none().0) } } fn pack_end>(&self, child: &P, expand: bool, fill: bool, padding: u32) { unsafe { ffi::gtk_box_pack_end( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, expand.into_glib(), fill.into_glib(), padding, ); } } fn pack_start>(&self, child: &P, expand: bool, fill: bool, padding: u32) { unsafe { ffi::gtk_box_pack_start( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, expand.into_glib(), fill.into_glib(), padding, ); } } fn query_child_packing>(&self, child: &P) -> (bool, bool, u32, PackType) { unsafe { let mut expand = mem::MaybeUninit::uninit(); let mut fill = mem::MaybeUninit::uninit(); let mut padding = mem::MaybeUninit::uninit(); let mut pack_type = mem::MaybeUninit::uninit(); ffi::gtk_box_query_child_packing( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, expand.as_mut_ptr(), fill.as_mut_ptr(), padding.as_mut_ptr(), pack_type.as_mut_ptr(), ); let expand = expand.assume_init(); let fill = fill.assume_init(); let padding = padding.assume_init(); let pack_type = pack_type.assume_init(); ( from_glib(expand), from_glib(fill), padding, from_glib(pack_type), ) } } fn reorder_child>(&self, child: &P, position: i32) { unsafe { ffi::gtk_box_reorder_child( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, position, ); } } fn set_baseline_position(&self, position: BaselinePosition) { unsafe { ffi::gtk_box_set_baseline_position( self.as_ref().to_glib_none().0, position.into_glib(), ); } } fn set_center_widget>(&self, widget: Option<&P>) { unsafe { ffi::gtk_box_set_center_widget( self.as_ref().to_glib_none().0, widget.map(|p| p.as_ref()).to_glib_none().0, ); } } fn set_child_packing>( &self, child: &P, expand: bool, fill: bool, padding: u32, pack_type: PackType, ) { unsafe { ffi::gtk_box_set_child_packing( self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, expand.into_glib(), fill.into_glib(), padding, pack_type.into_glib(), ); } } fn set_homogeneous(&self, homogeneous: bool) { unsafe { ffi::gtk_box_set_homogeneous(self.as_ref().to_glib_none().0, homogeneous.into_glib()); } } fn set_spacing(&self, spacing: i32) { unsafe { ffi::gtk_box_set_spacing(self.as_ref().to_glib_none().0, spacing); } } #[doc(hidden)] fn child_expands>(&self, item: &T) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"expand\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `expand` getter") } } #[doc(hidden)] fn set_child_expand>(&self, item: &T, expand: bool) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"expand\0".as_ptr() as *const _, expand.to_value().to_glib_none().0, ); } } #[doc(hidden)] fn child_fills>(&self, item: &T) -> bool { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"fill\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `fill` getter") } } #[doc(hidden)] fn set_child_fill>(&self, item: &T, fill: bool) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"fill\0".as_ptr() as *const _, fill.to_value().to_glib_none().0, ); } } #[doc(hidden)] fn child_pack_type>(&self, item: &T) -> PackType { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"pack-type\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `pack-type` getter") } } #[doc(hidden)] fn set_child_pack_type>(&self, item: &T, pack_type: PackType) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"pack-type\0".as_ptr() as *const _, pack_type.to_value().to_glib_none().0, ); } } #[doc(hidden)] fn child_padding>(&self, item: &T) -> u32 { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"padding\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `padding` getter") } } #[doc(hidden)] fn set_child_padding>(&self, item: &T, padding: u32) { unsafe { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"padding\0".as_ptr() as *const _, padding.to_value().to_glib_none().0, ); } } fn child_position>(&self, item: &T) -> i32 { unsafe { let mut value = glib::Value::from_type(::static_type()); crate::ffi::gtk_container_child_get_property( self.to_glib_none().0 as *mut crate::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 { crate::ffi::gtk_container_child_set_property( self.to_glib_none().0 as *mut crate::ffi::GtkContainer, item.to_glib_none().0 as *mut _, b"position\0".as_ptr() as *const _, position.to_value().to_glib_none().0, ); } } fn connect_baseline_position_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_baseline_position_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkBox, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Box::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::baseline-position\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_baseline_position_trampoline:: as *const (), )), Box_::into_raw(f), ) } } fn connect_homogeneous_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_homogeneous_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkBox, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Box::from_glib_borrow(this).unsafe_cast_ref()) } 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), ) } } fn connect_spacing_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_spacing_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::GtkBox, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Box::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), ) } } } impl fmt::Display for Box { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Box") } } gtk-0.14.3/src/auto/buildable.rs000064400000000000000000000114540072674642500145630ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Builder; use glib::object::IsA; use glib::translate::*; use std::fmt; glib::wrapper! { #[doc(alias = "GtkBuildable")] pub struct Buildable(Interface); match fn { type_ => || ffi::gtk_buildable_get_type(), } } pub const NONE_BUILDABLE: Option<&Buildable> = None; pub trait BuildableExt: 'static { #[doc(alias = "gtk_buildable_add_child")] fn add_child, Q: IsA>( &self, builder: &P, child: &Q, type_: Option<&str>, ); #[doc(alias = "gtk_buildable_construct_child")] fn construct_child>(&self, builder: &P, name: &str) -> Option; //#[doc(alias = "gtk_buildable_custom_finished")] //fn custom_finished, Q: IsA>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option); //#[doc(alias = "gtk_buildable_custom_tag_end")] //fn custom_tag_end, Q: IsA>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option); //#[doc(alias = "gtk_buildable_custom_tag_start")] //fn custom_tag_start, Q: IsA>(&self, builder: &P, child: Option<&Q>, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option) -> bool; #[doc(alias = "gtk_buildable_get_internal_child")] #[doc(alias = "get_internal_child")] fn internal_child>(&self, builder: &P, childname: &str) -> Option; #[doc(alias = "gtk_buildable_parser_finished")] fn parser_finished>(&self, builder: &P); #[doc(alias = "gtk_buildable_set_buildable_property")] fn set_buildable_property>(&self, builder: &P, name: &str, value: &glib::Value); } impl> BuildableExt for O { fn add_child, Q: IsA>( &self, builder: &P, child: &Q, type_: Option<&str>, ) { unsafe { ffi::gtk_buildable_add_child( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0, type_.to_glib_none().0, ); } } fn construct_child>(&self, builder: &P, name: &str) -> Option { unsafe { from_glib_full(ffi::gtk_buildable_construct_child( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, name.to_glib_none().0, )) } } //fn custom_finished, Q: IsA>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:gtk_buildable_custom_finished() } //} //fn custom_tag_end, Q: IsA>(&self, builder: &P, child: Option<&Q>, tagname: &str, data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:gtk_buildable_custom_tag_end() } //} //fn custom_tag_start, Q: IsA>(&self, builder: &P, child: Option<&Q>, tagname: &str, parser: /*Ignored*/glib::MarkupParser, data: /*Unimplemented*/&mut Option) -> bool { // unsafe { TODO: call ffi:gtk_buildable_custom_tag_start() } //} fn internal_child>( &self, builder: &P, childname: &str, ) -> Option { unsafe { from_glib_none(ffi::gtk_buildable_get_internal_child( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, childname.to_glib_none().0, )) } } fn parser_finished>(&self, builder: &P) { unsafe { ffi::gtk_buildable_parser_finished( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, ); } } fn set_buildable_property>( &self, builder: &P, name: &str, value: &glib::Value, ) { unsafe { ffi::gtk_buildable_set_buildable_property( self.as_ref().to_glib_none().0, builder.as_ref().to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, ); } } } impl fmt::Display for Buildable { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Buildable") } } gtk-0.14.3/src/auto/builder.rs000064400000000000000000000307650072674642500142740ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Application; use crate::Widget; 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::transmute; use std::ptr; glib::wrapper! { #[doc(alias = "GtkBuilder")] pub struct Builder(Object); match fn { type_ => || ffi::gtk_builder_get_type(), } } impl Builder { #[doc(alias = "gtk_builder_new")] pub fn new() -> Builder { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_builder_new()) } } #[doc(alias = "gtk_builder_new_from_resource")] #[doc(alias = "new_from_resource")] pub fn from_resource(resource_path: &str) -> Builder { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::gtk_builder_new_from_resource( resource_path.to_glib_none().0, )) } } #[doc(alias = "gtk_builder_new_from_string")] #[doc(alias = "new_from_string")] pub fn from_string(string: &str) -> Builder { assert_initialized_main_thread!(); let length = string.len() as isize; unsafe { from_glib_full(ffi::gtk_builder_new_from_string( string.to_glib_none().0, length, )) } } } impl Default for Builder { fn default() -> Self { Self::new() } } pub const NONE_BUILDER: Option<&Builder> = None; pub trait BuilderExt: 'static { //#[doc(alias = "gtk_builder_add_callback_symbol")] //fn add_callback_symbol(&self, callback_name: &str, callback_symbol: P); //#[doc(alias = "gtk_builder_add_callback_symbols")] //fn add_callback_symbols(&self, first_callback_name: &str, first_callback_symbol: P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); #[doc(alias = "gtk_builder_add_from_resource")] fn add_from_resource(&self, resource_path: &str) -> Result<(), glib::Error>; #[doc(alias = "gtk_builder_add_from_string")] fn add_from_string(&self, buffer: &str) -> Result<(), glib::Error>; #[doc(alias = "gtk_builder_add_objects_from_resource")] fn add_objects_from_resource( &self, resource_path: &str, object_ids: &[&str], ) -> Result<(), glib::Error>; #[doc(alias = "gtk_builder_add_objects_from_string")] fn add_objects_from_string(&self, buffer: &str, object_ids: &[&str]) -> Result<(), glib::Error>; //#[doc(alias = "gtk_builder_connect_signals")] //fn connect_signals(&self, user_data: /*Unimplemented*/Option); #[doc(alias = "gtk_builder_expose_object")] fn expose_object>(&self, name: &str, object: &P); #[doc(alias = "gtk_builder_extend_with_template")] fn extend_with_template>( &self, widget: &P, template_type: glib::types::Type, buffer: &str, ) -> Result<(), glib::Error>; #[doc(alias = "gtk_builder_get_application")] #[doc(alias = "get_application")] fn application(&self) -> Option; #[doc(alias = "gtk_builder_get_objects")] #[doc(alias = "get_objects")] fn objects(&self) -> Vec; #[doc(alias = "gtk_builder_get_translation_domain")] #[doc(alias = "get_translation_domain")] fn translation_domain(&self) -> Option; #[doc(alias = "gtk_builder_get_type_from_name")] #[doc(alias = "get_type_from_name")] fn type_from_name(&self, type_name: &str) -> glib::types::Type; //#[doc(alias = "gtk_builder_lookup_callback_symbol")] //fn lookup_callback_symbol(&self, callback_name: &str) -> Option>; #[doc(alias = "gtk_builder_set_application")] fn set_application>(&self, application: &P); #[doc(alias = "gtk_builder_set_translation_domain")] fn set_translation_domain(&self, domain: Option<&str>); #[doc(alias = "gtk_builder_value_from_string")] fn value_from_string( &self, pspec: &glib::ParamSpec, string: &str, ) -> Result; #[doc(alias = "gtk_builder_value_from_string_type")] fn value_from_string_type( &self, type_: glib::types::Type, string: &str, ) -> Result; #[doc(alias = "translation-domain")] fn connect_translation_domain_notify(&self, f: F) -> SignalHandlerId; } impl> BuilderExt for O { //fn add_callback_symbol(&self, callback_name: &str, callback_symbol: P) { // unsafe { TODO: call ffi:gtk_builder_add_callback_symbol() } //} //fn add_callback_symbols(&self, first_callback_name: &str, first_callback_symbol: P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { // unsafe { TODO: call ffi:gtk_builder_add_callback_symbols() } //} fn add_from_resource(&self, resource_path: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_add_from_resource( self.as_ref().to_glib_none().0, resource_path.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn add_from_string(&self, buffer: &str) -> Result<(), glib::Error> { let length = buffer.len() as usize; unsafe { let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_add_from_string( self.as_ref().to_glib_none().0, buffer.to_glib_none().0, length, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn add_objects_from_resource( &self, resource_path: &str, object_ids: &[&str], ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_add_objects_from_resource( self.as_ref().to_glib_none().0, resource_path.to_glib_none().0, object_ids.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn add_objects_from_string( &self, buffer: &str, object_ids: &[&str], ) -> Result<(), glib::Error> { let length = buffer.len() as usize; unsafe { let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_add_objects_from_string( self.as_ref().to_glib_none().0, buffer.to_glib_none().0, length, object_ids.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } //fn connect_signals(&self, user_data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:gtk_builder_connect_signals() } //} fn expose_object>(&self, name: &str, object: &P) { unsafe { ffi::gtk_builder_expose_object( self.as_ref().to_glib_none().0, name.to_glib_none().0, object.as_ref().to_glib_none().0, ); } } fn extend_with_template>( &self, widget: &P, template_type: glib::types::Type, buffer: &str, ) -> Result<(), glib::Error> { let length = buffer.len() as usize; unsafe { let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_extend_with_template( self.as_ref().to_glib_none().0, widget.as_ref().to_glib_none().0, template_type.into_glib(), buffer.to_glib_none().0, length, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn application(&self) -> Option { unsafe { from_glib_none(ffi::gtk_builder_get_application( self.as_ref().to_glib_none().0, )) } } fn objects(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_builder_get_objects( self.as_ref().to_glib_none().0, )) } } fn translation_domain(&self) -> Option { unsafe { from_glib_none(ffi::gtk_builder_get_translation_domain( self.as_ref().to_glib_none().0, )) } } fn type_from_name(&self, type_name: &str) -> glib::types::Type { unsafe { from_glib(ffi::gtk_builder_get_type_from_name( self.as_ref().to_glib_none().0, type_name.to_glib_none().0, )) } } //fn lookup_callback_symbol(&self, callback_name: &str) -> Option> { // unsafe { TODO: call ffi:gtk_builder_lookup_callback_symbol() } //} fn set_application>(&self, application: &P) { unsafe { ffi::gtk_builder_set_application( self.as_ref().to_glib_none().0, application.as_ref().to_glib_none().0, ); } } fn set_translation_domain(&self, domain: Option<&str>) { unsafe { ffi::gtk_builder_set_translation_domain( self.as_ref().to_glib_none().0, domain.to_glib_none().0, ); } } fn value_from_string( &self, pspec: &glib::ParamSpec, string: &str, ) -> Result { unsafe { let mut value = glib::Value::uninitialized(); let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_value_from_string( self.as_ref().to_glib_none().0, pspec.to_glib_none().0, string.to_glib_none().0, value.to_glib_none_mut().0, &mut error, ); if error.is_null() { Ok(value) } else { Err(from_glib_full(error)) } } } fn value_from_string_type( &self, type_: glib::types::Type, string: &str, ) -> Result { unsafe { let mut value = glib::Value::uninitialized(); let mut error = ptr::null_mut(); let _ = ffi::gtk_builder_value_from_string_type( self.as_ref().to_glib_none().0, type_.into_glib(), string.to_glib_none().0, value.to_glib_none_mut().0, &mut error, ); if error.is_null() { Ok(value) } else { Err(from_glib_full(error)) } } } fn connect_translation_domain_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_translation_domain_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::GtkBuilder, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Builder::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::translation-domain\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_translation_domain_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for Builder { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("Builder") } } gtk-0.14.3/src/auto/button.rs000064400000000000000000000717650072674642500141660ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::Actionable; use crate::Align; use crate::Bin; use crate::Buildable; use crate::Container; use crate::IconSize; use crate::PositionType; use crate::ReliefStyle; use crate::ResizeMode; use crate::Widget; use glib::object::Cast; use glib::object::IsA; use glib::object::ObjectExt; 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 = "GtkButton")] pub struct Button(Object) @extends Bin, Container, Widget, @implements Buildable, Actionable; match fn { type_ => || ffi::gtk_button_get_type(), } } impl Button { #[doc(alias = "gtk_button_new")] pub fn new() -> Button { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_button_new()).unsafe_cast() } } #[doc(alias = "gtk_button_new_from_icon_name")] #[doc(alias = "new_from_icon_name")] pub fn from_icon_name(icon_name: Option<&str>, size: IconSize) -> Button { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_button_new_from_icon_name( icon_name.to_glib_none().0, size.into_glib(), )) .unsafe_cast() } } #[doc(alias = "gtk_button_new_with_label")] #[doc(alias = "new_with_label")] pub fn with_label(label: &str) -> Button { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_button_new_with_label(label.to_glib_none().0)) .unsafe_cast() } } #[doc(alias = "gtk_button_new_with_mnemonic")] #[doc(alias = "new_with_mnemonic")] pub fn with_mnemonic(label: &str) -> Button { assert_initialized_main_thread!(); unsafe { Widget::from_glib_none(ffi::gtk_button_new_with_mnemonic(label.to_glib_none().0)) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Button`] objects. /// /// This method returns an instance of [`ButtonBuilder`] which can be used to create [`Button`] objects. pub fn builder() -> ButtonBuilder { ButtonBuilder::default() } } impl Default for Button { fn default() -> Self { Self::new() } } #[derive(Clone, Default)] // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Button`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html pub struct ButtonBuilder { always_show_image: Option, image: Option, image_position: Option, label: Option, relief: Option, use_underline: Option, border_width: Option, child: Option, resize_mode: Option, app_paintable: Option, can_default: Option, can_focus: Option, events: Option, expand: Option, #[cfg(any(feature = "v3_20", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 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_start: Option, margin_top: Option, name: Option, no_show_all: Option, opacity: Option, parent: Option, receives_default: Option, sensitive: Option, 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 ButtonBuilder { // rustdoc-stripper-ignore-next /// Create a new [`ButtonBuilder`]. pub fn new() -> Self { Self::default() } // rustdoc-stripper-ignore-next /// Build the [`Button`]. pub fn build(self) -> Button { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref always_show_image) = self.always_show_image { properties.push(("always-show-image", always_show_image)); } if let Some(ref image) = self.image { properties.push(("image", image)); } if let Some(ref image_position) = self.image_position { properties.push(("image-position", image_position)); } if let Some(ref label) = self.label { properties.push(("label", label)); } if let Some(ref relief) = self.relief { properties.push(("relief", relief)); } if let Some(ref use_underline) = self.use_underline { properties.push(("use-underline", use_underline)); } 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 events) = self.events { properties.push(("events", events)); } if let Some(ref expand) = self.expand { properties.push(("expand", expand)); } #[cfg(any(feature = "v3_20", feature = "dox"))] 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_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::