Class ViewSwitcherTitle

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") @Deprecated public final class ViewSwitcherTitle extends Widget implements Accessible, Buildable, ConstraintTarget
Deprecated.

A view switcher title.

view-switcher-title

A widget letting you switch between multiple views contained by a ViewStack via an ViewSwitcher.

It is designed to be used as the title widget of a HeaderBar, and will display the window's title when the window is too narrow to fit the view switcher e.g. on mobile phones, or if there are less than two views.

In order to center the title in narrow windows, the header bar should have HeaderBar:centering-policy set to Adw.CenteringPolicy.strict.

AdwViewSwitcherTitle is intended to be used together with ViewSwitcherBar.

A common use case is to bind the ViewSwitcherBar:reveal property to ViewSwitcherTitle:title-visible to automatically reveal the view switcher bar when the title label is displayed in place of the view switcher, as follows:

<object class="AdwWindow">
  <property name="content">
    <object class="AdwToolbarView">
      <child type="top">
        <object class="AdwHeaderBar">
          <property name="centering-policy">strict</property>
          <property name="title-widget">
            <object class="AdwViewSwitcherTitle" id="title">
              <property name="stack">stack</property>
            </object>
          </property>
        </object>
      </child>
      <property name="content">
        <object class="AdwViewStack" id="stack"/>
      </property>
      <child type="bottom">
        <object class="AdwViewSwitcherBar">
          <property name="stack">stack</property>
          <binding name="reveal">
            <lookup name="title-visible">title</lookup>
          </binding>
        </object>
      </child>
    </object>
  </property>
</object>

CSS nodes

AdwViewSwitcherTitle has a single CSS node with name viewswitchertitle.

  • Constructor Details

    • ViewSwitcherTitle

      public ViewSwitcherTitle(MemorySegment address)
      Deprecated.
      Create a ViewSwitcherTitle instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ViewSwitcherTitle

      public ViewSwitcherTitle()
      Deprecated.
      Create a new ViewSwitcherTitle.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Deprecated.
      Get the GType of the ViewSwitcherTitle class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      Deprecated.
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ViewSwitcherTitle asParent()
      Deprecated.
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getStack

      @Deprecated public @Nullable ViewStack getStack()
      Deprecated.
      Gets the stack controlled by self.
      Returns:
      the stack
    • getSubtitle

      @Deprecated public String getSubtitle()
      Deprecated.
      Gets the subtitle of self.
      Returns:
      the subtitle
    • getTitle

      @Deprecated public String getTitle()
      Deprecated.
      Gets the title of self.
      Returns:
      the title
    • getTitleVisible

      @Deprecated public boolean getTitleVisible()
      Deprecated.

      Gets whether the title of this ViewSwitcherTitle is currently visible.

      If the title is visible, it means the view switcher is hidden an it may be wanted to show an alternative switcher, e.g. a ViewSwitcherBar.

      Returns:
      whether the title of this ViewSwitcherTitle is currently visible
    • getViewSwitcherEnabled

      @Deprecated public boolean getViewSwitcherEnabled()
      Deprecated.
      Gets whether self's view switcher is enabled.
      Returns:
      whether the view switcher is enabled
    • setStack

      @Deprecated public void setStack(@Nullable ViewStack stack)
      Deprecated.
      Sets the stack controlled by self.
      Parameters:
      stack - a stack
    • setSubtitle

      @Deprecated public void setSubtitle(String subtitle)
      Deprecated.

      Sets the subtitle of self.

      The subtitle should give the user additional details.

      Parameters:
      subtitle - a subtitle
    • setTitle

      @Deprecated public void setTitle(String title)
      Deprecated.

      Sets the title of self.

      The title typically identifies the current view or content item, and generally does not use the application name.

      Parameters:
      title - a title
    • setViewSwitcherEnabled

      @Deprecated public void setViewSwitcherEnabled(boolean enabled)
      Deprecated.

      Sets whether self's view switcher is enabled.

      If it is disabled, the title will be displayed instead. This allows to programmatically hide the view switcher even if it fits in the available space.

      This can be used e.g. to ensure the view switcher is hidden below a certain window width, or any other constraint you find suitable.

      Parameters:
      enabled - whether the view switcher is enabled
    • builder

      public static ViewSwitcherTitle.Builder<? extends ViewSwitcherTitle.Builder> builder()
      Deprecated.
      A ViewSwitcherTitle.Builder object constructs a ViewSwitcherTitle with the specified properties. Use the various set...() methods to set properties, and finish construction with ViewSwitcherTitle.Builder.build().
      Returns:
      the builder object