gboolean
on_color_sample_draw_area_expose_event (GtkWidget       *widget,
                                        GdkEventExpose  *event,
                                        gpointer         user_data)
{
	GdkWindow* window = widget->window;
	GdkGC* gc = gdk_gc_new(window);
	GdkPixmap* pixmap;

	pixmap = LoadPixmap(GetTopWidget(widget), NULL, "color_sample.xpm");
	DrawPixmap(window, gc, 0, 0, pixmap, NULL);
	FreePixmap(pixmap, NULL);

	gdk_gc_unref(gc);
	return TRUE;
}
Example #2
0
void CGifItem::init(const QString& fileName,const QSize& size,bool bClip )
{
	m_oImageList.clear();
	m_nCurrFrame = 0;
	m_nTimerID = 0;
	m_fileName = fileName;
	QSize tmp(0,0);
	m_fileSize = tmp;
	m_bClip = bClip;

	if (size.isValid())
	{
		m_fileSize = size;
	}

	setFlags(ItemIsSelectable | ItemIsFocusable);
	LoadPixmap();

}
Example #3
0
void DrawQualityDrawingArea(GtkWidget* window, GtkWidget* area)
{
	GdkWindow* area_window = area->window;
	GdkGC* gc = gdk_gc_new(window->window);
	GdkPixmap* pixmap;
	GdkBitmap* mask;
	int quality;
	const gchar* button_name[] =
	{
		"quality_high_button",
		"quality_standard_button",
		"quality_draft_button",
		"quality_custom_button",
		NULL
	};
	const gchar* xpm_name[] = 
	{
		"quality_best.xpm",
		"quality_best_color.xpm",
		"quality_normal.xpm",
		"quality_normal_color.xpm",
		"quality_draft.xpm",
		"quality_draft_color.xpm",
		"quality_custom.xpm",
		"quality_custom_color.xpm"
	};

	quality = GetActiveButtonIndex(window, button_name, 0) << 1;

	if( !IsGrayPrint(g_main_window) )
		quality++;

	pixmap = LoadPixmap(window, &mask, xpm_name[quality]);
	DrawPixmap(area_window, gc,
			 QUALITY_PIXMAP_X, QUALITY_PIXMAP_Y, pixmap, mask);
	FreePixmap(pixmap, mask);

	gdk_gc_unref(gc);
}
Example #4
0
void DrawPrinterDrawingArea(GtkWidget* window, GtkWidget* area)
{
	GdkWindow* area_window = area->window;
	GdkPixmap* pixmap;
	GdkBitmap* mask;
	gchar* xpm_name;
	gchar* key_str;
	gchar* message_str;
	GdkGC* gc = gdk_gc_new(window->window);

	// Background pattern.
	pixmap = LoadPixmap(window, NULL, "bg.xpm");
	DrawPixmap(area_window, gc, 0, 0, pixmap, NULL);
	FreePixmap(pixmap, NULL);

	// Printer body.
	pixmap = LoadPixmap(window, &mask, "printer.xpm");
	DrawPixmap(area_window, gc,
				 BODY_PIXMAP_X, BODY_PIXMAP_Y, pixmap, mask);
	FreePixmap(pixmap, mask);

	// Paper set and out.
	// Right guide(Paper set).
	{
		gchar* in_xpm_name;
		gchar* out_xpm_name;
		gchar* guide_xpm_name;
		short supply = GetCurrentnValue(CNCL_MEDIASUPPLY);
#ifdef	SUPPORT_BANNER
		short media = GetCurrentnValue(CNCL_MEDIATYPE);
#endif
		short size = GetCurrentnValue(CNCL_PAPERSIZE);

		if( supply == CND_SUPPLY_MANUAL )
			in_xpm_name = "in_m.xpm";
		else
			in_xpm_name = NULL;

#ifdef	SUPPORT_BANNER
		if( media == CND_MEDIA_BANNER )
			guide_xpm_name = "guide_a3.xpm";
		else
#endif
			guide_xpm_name = NULL;

		if( GetPaperWidth(size) > GetPaperHeight(size) )
		{
			if( in_xpm_name == NULL )
				in_xpm_name = "in_l.xpm";
			if( guide_xpm_name == NULL )
				guide_xpm_name = "guide_a2.xpm";
			out_xpm_name = "out_ph.xpm";
		}
		else
		{
			if( in_xpm_name == NULL )
				in_xpm_name = "in_p.xpm";
			if( guide_xpm_name == NULL )
				guide_xpm_name = "guide_a1.xpm";
			out_xpm_name = "out_pv.xpm";
		}

		pixmap = LoadPixmap(window, &mask, in_xpm_name);
		DrawPixmap(area_window, gc,
				 BODY_PIXMAP_X, BODY_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);

		pixmap = LoadPixmap(window, &mask, out_xpm_name);
		DrawPixmap(area_window, gc,
				 BODY_PIXMAP_X, BODY_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);

		pixmap = LoadPixmap(window, &mask, guide_xpm_name);
		DrawPixmap(area_window, gc,
				 R_GUIDE_PIXMAP_X, R_GUIDE_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);
	}


	// Left guide(Thickness).
	{
		short thick = GetCurrentnValue(CNCL_MESS_THICK);

		switch( thick )
		{
		case CND_TMESSAGE_UPPER2:
			xpm_name = "guide_b1.xpm";
			break;
		default:
			xpm_name = "guide_b3.xpm";
			break;
		}

		pixmap = LoadPixmap(window, &mask, xpm_name);
		DrawPixmap(area_window, gc,
			 L_GUIDE_PIXMAP_X, L_GUIDE_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);
	}

	// Media type message.
	message_str = GetCurrentString(CNCL_MEDIATYPE);

	DrawString(area_window, g_main_font, gc,
			 MEDIA_TEXT_X, MEDIA_TEXT_Y, message_str);

	{
		if( IsGrayPrint(g_main_window) )
		{
			xpm_name = "print_mono.xpm";
			key_str = "print_mono_message";
		}
		else
		{
			xpm_name = "print_color.xpm";
			key_str = "print_color_message";
		}

#ifndef	NO_PRINT_COLOR_ICON
		// Print color icon.
		pixmap = LoadPixmap(window, &mask, xpm_name);
		DrawPixmap(area_window, gc,
				 COLOR_PIXMAP_X, COLOR_PIXMAP_Y, pixmap, mask);
		FreePixmap(pixmap, mask);
#endif	
		// Color type message.
		message_str = LookupText(g_keytext_list, key_str);
		DrawString(area_window, g_main_font, gc,
				 COLOR_TEXT_X, COLOR_TEXT_Y, message_str);
	}

	gdk_gc_unref(gc);
}
Example #5
0
void UIListBtnType::Init()
{
    QFontMetrics fm(m_fontActive->face);
    QSize sz1 = fm.size(Qt::SingleLine, "XXXXX");
    fm = QFontMetrics(m_fontInactive->face);
    QSize sz2 = fm.size(Qt::SingleLine, "XXXXX");
    m_itemHeight = QMAX(sz1.height(), sz2.height()) + (int)(2 * m_itemMargin);

    if (m_showScrollArrows) 
    {
        LoadPixmap(m_upArrowRegPix, "uparrow-reg");
        LoadPixmap(m_upArrowActPix, "uparrow-sel");
        LoadPixmap(m_dnArrowRegPix, "dnarrow-reg");
        LoadPixmap(m_dnArrowActPix, "dnarrow-sel");

        m_arrowsRect = QRect(0, m_rect.height() - m_upArrowActPix.height() - 1,
                             m_rect.width(), m_upArrowActPix.height());
    }
    else 
        m_arrowsRect = QRect(0, 0, 0, 0);
        
    m_contentsRect = QRect(0, 0, m_rect.width(), m_rect.height() -
                           m_arrowsRect.height() - 2 * m_itemMargin);

    m_itemsVisible = 0;
    int y = 0;
    while (y <= m_contentsRect.height() - m_itemHeight) 
    {
        y += m_itemHeight + m_itemSpacing;
        m_itemsVisible++;
    }

    LoadPixmap(m_checkNonePix, "check-empty");
    LoadPixmap(m_checkHalfPix, "check-half");
    LoadPixmap(m_checkFullPix, "check-full");
    
    LoadPixmap(m_arrowPix, "arrow");

    QImage img(m_rect.width(), m_itemHeight, 32);
    img.setAlphaBuffer(true);

    for (int y = 0; y < img.height(); y++) 
    {
        for (int x = 0; x < img.width(); x++) 
        {
            uint *p = (uint *)img.scanLine(y) + x;
            *p = qRgba(0, 0, 0, m_itemRegAlpha);
        }
    }

    {
        float rstep = float(m_itemRegEnd.red() - m_itemRegBeg.red()) / 
                      float(m_itemHeight);
        float gstep = float(m_itemRegEnd.green() - m_itemRegBeg.green()) / 
                      float(m_itemHeight);
        float bstep = float(m_itemRegEnd.blue() - m_itemRegBeg.blue()) / 
                      float(m_itemHeight);

        m_itemRegPix = QPixmap(img);
        QPainter p(&m_itemRegPix);

        float r = m_itemRegBeg.red();
        float g = m_itemRegBeg.green();
        float b = m_itemRegBeg.blue();
        for (int y = 0; y < img.height(); y++) 
        {
            QColor c((int)r, (int)g, (int)b);
            p.setPen(c);
            p.drawLine(0, y, img.width(), y);
            r += rstep;
            g += gstep;
            b += bstep;
        }
        p.setPen(black);
        p.drawLine(0, 0, 0, img.height() - 1);
        p.drawLine(0, 0, img.width() - 1, 0);
        p.drawLine(0, img.height() - 1, img.width() - 1, img.height() - 1);
        p.drawLine(img.width() - 1, 0, img.width() - 1, img.height() - 1);
        p.end();
    }   

    {
        float rstep = float(m_itemSelEnd.red() - m_itemSelBeg.red()) /
                      float(m_itemHeight);
        float gstep = float(m_itemSelEnd.green() - m_itemSelBeg.green()) / 
                      float(m_itemHeight);
        float bstep = float(m_itemSelEnd.blue() - m_itemSelBeg.blue()) /
                      float(m_itemHeight);

        m_itemSelInactPix = QPixmap(img);
        QPainter p(&m_itemSelInactPix);

        float r = m_itemSelBeg.red();
        float g = m_itemSelBeg.green();
        float b = m_itemSelBeg.blue();
        for (int y = 0; y < img.height(); y++) 
        {
            QColor c((int)r, (int)g, (int)b);
            p.setPen(c);
            p.drawLine(0, y, img.width(), y);
            r += rstep;
            g += gstep;
            b += bstep;
        }
        p.setPen(black);
        p.drawLine(0, 0, 0, img.height() - 1);
        p.drawLine(0, 0, img.width() - 1, 0);
        p.drawLine(0, img.height() - 1, img.width() - 1, img.height() - 1);
        p.drawLine(img.width() - 1, 0, img.width() - 1, img.height() - 1);
        p.end();

        img.setAlphaBuffer(false);
        
        m_itemSelActPix = QPixmap(img);
        p.begin(&m_itemSelActPix);

        r = m_itemSelBeg.red();
        g = m_itemSelBeg.green();
        b = m_itemSelBeg.blue();
        for (int y = 0; y < img.height(); y++) 
        {
            QColor c((int)r, (int)g, (int)b);
            p.setPen(c);
            p.drawLine(0, y, img.width(), y);
            r += rstep;
            g += gstep;
            b += bstep;
        }
        p.setPen(black);
        p.drawLine(0, 0, 0, img.height() - 1);
        p.drawLine(0, 0, img.width() - 1, 0);
        p.drawLine(0, img.height() - 1, img.width() - 1, img.height() - 1);
        p.drawLine(img.width() - 1, 0, img.width() - 1, img.height() - 1);
        p.end();

    }

    if (m_itemList.count() > m_itemsVisible && m_showScrollArrows)
        m_showDnArrow = true;
    else
        m_showDnArrow = false;

    m_initialized = true;
}