Add inputbox

This commit is contained in:
cnjinhao
2015-01-28 07:14:21 +08:00
parent c3d5c4aef4
commit a802083feb
5 changed files with 370 additions and 139 deletions

View File

@@ -91,6 +91,26 @@ namespace nana
button_t button_;
icon_t icon_;
};
class inputbox
{
public:
inputbox(window, ::nana::string description, ::nana::string title = ::nana::string(), ::nana::string label = ::nana::string());
void set_modal();
bool valid() const;
int get_int(int value, int begin, int last, int step);
double get_double(double value, double begin, double last, double step);
::nana::string get_string();
private:
window owner_;
bool valid_input_;
bool modal_mode_;
::nana::string description_;
::nana::string title_;
::nana::string label_;
};
}//end namespace nana
#endif

View File

@@ -49,6 +49,7 @@ namespace nana
void mouse_leave(graph_reference, const arg_mouse&) override;
void key_press(graph_reference, const arg_keyboard&) override;
void key_char(graph_reference, const arg_keyboard&) override;
void resized(graph_reference, const arg_resized&) override;
private:
implementation * const impl_;
};
@@ -80,6 +81,11 @@ namespace nana
void range(std::initializer_list<std::string> steps_utf8);
void range(std::initializer_list<std::wstring> steps);
/// Gets the spined value
::nana::string value() const;
int to_int() const;
double to_double() const;
/// Sets a predicator that determines whether accepts the current user input.
/// @param pred Predicator to determines the input.
void set_accept(std::function<bool(::nana::char_t)> pred);