forked from yvt/xtbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathXTBButtonMenuItem.cpp
48 lines (33 loc) · 918 Bytes
/
XTBButtonMenuItem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// XTBButtonMenuItem.cpp
// XTBook
//
// Created by Kawada Tomoaki on 5/19/11.
// Copyright 2011 Nexhawks. All rights reserved.
//
#include "XTBButtonMenuItem.h"
#include <tcw/twBaseSkin.h>
XTBButtonMenuItem::XTBButtonMenuItem(){
}
XTBButtonMenuItem::XTBButtonMenuItem(const std::wstring& str){
m_text=str;
}
void XTBButtonMenuItem::render(twDC *dc, const twRect& rt,
bool selected){
XTBActionMenuItem::render(dc, rt, selected);
twColor fgColor;
fgColor=twRGB(255, 255, 255);
if(selected){
fgColor=tw_curSkin->getSelectionTextColor();
}
if(!isEnable())
fgColor=twRGB(32, 32, 32);
m_font->render(dc, fgColor, twPoint(rt.x+5, rt.y+2), m_text);
m_font->render(dc, fgColor, twPoint(rt.x+5, rt.y+2), m_text);
}
int XTBButtonMenuItem::getHeight() const{
return m_font->measure(m_text).h+4;
}
int XTBButtonMenuItem::getMinWidth() const{
return m_font->measure(m_text).w+7;
}