I would like to have a splash screen at startup. I think it is a good
idea, because the application has to collect several informations and
detect some devices. This takes some time, so I want to show some progress
informations.
class SplashWindow
{
const int dx, dy;
char msg_text[255];
Fl_Window *win;
Fl_Box *logo_box;
Fl_Box *msg;
Fl_PNG_Image *logo;
protected:
void parse_events (void);
public:
SplashWindow(const char *logo_name=0);
~SplashWindow();
bool Show (const char *logo_name=0);
void Hide (void);
void Message (const char* fmt, ...);
};
I'm using the handling of the "current active group" from the code of
fl_message().
SplashWindow::SplashWindow (const char *logo_name)
: dx(320), dy(200), logo(0)
{
Fl_Group * prev_group = Fl_Group::current();
Fl_Group::current(0);
// ...
win = new Fl_Window((Fl::w()-dx)/2,(Fl::h()-dy)/2,dx,dy);
// ...add some widgets
win->end();
win->clear_border();
win->set_modal();
Fl_Group::current(prev_group);
}
Here is the function to show the splash screen. The loop with Fl::wait()
is inspired by fl_message() again.
bool SplashWindow::Show (const char *logo_name)
{
Fl_Widget *o;
if ( logo_name )
{
if ( logo ) delete logo;
logo = new Fl_PNG_Image(logo_name);
logo_box->image(logo);
logo_box->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER|FL_ALIGN_CLIP);
}
win->show();
while ( (o=Fl::readqueue())!=0 )
Fl::wait();
return true;
}
I have two problems now. This code doesn't display the splash screen. It
is shown with the first fl_message() or at the time the application
reaches fl::run().
How do I display the windows at the time Show() is called?
A second problem is the logo. I load a truecolor PNG image. This image has
some dithering pixels inside. I've tried Fl::visual(FL_RGB) in front all
all other fltk calls, but without success. Any tips?
Thanx in advance.
--
Email: Joerg Desch <jd DOT vvd AT web DOT de>
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk