On Dec 28, 10:42*am, Thomas Thomassen <tho...@thomthom.net> wrote:
> I'm writing plugins for Google SketchUp using its Ruby API. I want to
> manipulate some windows from my script and under Windows I have this
> working by using the Win32 API.
>
> But how can one do this under OSX?
I've never used SketchUp, but I thought this was abstracted through
their API (just curious)? Are these non-SketchUp windows of native
applications?
This sounds like it could be solved by the AbstractFactory pattern:
http://en.wikipedia.org/wiki/Abstract_factory_pattern
though I can't say if it's the right approach without more info.
class OSXWindow
def title
#OSX native stuff
end
end
# class Win32Window...
class Window
def initialize
case PLATFORM #is there an arch-less variable for this?
when /darwin/
OSXWindow.new
when /win32/
Win32Window.new
else
raise "#{PLATFORM} is not supported"
end
end
w = Window.new
-Skye