thomthom / SKUI

Ruby wrapper of classes that maps to GUI controls in SketchUp's UI::WebDialogs
MIT License
26 stars 14 forks source link

Added SKUI::ImageButton #80

Open GWydouw opened 10 years ago

GWydouw commented 10 years ago

Image button with images for default and active state (mouse down)

Methods: ImageButton.file= ImageButton.activestatefile=

Event: ImageButton.on( :click ) {|control| ... }

example toggle image button: @@active_toggle = false img_active = SKUI::ImageButton.new(css_path + "icons/off_red.png",css_path + "/icons/off_red_pushed.png") img_active.on( :click ) { if @@active_toggle == false img_active.file = (css_path + "/icons/on_green.png") img_active.activestatefile = (css_path + "/icons/on_green_pushed.png") @@active_toggle = true else img_active.file = (css_path + "/icons/off_red.png") img_active.activestatefile = (css_path + "/icons/off_red_pushed.png") @@active_toggle = false end } @@skui.add_control(img_active)

thomthom commented 10 years ago

I got an issue open #32 to review events for controls.

Having a click event for Image, or any control would be useful.

I am however wondering what the purpose for this control is? One can customize visual style via CSS, if you want buttons that look different.

Just trying to keep the number of controls simple and generic. Can you describe the use scenario for this?

thomthom commented 10 years ago

I'm just wondering if it's enough to add events to the Image class. And then you can for instance make a sub-class where you set the different images. (Though I need to #81 for that.)

GWydouw commented 10 years ago

Thomas,

I made a short movie to demonstrate the use of it. The dialog is made completely with SKUI, all the icons are ImageButtons.

Guy

architectuurburo wydouw bvba architect Guy Wydouw

Hoevensebaan 238 | 2950 Kapellen T 03/327.95.67 | F 03/327.95.68 | GSM 0496/26.25.87 E-mail guy@wydouw.be | www.wydouw.be

Op 26-jan.-2014, om 20:27 heeft Thomas Thomassen notifications@github.com het volgende geschreven:

I got an issue open #32 to review events for controls.

Having a click event for Image, or any control would be useful.

I am however wondering what the purpose for this control is? One can customize visual style via CSS, if you want buttons that look different.

Just trying to keep the number of controls simple and generic. Can you describe the use scenario for this?

— Reply to this email directly or view it on GitHub.

thomthom commented 10 years ago

Right, I think I'd prefer to modify the existing controls to allow subclassing. As this is practically a button - or an image with events. I want to avoid hybrids. Give me a couple of days to tweak it.