(Re)size Me Up #

(from now on all journal entries will refer to icon mangler unless otherwise stated)

I've improved the handling of controls. They now disable when they are in the background. I've also added an image well, where the icon is drawn (the image well has a nice bevel around it, which serves as a delimiter between the rest of the window and the icon). I've made it so that the control is resized dynamically when the window is resized, but there's some ugly flickering. I'll look into it later. Right now I want to do the resize constraining, because it'll look pretty impressive. Basically instead of using the system GrowWindow function I have to write my own (using DragGrayRgn to display the gray outline when resizing) and then I can do all the constraints I want.

(a bit later) I found some sample code on Apple's developer homepage showing how to "grow a window constrained to a grid (i.e. only allow a window to grow or shrink by 30 pixels, or whatever)." This is pretty close to what I'm looking for, hopefully it'll help me out.

Nope, that doesn't help me out, it doesn't use the method I was looking for, and it doesn't draw the resizing outline properly either. I guess I'll have to do it myself.

Eek! DragGrayRgn is apparently for moving windows, not for resizing them. I have no idea what to do now, drawing the gray outline by hand doesn't sound very exciting.... I guess what I'll do is let the system draw the gray outline with no constraints, but when I actually resize the window I'll apply the constraints. Not as neat as I'd like it to be, but this isn't the main point of the application, so I can do it properly later.

Well, that worked, the windows are resizing nicely now. I ran into a problem that caused the icon to dissapear when (de)activating the window, but that was because when an image well is (de)activated, apparently it does an erase rect, and thus cleared the contents. A call to Refresh fixed that, but it's not nice how it flickers. Oh well...

Next step is to add a small placard that contains the current level of magnification. Shouldn't be that hard, I just have to set it's text to the current magnification level.

(a bit later) Well, for some reason I couldn't figure out how to set the item text, so I'm using DrawString to draw over the placard. Not very neat, and the text doesn't take on the active color. Hopefully I'll be able to fix this tomorrow.

Post a Comment