~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to frontend/linux/linux_utilities/auto_completable.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __AUTO_COMPLETABLE_H__
 
2
#define __AUTO_COMPLETABLE_H__
 
3
 
 
4
#include <string>
 
5
#include <glibmm/refptr.h>
 
6
#include "text_list_columns_model.h"
 
7
 
 
8
namespace Gtk
 
9
{
 
10
  class Entry;
 
11
  class ListStore;
 
12
  class EntryCompletion;
 
13
}
 
14
 
 
15
//!
 
16
//! \addtogroup linuxutils Linux utils
 
17
//! @{
 
18
//!
 
19
 
 
20
//==============================================================================
 
21
//! AutoCompletion adds ability to have a history in the entry and to auto-complete
 
22
//! curretly typed text. Usage is simple: create AutoCompletable instance
 
23
//! and pass entry either to constructor or using method add_to_entry later.
 
24
//! Add each item which should appear in completion or list via add_completion_text
 
25
class AutoCompletable
 
26
{
 
27
  public:
 
28
    AutoCompletable(Gtk::Entry* entry = 0);
 
29
    void add_completion_text(const std::string& s);
 
30
    void add_to_entry(Gtk::Entry* entry);
 
31
    void set_popup_enabled(const bool enabled);
 
32
    void clear();
 
33
  private:
 
34
    TextListColumnsModel                _completion_columns;
 
35
    Glib::RefPtr<Gtk::ListStore>        _completion_model;
 
36
    Glib::RefPtr<Gtk::EntryCompletion>  _completion;
 
37
};
 
38
 
 
39
//!
 
40
//! @}
 
41
//!
 
42
 
 
43
#endif