gcc-4.3.0 fixes
[forms.git] / F / F_Input.H
blob00486eda3a315be04bdeb9c037ddfb12a4ebcfae
2  /*
3   *   Copyright (C) 2007, Harbour, All rights reserved.
4   */
6 #ifndef _F_INPUT_H_
7 #define _F_INPUT_H_
9 #include <F_Text_Display.H>
10 #include <F_Window.H>
12 namespace F {
14  enum F_Input_State_t {
15    F_INPUT_NORMAL,
16    F_INPUT_ON_FOCUS,
17    F_INPUT_PRESSED
18  };
20  class F_Input : public F_Widget {
22   F_Input_State_t state;
23   std::string text_;
25   bool handle(F_Event_t &ev);
27   public:
28    F_Input(F_Box_Type_t btype, coord_t x, coord_t y, dim_t w, dim_t h,
29      const char *label = 0) : F_Widget(x, y, w, h, label) {
30        state = F_INPUT_NORMAL;
31        can_be_focused(true);
32   }
33    ~F_Input() { }
34    void draw();
35    size_t size() { return text_.size(); }
36    const char *value() { return text_.c_str(); }
37    void value(const char *t) { if (t) text_ = t; else text_.clear(); }
38  };
41 #endif