LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2009, 10:59 PM   #1
gafferuk
LQ Newbie
 
Registered: Mar 2009
Posts: 18

Rep: Reputation: 0
GTKMM custom widget draw standard button style background


hi ive created a custom GTKMM widget which i wish to look like a table of buttons like 5 by 5.

how do i draw standard button backgrounds in my widget?

Thanks for your time.
Paul.
 
Old 03-30-2009, 11:48 AM   #2
gafferuk
LQ Newbie
 
Registered: Mar 2009
Posts: 18

Original Poster
Rep: Reputation: 0
Ive came up with this:
Code:
Gdk::Cairo::set_source_pixmap(cr, get_style()->get_bg_pixmap(Gtk::STATE_NORMAL), 0.,0.);
cr->paint();
It does not work, my app shuts down. but people here can get an idea of what im after.

How do you paint standard button backgrounds? also like hover, mouse down etc.

thanks.
 
Old 03-31-2009, 02:21 AM   #3
gafferuk
LQ Newbie
 
Registered: Mar 2009
Posts: 18

Original Poster
Rep: Reputation: 0
bump...
 
Old 03-31-2009, 03:21 AM   #4
gafferuk
LQ Newbie
 
Registered: Mar 2009
Posts: 18

Original Poster
Rep: Reputation: 0
im now trying the following but does not work, any ideas?

i have the following but does not work, any ideas?

Code:
bool MyWidget::on_expose_event(GdkEventExpose *event)
{

Glib::RefPtr<Gdk::Pixmap> pixmap = get_style()->get_bg_pixmap(Gtk::STATE_NORMAL);
        get_window()->draw_drawable
        (
                get_style()->get_fg_gc(get_state()),
  pixmap,
                event->area.x, event->area.y,
                event->area.x, event->area.y,
                event->area.width, event->area.height
        );
       
        return false;
}
 
Old 04-01-2009, 10:23 AM   #5
gafferuk
LQ Newbie
 
Registered: Mar 2009
Posts: 18

Original Poster
Rep: Reputation: 0
bump lol.

is it possible?

my app looks ugly, i need to paint button backgrounds.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mplayer/xine hate kde widget style based pixmap antro-xlove Linux - Desktop 3 09-01-2008 01:09 AM
LXer: Standard Widget Graphics for Eclipse LXer Syndicated Linux News 0 04-07-2008 10:30 PM
KControl doesn't see Plastik widget style techsimian Linux - Software 1 02-16-2005 07:10 PM
Standard output - Tcl/Tk widget liguorir Linux - Software 0 06-03-2004 01:15 PM
GTKmm custom cellrenderer... how? Ohmu Programming 0 02-26-2004 01:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration