FDOSTUI
FreeDOS Text User Interface
combobox.hpp
Go to the documentation of this file.
1 /*
2  COMBOBOX.HPP
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __combobox_hpp__
11 
12 #include "entry.hpp"
13 #include "listbox.hpp"
14 
15 class combobox : public entry
16 {
17 
18 public:
19 
20  combobox(
21  int const i_pos_x,
22  int const i_pos_y,
23  unsigned int const i_len_x,
24  unsigned int const i_len_y);
25 
26  virtual
27  ~combobox();
28 
29  int
30  add(
31  unsigned char const* i_label);
32 
33  virtual void
34  draw() const;
35 
36  virtual enum event_response
37  event_key(
38  struct event_key const& i_event);
39 
40  virtual enum event_response
42  struct event_mouse const& i_event);
43 
44  void
45  remove_all();
46 
47 protected:
48 
50 
51  virtual void
52  get_bbox(
53  struct box& o_bbox) const;
54 
55  void
56  popup();
57 
58 private:
59 
60  combobox();
61 
62  combobox(
63  const combobox&);
64 
65  combobox&
66  operator=(combobox const&);
67 
68  void
70 
71 };
72 
73 inline void
75  struct box& o_bbox) const
76 {
77 
78  o_bbox= m_box;
79  o_bbox.m_len_x--;
80 
81  return;
82 }
83 
84 inline int
86  unsigned char const* i_label)
87 {
88  int l_exit;
89 
90  l_exit= m_listbox.add(i_label);
91 
92  return l_exit;
93 }
94 
95 inline void
97 {
98 
100  set_text(0);
101 
102  return;
103 }
104 
105 #define __combobox_hpp__
106 #endif
contains entry class
void set_text(unsigned char const *i_str)
set the text of the entry
Definition: entry.cpp:526
void popup()
pops up the listbox widget
Definition: combobox.cpp:153
int add(unsigned char const *i_label)
adds a value to the end of a list
Definition: combobox.hpp:85
struct box m_box
Definition: widget.hpp:171
listbox m_listbox
listbox used for drop down
Definition: combobox.hpp:49
void listbox_configure()
configures (moves and resizes) the listbox widget for display
Definition: combobox.cpp:108
void remove_all()
removes all elements from the list
Definition: combobox.hpp:96
int add(unsigned char const *i_label)
adds a value to the end of a list
Definition: listbox.cpp:100
virtual ~combobox()
destructor
Definition: combobox.cpp:32
Allows a user to enter text.
Definition: entry.hpp:14
event_response
response
Definition: event.h:14
virtual enum event_response event_key(struct event_key const &i_event)
handle key event
Definition: combobox.cpp:58
unsigned int m_len_x
Definition: box.h:16
virtual void draw() const
draws the widget
Definition: combobox.cpp:38
virtual void get_bbox(struct box &o_bbox) const
get the inner bounding box param[out] o_bbox bounding box to fill
Definition: combobox.hpp:74
contains listbox class
virtual enum event_response event_mouse(struct event_mouse const &i_event)
handle mouse event
Definition: combobox.cpp:75
void remove_all()
remove all items from the listbox
Definition: listbox.cpp:653
Allows the user to choose a value from a drop down list. Optionally, the user can also enter a value ...
Definition: combobox.hpp:15
container for a mouse event
Definition: event.h:37
Allows the user to choose a value from a list.
Definition: listbox.hpp:20
defines a rectangular region
Definition: box.h:12
container for a keyboard event
Definition: event.h:23