Calling OSX API similar to calling Win32 API?

T

Thomas Thomassen

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?

Example: get the handle for a window and change its frame style.
 
S

Skye Shaw!@#$

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
 
T

Thomas Thomassen

With the SketchUp Ruby API one can create your own custom windows -
called WebDialogs - which is simply a window with an embedded browser
control where you create your UI in HTML+JS+CSS.

The only control one has over these windows via the API is this:
http://code.google.com/apis/sketchup/docs/ourdoc/webdialog.html

It does not allow you to change the window style. But I wanted to make
toolwindows and that I managed to do under Windows by using the Win32
API thanks to Ruby's Win32 module. (I send my own SetWindowLong message
after sniffing out the window's handle.)

So what I'm trying to do is modify windows which hasn't been created
directly by me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top