On 02/12/10 10:16, Dmitrij K wrote:
> Hi all!
>
> How I can have got access to the `ScrollBar' in a popup menu in the
> `InputBrowser', for change a style for it's?
>
> Thanks.
So whilst I'm aware this issue was solved through using 1.3.x, the below
snippet should achieve what the OP was asking for, using 2.x's themes.
Perhaps it might be useful for future reference for someone else
------------------
// compile with fltk2-config --compile scrolltheme.cxx
#include <fltk/Style.h>
#include <fltk/Window.h>
#include <fltk/Browser.h>
#include <fltk/Button.h>
#include <fltk/run.h>
using namespace fltk;
bool current_theme = 0;
bool default_theme(){
Style* s;
if((s = Style::find("scrollbar"))){
s->color(1000);
s->highlight_color(1);
s->buttoncolor(9);
s->scrollbar_width(10);
}
return true;
}
bool changed_theme(){
Style* s;
if((s = Style::find("scrollbar"))){
s->color(1);
s->buttoncolor(2);
}
return true;
}
void buttonCB(Widget* w, void*){
current_theme ^= 1;
if(current_theme){
fltk::reset_theme();
fltk::theme(changed_theme);
fltk::reload_theme();
} else {
fltk::reset_theme();
fltk::theme(default_theme);
fltk::reload_theme();
}
}
int main(){
fltk::theme(default_theme);
Window win(180, 120, "Style");
win.begin();
Browser browser(10, 10, 160, 40,"");
Button button(10, 60, 160, 50, "Change theme");
win.end();
browser.add("test/one", 0, 0);
browser.add("test/two", 0, 0);
browser.add("temp/one", 0, 0);
browser.add("temp/two", 0, 0);
browser.add("foo", 0, 0);
button.callback(buttonCB);
win.resizable(browser);
win.show();
return run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk