[]Struct gtk::PadController

pub struct PadController(_, _);

PadController is an event controller for the pads found in drawing tablets (The collection of buttons and tactile sensors often found around the stylus-sensitive area).

These buttons and sensors have no implicit meaning, and by default they perform no action, this event controller is provided to map those to gio::Action objects, thus letting the application give those a more semantic meaning.

Buttons and sensors are not constrained to triggering a single action, some gdk::InputSource::TabletPad devices feature multiple "modes", all these input elements have one current mode, which may determine the final action being triggered. Pad devices often divide buttons and sensors into groups, all elements in a group share the same current mode, but different groups may have different modes. See gdk::DevicePad::get_n_groups and gdk::DevicePad::get_group_n_modes.

Each of the actions that a given button/strip/ring performs for a given mode is defined by PadActionEntry, it contains an action name that will be looked up in the given gio::ActionGroup and activated whenever the specified input element and mode are triggered.

A simple example of PadController usage, assigning button 1 in all modes and pad devices to an "invert-selection" action:

  GtkPadActionEntry *pad_actions[] = {
    { GTK_PAD_ACTION_BUTTON, 1, -1, "Invert selection", "pad-actions.invert-selection" },
    …
  };

  …
  action_group = g_simple_action_group_new ();
  action = g_simple_action_new ("pad-actions.invert-selection", NULL);
  g_signal_connect (action, "activate", on_invert_selection_activated, NULL);
  g_action_map_add_action (G_ACTION_MAP (action_group), action);
  …
  pad_controller = gtk_pad_controller_new (window, action_group, NULL);

The actions belonging to rings/strips will be activated with a parameter of type G_VARIANT_TYPE_DOUBLE bearing the value of the given axis, it is required that those are made stateful and accepting this glib::VariantType.

Feature: v3_22

Implements

EventControllerExt, glib::object::ObjectExt

Implementations

impl PadController[src]

pub fn new<P: IsA<Window>, Q: IsA<ActionGroup>>(
    window: &P,
    group: &Q,
    pad: Option<&Device>
) -> PadController
[src]

Creates a new PadController that will associate events from pad to actions. A None pad may be provided so the controller manages all pad devices generically, it is discouraged to mix PadController objects with None and non-None pad argument on the same window, as execution order is not guaranteed.

The PadController is created with no mapped actions. In order to map pad events to actions, use PadController::set_action_entries or PadController::set_action.

Feature: v3_22

window

a Window

group

gio::ActionGroup to trigger actions from

pad

A gdk::InputSource::TabletPad device, or None to handle all pads

Returns

A newly created PadController

pub fn set_action(
    &self,
    type_: PadActionType,
    index: i32,
    mode: i32,
    label: &str,
    action_name: &str
)
[src]

Adds an individual action to self. This action will only be activated if the given button/ring/strip number in index is interacted while the current mode is mode. -1 may be used for simple cases, so the action is triggered on all modes.

The given label should be considered user-visible, so internationalization rules apply. Some windowing systems may be able to use those for user feedback.

Feature: v3_22

type_

the type of pad feature that will trigger this action

index

the 0-indexed button/ring/strip number that will trigger this action

mode

the mode that will trigger this action, or -1 for all modes.

label

Human readable description of this action, this string should be deemed user-visible.

action_name

action name that will be activated in the gio::ActionGroup

pub fn get_property_action_group(&self) -> Option<ActionGroup>[src]

pub fn get_property_pad(&self) -> Option<Device>[src]

impl PadController[src]

pub fn set_action_entries(&self, entries: &[PadActionEntry])[src]

This is a convenience function to add a group of action entries on self. See PadActionEntry and PadController::set_action.

Feature: v3_22

entries

the action entries to set on self

n_entries

the number of elements in entries

Trait Implementations

impl Clone for PadController

impl Debug for PadController

impl Display for PadController[src]

impl Eq for PadController

impl Hash for PadController

impl IsA<EventController> for PadController

impl Ord for PadController

impl<T: ObjectType> PartialEq<T> for PadController

impl<T: ObjectType> PartialOrd<T> for PadController

impl StaticType for PadController

Auto Trait Implementations

impl RefUnwindSafe for PadController

impl !Send for PadController

impl !Sync for PadController

impl Unpin for PadController

impl UnwindSafe for PadController

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.