summaryrefslogtreecommitdiffstats
path: root/src/Text.h
blob: 35a0b8bec89a48e5f7e3fb1d117ee1a8fa8631ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef __PY_TEXT_H_
#define __PY_TEXT_H_

#include <ibus.h>
#include "Pointer.h"
#include "String.h"

namespace PY {

class Text : public Pointer<IBusText> {
public:
    Text (IBusText *text)
        : Pointer<IBusText> (text) {}
    Text (const gchar *str)
        : Pointer<IBusText> (ibus_text_new_from_string (str)) {}

    Text (const String & str)
        : Pointer<IBusText> (ibus_text_new_from_string ((const gchar *) str)) {}

    Text (gunichar ch)
        : Pointer<IBusText> (ibus_text_new_from_unichar (ch)) {}

    void appendAttribute (guint type, guint value, guint start, guint end) {
        ibus_text_append_attribute (*this, type, value, start, end);
    }
};

class StaticText : public Text {
public:
    StaticText (const gchar *str)
        : Text (ibus_text_new_from_static_string (str)) {}

    StaticText (const String & str)
        : Text (ibus_text_new_from_static_string ((const gchar *) str)) {}

    StaticText (gunichar ch)
        : Text (ch) {}
};

};

#endif