Example #1
0
void hCheckBox::draw(void)
// Corrected bug: did'nt work correctly with another background color than the default
{	
	if(varType != HGUI_NO_VAR)
		syncWithVar();
	
    hGui * gui = hGui::getInstance();
	
    ofFill();
    if(data->selected == false) {
		if(backgroundColor != -1)
			hSetHexColor(backgroundColor);
		else hSetHexColor(gui->fillColor);
		ofRect(x, y, w, h);
	}
    else {
        if(data->selectColor != -1)
			hSetHexColor(data->selectColor);
        else hSetHexColor(gui->checkBoxColor);
		ofRect(x, y, w, h);
    }

	hSetHexColor(gui->borderColor);
	hFrameRect(x, y, w, h);
}
Example #2
0
void hLabel::draw(void)
{
    hGui * gui = hGui::getInstance();

	if(data->label.size() > 0) {
		int yy = y;

		if(data->selected) {
			hSetHexColor(gui->labelSelColor);
			hPaintRect(x-1, y, w, h+2);
			
			hSetHexColor(gui->borderColor);
			hFrameRect(x-1, y, w, h+2);
			
			yy += 2;
			hSetHexColor(gui->labelSelTextColor);
		}
		
		else hSetHexColor(gui->textColor);
		
        if(fixedMode == true) {
			hDrawString(gui->ffont, data->label, x+4, yy+gui->ftextHeight);
		}
		else {
			if(warningMode == true){
				 hSetHexColor(gui->warningColor);
				 hDrawString(gui->font, data->label, x+4, yy+gui->textHeight);
			}
			else hDrawString(gui->font,  data->label, x+4, yy+gui->textHeight);
		}
    }
}
Example #3
0
void hDialog::draw(void)
{
    hGui * gui = hGui::getInstance();

    int hh;

    if((confirmButton != NULL) || (msgTextArea != NULL))
		hh = (h - gui->buttonHeight) + 1;
    else hh = h;

    // Draw the dialog background
    if(visibleBackground){
        if(backgroundColor != -1)
			hSetHexColor(backgroundColor);
        else hSetHexColor(gui->backgroundColor);
        hPaintRect(x, y, w, hh);
    }

    // Draw top bar content
    hSetHexColor(dialogColor);
    hPaintRect(x, y, w, gui->checkBoxSize);

    // Draw all widgets inside the dialog
    int size = widgets.size();
    for(int i = 0; i < size; ++i)
        widgets[i]->draw();

	//  Frames have to be done last, in case they are recovered by something else
    // Draw the dialog frame
    if(visibleBorder){
        hSetHexColor(gui->borderColor);
        hFrameRect(x, y, w, hh);
    }

    // Draw top bar frame
    hSetHexColor(gui->borderColor);
    hFrameRect(x, y, w, gui->checkBoxSize);

#if defined( __WIN32__ ) || defined( _WIN32 )
    hSetHexColor(dialogColor);
    hLine(x, y+gui->checkBoxSize-1, x+w-gui->checkBoxSize-1, y+gui->checkBoxSize-1);
#endif
}
Example #4
0
void hScrollBar::draw(void)
{
    if(linkedListBox == NULL) return;

    int numItems  = linkedListBox->getNumWidgets();
    int numData   = linkedListBox->getNumData();

    if((numData - numItems) > 0)
    {
        hGui * gui = hGui::getInstance();

        int hh  = gui->scrollHandleHeight;
        int yy  = (y + position) - (hh/2);

/* NO MORE NECESSARY!
#if defined( __WIN32__ ) || defined( _WIN32 )
        hh-=1;
#endif
*/
        hSetHexColor(gui->fillColor);
        hPaintRect(x+1, y, w-2, h);

        hSetHexColor(gui->scrollHandleColor);
        hPaintRect(x+1, yy, w-2, hh);

        hSetHexColor(gui->borderColor);
        hFrameRect(x, y, w, h);
        hFrameRect(x+2, yy, w-4, hh);

        // Enable the drawing of the other small widgets
        linkedListBox->incButton->setEnabled(true);
        linkedListBox->decButton->setEnabled(true);
	} // (numData - numItems) > 0)
    else {
        // Disable the drawing of the other small widgets
        linkedListBox->incButton->setEnabled(false);
        linkedListBox->decButton->setEnabled(false);
    }
}
Example #5
0
void hTScrollBar::draw(void)
// WARNING: draw it only if usable
{
    if(linkedTextArea == NULL) return;

    int numItems = linkedTextArea->maxLines;
    int numData  = linkedTextArea->lines.size();

    if((numData - numItems) > 0) {
        hGui * gui = hGui::getInstance();

        int hh  = gui->scrollHandleHeight;
        int yy  = (y + position) - (hh/2);
/*
#if defined( __WIN32__ ) || defined( _WIN32 )
        hh-=1;
#endif
*/
        hSetHexColor(gui->fillColor);
        hPaintRect(x+1, y, w-2, h);

        hSetHexColor(gui->scrollHandleColor);
        hPaintRect(x+1, yy, w-2, hh);

        hSetHexColor(gui->borderColor);
        hFrameRect(x, y, w, h);
        hFrameRect(x+2, yy, w-4, hh);

        // Enable the drawing of the other small widgets
        linkedTextArea->incButton->setEnabled(true);
        linkedTextArea->decButton->setEnabled(true);
    }// (numData - numItems) > 0)
    else {
        // Disable the drawing of the other small widgets
        linkedTextArea->incButton->setEnabled(false);
        linkedTextArea->decButton->setEnabled(false);
    }
}
Example #6
0
void hWidget::draw(void)
{ 
    hGui * gui = hGui::getInstance();
	
    if(visibleBackground){
        if(backgroundColor != -1)
			hSetHexColor(backgroundColor);
        else hSetHexColor(gui->backgroundColor);
        hPaintRect(x, y, w, h);
    }
	
    if(visibleBorder){
        hSetHexColor(gui->borderColor);
        hFrameRect(x, y, w, h);
    }
}