use UTF-8 for string representation

This commit is contained in:
Jinhao
2015-12-14 00:30:03 +08:00
parent 009e7e7647
commit 8fc84938bf
10 changed files with 47 additions and 34 deletions

View File

@@ -203,7 +203,7 @@ namespace detail
void default_native_font(const font_ptr_t&);
unsigned font_size_to_height(unsigned) const;
unsigned font_height_to_size(unsigned) const;
font_ptr_t make_native_font(const nana::char_t* name, unsigned height, unsigned weight, bool italic, bool underline, bool strick_out);
font_ptr_t make_native_font(const char* name, unsigned height, unsigned weight, bool italic, bool underline, bool strick_out);
Display* open_display();
void close_display();

View File

@@ -80,7 +80,7 @@ namespace detail
struct font_tag
{
nana::string name;
native_string_type name;
unsigned height;
unsigned weight;
bool italic;
@@ -186,7 +186,7 @@ namespace detail
void default_native_font(const font_ptr_t&);
unsigned font_size_to_height(unsigned) const;
unsigned font_height_to_size(unsigned) const;
font_ptr_t make_native_font(const nana::char_t* name, unsigned height, unsigned weight, bool italic, bool underline, bool strike_out);
font_ptr_t make_native_font(const char* name, unsigned height, unsigned weight, bool italic, bool underline, bool strike_out);
static platform_spec& instance();

View File

@@ -174,13 +174,25 @@ namespace nana
{
}
categorize(window wd, const nana::string& text, bool visible = true)
categorize(window wd, const std::string& text_utf8, bool visible = true)
: categorize(wd, ::nana::rectangle(), visible)
{
this->caption(text);
}
categorize(window wd, const nana::char_t* text, bool visible = true)
categorize(window wd, const char* text_utf8, bool visible = true)
: categorize(wd, ::nana::rectangle(), visible)
{
this->caption(text);
}
categorize(window wd, const std::wstring& text, bool visible = true)
: categorize(wd, ::nana::rectangle(), visible)
{
this->caption(text);
}
categorize(window wd, const wchar_t* text, bool visible = true)
: categorize(wd, ::nana::rectangle(), visible)
{
this->caption(text);
@@ -206,7 +218,7 @@ namespace nana
}
/// Erases a child category with a specified name from current category.
categorize& childset_erase(const nana::string& name)
categorize& childset_erase(const std::string& name)
{
if(this->get_drawer_trigger().childset_erase(name))
API::update_window(*this);
@@ -220,13 +232,13 @@ namespace nana
}
/// Sets the splitter string
categorize& splitstr(const nana::string& sstr)
categorize& splitstr(const std::string& sstr)
{
this->get_drawer_trigger().splitstr(sstr);
return *this;
}
nana::string splitstr() const
std::string splitstr() const
{
return this->get_drawer_trigger().splitstr();
}

View File

@@ -434,7 +434,7 @@ namespace nana{ namespace widgets{ namespace skeletons
};
};
::std::wstring font;
::std::string font;
std::size_t font_size;
bool bold;
bool bold_empty; //bold should be ignored if bold_empty is true
@@ -706,7 +706,7 @@ namespace nana{ namespace widgets{ namespace skeletons
if(token::string != tknizer.read())
throw std::runtime_error("");
fp->font = tknizer.idstr();
fp->font = to_utf8(tknizer.idstr());
break;
case token::size:
if(token::equal != tknizer.read())

View File

@@ -36,14 +36,14 @@ namespace nana
font();
font(drawable_type);
font(const font&);
font(const char_t* name, unsigned size, bool bold = false, bool italic = false, bool underline = false, bool strike_out = false);
font(const ::std::string& name, unsigned size, bool bold = false, bool italic = false, bool underline = false, bool strike_out = false);
~font();
bool empty() const;
void make(const char_t* name, unsigned size, bool bold = false, bool italic = false, bool underline = false, bool strike_out = false);
void make_raw(const char_t*, unsigned height, unsigned weight, bool italic, bool underline, bool strike_out);
void make(const ::std::string& name, unsigned size, bool bold = false, bool italic = false, bool underline = false, bool strike_out = false);
void make_raw(const ::std::string& name, unsigned height, unsigned weight, bool italic, bool underline, bool strike_out);
void set_default() const;
::nana::string name() const;
::std::string name() const;
unsigned size() const;
bool bold() const;
unsigned height() const;

View File

@@ -32,8 +32,6 @@ namespace paint
image();
image(const image&);
image(image&&);
//image(const nana::char_t* file);
//image(const nana::string& filename); //deprecated
image(const ::nana::experimental::filesystem::path& file);
template<typename Source>
@@ -45,7 +43,6 @@ namespace paint
~image();
image& operator=(const image& rhs);
image& operator=(image&&);
//bool open(const nana::string& filename); //deprecated
bool open(const ::nana::experimental::filesystem::path& file);
/// Opens an icon from a specified buffer