uiLitejhksdhkfj/widgets/label.cpp

31 lines
835 B
C++
Raw Normal View History

#include "core_include/api.h"
#include "core_include/rect.h"
#include "core_include/cmd_target.h"
#include "core_include/wnd.h"
#include "core_include/surface.h"
2018-10-04 14:30:29 +08:00
#include "core_include/resource.h"
#include "core_include/bitmap.h"
#include "core_include/theme.h"
#include "core_include/word.h"
#include "../widgets_include/label.h"
2017-12-06 21:43:47 +08:00
void c_label::pre_create_wnd()
{
2018-12-02 22:39:43 +08:00
m_style = GL_ATTR_VISIBLE | ALIGN_LEFT | ALIGN_VCENTER;
2018-11-01 10:35:37 +08:00
m_font_color = GL_RGB(255,255,255);
2017-12-06 21:43:47 +08:00
m_font_type = c_theme::get_font(FONT_DEFAULT);
2017-12-06 21:43:47 +08:00
}
void c_label::on_paint()
{
c_rect rect;
get_screen_rect(rect);
2018-10-04 14:30:29 +08:00
if (m_str)
2017-12-06 21:43:47 +08:00
{
m_surface->fill_rect(rect.m_left, rect.m_top, rect.m_right, rect.m_bottom, m_parent->get_bg_color(), m_z_order);
2018-11-01 10:35:37 +08:00
c_word::draw_string_in_rect(m_surface, m_z_order, m_str, rect, m_font_type, m_font_color, GL_ARGB(0, 0, 0, 0), m_style);
2017-12-06 21:43:47 +08:00
}
}