~haggai-eran/nux/rtl

« back to all changes in this revision

Viewing changes to Nux/TextEntry.h

  • Committer: Haggai Eran
  • Date: 2011-10-15 21:01:00 UTC
  • mfrom: (413.1.84 nux)
  • Revision ID: haggai.eran@gmail.com-20111015210100-4amf0pdxuzkynotw
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
    sigc::signal <void> activated;
129
129
    sigc::signal <void, int> cursor_moved;
130
130
 
131
 
//     void SetWidth(int width);
132
 
//     int GetWidth();
133
 
//     void SetHeight(int height);
134
 
//     int GetHeight();
135
 
//     void GetSizeRequest(int *width, int *height);
136
 
//     void SetBold(bool bold);
137
 
//     bool IsBold();
138
 
//     void SetItalic(bool italic);
139
 
//     bool IsItalic();
140
 
//     void SetStrikeout(bool strikeout);
141
 
//     bool IsStrikeout();
142
 
//     void SetUnderline(bool underline);
143
 
//     bool IsUnderline();
144
 
//     void SetMultiline(bool multiline);
145
 
//     bool IsMultiline();
146
 
//     void SetWordWrap(bool wrap);
147
 
//     bool IsWordWrap();
148
 
//     void SetReadOnly(bool readonly);
149
 
//     bool IsReadOnly();
150
131
    void SetText(const char *text);
151
 
    std::string GetText();
152
 
//     void SetBackground(Texture *background);
153
 
//     const Texture *GetBackground();
 
132
    std::string const& GetText() const;
 
133
 
154
134
    void SetTextColor(const Color &color);
155
 
    Color GetTextColor() const;
 
135
    Color const& GetTextColor() const;
156
136
    void SetFontFamily (const char *font);
157
137
    void SetFontSize (double font_size);
158
138
    void SetFontOptions (const cairo_font_options_t *options);
159
139
 
160
 
//     std::string GetFontFamily();
161
 
//     void OnFontSizeChange();
162
 
//     void SetPasswordChar(const char *c);
163
 
//     std::string GetPasswordChar();
164
 
//     bool IsScrollBarRequired();
165
 
//     void GetScrollBarInfo(int *range, int *line_step,
166
 
//                           int *page_step, int *cur_pos);
167
 
//     void ScrollTo(int position);
168
 
//     void MarkRedraw();
169
140
    /** Select text between start and end. */
170
141
    void Select(int start, int end);
171
142
    /** Select all text */
174
145
    CairoGraphics::Alignment GetAlign() const;
175
146
    void SetAlign(CairoGraphics::Alignment align);
176
147
 
177
 
    protected:
 
148
  protected:
178
149
    virtual void DoSetFocused (bool focused);
179
150
    bool _block_focus; // used to selectively ignore focus keyevents
180
151
 
181
152
    virtual void GeometryChanged ();
182
 
    
183
 
    private:
 
153
 
184
154
    /**
185
155
     * Enum used to specify different motion types.
186
156
     */
217
187
    void ResetImContext();
218
188
    /** Reset preedit text */
219
189
    void ResetPreedit();
220
 
//     /** Create a new im context according to current visibility setting */
221
 
//     void InitImContext();
222
 
//     /** Set the visibility of the edit control */
223
 
//     void SetVisibility(bool visible);
224
 
//
225
 
//  /** Check if the cursor should be blinking */
226
 
//  bool IsCursorBlinking();
227
190
    /** Send out a request to blink the cursor if necessary */
228
191
    void QueueCursorBlink();
229
192
    static bool CursorBlinkCallback(TextEntry *data);
230
 
    
 
193
 
231
194
    void ShowCursor();
232
195
    void HideCursor();
233
196
 
301
264
    void Delete(MovementStep step);
302
265
    /** Switch between the overwrite mode and the insert mode*/
303
266
    void ToggleOverwrite();
304
 
//
 
267
 
305
268
    /** Gets the color of selection background. */
