On 4/12/19 2:33 PM, Huw Davies wrote:
On Fri, Apr 12, 2019 at 02:16:10PM +0300, Gabriel Ivăncescu wrote:
On 4/12/19 12:33 PM, Huw Davies wrote:
You should be able to use a SBS_SIZEBOX scrollbar for this, rather than re-invent the wheel.
You mean for the grip?
Yes, sorry I meant to reply to [2/4].
Huw.
Ok, that makes more sense, but IMO it's not any better. Most of the code will have to remain or be moved around.
The only difference I can see is in WM_NCCALCSIZE, which would have to be "moved" to update_listbox_size, so it's not really a gain (if I use SBS_SIZEBOX) since the flipping logic would need to be moved there.
WM_NCHITTEST will have to remain for two reasons: when it's flipped up, the arrows and behavior needs to change. Also, when the grip is a triangle (scrollbar is not visible), on Windows moving the mouse to the *square* of the grip enables it just like if it were a square. If I rely on SBS_SIZEBOX's native functionality it wouldn't work like on Windows. Bottom line is, I'd still have to add a WM_NCHITTEST manually, so it's not really a gain here, either.
The painting of the grip will still have to be done due to the flipping (I don't think drawing the scrollbar with a DefWindowProc is a problem).
And if I use a SBS_SIZEBOX it means it will have to be another window, separate from the scrollbar, which I think will complicate the code more.
Looking at the patch, I can't really identify other areas where it would result in less code. Do you have something specific in mind?
I realize the patch, by itself, seems slightly redundant for now, but it's needed for the last patch which flips it up. :-) (I *did* try with separate windows initially and gave up on it due to this)