本文整理汇总了C++中SkinTheme::draw_bounds_nw方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinTheme::draw_bounds_nw方法的具体用法?C++ SkinTheme::draw_bounds_nw怎么用?C++ SkinTheme::draw_bounds_nw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTheme
的用法示例。
在下文中一共展示了SkinTheme::draw_bounds_nw方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawTab
void Tabs::drawTab(Graphics* g, const gfx::Rect& box, Tab* tab, int y_delta, bool selected)
{
// Is the tab outside the bounds of the widget?
if (box.x >= getBounds().x2() || box.x2() <= getBounds().x)
return;
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
gfx::Color text_color;
gfx::Color face_color;
// Selected
if (selected) {
text_color = theme->getColor(ThemeColor::TabSelectedText);
face_color = theme->getColor(ThemeColor::TabSelectedFace);
}
// Non-selected
else {
text_color = theme->getColor(ThemeColor::TabNormalText);
face_color = theme->getColor(ThemeColor::TabNormalFace);
}
if (box.w > 2) {
theme->draw_bounds_nw(g,
gfx::Rect(box.x, box.y+y_delta, box.w, box.h),
(selected) ? PART_TAB_SELECTED_NW:
PART_TAB_NORMAL_NW,
face_color);
g->drawString(tab->text, text_color, gfx::ColorNone,
gfx::Point(
box.x + 4*jguiscale(),
box.y + box.h/2 - getFont()->height()/2+1 + y_delta));
}
if (selected) {
theme->draw_bounds_nw(g,
gfx::Rect(box.x, box.y2(), box.w, getBounds().y2()-box.y2()),
PART_TAB_BOTTOM_SELECTED_NW,
theme->getColor(ThemeColor::TabSelectedFace));
}
else {
theme->draw_part_as_hline(g,
gfx::Rect(box.x, box.y2(), box.w, getBounds().y2()-box.y2()),
PART_TAB_BOTTOM_NORMAL);
}
#ifdef CLOSE_BUTTON_IN_EACH_TAB
she::Surface* close_icon = theme->get_part(PART_WINDOW_CLOSE_BUTTON_NORMAL);
g->drawRgbaSurface(close_icon,
box.x2() - 4*jguiscale() - close_icon->width(),
box.y + box.h/2 - close_icon->height()/2+1 * jguiscale());
#endif
}
示例2: drawTab
void Tabs::drawTab(BITMAP* bmp, JRect box, Tab* tab, int y_delta, bool selected)
{
// Is the tab outside the bounds of the widget?
if (box->x1 >= this->rc->x2 || box->x2 <= this->rc->x1)
return;
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
int text_color;
int face_color;
// Selected
if (selected) {
text_color = theme->get_tab_selected_text_color();
face_color = theme->get_tab_selected_face_color();
}
// Non-selected
else {
text_color = theme->get_tab_normal_text_color();
face_color = theme->get_tab_normal_face_color();
}
if (jrect_w(box) > 2) {
theme->draw_bounds_nw(bmp,
box->x1, box->y1+y_delta, box->x2-1, box->y2-1,
(selected) ? PART_TAB_SELECTED_NW:
PART_TAB_NORMAL_NW, face_color);
jdraw_text(bmp, this->getFont(), tab->text.c_str(),
box->x1+4*jguiscale(),
(box->y1+box->y2)/2-text_height(this->getFont())/2+1 + y_delta,
text_color, face_color, false, jguiscale());
}
if (selected) {
theme->draw_bounds_nw(bmp,
box->x1, box->y2, box->x2-1, this->rc->y2-1,
PART_TAB_BOTTOM_SELECTED_NW,
theme->get_tab_selected_face_color());
}
else {
theme->draw_part_as_hline(bmp,
box->x1, box->y2, box->x2-1, this->rc->y2-1,
PART_TAB_BOTTOM_NORMAL);
}
#ifdef CLOSE_BUTTON_IN_EACH_TAB
BITMAP* close_icon = theme->get_part(PART_WINDOW_CLOSE_BUTTON_NORMAL);
set_alpha_blender();
draw_trans_sprite(doublebuffer, close_icon,
box->x2-4*jguiscale()-close_icon->w,
(box->y1+box->y2)/2-close_icon->h/2+1*jguiscale());
#endif
}
示例3: getClientBounds
void ButtonSet::Item::onPaint(ui::PaintEvent& ev)
{
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
Graphics* g = ev.getGraphics();
gfx::Rect rc = getClientBounds();
gfx::Color face;
int nw;
if (!gfx::is_transparent(getBgColor()))
g->fillRect(getBgColor(), g->getClipBounds());
if (isSelected() || hasMouseOver()) {
nw = PART_TOOLBUTTON_HOT_NW;
face = theme->getColor(ThemeColor::ButtonHotFace);
}
else {
nw = PART_TOOLBUTTON_LAST_NW;
face = theme->getColor(ThemeColor::ButtonNormalFace);
}
Grid::Info info = buttonSet()->getChildInfo(this);
if (info.col < info.grid_cols-1) rc.w+=1*jguiscale();
if (info.row < info.grid_rows-1) rc.h+=3*jguiscale();
theme->draw_bounds_nw(g, rc, nw, face);
if (m_icon) {
g->drawRgbaSurface(m_icon,
rc.x + rc.w/2 - m_icon->width()/2,
rc.y + rc.h/2 - m_icon->height()/2);
}
}
示例4: onPaint
void EditorView::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
Widget* viewport = getViewport();
Widget* child = UI_FIRST_WIDGET(viewport->getChildren());
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
bool selected = false;
switch (m_type) {
// Only show the view selected if it is the current editor
case CurrentEditorMode:
selected = (child == current_editor);
break;
// Always show selected
case AlwaysSelected:
selected = true;
break;
}
theme->draw_bounds_nw(g, getClientBounds(),
selected ? PART_EDITOR_SELECTED_NW:
PART_EDITOR_NORMAL_NW,
ColorNone);
}
示例5: getClientBounds
void ColorBar::ScrollableView::onPaint(ui::PaintEvent& ev)
{
ui::Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
theme->draw_bounds_nw(g,
getClientBounds(),
hasFocus() ? PART_EDITOR_SELECTED_NW:
PART_EDITOR_NORMAL_NW,
ColorNone);
}
示例6: onProcessMessage
bool EditorView::onProcessMessage(Message* msg)
{
switch (msg->type) {
case JM_SETPOS:
// This avoid the displacement of the widgets in the viewport
jrect_copy(this->rc, &msg->setpos.rect);
updateView();
return true;
case JM_DRAW:
{
Widget* viewport = getViewport();
Widget* child = reinterpret_cast<JWidget>(jlist_first_data(viewport->children));
JRect pos = jwidget_get_rect(this);
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
bool selected = false;
switch (m_type) {
// Only show the view selected if it is the current editor
case CurrentEditorMode:
selected = (child == current_editor);
break;
// Always show selected
case AlwaysSelected:
selected = true;
break;
}
theme->draw_bounds_nw(ji_screen,
pos->x1, pos->y1,
pos->x2-1, pos->y2-1,
selected ? PART_EDITOR_SELECTED_NW:
PART_EDITOR_NORMAL_NW, false);
jrect_free(pos);
}
return true;
}
return View::onProcessMessage(msg);
}
示例7: onProcessMessage
bool ColorBar::ScrollableView::onProcessMessage(Message* msg)
{
switch (msg->type) {
case JM_DRAW:
{
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
theme->draw_bounds_nw(ji_screen,
rc->x1, rc->y1,
rc->x2-1, rc->y2-1,
hasFocus() ? PART_EDITOR_SELECTED_NW:
PART_EDITOR_NORMAL_NW,
ColorNone);
}
return true;
}
return View::onProcessMessage(msg);
}
示例8: onProcessMessage
bool ColorBar::ScrollableView::onProcessMessage(Message* msg)
{
switch (msg->type) {
case JM_DRAW:
{
Viewport* viewport = getViewport();
Widget* child = reinterpret_cast<Widget*>(jlist_first_data(viewport->children));
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
theme->draw_bounds_nw(ji_screen,
rc->x1, rc->y1,
rc->x2-1, rc->y2-1,
hasFocus() ? PART_EDITOR_SELECTED_NW:
PART_EDITOR_NORMAL_NW, false);
}
return true;
}
return View::onProcessMessage(msg);
}
示例9: draw_color_button
void draw_color_button(BITMAP* bmp,
const Rect& rc,
bool outer_nw, bool outer_n, bool outer_ne, bool outer_e,
bool outer_se, bool outer_s, bool outer_sw, bool outer_w,
PixelFormat pixelFormat, const Color& color, bool hot, bool drag)
{
SkinTheme* theme = (SkinTheme*)CurrentTheme::get();
int scale = jguiscale();
// Draw background (the color)
draw_color(bmp,
Rect(rc.x+1*jguiscale(),
rc.y+1*jguiscale(),
rc.w-((outer_e) ? 2*jguiscale(): 1*jguiscale()),
rc.h-((outer_s) ? 2*jguiscale(): 1*jguiscale())), pixelFormat, color);
// Draw opaque border
{
int parts[8] = {
outer_nw ? PART_COLORBAR_0_NW: PART_COLORBAR_3_NW,
outer_n ? PART_COLORBAR_0_N : PART_COLORBAR_2_N,
outer_ne ? PART_COLORBAR_1_NE: (outer_e ? PART_COLORBAR_3_NE: PART_COLORBAR_2_NE),
outer_e ? PART_COLORBAR_1_E : PART_COLORBAR_0_E,
outer_se ? PART_COLORBAR_3_SE: (outer_s ? PART_COLORBAR_2_SE: (outer_e ? PART_COLORBAR_1_SE: PART_COLORBAR_0_SE)),
outer_s ? PART_COLORBAR_2_S : PART_COLORBAR_0_S,
outer_sw ? PART_COLORBAR_2_SW: (outer_s ? PART_COLORBAR_3_SW: PART_COLORBAR_1_SW),
outer_w ? PART_COLORBAR_0_W : PART_COLORBAR_1_W,
};
theme->draw_bounds_array(bmp, rc.x, rc.y, rc.x+rc.w-1, rc.y+rc.h-1, parts);
}
// Draw hot
if (hot) {
theme->draw_bounds_nw(bmp,
rc.x, rc.y,
rc.x+rc.w-1,
rc.y+rc.h-1 - (outer_s ? 1*scale: 0),
PART_COLORBAR_BORDER_HOTFG_NW);
}
}
示例10: getToolBounds
void ToolBar::ToolStrip::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
ToolBox* toolbox = App::instance()->getToolBox();
Rect toolrc;
int index = 0;
for (ToolIterator it = toolbox->begin(); it != toolbox->end(); ++it) {
Tool* tool = *it;
if (tool->getGroup() == m_group) {
gfx::Color face;
int nw;
if (UIContext::instance()->settings()->getCurrentTool() == tool ||
m_hotTool == tool) {
nw = PART_TOOLBUTTON_HOT_NW;
face = theme->getColor(ThemeColor::ButtonHotFace);
}
else {
nw = PART_TOOLBUTTON_LAST_NW;
face = theme->getColor(ThemeColor::ButtonNormalFace);
}
toolrc = getToolBounds(index++);
toolrc.offset(-getBounds().x, -getBounds().y);
theme->draw_bounds_nw(g, toolrc, nw, face);
// Draw the tool icon
she::Surface* icon = theme->get_toolicon(tool->getId().c_str());
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
}
}
}
示例11: draw_color_button
void draw_color_button(ui::Graphics* g,
const Rect& rc, const app::Color& color,
bool hot, bool drag)
{
SkinTheme* theme = (SkinTheme*)ui::CurrentTheme::get();
int scale = ui::guiscale();
// Draw background (the color)
draw_color(g,
Rect(rc.x+1*scale,
rc.y+1*scale,
rc.w-2*scale,
rc.h-2*scale), color);
// Draw opaque border
{
int parts[8] = {
PART_COLORBAR_0_NW,
PART_COLORBAR_0_N,
PART_COLORBAR_1_NE,
PART_COLORBAR_1_E,
PART_COLORBAR_3_SE,
PART_COLORBAR_2_S,
PART_COLORBAR_2_SW,
PART_COLORBAR_0_W
};
theme->draw_bounds_array(g, rc, parts);
}
// Draw hot
if (hot) {
theme->draw_bounds_nw(g,
gfx::Rect(rc.x, rc.y, rc.w, rc.h-1 - 1*scale),
PART_COLORBAR_BORDER_HOTFG_NW);
}
}
示例12: onPaint
void ToolBar::onPaint(ui::PaintEvent& ev)
{
gfx::Rect bounds = getClientBounds();
Graphics* g = ev.getGraphics();
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
gfx::Color normalFace = theme->getColor(ThemeColor::ButtonNormalFace);
gfx::Color hotFace = theme->getColor(ThemeColor::ButtonHotFace);
ToolBox* toolbox = App::instance()->getToolBox();
ToolGroupList::iterator it = toolbox->begin_group();
int groups = toolbox->getGroupsCount();
Rect toolrc;
g->fillRect(theme->getColor(ThemeColor::TabSelectedFace), bounds);
for (int c=0; c<groups; ++c, ++it) {
ToolGroup* tool_group = *it;
Tool* tool = m_selectedInGroup[tool_group];
gfx::Color face;
int nw;
if (UIContext::instance()->settings()->getCurrentTool() == tool ||
m_hotIndex == c) {
nw = PART_TOOLBUTTON_HOT_NW;
face = hotFace;
}
else {
nw = c >= 0 && c < groups-1 ? PART_TOOLBUTTON_NORMAL_NW:
PART_TOOLBUTTON_LAST_NW;
face = normalFace;
}
toolrc = getToolGroupBounds(c);
toolrc.offset(-getBounds().x, -getBounds().y);
theme->draw_bounds_nw(g, toolrc, nw, face);
// Draw the tool icon
she::Surface* icon = theme->get_toolicon(tool->getId().c_str());
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
}
// Draw button to show tool configuration
toolrc = getToolGroupBounds(ConfigureToolIndex);
toolrc.offset(-getBounds().x, -getBounds().y);
bool isHot = (m_hotIndex == ConfigureToolIndex);
theme->draw_bounds_nw(g,
toolrc,
isHot ? PART_TOOLBUTTON_HOT_NW:
PART_TOOLBUTTON_LAST_NW,
isHot ? hotFace: normalFace);
she::Surface* icon = theme->get_toolicon("configuration");
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
// Draw button to show/hide mini editor
toolrc = getToolGroupBounds(MiniEditorVisibilityIndex);
toolrc.offset(-getBounds().x, -getBounds().y);
isHot = (m_hotIndex == MiniEditorVisibilityIndex ||
App::instance()->getMainWindow()->getMiniEditor()->isMiniEditorEnabled());
theme->draw_bounds_nw(g,
toolrc,
isHot ? PART_TOOLBUTTON_HOT_NW:
PART_TOOLBUTTON_LAST_NW,
isHot ? hotFace: normalFace);
icon = theme->get_toolicon("minieditor");
if (icon) {
g->drawRgbaSurface(icon,
toolrc.x+toolrc.w/2-icon->width()/2,
toolrc.y+toolrc.h/2-icon->height()/2);
}
}