306
269
    Color GetSelectionBackgroundColor();
307
270
    /** Gets the color of selection text. */
308
271
    Color GetSelectionTextColor();
309
 
//
310
 
//     /**
311
 
//      * Gets the gtk widget used by the gadget host and the cursor location
312
 
//      * for gtk im context. relative to the widget coordinate.
313
 
//      */
314
 
//     GtkWidget *GetWidgetAndCursorLocation(GdkRectangle *cur);
315
 
//
 
272
 
316
273
    /**
317
274
     * Gets the cursor location in pango layout. The unit is pixel.
318
275
     */
319
276
    void GetCursorLocationInLayout(int *strong_x, int *strong_y, int *strong_height,
320
277
                                   int *weak_x, int *weak_y, int *weak_height);
321
278
 
322
 
//     /**
323
 
//      * Updates the cursor location of input method context.
324
 
//      */
325
 
//     void UpdateIMCursorLocation();
326
 
//
327
 
//     /** Callback function for IM "commit" signal */
328
 
//     static void CommitCallback(GtkIMContext *context,
329
 
//                                const char *str, void *gg);
330
 
//     /** Callback function for IM "retrieve-surrounding" signal */
331
 
//     static gboolean RetrieveSurroundingCallback(GtkIMContext *context,
332
 
//                                                 void *gg);
333
 
//     /** Callback function for IM "delete-surrounding" signal */
334
 
//     static gboolean DeleteSurroundingCallback(GtkIMContext *context, int offset,
335
 
//                                               int n_chars, void *gg);
336
 
//     /** Callback function for IM "preedit-start" signal */
337
 
//     static void PreeditStartCallback(GtkIMContext *context, void *gg);
338
 
//     /** Callback function for IM "preedit-changed" signal */
339
 
//     static void PreeditChangedCallback(GtkIMContext *context, void *gg);
340
 
//     /** Callback function for IM "preedit-end" signal */
341
 
//     static void PreeditEndCallback(GtkIMContext *context, void *gg);
342
 
//     /**
343
 
//      * Callback for gtk_clipboard_request_text function.
344
 
//      * This function performs real paste.
345
 
//      */
346
 
//     static void PasteCallback(GtkClipboard *clipboard,
347
 
//                               const gchar *str, void *gg);
348
 
//
349
 
//    private:
350
 
//     /** Owner of this gtk edit implementation object. */
351
 
//     GtkEditElement *owner_;
352
 
//     /** Main loop object */
353
 
//     MainLoopInterface *main_loop_;
354
 
//     /** Graphics object, must be CairoGraphics */
355
 
//     const GraphicsInterface *graphics_;
356
 
//
357
279
    /** The CairoCanvas which hold cairo_t inside */
358
 
    CairoGraphics *canvas_;
359
 
 
360
 
//     /** Gtk InputMethod Context */
361
 
//     GtkIMContext *im_context_;
 
280
    CairoGraphics* canvas_;
362
281
 
363
282
    /** The cached Pango Layout */
364
 
    PangoLayout *cached_layout_;
 
283
    PangoLayout* cached_layout_;
365
284
 
366
285
    /** The text content of the edit control */
367
286
    std::string _text;
377
296
 
378
297
    /** Last time of mouse double click event. */
379
298
    t_u64 last_dblclick_time_;
380
 
//
381
 
//     /** Canvas width */
382
 
//     int width_;
383
 
//     /** Canvas height */
384
 
//     int height_;
385
 
//
 
299
 
386
300
    /** The current cursor position in number of bytes. */
387
301
    int cursor_;
388
302
    /**
464
378
    cairo_font_options_t *font_options_;
465
379
    double font_dpi_;
466
380
 
467
 
    int full_height_;
468
 
 
469
 
//     /** The background texture of the edit control */
470
 
//     Texture *background_;
471
 
 
472
381
    /** The text color of the edit control */
473
382
    Color _text_color;
474
383