Release 0.4.10
Mon Nov 22 13:58:56 1993 David Metcalfe <david@prism.demon.co.uk>
* [windows/scroll.c]
Preliminary implementations of ScrollWindow, ScrollDC and
ScrollWindowEx.
Nov 21, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/listbox.c]
Optimization of redraw during 'Add' or 'Insert'.
* [controls/scroll.c]
Optimization of WM_PAINT during 'thumbtracking'.
* [controls/button.c]
Add of beta implement of 'BS_OWNERDRAW'
* [controls/static.c]
Style 'SS_ICON' new supported.
* [misc/message.c]
Begin of implemantation of MB_XXX styles.
* [loader/resource.c]
Function LoadIcon() : now prepare transparency Bitmap mask.
Function LoadCursor() : now prepare a 'X pixmapcursor'.
New function SetCursor() : not finished.
New function ShowCursor() : not finished.
New function AccessResource() : stub.
* [obj/dib.c]
Function DrawIcon(): deugging phase of icon transparency mask.
* [loader/library.c]
new file for news functions LoadLibrary() & FreeLibrary().
* [sysres.dll]
Resources only 16bits DLL for System Resources, icons, etc...
Sun Nov 14 14:39:06 1993 julliard@di.epfl.ch (Alexandre Julliard)
* [include/dialog.h] [windows/dialog.c]
Simplified dialog template parsing.
Implemented DialogBoxIndirect().
* [windows/win.c]
Fixed bug in CreateWindow() when aborting window creation.
Modified UpdateWindow() to only update visible windows.
Implemented IsWindow().
Nov 14, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/listbox.c]
Listbox control window : new messages.
* [controls/combo.c]
Combo box control window : new messages.
* [misc/message.c]
Moved stub MessageBox() to this new file.
Implemented of a callback, now MessageBox show a window.
* [loader/resource.c]
New function DestroyIcon()
New function DestroyCursor()
Filled stub LoadIcon()
Filled stub LoadCursor()
Bug fixed in FindResourceByName() : missing lseek().
* [obj/dib.c]
New function DrawIcon()
* [windows/win.c]
New function CloseWindow()
New function OpenIcon()
New function IsIconic()
New Function FindWindow()
Sun Nov 14 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de)
* [loader/selector.c]
Wrote AllocCStoDSAlias() and AllocDStoCSAlias()
Sun Nov 14 08:27:19 1993 Bob Amstadt (bob at amscons)
* [loader/selector.c]
Wrote AllocSelector() and PrestoChangoSelector(). YUK!
Sat Nov 13 13:56:42 1993 Bob Amstadt (bob at amscons)
* [loader/resource.c]
Wrote FindResource(), LoadResource(), LockResource(),
and FreeResource()
* [include/segmem.h] [loader/selector.c] [loader/signal.h]
Changed selector allocation method.
Sun Nov 10 08:27:19 1993 Karl Guenter Wuensch (hz225wu@unidui.uni-duisburg.de)
* [if1632/callback.c if1632/call.S if1632/user.spec]
added Catch (KERNEL.55) and Throw (KERNEL.56)
Nov 7, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/scroll.c]
Scroll bar control window
Bug resolved : Painting message before scroll visible.
* [controls/listbox.c]
Listbox control window
Destroy cleanup.
* [controls/combo.c]
Combo box control window
Destroy cleanup.
* [controls/button.c]
GetCheck Message now return is state.
* [windows/win.c]
New function IsWindowVisible()
diff --git a/controls/button.c b/controls/button.c
index 1a13b9d..aad2aa1 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -9,6 +9,7 @@
#include <windows.h>
#include "win.h"
+#include "user.h"
LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
@@ -48,6 +49,10 @@
static LONG UB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
static LONG UB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
static LONG UB_KillFocus(HWND hWnd);
+static LONG OB_Paint(HWND hWnd);
+static LONG OB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam);
+static LONG OB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam);
+static LONG OB_KillFocus(HWND hWnd);
typedef struct
{
@@ -60,7 +65,7 @@
LONG (*getCheckfn)();
} BTNFN;
-#define MAX_BTN_TYPE 10
+#define MAX_BTN_TYPE 12
static BTNFN btnfn[MAX_BTN_TYPE] =
{
@@ -153,7 +158,25 @@
(LONG(*)())RB_KillFocus,
(LONG(*)())RB_SetCheck,
(LONG(*)())RB_GetCheck
- }
+ },
+ {
+ (LONG(*)())NULL, /* Not defined */
+ (LONG(*)())NULL,
+ (LONG(*)())NULL,
+ (LONG(*)())NULL,
+ (LONG(*)())NULL,
+ (LONG(*)())NULL,
+ (LONG(*)())NULL
+ },
+ {
+ (LONG(*)())OB_Paint, /* BS_OWNERDRAW */
+ (LONG(*)())OB_LButtonDown,
+ (LONG(*)())OB_LButtonUp,
+ (LONG(*)())NULL,
+ (LONG(*)())OB_KillFocus,
+ (LONG(*)())NULL,
+ (LONG(*)())NULL
+ },
};
@@ -239,7 +262,7 @@
case BM_GETCHECK:
if (btnfn[style].getCheckfn)
- (btnfn[style].getCheckfn)(hWnd);
+ return (btnfn[style].getCheckfn)(hWnd);
break;
default:
@@ -954,3 +977,91 @@
UpdateWindow(hWnd);
}
+
+/**********************************************************************
+ * Ownerdrawn Button Functions
+ */
+
+static LONG OB_Paint(HWND hWnd)
+{
+ PAINTSTRUCT ps;
+ HDC hDC;
+ RECT rc;
+ HANDLE hDis;
+ LPDRAWITEMSTRUCT lpdis;
+ WND *wndPtr = WIN_FindWndPtr(hWnd);
+ hDC = BeginPaint(hWnd, &ps);
+ GetClientRect(hWnd, &rc);
+ hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
+ lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
+ lpdis->hDC = hDC;
+ lpdis->itemID = 0;
+ CopyRect(&lpdis->rcItem, &rc);
+ lpdis->CtlID = wndPtr->wIDmenu;
+ lpdis->CtlType = ODT_BUTTON;
+ lpdis->itemAction = ODA_DRAWENTIRE;
+/* printf("ownerdrawn button WM_DRAWITEM CtrlID=%X\n", lpdis->CtlID);*/
+ SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis);
+ USER_HEAP_FREE(hDis);
+ EndPaint(hWnd, &ps);
+}
+
+static LONG OB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam)
+{
+ HDC hDC;
+ RECT rc;
+ HANDLE hDis;
+ LPDRAWITEMSTRUCT lpdis;
+ WND *wndPtr = WIN_FindWndPtr(hWnd);
+/* SetFocus(hWnd); */
+ SetCapture(hWnd);
+ hDC = GetDC(hWnd);
+ GetClientRect(hWnd, &rc);
+ if (PtInRect(&rc, MAKEPOINT(lParam)))
+ NOTIFY_PARENT(hWnd, BN_CLICKED);
+ GetClientRect(hWnd, &rc);
+ hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
+ lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
+ lpdis->hDC = hDC;
+ lpdis->itemID = 0;
+ CopyRect(&lpdis->rcItem, &rc);
+ lpdis->CtlID = wndPtr->wIDmenu;
+ lpdis->CtlType = ODT_BUTTON;
+ lpdis->itemAction = ODA_SELECT;
+ SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis);
+ USER_HEAP_FREE(hDis);
+ ReleaseDC(hWnd, hDC);
+}
+
+static LONG OB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
+{
+ HDC hDC;
+ RECT rc;
+ HANDLE hDis;
+ LPDRAWITEMSTRUCT lpdis;
+ WND *wndPtr = WIN_FindWndPtr(hWnd);
+ ReleaseCapture();
+ hDC = GetDC(hWnd);
+ GetClientRect(hWnd, &rc);
+ if (PtInRect(&rc, MAKEPOINT(lParam)))
+ NOTIFY_PARENT(hWnd, BN_CLICKED);
+ GetClientRect(hWnd, &rc);
+ hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
+ lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
+ lpdis->hDC = hDC;
+ lpdis->itemID = 0;
+ CopyRect(&lpdis->rcItem, &rc);
+ lpdis->CtlID = wndPtr->wIDmenu;
+ lpdis->CtlType = ODT_BUTTON;
+ lpdis->itemAction = ODA_SELECT;
+ SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis);
+ USER_HEAP_FREE(hDis);
+ ReleaseDC(hWnd, hDC);
+}
+
+static LONG OB_KillFocus(HWND hWnd)
+{
+ InvalidateRect(hWnd, NULL, FALSE);
+ UpdateWindow(hWnd);
+}
+