~3v1n0/unity/overlay-border-scale

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/SearchBar.h

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
18
18
 */
19
19
 
20
 
#ifndef DASH_SEARCH_BAR_H
21
 
#define DASH_SEARCH_BAR_H
 
20
#ifndef SEARCH_BAR_H
 
21
#define SEARCH_BAR_H
 
22
 
 
23
#include <memory>
22
24
 
23
25
#include <gtk/gtk.h>
24
26
 
32
34
#include <Nux/TextEntry.h>
33
35
#include <UnityCore/GLibSignal.h>
34
36
 
35
 
#include "DashSearchBarSpinner.h"
 
37
#include "SearchBarSpinner.h"
36
38
#include "IconTexture.h"
37
39
#include "IMTextEntry.h"
38
40
#include "Introspectable.h"
39
41
#include "StaticCairoText.h"
40
42
 
 
43
namespace nux
 
44
{
 
45
class AbstractPaintLayer;
 
46
class LinearLayout;
 
47
}
 
48
 
41
49
namespace unity
42
50
{
43
 
namespace dash
44
 
{
45
51
 
46
52
using namespace unity::glib;
47
53
 
49
55
{
50
56
  NUX_DECLARE_OBJECT_TYPE(SearchBar, nux::View);
51
57
public:
 
58
  typedef nux::ObjectPtr<SearchBar> Ptr;
52
59
  SearchBar(NUX_FILE_LINE_PROTO);
 
60
  SearchBar(int search_width, bool show_filter_hint, NUX_FILE_LINE_PROTO);
 
61
  SearchBar(int search_width, NUX_FILE_LINE_PROTO);
53
62
  ~SearchBar();
54
63
 
55
64
  void SearchFinished();
56
65
  nux::TextEntry* text_entry() const;
 
66
  nux::View* show_filters() const;
57
67
 
58
68
  nux::RWProperty<std::string> search_string;
59
69
  nux::Property<std::string> search_hint;
60
70
  nux::Property<bool> showing_filters;
61
71
  nux::Property<bool> can_refine_search;
 
72
  nux::Property<bool> disable_glow;
62
73
  nux::ROProperty<bool> im_active;
63
74
 
64
75
  sigc::signal<void> activated;
67
78
 
68
79
private:
69
80
 
 
81
  void Init();
 
82
 
70
83
  void OnFontChanged(GtkSettings* settings, GParamSpec* pspec=NULL);
71
84
  void OnSearchHintChanged();
72
85
 
76
89
  void OnMouseButtonDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
77
90
  void OnEndKeyFocus();
78
91
 
79
 
  void UpdateBackground();
 
92
  void UpdateBackground(bool force);
80
93
  void OnSearchChanged(nux::TextEntry* text_entry);
81
94
  void OnClearClicked(int x, int y, unsigned long button_flags, unsigned long key_flags);
82
95
  void OnEntryActivated();
85
98
  std::string get_search_string() const;
86
99
  bool set_search_string(std::string const& string);
87
100
  bool get_im_active() const;
 
101
  bool show_filter_hint_;
88
102
 
89
103
  static gboolean OnLiveSearchTimeout(SearchBar* self);
90
104
  static gboolean OnSpinnerStartCb(SearchBar* self);
94
108
  bool AcceptKeyNavFocus();
95
109
 
96
110
private:
 
111
  bool ShouldBeHighlighted();
 
112
 
97
113
  glib::SignalManager sig_manager_;
98
114
  
99
115
  nux::AbstractPaintLayer* bg_layer_;
 
116
  std::unique_ptr<nux::AbstractPaintLayer> highlight_layer_;
100
117
  nux::HLayout* layout_;
101
118
  nux::LayeredLayout* layered_layout_;
102
119
  nux::StaticCairoText* hint_;
 
120
  nux::LinearLayout* expander_layout_;
103
121
  IMTextEntry* pango_entry_;
 
122
  nux::View* expander_view_;
104
123
  nux::HLayout* filter_layout_;
105
 
  nux::SpaceLayout* filter_space_;
106
124
  nux::StaticCairoText* show_filters_;
107
125
  nux::VLayout* arrow_layout_;
108
126
  nux::SpaceLayout* arrow_top_space_;
110
128
  IconTexture* expand_icon_;
111
129
  int search_bar_width_;
112
130
 
113
 
 
114
131
  int last_width_;
115
132
  int last_height_;
116
133
  
121
138
};
122
139
 
123
140
}
124
 
}
125
141
 
126
142
#endif