Package: libwftk-0.7
Version: 0.7.1-5
Severity: normal
There are 3 ways to setup a picture in a setup button. I assume that it is
supposed to be equivalent given only for convenience. You can setup a
pushbutton via a resource name, a resource reference or a surface.
I browsed through the code and I discovered that in the third case there is
a scaling going on. However if you call the setUpPic() before the layout
manager (pack()) (BUG_TYPE == 1) there is no effect premasumably because the
widget has no size. The other methods are working correctly (BUG_TYPE == 0).
If you setUpPic() after the packing (BUG_TYPE == 3) there is an extra scaling
going
on that results into different visual effect than using the other type of
setUpPic() after the pack() (BUG_TYPE == 2)
To summarize:
BUG_TYPE set{Up|Down}Pic() before pack() Result
0 resource yes ok
2 resource no ok
1 surface yes nothing
3 surface no incorrect scaling
I can dig into it and produce a patch if there is sufficient interest.
--------------------------
#include <wftk/application.h>
#include <wftk/rootwindow.h>
#include <wftk/box.h>
#include <wftk/filler.h>
#include <wftk/pushbutton.h>
#define BUG_TYPE 3
using namespace wftk;
class MyApp : public Application {
private:
RootWindow *back;
PushButton *ok_b;
public:
MyApp(int argc, char** argv) : Application(argc, argv) {
back = new RootWindow(640, 480, 0, false, true, Surface(), 0, 0);
// These font resources are used by various gui elements,
// so you should always register text_font and button_font when
// using wftk
Font::registry.load("text_font","wf_opal.ttf, 17, 0xF0F0F0FF,
0x707070FF");
Font::registry.load("button_font","wf_opal.ttf, 16, 0xE0E0F0FF,
0x607f70EE");
ok_b = new PushButton("OK");
#if BUG_TYPE == 0 || BUG_TYPE == 2
Surface::registry.load("up", "button_idle.png");
Surface::registry.load("down", "button_pressed.png");
#elif BUG_TYPE == 1 || BUG_TYPE == 3
Surface *up = new Surface();
up->readFromFile("button_idle.png");
Surface *down = new Surface();
down->readFromFile("button_pressed.png");
#endif
Box *main_box = new Box(Box::LEFT_TO_RIGHT);
Box *left_box = new Box(Box::LEFT_TO_RIGHT);
Box *right_box = new Box(Box::TOP_TO_BOTTOM);
back->pack(main_box);
main_box->packBack(left_box);
main_box->packBack(right_box);
left_box->packBack(new Filler(Filler::HORIZONTAL));
right_box->packBack(new Filler(Filler::VERTICAL));
#if BUG_TYPE == 0
ok_b->setUpPic("up");
ok_b->setDownPic("down");
#elif BUG_TYPE == 1
ok_b->setUpPic(*up);
ok_b->setDownPic(*down);
#endif
right_box->packBack(ok_b);
#if BUG_TYPE == 2
ok_b->setUpPic("up");
ok_b->setDownPic("down");
#elif BUG_TYPE == 3
ok_b->setUpPic(*up);
ok_b->setDownPic(*down);
#endif
}
~MyApp() {
printf("MyApp destructor called\n");
}
};
int main(int argc, char **argv)
{
return MyApp(argc, argv).exec();
}
--------------------------
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.9
Locale: LANG=el_GR, LC_CTYPE=el_GR (charmap=ISO-8859-7)
Versions of packages libwftk-0.7 depends on:
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
ii libfreetype6 2.1.7-2.3 FreeType 2 font engine, shared lib
ii libgcc1 1:3.4.3-6 GCC support library
ii libpng12-0 1.2.8rel-1 PNG library - runtime
ii libsdl-mixer1 1.2.6-1 mixer library for Simple DirectMed
ii libsdl1.2debi 1.2.7+1.2.8cvs20041007-4.1 Simple DirectMedia Layer
ii libsigc++-1.2 1.2.5-4 type-safe Signal Framework for C++
ii libsmpeg0 0.4.5+cvs20030824-1 SDL MPEG Player Library - shared l
ii libstdc++5 1:3.3.5-8 The GNU Standard C++ Library v3
ii xlibmesa-gl [ 4.3.0.dfsg.1-10 Mesa 3D graphics library [XFree86]
ii zlib1g 1:1.2.2-3 compression library - runtime
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]