TitledToggleButton::TitledToggleButton(string title) { _titleView = new TextRenderView(CGRect(22,-10,100,50), CGColor(0.0,0.0,0.0,1.0), title); _toggleButton = new ToggleButton(); _toggleButton->setBounds(CGRect(0,0,20,20)); this->addSubView(_titleView); this->addSubView(_toggleButton); }
TabBarViewController::TabBarViewController() : ViewController() { _tabCount = 0; View * masterView = getMasterView(); CGColor temp = CGColor(); temp.setColorWithHSB(0.0, 0.0, 0.0); masterView->setBackgroundColor(temp); }
CGFrame::CGFrame(int x, int y, int width, int height, CGWidget *parent): CGWidget(x,y,width,height,parent), m_frameWidth(1), m_frameColor(255) { setBackgroundColor(CGColor(0)); m_border=m_frameWidth+1; setPropsFromDefaultPalette(); }
void ProgressBar::draw() { CGRect gB = this->getGlobalBounds(); drawRectWithColor(gB, this->getColor()); // draw the progress bar rectangle drawRectWithColor(CGRect(gB.getX(),gB.getY(),gB.getWidth()*_percentComplete, gB.getHeight()), *_foregroundColor); // draw a border drawBorderWithColor(gB, CGColor(0.0,0.0,0.0,1.0)); // no subviews to call draw on }
void CGSampleView::OnInitialUpdate() { CView::OnInitialUpdate(); // TODO: 여기에 특수화된 코드를 추가 및/또는 기본 클래스를 호출합니다. { // G3D 뷰 초기화 데이타를 설정한다. CG3DViewInitData initData; { // G3D가 그려질 윈도우 핸들을 연결한다. initData.SetWnd(GetSafeHwnd()); // G3D에 연결될 device context 설정 initData.SetDC(&m_dc); // G3D 뷰의 배경색 initData.SetBackgroundColor(CGColor(0.8f, 0.8f, 0.8f)); // G3D 뷰의 채우기 모드 initData.SetFillMode(CG3DViewInitData::eFillModeSolid); } // G3D 뷰에 G3D 뷰 레이어를 추가한다.(GVIEWLAYER_MAIN는 필수) { CG3DViewLayer *pViewLayer = new CG3DViewLayer; pViewLayer->SetName(GVIEWLAYER_MAIN); // 레이어에 연결될 G3DDB 설정 pViewLayer->SetDB(&m_3DDB); // 뷰 초기화 데이타에 레이어를 추가 initData.AddViewLayer(pViewLayer); } m_3DView.InitView(initData); } }
void TextInputView::draw() { // Draw the rect drawRectWithColor(this->getGlobalBounds(), this->getColor()); // Split up and draw the text based on the size of the rectangle // _lines.empty(); // start anew _lines.resize(0); string temp = ""; int cnt = 0; const int maxChars = getMaxCharsPerLine(); const int maxLines = getMaxLines(); for (string::iterator it = _content.begin(); it != _content.end(); ++it) { if (_lines.size() >= maxLines ) { break; } temp += (*it); cnt++; if (cnt >= maxChars) { _lines.push_back(temp); temp.clear(); cnt = 0; } } // add a cursor if has focus // Currently the cursor is always at the end, // this will change when we make it so that the // position can be set with a mouse click or the // arrow keys if ( getHasFocus() ) { if (temp.length() > 0) { temp += "~"; // there is more to push, so stick the cursor on the last line } // hell, this seems to work okay visually... } _lines.push_back(temp); // push the rest CGRect bounds = this->getGlobalBounds(); int x = bounds.getX() + 5; int y = bounds.getY() + 14; for(vector<string>::iterator it = _lines.begin(); it != _lines.end(); ++it) { drawStringWithColorAndFormat( (*it), this->getTextColor(), CGPoint( x, y), "small fixed"); y += this->getLineSpacing(); } // Draw the border if (getHasFocus()) drawBorderWithColor(bounds, CGColor(0.0,0.0,0.6,1.0)); else drawBorderWithColor(bounds, CGColor(0.0,0.0,0.0,1.0)); // Draw the subviews this->callDrawOnSubViews(); }