change some APIs for accepting utf8
This commit is contained in:
@@ -9,9 +9,6 @@ namespace nana
|
||||
utf8, utf16, utf32
|
||||
};
|
||||
|
||||
/// Checks whether a specified text is utf8 encoding
|
||||
bool is_utf8(const char* str, unsigned len);
|
||||
|
||||
namespace detail
|
||||
{
|
||||
class charset_encoding_interface;
|
||||
|
||||
@@ -72,6 +72,16 @@ namespace std
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace nana
|
||||
{
|
||||
/// Checks whether a specified text is utf8 encoding
|
||||
bool is_utf8(const char* str, unsigned len);
|
||||
void throw_not_utf8(const std::string& text);
|
||||
void throw_not_utf8(const char*, unsigned len);
|
||||
|
||||
std::wstring utf8_cast(const std::string&);
|
||||
std::string utf8_cast(const std::wstring&);
|
||||
}
|
||||
|
||||
#ifndef NANA_UNICODE
|
||||
namespace nana
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace filesystem
|
||||
tm modified;
|
||||
};
|
||||
|
||||
bool file_attrib(const nana::string& file, attribute&);
|
||||
bool file_attrib(const ::std::string& file, attribute&);
|
||||
long long filesize(const nana::string& file);
|
||||
|
||||
bool mkdir(const nana::string& dir, bool & if_exist);
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace detail
|
||||
basic_window *parent;
|
||||
basic_window *owner;
|
||||
|
||||
::nana::string title;
|
||||
::std::string title;
|
||||
::nana::detail::drawer drawer; //Self Drawer with owen graphics
|
||||
basic_window* root_widget; //A pointer refers to the root basic window, if the window is a root, the pointer refers to itself.
|
||||
paint::graphics* root_graph; //Refer to the root buffer graphics
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace detail
|
||||
|
||||
static void window_size(native_window_type, const size&);
|
||||
static void get_window_rect(native_window_type, rectangle&);
|
||||
static void window_caption(native_window_type, const nana::string&);
|
||||
static nana::string window_caption(native_window_type);
|
||||
static void window_caption(native_window_type, const std::string&);
|
||||
static std::string window_caption(native_window_type);
|
||||
static void capture_window(native_window_type, bool);
|
||||
static nana::point cursor_position();
|
||||
static native_window_type get_owner_window(native_window_type);
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace nana
|
||||
|
||||
virtual widget* widget_ptr() const = 0;
|
||||
virtual void destroy() = 0;
|
||||
virtual std::wstring caption() = 0;
|
||||
virtual void caption(std::wstring) = 0;
|
||||
virtual std::string caption() = 0;
|
||||
virtual void caption(std::string) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace nana
|
||||
filebox(filebox&&) = delete;
|
||||
filebox& operator=(filebox&&) = delete;
|
||||
public:
|
||||
using filters = std::vector<std::pair<nana::string, nana::string>>;
|
||||
using filters = std::vector<std::pair< ::std::string, ::std::string>>;
|
||||
|
||||
filebox(bool is_open_mode);
|
||||
filebox(window owner, bool is_open_mode);
|
||||
@@ -37,21 +37,21 @@ namespace nana
|
||||
/// Change owner window
|
||||
void owner(window);
|
||||
|
||||
/** @brief specify a title for the dialog
|
||||
* @param string a text for title
|
||||
*/
|
||||
nana::string title( nana::string new_title); ///< . Set a new title for the dialog and \return the old title
|
||||
/// specify a title for the dialog
|
||||
/// @param string a text for title
|
||||
/// @return old title.
|
||||
::std::string title( ::std::string new_title); ///< . Set a new title for the dialog and \return the old title
|
||||
|
||||
/** @brief specify a suggestion directory
|
||||
* @param string a path of initial directory
|
||||
* @note the behavior of init_path is different between Win7 and Win2K/XP/Vista, but its behavior under Linux is conformed with Win7.
|
||||
*/
|
||||
filebox& init_path(const nana::string&); ///< Suggested init path used to locate a directory when the filebox starts.
|
||||
filebox& init_file(const nana::string&); ///< Init file, if it contains a path, the init path is replaced by the path of init file.
|
||||
filebox& init_path(const ::std::string&); ///< Suggested init path used to locate a directory when the filebox starts.
|
||||
filebox& init_file(const ::std::string&); ///< Init file, if it contains a path, the init path is replaced by the path of init file.
|
||||
/// \brief Add a filetype filter.
|
||||
/// To specify multiple filter in a single description, use a semicolon to separate the patterns(for example,"*.TXT;*.DOC;*.BAK").
|
||||
filebox& add_filter(const nana::string& description, ///< for example. "Text File"
|
||||
const nana::string& filetype ///< filter pattern(for example, "*.TXT")
|
||||
filebox& add_filter(const ::std::string& description, ///< for example. "Text File"
|
||||
const ::std::string& filetype ///< filter pattern(for example, "*.TXT")
|
||||
);
|
||||
|
||||
filebox& add_filter(const filters &ftres)
|
||||
@@ -62,16 +62,14 @@ namespace nana
|
||||
};
|
||||
|
||||
|
||||
nana::string path() const;
|
||||
nana::string file() const;
|
||||
::std::string path() const;
|
||||
::std::string file() const;
|
||||
|
||||
/** @brief Display the filebox dialog
|
||||
*/
|
||||
/// Display the filebox dialog
|
||||
bool show() const;
|
||||
|
||||
/** @brief Display the filebox dialog
|
||||
* @note A function object method alternative to show()
|
||||
*/
|
||||
/// Display the filebox dialog
|
||||
/// A function object method alternative to show()
|
||||
bool operator()() const
|
||||
{
|
||||
return show();
|
||||
|
||||
@@ -43,10 +43,10 @@ namespace nana
|
||||
msgbox& operator=(const msgbox&);
|
||||
|
||||
/// Construct that creates a message box with a specified title and default button.
|
||||
msgbox(const nana::string&);
|
||||
msgbox(const ::std::string&);
|
||||
|
||||
/// Construct that creates a message box with an owner windoow, a specified title and buttons.
|
||||
msgbox(window, const nana::string&, button_t = ok);
|
||||
msgbox(window, const ::std::string&, button_t = ok);
|
||||
|
||||
/// Sets an icon for informing user.
|
||||
msgbox& icon(icon_t);
|
||||
@@ -86,7 +86,7 @@ namespace nana
|
||||
private:
|
||||
std::stringstream sstream_;
|
||||
window wd_;
|
||||
nana::string title_;
|
||||
std::string title_;
|
||||
button_t button_;
|
||||
icon_t icon_;
|
||||
};
|
||||
@@ -97,7 +97,7 @@ namespace nana
|
||||
{
|
||||
virtual ~abstract_content() = default;
|
||||
|
||||
virtual const ::nana::string& label() const = 0;
|
||||
virtual const ::std::string& label() const = 0;
|
||||
virtual window create(window, unsigned label_px) = 0;
|
||||
virtual unsigned fixed_pixels() const;
|
||||
};
|
||||
@@ -107,13 +107,13 @@ namespace nana
|
||||
{
|
||||
struct implement;
|
||||
public:
|
||||
integer(::nana::string label, int init_value, int begin, int last, int step);
|
||||
integer(::std::string label, int init_value, int begin, int last, int step);
|
||||
~integer();
|
||||
|
||||
int value() const;
|
||||
private:
|
||||
//Implementation of abstract_content
|
||||
const ::nana::string& label() const override;
|
||||
const ::std::string& label() const override;
|
||||
window create(window, unsigned label_px) override;
|
||||
private:
|
||||
std::unique_ptr<implement> impl_;
|
||||
@@ -124,13 +124,13 @@ namespace nana
|
||||
{
|
||||
struct implement;
|
||||
public:
|
||||
real(::nana::string label, double init_value, double begin, double last, double step);
|
||||
real(::std::string label, double init_value, double begin, double last, double step);
|
||||
~real();
|
||||
|
||||
double value() const;
|
||||
private:
|
||||
//Implementation of abstract_content
|
||||
const ::nana::string& label() const override;
|
||||
const ::std::string& label() const override;
|
||||
window create(window, unsigned label_px) override;
|
||||
private:
|
||||
std::unique_ptr<implement> impl_;
|
||||
@@ -144,8 +144,8 @@ namespace nana
|
||||
text(const text&) = delete;
|
||||
text& operator=(const text&) = delete;
|
||||
public:
|
||||
text(::nana::string label, ::nana::string init_text = ::nana::string());
|
||||
text(::nana::string label, std::vector<::nana::string>);
|
||||
text(::std::string label, ::std::string init_text = ::std::string());
|
||||
text(::std::string label, std::vector<::std::string>);
|
||||
|
||||
~text();
|
||||
|
||||
@@ -154,10 +154,10 @@ namespace nana
|
||||
|
||||
void mask_character(wchar_t ch);
|
||||
|
||||
::nana::string value() const;
|
||||
::std::string value() const;
|
||||
private:
|
||||
//Implementation of abstract_content
|
||||
const ::nana::string& label() const override;
|
||||
const ::std::string& label() const override;
|
||||
window create(window, unsigned label_px) override;
|
||||
private:
|
||||
std::unique_ptr<implement> impl_;
|
||||
@@ -168,17 +168,17 @@ namespace nana
|
||||
{
|
||||
struct implement;
|
||||
public:
|
||||
date(::nana::string label);
|
||||
date(::std::string label);
|
||||
|
||||
~date();
|
||||
|
||||
::nana::string value() const;
|
||||
::std::string value() const;
|
||||
int year() const;
|
||||
int month() const; //[1, 12]
|
||||
int day() const; //[1, 31]
|
||||
private:
|
||||
//Implementation of abstract_content
|
||||
const ::nana::string& label() const override;
|
||||
const ::std::string& label() const override;
|
||||
window create(window, unsigned label_px) override;
|
||||
unsigned fixed_pixels() const override;
|
||||
private:
|
||||
@@ -190,19 +190,19 @@ namespace nana
|
||||
{
|
||||
struct implement;
|
||||
public:
|
||||
path(::nana::string label, const ::nana::filebox&);
|
||||
path(::std::string label, const ::nana::filebox&);
|
||||
~path();
|
||||
|
||||
::nana::string value() const;
|
||||
::std::string value() const;
|
||||
private:
|
||||
//Implementation of abstract_content
|
||||
const ::nana::string& label() const override;
|
||||
const ::std::string& label() const override;
|
||||
window create(window, unsigned label_px) override;
|
||||
private:
|
||||
std::unique_ptr<implement> impl_;
|
||||
};
|
||||
|
||||
inputbox(window, ::nana::string description, ::nana::string title = ::nana::string());
|
||||
inputbox(window, ::std::string description, ::std::string title = ::std::string());
|
||||
|
||||
void image(::nana::paint::image, bool is_left, const rectangle& valid_area = {});
|
||||
void image_v(::nana::paint::image, bool is_top, const rectangle& valid_area = {});
|
||||
@@ -246,8 +246,8 @@ namespace nana
|
||||
bool _m_open(std::vector<abstract_content*>&, bool modal);
|
||||
private:
|
||||
window owner_;
|
||||
::nana::string description_;
|
||||
::nana::string title_;
|
||||
::std::string description_;
|
||||
::std::string title_;
|
||||
std::function<bool(window)> verifier_;
|
||||
::nana::paint::image images_[4];
|
||||
::nana::rectangle valid_areas_[4];
|
||||
|
||||
@@ -42,13 +42,17 @@ namespace nana
|
||||
: init_(std::move(initializer))
|
||||
{}
|
||||
|
||||
agent(const nana::char_t* text)
|
||||
agent(const char* text)
|
||||
: text_(text)
|
||||
{}
|
||||
{
|
||||
throw_not_utf8(text);
|
||||
}
|
||||
|
||||
agent(nana::string text, std::function<void(Widget&)> initializer = {})
|
||||
agent(std::string text, std::function<void(Widget&)> initializer = {})
|
||||
: text_(std::move(text)), init_(std::move(initializer))
|
||||
{}
|
||||
{
|
||||
throw_not_utf8(text_);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<nana::widget> create(nana::window handle) const override
|
||||
@@ -60,7 +64,7 @@ namespace nana
|
||||
return std::move(ptr);
|
||||
}
|
||||
private:
|
||||
nana::string text_;
|
||||
std::string text_;
|
||||
std::function<void(Widget&)> init_;
|
||||
};
|
||||
|
||||
@@ -79,8 +83,8 @@ namespace nana
|
||||
public:
|
||||
field_interface() = default;
|
||||
virtual ~field_interface() = default;
|
||||
virtual field_interface& operator<<(const nana::char_t* label) = 0;
|
||||
virtual field_interface& operator<<(nana::string label) = 0;
|
||||
virtual field_interface& operator<<(const char* label) = 0;
|
||||
virtual field_interface& operator<<(std::string label) = 0;
|
||||
virtual field_interface& operator<<(window) = 0;
|
||||
virtual field_interface& fasten(window) = 0;
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace API
|
||||
widget_colors* get_scheme(window);
|
||||
|
||||
void attach_drawer(widget&, drawer_trigger&);
|
||||
nana::string window_caption(window) throw();
|
||||
void window_caption(window, nana::string);
|
||||
std::string window_caption(window) throw();
|
||||
void window_caption(window, std::string);
|
||||
|
||||
window create_window(window, bool nested, const rectangle&, const appearance&, widget* attached);
|
||||
window create_widget(window, const rectangle&, widget* attached);
|
||||
@@ -272,7 +272,7 @@ namespace API
|
||||
|
||||
void window_caption(window, const std::string& title_utf8);
|
||||
void window_caption(window, const nana::string& title);
|
||||
nana::string window_caption(window);
|
||||
::std::string window_caption(window);
|
||||
|
||||
void window_cursor(window, cursor);
|
||||
cursor window_cursor(window);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace nana
|
||||
|
||||
virtual bool tooltip_empty() const = 0;
|
||||
virtual nana::size tooltip_size() const = 0;
|
||||
virtual void tooltip_text(const nana::string&) = 0;
|
||||
virtual void tooltip_text(const ::std::string&) = 0;
|
||||
virtual void tooltip_move(const nana::point& screen_pos, bool ignore_pos) = 0;
|
||||
virtual void duration(std::size_t) = 0;
|
||||
};
|
||||
@@ -63,11 +63,11 @@ namespace nana
|
||||
}
|
||||
|
||||
tooltip(){}
|
||||
tooltip(window w, const nana::string &tip){set(w,tip);}
|
||||
tooltip(window w, const ::std::string &tip){set(w,tip);}
|
||||
|
||||
|
||||
static void set(window, const nana::string&);
|
||||
static void show(window, point pos, const nana::string&, std::size_t duration);
|
||||
static void set(window, const ::std::string&);
|
||||
static void show(window, point pos, const ::std::string&, std::size_t duration);
|
||||
static void close();
|
||||
private:
|
||||
static void _m_hold_factory(factory_interface*);
|
||||
|
||||
@@ -83,8 +83,8 @@ namespace nana{
|
||||
public:
|
||||
button();
|
||||
button(window, bool visible);
|
||||
button(window, const nana::string& caption, bool visible = true);
|
||||
button(window, const nana::char_t* caption, bool visible = true);
|
||||
button(window, const ::std::string& caption, bool visible = true);
|
||||
button(window, const char* caption, bool visible = true);
|
||||
button(window, const nana::rectangle& = rectangle(), bool visible = true);
|
||||
|
||||
button& icon(const nana::paint::image&);
|
||||
@@ -104,7 +104,7 @@ namespace nana{
|
||||
private:
|
||||
//Overrides widget virtual functions
|
||||
void _m_complete_creation() override;
|
||||
void _m_caption(nana::string&&) override;
|
||||
void _m_caption(std::string&&) override;
|
||||
};
|
||||
}//end namespace nana
|
||||
#endif
|
||||
|
||||
@@ -108,9 +108,9 @@ namespace nana
|
||||
trigger();
|
||||
~trigger();
|
||||
|
||||
void insert(const nana::string&, nana::any);
|
||||
bool childset(const nana::string&, nana::any);
|
||||
bool childset_erase(const nana::string&);
|
||||
void insert(const ::std::string&, nana::any);
|
||||
bool childset(const ::std::string&, nana::any);
|
||||
bool childset_erase(const ::std::string&);
|
||||
bool clear();
|
||||
|
||||
//splitstr
|
||||
@@ -118,8 +118,8 @@ namespace nana
|
||||
void splitstr(const nana::string&);
|
||||
const nana::string& splitstr() const;
|
||||
|
||||
void path(const nana::string&);
|
||||
nana::string path() const;
|
||||
void path(const ::std::string&);
|
||||
::std::string path() const;
|
||||
|
||||
template<typename T>
|
||||
void create_event_agent(::nana::categorize<T>& wdg)
|
||||
@@ -189,7 +189,7 @@ namespace nana
|
||||
/// Insert a new category with a specified name and the object of value type.
|
||||
/// The new category would be inserted as a child in current category,
|
||||
/// and after inserting, the new category is replaced of the current category as a new current one.
|
||||
categorize& insert(const nana::string& name, const value_type& value)
|
||||
categorize& insert(const std::string& name, const value_type& value)
|
||||
{
|
||||
this->get_drawer_trigger().insert(name, value);
|
||||
API::update_window(*this);
|
||||
@@ -197,8 +197,9 @@ namespace nana
|
||||
}
|
||||
|
||||
/// Inserts a child category into current category.
|
||||
categorize& childset(const nana::string& name, const value_type& value)
|
||||
categorize& childset(const std::string& name, const value_type& value)
|
||||
{
|
||||
throw_not_utf8(name);
|
||||
if(this->get_drawer_trigger().childset(name, value))
|
||||
API::update_window(*this);
|
||||
return *this;
|
||||
@@ -237,7 +238,7 @@ namespace nana
|
||||
}
|
||||
private:
|
||||
//Overrides widget's virtual functions
|
||||
void _m_caption(nana::string&& str) override
|
||||
void _m_caption(std::string&& str) override
|
||||
{
|
||||
this->get_drawer_trigger().path(str);
|
||||
API::dev::window_caption(*this, this->get_drawer_trigger().path());
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace drawerbase
|
||||
public:
|
||||
checkbox();
|
||||
checkbox(window, bool visible);
|
||||
checkbox(window, const nana::string& text, bool visible = true);
|
||||
checkbox(window, const nana::char_t* text, bool visible = true);
|
||||
checkbox(window, const std::string& text, bool visible = true);
|
||||
checkbox(window, const char* text, bool visible = true);
|
||||
checkbox(window, const rectangle& = rectangle(), bool visible = true);
|
||||
|
||||
void element_set(const char* name);
|
||||
|
||||
@@ -75,8 +75,8 @@ namespace nana
|
||||
{
|
||||
public:
|
||||
item_proxy(drawer_impl*, std::size_t pos);
|
||||
item_proxy& text(const nana::string&);
|
||||
nana::string text() const;
|
||||
item_proxy& text(const ::std::string&);
|
||||
::std::string text() const;
|
||||
item_proxy& select();
|
||||
bool selected() const;
|
||||
item_proxy& icon(const nana::paint::image&);
|
||||
@@ -112,14 +112,13 @@ namespace nana
|
||||
template<typename T>
|
||||
item_proxy& value(T&& t)
|
||||
{
|
||||
*_m_anyobj(true) = std::move(t);
|
||||
*_m_anyobj(true) = ::std::move(t);
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
/// Behavior of Iterator's value_type
|
||||
bool operator==(const nana::string&) const;
|
||||
bool operator==(const ::std::string&) const;
|
||||
bool operator==(const char*) const;
|
||||
bool operator==(const wchar_t*) const;
|
||||
|
||||
/// Behavior of Iterator
|
||||
item_proxy & operator=(const item_proxy&);
|
||||
@@ -166,19 +165,19 @@ namespace nana
|
||||
|
||||
combox();
|
||||
combox(window, bool visible);
|
||||
combox(window, nana::string, bool visible = true);
|
||||
combox(window, const nana::char_t*, bool visible = true);
|
||||
combox(window, ::std::string, bool visible = true);
|
||||
combox(window, const char*, bool visible = true);
|
||||
combox(window, const rectangle& r = rectangle(), bool visible = true);
|
||||
|
||||
void clear();
|
||||
void editable(bool);
|
||||
bool editable() const;
|
||||
void set_accept(std::function<bool(nana::char_t)>);
|
||||
combox& push_back(nana::string);
|
||||
combox& push_back(std::string);
|
||||
std::size_t the_number_of_options() const;
|
||||
std::size_t option() const; ///< Index of the last selected, from drop-down list, item.
|
||||
void option(std::size_t); ///< Select the text specified by index
|
||||
nana::string text(std::size_t) const;
|
||||
::std::string text(std::size_t) const;
|
||||
void erase(std::size_t pos);
|
||||
|
||||
template<typename Key>
|
||||
@@ -224,8 +223,8 @@ namespace nana
|
||||
const drawerbase::combox::drawer_impl& _m_impl() const;
|
||||
private:
|
||||
//Overrides widget's virtual functions
|
||||
nana::string _m_caption() const throw() override;
|
||||
void _m_caption(nana::string&&) override;
|
||||
::std::string _m_caption() const throw() override;
|
||||
void _m_caption(::std::string&&) override;
|
||||
nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ namespace nana
|
||||
trigger();
|
||||
bool chose() const;
|
||||
nana::date read() const;
|
||||
void week_name(unsigned index, const nana::string&);
|
||||
void week_name(unsigned index, const std::string&);
|
||||
private:
|
||||
where _m_pos_where(graph_reference, const ::nana::point& pos);
|
||||
void _m_draw_topbar(graph_reference);
|
||||
void _m_make_drawing_basis(drawing_basis&, graph_reference, const nana::point& refpos);
|
||||
void _m_draw_pos(drawing_basis &, graph_reference, int x, int y, const nana::string&, bool primary, bool sel);
|
||||
void _m_draw_pos(drawing_basis &, graph_reference, int x, int y, const ::std::string&, bool primary, bool sel);
|
||||
void _m_draw_pos(drawing_basis &, graph_reference, int x, int y, int number, bool primary, bool sel);
|
||||
void _m_draw_ex_days(drawing_basis &, graph_reference, int begx, int begy, bool before);
|
||||
void _m_draw_days(const nana::point& refpos, graph_reference);
|
||||
@@ -61,7 +61,7 @@ namespace nana
|
||||
void mouse_leave(graph_reference, const arg_mouse&) override;
|
||||
void mouse_up(graph_reference, const arg_mouse&) override;
|
||||
private:
|
||||
nana::string weekstr_[7];
|
||||
::std::string weekstr_[7];
|
||||
|
||||
widget * widget_;
|
||||
|
||||
@@ -105,13 +105,13 @@ namespace nana
|
||||
public:
|
||||
date_chooser();
|
||||
date_chooser(window, bool visible);
|
||||
date_chooser(window, const nana::string& text, bool visible = true);
|
||||
date_chooser(window, const nana::char_t* text, bool visible = true);
|
||||
date_chooser(window, const ::std::string& text, bool visible = true);
|
||||
date_chooser(window, const char* text, bool visible = true);
|
||||
date_chooser(window, const nana::rectangle& r = rectangle(), bool visible = true);
|
||||
|
||||
bool chose() const;
|
||||
nana::date read() const;
|
||||
void weekstr(unsigned index, const nana::string&);///<Set the week strings which will be displayed for day, index is in range of [0, 6]
|
||||
void weekstr(unsigned index, const ::std::string&);///<Set the week strings which will be displayed for day, index is in range of [0, 6]
|
||||
};
|
||||
}//end namespace nana
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace nana
|
||||
virtual ~item_interface(){}
|
||||
|
||||
virtual const nana::paint::image & image() const = 0;
|
||||
virtual const nana::char_t* text() const = 0;
|
||||
virtual const char* text() const = 0;
|
||||
};
|
||||
|
||||
//struct module_def
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace nana{
|
||||
/// The construction that creates the widget and set the titel or caption
|
||||
|
||||
group(window parent, ///< a handle to the parent
|
||||
::nana::string titel, ///< caption of the group
|
||||
::std::string titel, ///< caption of the group
|
||||
bool formatted = false, ///< Enable/disable the formatted text for the title
|
||||
unsigned gap = 2, ///< betwen the content and the external limit
|
||||
const rectangle& r = {} ,
|
||||
@@ -49,7 +49,7 @@ namespace nana{
|
||||
~group();
|
||||
|
||||
/// Adds an option for user selection
|
||||
group& add_option(::nana::string);
|
||||
group& add_option(::std::string);
|
||||
|
||||
/// Enables/disables the radio mode which is single selection
|
||||
group& radio_mode(bool);
|
||||
@@ -77,8 +77,8 @@ namespace nana{
|
||||
void _m_add_child(const char* field, widget*);
|
||||
void _m_init();
|
||||
void _m_complete_creation() override;
|
||||
::nana::string _m_caption() const throw() override;
|
||||
void _m_caption(::nana::string&&) override;
|
||||
::std::string _m_caption() const throw() override;
|
||||
void _m_caption(::std::string&&) override;
|
||||
private:
|
||||
std::unique_ptr<implement> impl_;
|
||||
};
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace nana
|
||||
typedef drawerbase::label::command command;
|
||||
label();
|
||||
label(window, bool visible);
|
||||
label(window, const nana::string& text, bool visible = true);
|
||||
label(window parent, const nana::char_t* text, bool visible = true) :label(parent, nana::string(text),visible) {};
|
||||
label(window, const std::string& text, bool visible = true);
|
||||
label(window parent, const char* text, bool visible = true) :label(parent, std::string(text),visible) {};
|
||||
label(window, const rectangle& = {}, bool visible = true);
|
||||
label& transparent(bool); ///< Switchs the label widget to the transparent background mode.
|
||||
bool transparent() const throw();
|
||||
@@ -71,12 +71,12 @@ namespace nana
|
||||
/// "corrected" size that changes lines to fit the text into the specified width
|
||||
nana::size measure(unsigned allowed_width_in_pixel) const;
|
||||
|
||||
static ::nana::size measure(::nana::paint::graphics&, const ::nana::string&, unsigned allowed_width_in_pixel, bool format_enabled, align h_align, align_v v_align);
|
||||
static ::nana::size measure(::nana::paint::graphics&, const ::std::string&, unsigned allowed_width_in_pixel, bool format_enabled, align h_align, align_v v_align);
|
||||
|
||||
label& text_align(align horizontal_align, align_v vertical_align= align_v::top);
|
||||
private:
|
||||
//Overrides widget's virtual function
|
||||
void _m_caption(nana::string&&) override;
|
||||
void _m_caption(std::string&&) override;
|
||||
};
|
||||
}//end namespace nana
|
||||
#endif
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace nana
|
||||
{
|
||||
graph_ = &graph;
|
||||
widget_ = static_cast< ::nana::scroll<Vertical>*>(&widget);
|
||||
widget.caption(STR("Nana Scroll"));
|
||||
widget.caption("nana scroll");
|
||||
|
||||
timer_.stop();
|
||||
timer_.elapse(std::bind(&trigger::_m_tick, this));
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace nana
|
||||
{
|
||||
public:
|
||||
virtual ~provider() = default;
|
||||
virtual nana::string adorn_trace(unsigned vmax, unsigned vadorn) const = 0;
|
||||
virtual std::string adorn_trace(unsigned vmax, unsigned vadorn) const = 0;
|
||||
};
|
||||
|
||||
class renderer
|
||||
@@ -81,7 +81,7 @@ namespace nana
|
||||
|
||||
virtual void background(window, graph_reference, bool isglass) = 0;
|
||||
virtual void adorn(window, graph_reference, const adorn_t&) = 0;
|
||||
virtual void adorn_textbox(window, graph_reference, const nana::string&, const nana::rectangle&) = 0;
|
||||
virtual void adorn_textbox(window, graph_reference, const ::std::string&, const nana::rectangle&) = 0;
|
||||
virtual void bar(window, graph_reference, const bar_t&) = 0;
|
||||
virtual void slider(window, graph_reference, const slider_t&) = 0;
|
||||
};
|
||||
|
||||
@@ -106,8 +106,8 @@ namespace nana
|
||||
void modifier(std::wstring prefix, std::wstring suffix);
|
||||
void modifier(const std::string & prefix_utf8, const std::string& suffix_utf8);
|
||||
private:
|
||||
::nana::string _m_caption() const throw();
|
||||
void _m_caption(::nana::string&&);
|
||||
::std::string _m_caption() const throw();
|
||||
void _m_caption(::std::string&&);
|
||||
}; //end class spinbox
|
||||
}//end namespace nana
|
||||
|
||||
|
||||
@@ -111,13 +111,13 @@ namespace nana
|
||||
/// @param window A handle to the parent window of the widget being created.
|
||||
/// @param text the text that will be displayed.
|
||||
/// @param visible specifying the visible after creating.
|
||||
textbox(window, const nana::string& text, bool visible = true);
|
||||
textbox(window, const std::string& text, bool visible = true);
|
||||
|
||||
/// \brief The construct that creates a widget with a specified text.
|
||||
/// @param window A handle to the parent window of the widget being created.
|
||||
/// @param text the text that will be displayed.
|
||||
/// @param visible specifying the visible after creating.
|
||||
textbox(window, const nana::char_t* text, bool visible = true);
|
||||
textbox(window, const char* text, bool visible = true);
|
||||
|
||||
/// \brief The construct that creates a widget.
|
||||
/// @param window A handle to the parent window of the widget being created.
|
||||
@@ -173,7 +173,7 @@ namespace nana
|
||||
textbox& editable(bool);
|
||||
void set_accept(std::function<bool(nana::char_t)>);
|
||||
|
||||
textbox& tip_string(nana::string);
|
||||
textbox& tip_string(::std::string);
|
||||
|
||||
/// Set a mask character. Text is displayed as mask character if a mask character is set. This is used for hiding some special text, such as password.
|
||||
textbox& mask(nana::char_t);
|
||||
@@ -195,11 +195,10 @@ namespace nana
|
||||
|
||||
void set_highlight(const std::string& name, const ::nana::color& fgcolor, const ::nana::color& bgcolor);
|
||||
void erase_highlight(const std::string& name);
|
||||
void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<nana::string> kw_list);
|
||||
void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<std::wstring> kw_list);
|
||||
void set_keywords(const std::string& name, bool case_sensitive, bool whole_word_match, std::initializer_list<std::string> kw_list_utf8);
|
||||
void erase_keyword(const nana::string& kw);
|
||||
|
||||
|
||||
/// Returns the text position of each line that currently displays on screen.
|
||||
text_positions text_position() const;
|
||||
|
||||
@@ -210,8 +209,8 @@ namespace nana
|
||||
unsigned line_pixels() const;
|
||||
protected:
|
||||
//Overrides widget's virtual functions
|
||||
::nana::string _m_caption() const throw() override;
|
||||
void _m_caption(::nana::string&&) override;
|
||||
::std::string _m_caption() const throw() override;
|
||||
void _m_caption(::std::string&&) override;
|
||||
void _m_typeface(const paint::font&) override;
|
||||
};
|
||||
}//end namespace nana
|
||||
|
||||
@@ -87,8 +87,8 @@ namespace nana
|
||||
toolbar(window, const rectangle& = rectangle(), bool visible = true);
|
||||
|
||||
void separate(); ///< Adds a separator.
|
||||
void append(const nana::string& text, const nana::paint::image& img); ///< Adds a control button.
|
||||
void append(const nana::string& text); ///< Adds a control button.
|
||||
void append(const ::std::string& text, const nana::paint::image& img); ///< Adds a control button.
|
||||
void append(const ::std::string& text); ///< Adds a control button.
|
||||
bool enable(size_type index) const;
|
||||
void enable(size_type index, bool enable_state);
|
||||
void scale(unsigned s); ///< Sets the scale of control button.
|
||||
|
||||
@@ -41,9 +41,8 @@ namespace nana
|
||||
|
||||
window parent() const;
|
||||
|
||||
nana::string caption() const throw();
|
||||
::std::string caption() const throw();
|
||||
void caption(std::string utf8);
|
||||
void caption(std::wstring);
|
||||
|
||||
template<typename ...Args>
|
||||
void i18n(std::string msgid, Args&&... args)
|
||||
@@ -91,7 +90,7 @@ namespace nana
|
||||
widget& register_shortkey(char_t); ///< Registers a shortkey. To remove a registered key, pass 0.
|
||||
|
||||
widget& take_active(bool activated, window take_if_not_activated);
|
||||
widget& tooltip(const nana::string&);
|
||||
widget& tooltip(const ::std::string&);
|
||||
|
||||
operator dummy_bool_type() const;
|
||||
operator window() const;
|
||||
@@ -105,8 +104,8 @@ namespace nana
|
||||
virtual void _m_complete_creation();
|
||||
|
||||
virtual general_events& _m_get_general_events() const = 0;
|
||||
virtual nana::string _m_caption() const throw();
|
||||
virtual void _m_caption(nana::string&&);
|
||||
virtual ::std::string _m_caption() const throw();
|
||||
virtual void _m_caption(::std::string&&);
|
||||
virtual nana::cursor _m_cursor() const;
|
||||
virtual void _m_cursor(nana::cursor);
|
||||
virtual void _m_close();
|
||||
|
||||
@@ -28,34 +28,34 @@ namespace nana
|
||||
void load_utf8(const std::string& file);
|
||||
|
||||
template<typename ...Args>
|
||||
nana::string get(std::string msgid_utf8, Args&&... args) const
|
||||
::std::string get(std::string msgid_utf8, Args&&... args) const
|
||||
{
|
||||
std::vector<nana::string> arg_strs;
|
||||
std::vector<std::string> arg_strs;
|
||||
_m_fetch_args(arg_strs, std::forward<Args>(args)...);
|
||||
|
||||
nana::string msgstr;
|
||||
::std::string msgstr;
|
||||
if (_m_get(msgid_utf8, msgstr))
|
||||
_m_replace_args(msgstr, &arg_strs);
|
||||
return msgstr;
|
||||
}
|
||||
|
||||
nana::string get(std::string msgid_utf8) const;
|
||||
void set(std::string msgid_utf8, nana::string msgstr);
|
||||
::std::string get(std::string msgid_utf8) const;
|
||||
void set(std::string msgid_utf8, ::std::string msgstr);
|
||||
|
||||
template<typename ...Args>
|
||||
nana::string operator()(std::string msgid_utf8, Args&&... args) const
|
||||
::std::string operator()(std::string msgid_utf8, Args&&... args) const
|
||||
{
|
||||
return get(msgid_utf8, std::forward<Args>(args)...);
|
||||
}
|
||||
private:
|
||||
bool _m_get(std::string& msgid, nana::string& msgstr) const;
|
||||
void _m_replace_args(nana::string& str, std::vector<nana::string> * arg_strs) const;
|
||||
bool _m_get(std::string& msgid, ::std::string& msgstr) const;
|
||||
void _m_replace_args(::std::string& str, std::vector<::std::string> * arg_strs) const;
|
||||
|
||||
void _m_fetch_args(std::vector<nana::string>&) const //Termination of _m_fetch_args
|
||||
void _m_fetch_args(std::vector<std::string>&) const //Termination of _m_fetch_args
|
||||
{}
|
||||
|
||||
template<typename Arg>
|
||||
void _m_fetch_args(std::vector<nana::string>& v, Arg&& arg) const
|
||||
void _m_fetch_args(std::vector<std::string>& v, Arg&& arg) const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << arg;
|
||||
@@ -63,52 +63,39 @@ namespace nana
|
||||
}
|
||||
|
||||
template<typename ...Args>
|
||||
void _m_fetch_args(std::vector<nana::string>& v, const char* arg, Args&&... args) const
|
||||
void _m_fetch_args(std::vector<std::string>& v, const char* arg, Args&&... args) const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << nana::string(nana::charset(arg));
|
||||
v.emplace_back(ss.str());
|
||||
|
||||
v.emplace_back(arg);
|
||||
_m_fetch_args(v, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename ...Args>
|
||||
void _m_fetch_args(std::vector<nana::string>& v, const std::string& arg, Args&&... args) const
|
||||
void _m_fetch_args(std::vector<std::string>& v, const std::string& arg, Args&&... args) const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << nana::string(nana::charset(arg));
|
||||
v.emplace_back(ss.str());
|
||||
|
||||
v.emplace_back(arg);
|
||||
_m_fetch_args(v, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename ...Args>
|
||||
void _m_fetch_args(std::vector<nana::string>& v, std::string& arg, Args&&... args) const
|
||||
void _m_fetch_args(std::vector<std::string>& v, std::string& arg, Args&&... args) const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << nana::string(nana::charset(arg));
|
||||
v.emplace_back(ss.str());
|
||||
|
||||
v.emplace_back(arg);
|
||||
_m_fetch_args(v, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename ...Args>
|
||||
void _m_fetch_args(std::vector<nana::string>& v, std::string&& arg, Args&&... args) const
|
||||
void _m_fetch_args(std::vector<std::string>& v, std::string&& arg, Args&&... args) const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << nana::string(nana::charset(arg));
|
||||
v.emplace_back(ss.str());
|
||||
|
||||
v.emplace_back(std::move(arg));
|
||||
_m_fetch_args(v, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template<typename Arg, typename ...Args>
|
||||
void _m_fetch_args(std::vector<nana::string>& v, Arg&& arg, Args&&... args) const
|
||||
void _m_fetch_args(std::vector<std::string>& v, Arg&& arg, Args&&... args) const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
std::stringstream ss;
|
||||
ss << arg;
|
||||
v.emplace_back(ss.str());
|
||||
|
||||
_m_fetch_args(v, std::forward<Args>(args)...);
|
||||
}
|
||||
};//end class internationalization
|
||||
@@ -119,7 +106,7 @@ namespace nana
|
||||
{
|
||||
public:
|
||||
virtual ~eval_arg() = default;
|
||||
virtual nana::string eval() const = 0;
|
||||
virtual std::string eval() const = 0;
|
||||
virtual std::unique_ptr<eval_arg> clone() const = 0;
|
||||
};
|
||||
|
||||
@@ -134,7 +121,7 @@ namespace nana
|
||||
: fn_(fn)
|
||||
{}
|
||||
|
||||
nana::string eval() const override
|
||||
std::string eval() const override
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << fn_();
|
||||
@@ -166,7 +153,7 @@ namespace nana
|
||||
i18n_eval& operator=(const i18n_eval&);
|
||||
i18n_eval& operator=(i18n_eval&& rhs);
|
||||
|
||||
nana::string operator()() const;
|
||||
std::string operator()() const;
|
||||
private:
|
||||
void _m_fetch_args(){} //Termination of _m_fetch_args
|
||||
|
||||
@@ -180,7 +167,7 @@ namespace nana
|
||||
template<typename Arg>
|
||||
void _m_add_args(Arg&& arg)
|
||||
{
|
||||
std::wstringstream ss;
|
||||
std::stringstream ss;
|
||||
ss << arg;
|
||||
_m_add_args(ss.str());
|
||||
}
|
||||
|
||||
@@ -89,12 +89,13 @@ namespace nana
|
||||
void resize(const ::nana::size&);
|
||||
void typeface(const font&); ///< Selects a specified font type into the graphics object.
|
||||
font typeface() const;
|
||||
::nana::size text_extent_size(const ::std::string&) const;
|
||||
::nana::size text_extent_size(const char_t*) const; ///< Computes the width and height of the specified string of text.
|
||||
::nana::size text_extent_size(const string&) const; ///< Computes the width and height of the specified string of text.
|
||||
::nana::size text_extent_size(const ::std::wstring&) const; ///< Computes the width and height of the specified string of text.
|
||||
::nana::size text_extent_size(const char_t*, std::size_t length) const; ///< Computes the width and height of the specified string of text with the specified length.
|
||||
::nana::size text_extent_size(const string&, std::size_t length) const; ///< Computes the width and height of the specified string of text with the specified length.
|
||||
::nana::size text_extent_size(const ::std::wstring&, std::size_t length) const; ///< Computes the width and height of the specified string of text with the specified length.
|
||||
::nana::size glyph_extent_size(const char_t*, std::size_t length, std::size_t begin, std::size_t end) const;
|
||||
::nana::size glyph_extent_size(const string&, std::size_t length, std::size_t begin, std::size_t end) const;
|
||||
::nana::size glyph_extent_size(const ::std::wstring&, std::size_t length, std::size_t begin, std::size_t end) const;
|
||||
bool glyph_pixels(const char_t *, std::size_t length, unsigned* pxbuf) const;
|
||||
::nana::size bidi_extent_size(const std::wstring&) const;
|
||||
::nana::size bidi_extent_size(const std::string&) const;
|
||||
@@ -150,6 +151,7 @@ namespace nana
|
||||
void set_pixel(int x, int y, const ::nana::color&);
|
||||
void set_pixel(int x, int y);
|
||||
|
||||
void string(const point&, const std::string&);
|
||||
void string(point, const char_t*, std::size_t len);
|
||||
void string(const point&, const char_t*);
|
||||
void string(const point&, const ::nana::string&);
|
||||
|
||||
Reference in New Issue
Block a user