FLTK - adding images
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: FLTK - adding images

  1. #1
    Join Date
    Jan 2009
    Location
    UK
    Posts
    1

    FLTK - adding images

    Hi folks,

    Im creating a simple calculator in cpp using Dev-C++ and the FLTK gui toolkit. Iwant to adda background image to the main window and several other images to buttons within the window however i am unsure how and where to implement the code. The code for the layout is as follows:
    Code:
    #include <FL/Fl.H>
    #include <FL/Fl_Window.H>
    #include <FL/Fl_Box.H>
    #include <FL/Fl_Button.H>
    #include <FL/Fl_Shared_Image.H>
    
    int main(int argc, char ** argv)
    {
    
        Fl_Window *window;
        window = new Fl_Window(623, 464);
    
        //Buttons
        Fl_Button *n0;
        Fl_Button *n1;
        Fl_Button *n2;
        Fl_Button *n3;
        Fl_Button *n4;
        Fl_Button *n5;
        Fl_Button *n6;
        Fl_Button *n7;
        Fl_Button *n8;
        Fl_Button *n9;
        Fl_Button *plus;
        Fl_Button *minu;
        Fl_Button *mult;
        Fl_Button *divi;
        Fl_Button *poin;
        Fl_Button *plmi;
        	
        //Button Params'
        n0 = new Fl_Button(453, 359, 60, 60, "0");
        n0->type(FL_NORMAL_BUTTON);
        n0->shortcut('0');
        n1 = new Fl_Button(388, 294, 60, 60, "1");
        n1->type(FL_NORMAL_BUTTON);
        n1->shortcut('1');
        n2 = new Fl_Button(453, 294, 60, 60, "2");
        n2->type(FL_NORMAL_BUTTON);
        n2->shortcut('2');
        n3 = new Fl_Button(518, 294, 60, 60, "3");
        n3->type(FL_NORMAL_BUTTON);
        n3->shortcut('3');
        n4 = new Fl_Button(388, 229, 60, 60, "4");
        n4->type(FL_NORMAL_BUTTON);
        n4->shortcut('4');
        n5 = new Fl_Button(453, 229, 60, 60, "5");
        n5->type(FL_NORMAL_BUTTON);
        n5->shortcut('5');
        n6 = new Fl_Button(518, 229, 60, 60, "6");
        n6->type(FL_NORMAL_BUTTON);
        n6->shortcut('6');
        n7 = new Fl_Button(388, 164, 60, 60, "7");
        n7->type(FL_NORMAL_BUTTON);
        n7->shortcut('7');
        n8 = new Fl_Button(453, 164, 60, 60, "8");
        n8->type(FL_NORMAL_BUTTON);
        n8->shortcut('8');
        n9 = new Fl_Button(518, 164, 60, 60, "9");
        n9->type(FL_NORMAL_BUTTON);
        n9->shortcut('9');
        plus = new Fl_Button(303, 359, 60, 60, "+");
        plus->type(FL_NORMAL_BUTTON);
        plus->shortcut('+');
        minu = new Fl_Button(303, 294, 60, 60, "-");
        minu->type(FL_NORMAL_BUTTON);
        minu->shortcut('-');
        mult = new Fl_Button(238, 359, 60, 60, "x");
        mult->type(FL_NORMAL_BUTTON);
        mult->shortcut('*');
        divi = new Fl_Button(238, 294, 60, 60, "/");
        divi->type(FL_NORMAL_BUTTON);
        divi->shortcut('/');
        
        window->end();
        window->show(argc, argv);
    
        return(Fl::run());
    }
    The images are png's but I have included the Fl_Shared_Image library although there is an Fl_PNG_Image library also.

    Would be most greatful if some1 could tell me how i should go about adding the images to the layout.

    Thanks

    Sol
    Last edited by Andreas Masur; January 13th, 2009 at 12:56 PM. Reason: Added code tags...

  2. #2
    Join Date
    Feb 2005
    Location
    "The Capital"
    Posts
    5,306

    Re: FLTK - adding images

    You are more likely to get help for FLTK on their forums/support or mailing lists whichever exist. If you're lucky then someone here might have an experience with that toolkit and bump into your thread.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center