This file is indexed.

/usr/include/Nux-4.0/Nux/EditTextBox.h is in libnux-4.0-dev 4.0.8+17.10.20170922-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/*
 * Copyright 2010 Inalogic® Inc.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License, as
 * published by the  Free Software Foundation; either version 2.1 or 3.0
 * of the License.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of both the GNU Lesser General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>
 *
 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
 *
 */


#ifndef EDITTEXTBOX_H
#define EDITTEXTBOX_H

#include "KeyboardHandler.h"
#include "TimerProc.h"

namespace nux
{
  class HLayout;
  class VLayout;
  class Layout;
  class BaseKeyboardHandler;
  class TextLine;
  class Validator;


  class EditTextBox : public View
  {
  public:
    EditTextBox(const char *Caption, NUX_FILE_LINE_PROTO);
    ~EditTextBox();
    virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
    virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);

    //! Return True if the the area knows what to do with the key event.
    virtual bool InspectKeyEvent(unsigned int eventType,
      unsigned int keysym,
      const char* character);

    void SetText(const char *Caption);
    void SetText(const std::string &Caption);
    const char *GetText() const;
    unsigned int GetTextSize() const
    {
      return (unsigned int) m_Text.length();
    }

    void SetDoubleValue(double d);
    void SetIntegerValue(int i);

    //! Return a caption string striping out the prefix and the suffix
    virtual std::string GetCleanText() const;

    void SetTextBackgroundColor(const Color &color);
    Color GetTextBackgroundColor() const;

    void SetSelectedTextColor(Color color)
    {
      m_SelectedTextColor = color;
    }
    void SetSelectedTextBackgroundColor(Color color)
    {
      m_SelectedTextBackgroundColor = color;
    }
    void SetTextBlinkColor(Color color)
    {
      m_TextBlinkColor = color;
    }
    void SetCursorColor(Color color)
    {
      m_CursorColor = color;
    }

    Color GetSelectedTextColor() const
    {
      return m_SelectedTextColor;
    }
    Color GetSelectedTextBackgroundColor() const
    {
      return m_SelectedTextBackgroundColor;
    }
    Color GetTextBlinkColor() const
    {
      return m_TextBlinkColor;
    }
    Color GetCursorColor() const
    {
      return m_CursorColor;
    }

    void SetKeyEntryType(BaseKeyboardHandler::eKeyEntryType keytype)
    {
      m_KeyboardHandler.SetKeyEntryType(keytype);
    }
    BaseKeyboardHandler::eKeyEntryType GetKeyEntryType()
    {
      return m_KeyboardHandler.GetKeyEntryType();
    }

    //  Receivers
    void RecvMouseDoubleClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
    void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
    void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
    void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
    void RecvKeyEvent(
      unsigned long    eventType  ,   /*event type*/
      unsigned long    keysym     ,   /*event keysym*/
      unsigned long    state      ,   /*event state*/
      const char*     character  ,   /*character*/
      unsigned short   keyCount       /*key repeat count*/);

    void RecvStartKeyFocus();
    void RecvEndKeyFocus();


    void SetPrefix(const char *p)
    {
      m_Prefix = p;
    };
    void SetPrefix(const char &p)
    {
      m_Prefix = p;
    };
    void SetPrefix(const std::string &p)
    {
      m_Prefix = p;
    };
    std::string GetPrefix() const
    {
      return m_Prefix;
    };

    void SetSuffix(const char *s)
    {
      m_Suffix = s;
    };
    void SetSuffix(const char &s)
    {
      m_Suffix = s;
    };
    void SetSuffix(const std::string &s)
    {
      m_Suffix = s;
    };
    std::string Getsuffix() const
    {
      return m_Suffix;
    };

    void SetValidator(const Validator *validator);

    sigc::signal< void, EditTextBox *, unsigned int > sigCharacter; // Emitted every time a character typed
    sigc::signal< void, EditTextBox * > sigEditChange; // Emitted every time a character typed

    sigc::signal< void, EditTextBox *, const std::string &> sigValidateKeyboardEntry;
    sigc::signal< void, EditTextBox * > sigValidateEntry;   // Emitted when the text is validated
    sigc::signal< void, EditTextBox * > sigSetText;     // Emitted when text is set with setCaption
    sigc::signal< void, EditTextBox * > sigEscapeKeyboardFocus;
    sigc::signal< void, EditTextBox * > sigStartKeyboardFocus;
    sigc::signal< void, EditTextBox * > sigEndKeyboardFocus;

    bool IsTextSelected()
    {
      return m_KeyboardHandler.IsTextSelected();
    }
    bool IsEmpty();

  private:
    bool ValidateKeyboardEntry(const char *text) const;
    void EscapeKeyboardFocus();
    void EnteringKeyboardFocus();
    void QuitingKeyboardFocus();

    virtual long PostLayoutManagement(long LayoutResult);

    std::string m_Text;
    HLayout *hlayout;

    Color m_BackgroundColor;
    Color m_SelectedTextColor;
    Color m_SelectedTextBackgroundColor;
    Color m_TextBlinkColor;
    Color m_CursorColor;

    BaseKeyboardHandler m_KeyboardHandler;
    std::string m_temporary_caption;
    BaseKeyboardHandler::eKeyEntryType m_keytype;

    Validator *m_Validator;
    std::string m_Suffix;
    std::string m_Prefix;

    bool BlinkCursor;
    void BlinkCursorTimerInterrupt(void *v);
    void StopBlinkCursor(bool BlinkState = false);
    void StartBlinkCursor(bool BlinkState = false);
    TimerFunctor *m_BlinkTimerFunctor;
    TimerHandle m_BlinkTimerHandler;

    void ScrollTimerInterrupt(void *v);
    TimerFunctor *m_ScrollTimerFunctor;
    TimerHandle m_ScrollTimerHandler;

    //! If true, blend the characters alpha value with the destination and write the result to the destination buffer.
    bool m_WriteAlpha;

    bool text_input_mode_;
    bool key_nav_mode_;

    friend class RGBValuator;
  };

}

#endif // EDITTEXTBOX_H