[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Questions about the system
From: |
Uli Kusterer |
Subject: |
Re: Questions about the system |
Date: |
Mon, 16 Feb 2004 08:34:00 +0100 |
User-agent: |
MT-NewsWatcher/3.3b1 (PPC Mac OS X) |
In article <mailman.2419.1076840228.928.discuss-gnustep@gnu.org>,
Fred Kiefer <fredkiefer@gmx.de> wrote:
> What is more complicated is that GNUstep allows programmers to subclass
> any widgets and replace only part of the drawing. This is an important
> feature, that could easyly get lost, when doing a to simple minded
> widget drawing attempt. Please take extra care to preserve this,
> otherwise the new drawing code would never be excepted by application
> programmers.
A smart idea to alleviate this problem would be to have a look at the
"Appearance Manager" APIs Apple wrote way back in MacOS 9. They
basically added APIs to:
-> Draw any control, and several parts of it. E.g. there were methods
for drawing empty menus, menu item backgrounds, shortcuts, separators,
pushbuttons, pushbutton titles, slider tracks and knobs, scroll bar
arrows/tracks/thumbs, window title bars, borders etc.
-> Get any color or pattern used for drawing a particular control and
control part. In particular the text color (selected, highlighted,
disabled, inactive and plain) and background color (also for all five
states). This could probably be done by expanding upon what is already
present in NSColor, but the important part is that there are separate
ones for each kind of control/cell to allow maximum theme-ability.
-> Determine the dimensions (minimal, optimal, maximal, based on a
particular rectangle) for any of the drawable items.
Of course, the way in which Carbon did this with a plain C API and how
many controls were missing or incompletely implemented (e.g. there was
no way to draw a throbbing default button manually) should not be
mimicked, and one might want to make the drawing functions somewhat
similar to those that already draw sunken, raised or bezeled boxes etc.
Of course, for views like scroll bars, having more granularity (e.g. a
drawTrackInRect: or drawThumbInRect: in addition to drawRect:) in
methods that can be overridden may already alleviate this problem.
But of course, all those extensions would be GNUstep-specific. Though I
would guess that one could try creating compatible versions for Cocoa by
using those Carbon calls I mentioned.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de