gi-handy-0.0.1: libhandy bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Handy.Objects.SearchBar

Contents

Description

No description available in the introspection data.

Synopsis

Exported types

newtype SearchBar Source #

Memory-managed wrapper type.

Instances
GObject SearchBar Source # 
Instance details

Defined in GI.Handy.Objects.SearchBar

Methods

gobjectType :: IO GType #

HasParentTypes SearchBar Source # 
Instance details

Defined in GI.Handy.Objects.SearchBar

type ParentTypes SearchBar Source # 
Instance details

Defined in GI.Handy.Objects.SearchBar

type ParentTypes SearchBar = Bin ': (Container ': (Widget ': (Object ': (ImplementorIface ': (Buildable ': ([] :: [Type]))))))

class (GObject o, IsDescendantOf SearchBar o) => IsSearchBar o Source #

Type class for types which can be safely cast to SearchBar, for instance with toSearchBar.

Instances
(GObject o, IsDescendantOf SearchBar o) => IsSearchBar o Source # 
Instance details

Defined in GI.Handy.Objects.SearchBar

toSearchBar :: (MonadIO m, IsSearchBar o) => o -> m SearchBar Source #

Cast to SearchBar, for types for which this is known to be safe. For general casts, use castTo.

noSearchBar :: Maybe SearchBar Source #

A convenience alias for Nothing :: Maybe SearchBar.

Methods

connectEntry

searchBarConnectEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchBar a, IsEntry b) 
=> a

self: a SearchBar

-> b

entry: a Entry

-> m () 

Connects the Entry widget passed as the one to be used in this search bar. The entry should be a descendant of the search bar. This is only required if the entry isn’t the direct child of the search bar (as in our main example).

Since: 0.0.6

getSearchMode

searchBarGetSearchMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchBar a) 
=> a

self: a SearchBar

-> m Bool

Returns: whether search mode is toggled on

Returns whether the search mode is on or off.

Since: 0.0.6

getShowCloseButton

searchBarGetShowCloseButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchBar a) 
=> a

self: a SearchBar

-> m Bool

Returns: whether the close button is shown

Returns whether the close button is shown.

Since: 0.0.6

handleEvent

searchBarHandleEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchBar a) 
=> a

self: a SearchBar

-> Event

event: a Event containing key press events

-> m Bool

Returns: EVENT_STOP if the key press event resulted in text being entered in the search entry (and revealing the search bar if necessary), EVENT_PROPAGATE otherwise.

This function should be called when the top-level window which contains the search bar received a key event.

If the key event is handled by the search bar, the bar will be shown, the entry populated with the entered text and EVENT_STOP will be returned. The caller should ensure that events are not propagated further.

If no entry has been connected to the search bar, using searchBarConnectEntry, this function will return immediately with a warning.

Showing the search bar on key presses

C code

static gboolean
on_key_press_event (GtkWidget *widget,
                    GdkEvent  *event,
                    gpointer   user_data)
{
  HdySearchBar *bar = HDY_SEARCH_BAR (user_data);
  return hdy_search_bar_handle_event (self, event);
}

static void
create_toplevel (void)
{
  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  GtkWindow *search_bar = hdy_search_bar_new ();

 // Add more widgets to the window...

  g_signal_connect (window,
                   "key-press-event",
                    G_CALLBACK (on_key_press_event),
                    search_bar);
}

Since: 0.0.6

new

searchBarNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m SearchBar

Returns: a new SearchBar

Creates a SearchBar. You will need to tell it about which widget is going to be your text entry using searchBarConnectEntry.

Since: 0.0.6

setSearchMode

searchBarSetSearchMode Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchBar a) 
=> a

self: a SearchBar

-> Bool

searchMode: the new state of the search mode

-> m () 

Switches the search mode on or off.

Since: 0.0.6

setShowCloseButton

searchBarSetShowCloseButton Source #

Arguments

:: (HasCallStack, MonadIO m, IsSearchBar a) 
=> a

self: a SearchBar

-> Bool

visible: whether the close button will be shown or not

-> m () 

Shows or hides the close button. Applications that already have a “search” toggle button should not show a close button in their search bar, as it duplicates the role of the toggle button.

Since: 0.0.6

Properties

searchModeEnabled

Whether the search mode is on and the search bar shown.

See searchBarSetSearchMode for details.

constructSearchBarSearchModeEnabled :: IsSearchBar o => Bool -> IO (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “search-mode-enabled” property. This is rarely needed directly, but it is used by new.

getSearchBarSearchModeEnabled :: (MonadIO m, IsSearchBar o) => o -> m Bool Source #

Get the value of the “search-mode-enabled” property. When overloading is enabled, this is equivalent to

get searchBar #searchModeEnabled

setSearchBarSearchModeEnabled :: (MonadIO m, IsSearchBar o) => o -> Bool -> m () Source #

Set the value of the “search-mode-enabled” property. When overloading is enabled, this is equivalent to

set searchBar [ #searchModeEnabled := value ]

showCloseButton

Whether to show the close button in the toolbar.

constructSearchBarShowCloseButton :: IsSearchBar o => Bool -> IO (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “show-close-button” property. This is rarely needed directly, but it is used by new.

getSearchBarShowCloseButton :: (MonadIO m, IsSearchBar o) => o -> m Bool Source #

Get the value of the “show-close-button” property. When overloading is enabled, this is equivalent to

get searchBar #showCloseButton

setSearchBarShowCloseButton :: (MonadIO m, IsSearchBar o) => o -> Bool -> m () Source #

Set the value of the “show-close-button” property. When overloading is enabled, this is equivalent to

set searchBar [ #showCloseButton := value ]