add various overlodings for widget::caption()
This commit is contained in:
parent
83161a3843
commit
ed4d2af7dd
@ -573,7 +573,8 @@ By \a clicking on one header the list get \a reordered, first up, and then down
|
||||
|
||||
cat_proxy append(nana::string); ///< Appends a new category at the end
|
||||
void append(std::initializer_list<nana::string>); ///< Appends categories at the end
|
||||
cat_proxy insert(cat_proxy, nana::string);
|
||||
|
||||
cat_proxy insert(cat_proxy, ::std::wstring);
|
||||
cat_proxy at(size_type pos) const;
|
||||
|
||||
/// add categories in order when use a key?
|
||||
@ -606,7 +607,8 @@ By \a clicking on one header the list get \a reordered, first up, and then down
|
||||
|
||||
item_proxy at(const index_pair &abs_pos) const;
|
||||
|
||||
void insert(const index_pair&, nana::string); ///<Insert a new item with a text in the first column.
|
||||
void insert(const index_pair&, ::std::string); ///<Insert a new item with a text in the first column.
|
||||
void insert(const index_pair&, ::std::wstring); ///<Insert a new item with a text in the first column.
|
||||
|
||||
void checkable(bool);
|
||||
selection checked() const; ///<Returns the items which are checked.
|
||||
|
@ -42,7 +42,7 @@ namespace nana{ namespace widgets{ namespace skeletons
|
||||
class tokenizer
|
||||
{
|
||||
public:
|
||||
tokenizer(const nana::string& s, bool format_enabled)
|
||||
tokenizer(const std::wstring& s, bool format_enabled)
|
||||
: iptr_(s.data()),
|
||||
endptr_(s.data() + s.size()),
|
||||
format_enabled_(format_enabled)
|
||||
@ -74,7 +74,7 @@ namespace nana{ namespace widgets{ namespace skeletons
|
||||
return _m_token();
|
||||
}
|
||||
|
||||
const nana::string& idstr() const
|
||||
const ::std::wstring& idstr() const
|
||||
{
|
||||
return idstr_;
|
||||
}
|
||||
@ -434,7 +434,7 @@ namespace nana{ namespace widgets{ namespace skeletons
|
||||
};
|
||||
};
|
||||
|
||||
::nana::string font;
|
||||
::std::wstring font;
|
||||
std::size_t font_size;
|
||||
bool bold;
|
||||
bool bold_empty; //bold should be ignored if bold_empty is true
|
||||
@ -442,8 +442,8 @@ namespace nana{ namespace widgets{ namespace skeletons
|
||||
::nana::color bgcolor; //If the color is not specified, it will be ignored, and the system will search for its parent.
|
||||
::nana::color fgcolor; //ditto
|
||||
|
||||
::nana::string target;
|
||||
::nana::string url;
|
||||
::std::wstring target;
|
||||
::std::wstring url;
|
||||
|
||||
fblock * parent;
|
||||
};
|
||||
|
@ -34,6 +34,11 @@ namespace nana
|
||||
class inner_widget_notifier;
|
||||
typedef void(*dummy_bool_type)(widget* (*)(const widget&));
|
||||
public:
|
||||
#if defined(NANA_WINDOWS)
|
||||
using native_string_type = std::wstring;
|
||||
#else //POSIX
|
||||
using native_string_type = std::string;
|
||||
#endif
|
||||
virtual ~widget() = default;
|
||||
virtual window handle() const = 0; ///< Returns the handle of window, returns 0 if window is not created.
|
||||
bool empty() const; ///< Determines whether the manipulator is handling a window.
|
||||
@ -42,7 +47,11 @@ namespace nana
|
||||
window parent() const;
|
||||
|
||||
::std::string caption() const throw();
|
||||
void caption(std::string utf8);
|
||||
::std::wstring caption_wstring() const throw();
|
||||
native_string_type caption_native() const throw();
|
||||
|
||||
widget& caption(std::string utf8);
|
||||
widget& caption(std::wstring);
|
||||
|
||||
template<typename ...Args>
|
||||
void i18n(std::string msgid, Args&&... args)
|
||||
|
@ -52,8 +52,8 @@ namespace nana
|
||||
struct traceable
|
||||
{
|
||||
nana::rectangle r;
|
||||
nana::string target;
|
||||
nana::string url;
|
||||
std::wstring target;
|
||||
std::wstring url;
|
||||
};
|
||||
|
||||
public:
|
||||
@ -148,7 +148,7 @@ namespace nana
|
||||
graph.typeface(ft);
|
||||
}
|
||||
|
||||
bool find(int x, int y, nana::string& target, nana::string& url) const
|
||||
bool find(int x, int y, std::wstring& target, std::wstring& url) const
|
||||
{
|
||||
for (auto & t : traceable_)
|
||||
{
|
||||
|
@ -4324,7 +4324,7 @@ namespace nana
|
||||
ess.update();
|
||||
}
|
||||
|
||||
auto listbox::insert(cat_proxy cat, nana::string str) -> cat_proxy
|
||||
auto listbox::insert(cat_proxy cat, std::wstring str) -> cat_proxy
|
||||
{
|
||||
internal_scope_guard lock;
|
||||
auto & ess = _m_ess();
|
||||
@ -4358,7 +4358,12 @@ namespace nana
|
||||
return at(pos_abs.cat).at(pos_abs.item);
|
||||
}
|
||||
|
||||
void listbox::insert(const index_pair& pos, nana::string text)
|
||||
void listbox::insert(const index_pair& pos, std::string text)
|
||||
{
|
||||
insert(pos, utf8_cast(text));
|
||||
}
|
||||
|
||||
void listbox::insert(const index_pair& pos, std::wstring text)
|
||||
{
|
||||
internal_scope_guard lock;
|
||||
auto & ess = _m_ess();
|
||||
|
@ -59,10 +59,31 @@ namespace nana
|
||||
return this->_m_caption();
|
||||
}
|
||||
|
||||
void widget::caption(std::string utf8)
|
||||
std::wstring widget::caption_wstring() const throw()
|
||||
{
|
||||
return utf8_cast(_m_caption());
|
||||
}
|
||||
|
||||
auto widget::caption_native() const throw() -> native_string_type
|
||||
{
|
||||
#if defined(NANA_WINDOWS)
|
||||
return caption_wstring();
|
||||
#else
|
||||
return caption();
|
||||
#endif
|
||||
}
|
||||
|
||||
widget& widget::caption(std::string utf8)
|
||||
{
|
||||
::nana::throw_not_utf8(utf8);
|
||||
_m_caption(std::move(utf8));
|
||||
return *this;
|
||||
}
|
||||
|
||||
widget& widget::caption(std::wstring text)
|
||||
{
|
||||
_m_caption(utf8_cast(text));
|
||||
return *this;
|
||||
}
|
||||
|
||||
void widget::i18n(i18n_eval eval)
|
||||
|
Loading…
x
Reference in New Issue
Block a user