~haggai-eran/nux/rtl-rebased

« back to all changes in this revision

Viewing changes to Nux/KeyboardHandler.h

  • Committer: Jay Taoko
  • Date: 2011-10-21 23:49:15 UTC
  • mfrom: (508.1.2 nux-20)
  • Revision ID: jay.taoko@canonical.com-20111021234915-hnzakb5ndebica8i
* Removed custom Nux types: t_u32, t_s32, t_bool, ...

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    {
66
66
      return m_textline;
67
67
    }
68
 
    t_u32 GetLength() const
 
68
    unsigned int GetLength() const
69
69
    {
70
 
      return (t_u32) m_textline.Length();
 
70
      return (unsigned int) m_textline.Length();
71
71
    }
72
72
 
73
 
    t_u32 GetCursorPosition() const
 
73
    unsigned int GetCursorPosition() const
74
74
    {
75
75
      return m_caret;
76
76
    }
78
78
    {
79
79
      return m_need_redraw;
80
80
    }
81
 
    t_s32 GetPositionX() const
 
81
    int GetPositionX() const
82
82
    {
83
83
      return m_text_positionx;
84
84
    }
85
 
    t_s32 GetPositionY() const
 
85
    int GetPositionY() const
86
86
    {
87
87
      return m_text_positiony;
88
88
    }
92
92
    void SetText(const NString &s);
93
93
 
94
94
    void ClearText();
95
 
    void PlaceCaret(t_u32 cp);
 
95
    void PlaceCaret(unsigned int cp);
96
96
 
97
97
    void MoveCursorAtStart();
98
98
    void MoveCursorAtEnd();
101
101
    eKeyEntryType GetKeyEntryType();
102
102
 
103
103
    void SetClipRegion(const Geometry &g);
104
 
    void GetTextSelection(t_s32 *start, t_s32 *end) const;
105
 
    t_s32 GetTextSelectionStart() const;
106
 
    t_s32 GetTextSelectionEnd() const;
 
104
    void GetTextSelection(int *start, int *end) const;
 
105
    int GetTextSelectionStart() const;
 
106
    int GetTextSelectionEnd() const;
107
107
    NString GetSelectedText() const;
108
108
    void SelectAllText();
109
109
    void UnselectAllText();
114
114
 
115
115
    void EnterFocus();
116
116
 
117
 
    t_u32 NextWordPosition(t_u32 cp);
118
 
    t_u32 PrevWordPosition(t_u32 cp);
119
 
    void ResolveCaretPosition(t_s32 x, t_s32 y);
120
 
    void CaretAutoScroll(t_s32 x, t_s32 y, Geometry geo);
121
 
    void MouseDown(t_s32 x, t_s32 y);
122
 
    void MouseUp(t_s32 x, t_s32 y);
123
 
    void MouseDrag(t_s32 x, t_s32 y);
 
117
    unsigned int NextWordPosition(unsigned int cp);
 
118
    unsigned int PrevWordPosition(unsigned int cp);
 
119
    void ResolveCaretPosition(int x, int y);
 
120
    void CaretAutoScroll(int x, int y, Geometry geo);
 
121
    void MouseDown(int x, int y);
 
122
    void MouseUp(int x, int y);
 
123
    void MouseDrag(int x, int y);
124
124
    //bool IsMouseDrag();
125
125
 
126
126
    void SetFont(ObjectPtr<FontTexture> Font);
129
129
  protected:
130
130
    ObjectPtr<FontTexture> m_Font;
131
131
    NString m_textline;
132
 
    t_s32 m_previous_cursor_position;
 
132
    int m_previous_cursor_position;
133
133
    bool m_need_redraw;
134
 
    t_s32 m_text_positionx;
135
 
    t_s32 m_text_positiony;
 
134
    int m_text_positionx;
 
135
    int m_text_positiony;
136
136
    Geometry m_clip_region;
137
137
 
138
138
    eKeyEntryType m_KeyType;
139
139
 
140
 
    t_s32   m_caret;           //!< Caret position, in characters
 
140
    int   m_caret;           //!< Caret position, in characters
141
141
    bool    m_insert_mode;     //!< If true, control is in insert mode. Else, overwrite mode.
142
 
    t_s32   m_selection_start; //!< Starting position of the selection. The caret marks the end.
143
 
    t_s32   m_first_visible_char;   //!< First visible character in the edit control
 
142
    int   m_selection_start; //!< Starting position of the selection. The caret marks the end.
 
143
    int   m_first_visible_char;   //!< First visible character in the edit control
144
144
 
145
145
    void DeleteSelectionText();
146
 
    void InsertChar(t_u32 character);
 
146
    void InsertChar(unsigned int character);
147
147
    void AdjustCursorAndTextPosition();
148
148
 
149
149
 
156
156
        When the caret reaches the left or right border of the control and there are more characters to reveals,
157
157
        the caret jumps back in the opposite direction by a number of pixel at the same moment when new characters are revealed.
158
158
    */
159
 
    static t_s32 s_jump_offset_at_borders;
160
 
    static t_s32 s_cursor_width;
 
159
    static int s_jump_offset_at_borders;
 
160
    static int s_cursor_width;
161
161
  };
162
162
 
163
163
}