[wpdev-commits] wolfpack console_win.cpp,1.13,1.14
Brought to you by:
rip,
thiagocorrea
|
From: <dar...@us...> - 2003-10-08 00:45:16
|
Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv16019
Modified Files:
console_win.cpp
Log Message:
New Stuff for the Windows Console.
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** console_win.cpp 7 Oct 2003 23:57:24 -0000 1.13
--- console_win.cpp 8 Oct 2003 00:45:11 -0000 1.14
***************
*** 57,60 ****
--- 57,62 ----
#define CONTROL_INPUT 0x11
+ HBITMAP hLogo = 0;
+ HBRUSH hbSeparator = 0, hbBackground = 0;
HWND logWindow = 0; // Log Window
HWND inputWindow = 0; // Input Textfield
***************
*** 84,87 ****
--- 86,127 ----
}
+ // Fill a rectangular on a specific context
+ void paintRect( HDC dc, INT32 x, INT32 y, INT32 width, INT32 height, HBRUSH brush )
+ {
+ RECT rect;
+ rect.bottom = y + height;
+ rect.right = x + width;
+ rect.top = y;
+ rect.left = x;
+
+ FillRect( dc, &rect, brush );
+ }
+
+ void drawWindow( HWND window )
+ {
+ PAINTSTRUCT paintInfo;
+ HDC dc = BeginPaint( window, &paintInfo );
+
+ RECT rect;
+ GetClientRect( window, &rect );
+
+ paintRect( dc, 0, 0, rect.right, 87, hbBackground );
+ paintRect( dc, 0, 87, rect.right, 1, hbSeparator );
+
+ // Draw our Logo
+ HDC tempdc = CreateCompatibleDC( dc );
+ HGDIOBJ oldobj = SelectObject( tempdc, hLogo );
+
+ BITMAP bm;
+ GetObject( hLogo, sizeof(bm), &bm );
+
+ BitBlt( dc, 0, 0, bm.bmWidth, bm.bmHeight, tempdc, 0, 0, SRCCOPY );
+
+ SelectObject( tempdc, oldobj );
+ DeleteDC( tempdc );
+
+ EndPaint( window, &paintInfo );
+ }
+
LRESULT CALLBACK wpWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
***************
*** 96,99 ****
--- 136,143 ----
{
case WM_CREATE:
+ hLogo = LoadBitmap( appInstance, MAKEINTRESOURCE( IDB_LOGO ) );
+ hbSeparator = CreateSolidBrush( RGB( 0xAF, 0xAF, 0xAF ) );
+ hbBackground = CreateSolidBrush( RGB( 0, 64, 38 ) );
+
// Create Richedit Box
logWindow = CreateWindow( RICHEDIT_CLASS, 0, ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL|ES_READONLY|WS_CHILD|WS_VISIBLE|WS_VSCROLL, 0, 0, 10, 10, hwnd, (HMENU)CONTROL_LOGWINDOW, appInstance, 0 );
***************
*** 159,163 ****
}
! MoveWindow( logWindow, 0, 0, width, height - inputHeight, TRUE );
MoveWindow( inputWindow, 0, height - inputHeight, width, inputHeight, TRUE );
}
--- 203,208 ----
}
! // Note: 88 pixel spacer are always on top
! MoveWindow( logWindow, 0, 88, width, height - inputHeight - 88, TRUE );
MoveWindow( inputWindow, 0, height - inputHeight, width, inputHeight, TRUE );
}
***************
*** 165,168 ****
--- 210,216 ----
return 0;
+ case WM_PAINT:
+ drawWindow( hwnd );
+
case WM_ERASEBKGND:
return 1;
***************
*** 214,217 ****
--- 262,268 ----
case WM_DESTROY:
+ DeleteObject( hLogo );
+ DeleteObject( hbSeparator );
+ DeleteObject( hbBackground );
keeprun = 0;
PostQuitMessage( 0 );
|