diff options
Diffstat (limited to 'app/wlib/mswlib/mswmsg.c')
-rw-r--r-- | app/wlib/mswlib/mswmsg.c | 75 |
1 files changed, 16 insertions, 59 deletions
diff --git a/app/wlib/mswlib/mswmsg.c b/app/wlib/mswlib/mswmsg.c index 6445299..8487e31 100644 --- a/app/wlib/mswlib/mswmsg.c +++ b/app/wlib/mswlib/mswmsg.c @@ -21,17 +21,12 @@ #define SCALE_LARGE 1.6 #define SCALE_SMALL 0.8 -#ifdef CONTROL3D -static int messageHeight = 18; -#endif - struct wMessage_t { WOBJ_COMMON long flags; const char * message; }; -#ifndef CONTROL3D static void repaintMessage( HWND hWnd, wControl_p b ) @@ -83,7 +78,7 @@ static void repaintMessage( rect.left = bm->x; SetBkColor( hDc, GetSysColor( COLOR_BTNFACE ) ); - ExtTextOut( hDc, bm->x, bm->y + ((bm->h + 2 - textMetrics.tmHeight) / 2), ETO_CLIPPED|ETO_OPAQUE, &rect, bm->message, strlen( bm->message ), NULL ); + ExtTextOut( hDc, bm->x, bm->y + ((bm->h + 2 - textMetrics.tmHeight) / 2), ETO_CLIPPED|ETO_OPAQUE, &rect, bm->message, (int)(strlen( bm->message )), NULL ); if( scale != 1.0 ) /* in case we did create a new font earlier, delete it now */ @@ -94,7 +89,6 @@ static void repaintMessage( ReleaseDC( hWnd, hDc ); } -#endif void wMessageSetValue( wMessage_p b, @@ -106,34 +100,26 @@ void wMessageSetValue( b->message = mswStrdup( arg ); else b->message = NULL; -#ifdef CONTROL3D - SetWindowText( b->hWnd, arg ); -#else + repaintMessage( ((wControl_p)(b->parent))->hWnd, (wControl_p)b ); -#endif + } void wMessageSetWidth( wMessage_p b, - wPos_t width ) + wWinPix_t width ) { b->w = width; -#ifdef CONTROL3D - SetWindowPos( b->hWnd, HWND_TOP, CW_USEDEFAULT, CW_USEDEFAULT, - width, messageHeight, SWP_NOMOVE ); -#endif + } -wPos_t wMessageGetWidth(const char *string) +wWinPix_t wMessageGetWidth(const char *string) { return(wLabelWidth(string)); } -wPos_t wMessageGetHeight( long flags ) +wWinPix_t wMessageGetHeight( long flags ) { -#ifdef CONTROL3D - return messageHeight; -#else double scale = 1.0; if( flags & BM_LARGE ) @@ -141,8 +127,8 @@ wPos_t wMessageGetHeight( long flags ) if( flags & BM_SMALL ) scale = SCALE_SMALL; - return((wPos_t)((mswEditHeight) * scale )); -#endif + return((wWinPix_t)((mswEditHeight) * scale )); + } static void mswMessageSetBusy( @@ -152,68 +138,39 @@ static void mswMessageSetBusy( } -#ifndef CONTROL3D + static callBacks_t messageCallBacks = { repaintMessage, NULL, NULL, mswMessageSetBusy }; -#endif - wMessage_p wMessageCreateEx( wWin_p parent, - POS_T x, - POS_T y, + wWinPix_t x, + wWinPix_t y, const char * helpStr, - POS_T width, + wWinPix_t width, const char *message, long flags ) { wMessage_p b; int index; -#ifdef CONTROL3D - RECT rect; -#endif - + b = (wMessage_p)mswAlloc( parent, B_MESSAGE, NULL, sizeof *b, NULL, &index ); mswComputePos( (wControl_p)b, x, y ); b->option |= BO_READONLY; b->message = mswStrdup( message ); b->flags = flags; -#ifdef CONTROL3D - if ( width <= 0 && strlen(b->message) > 0 ) { - width = wLabelWidth( b->message ); - } - - b->hWnd = CreateWindow( "STATIC", NULL, - SS_LEFTNOWORDWRAP | WS_CHILD | WS_VISIBLE, - b->x, b->y, - width, messageHeight, - ((wControl_p)parent)->hWnd, (HMENU)index, mswHInst, NULL ); - if (b->hWnd == NULL) { - mswFail("CreateWindow(MESSAGE)"); - return b; - } - - if ( !mswThickFont ) - SendMessage( b->hWnd, WM_SETFONT, (WPARAM)mswLabelFont, 0L ); - SetWindowText( b->hWnd, message ); - - GetWindowRect( b->hWnd, &rect ); - b->w = rect.right - rect.left; - b->h = rect.bottom - rect.top; -#else b->w = width; b->h = wMessageGetHeight( flags ) + 1; repaintMessage( ((wControl_p)parent)->hWnd, (wControl_p)b ); -#endif + mswAddButton( (wControl_p)b, FALSE, helpStr ); -#ifndef CONTROL3D mswCallBacks[B_MESSAGE] = &messageCallBacks; -#endif + return b; } |