Пример #1
0
void DoDeleteRepStuff(HWND hwnd, LPINSERTITEM pfr)
{                                        
    int ret;
    
    if (pfr->NullHwd) 
        ret = Header_DeleteItem(NULL, pfr->index);
    else
        ret = Header_DeleteItem(pfr->hwnd, pfr->index);

    wsprintf(szDbgMsg, "%d = Header_DeleteItem(index = %d)", ret, pfr->index);
    
    MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
    
    SetDlgItemInt(hwnd, IDC_DELETERET, ret, TRUE) ;
    
}
Пример #2
0
LRESULT	WINAPI LoopFafaCheck( HWND w, UINT msg, WPARAM mw, LPARAM ml )
{
HDC	h ;

	switch( msg )
		{
		case WM_SYSCOLORCHANGE:
			CreatePensBrushes() ;
			break ;
		case WM_CREATE :
			InitButtonWords( w ) ;
			if ( TstF( GetStyle(), FC_PRESELECT ) )
				SetState( (WORD)FB_SELECTED ) ;
			break ;

		case WM_SETFONT:
		{
			HFONT f = (HFONT)mw ;
			SetFont(f) ;
		        h = GetDC( w ) ;
			if ( TstF( GetStyle(), FC_BUTTONDRAW ) )
				DrawFafaButton( w ,h ) ;
			else	DrawFafaCheck( w ,h ) ;
		        ReleaseDC( w, h ) ;
			break ;
		}
		case WM_CHANGEBITMAP:
		{
			HBITMAP f = (HBITMAP)ml ;
			WORD width = LOBYTE(mw) ;
			WORD height = HIBYTE(mw) ;
			LONG style = GetStyle() ;
			
			if (width == 255) {
		           SIZE s;
			   GetBitmapDimensionEx(f, &s);
			   width = s.cx;
			   height = s.cy;
			}
			
			SetBitmap(f) ;
			SetBitmapW(width) ;
			SetBitmapH(height) ;

			if (f)
			{
				/* Switch to Bitmap button */
				style &= 0xffffff70 ;
				style |= (FC_BUTTONDRAW|FB_BITMAP) ;
			}
			else
			{
				/* Switch to Text button */
				style &= 0xffffff70 ;
				/* default text style for check items */
				if (style&FC_RADIO)
					style |= FC_CIR_DWN ;
				else
					style |= FC_REC_DWN ;
			}
			SetStyle(style) ;
		        h = GetDC( w ) ;
			if ( TstF( GetStyle(), FC_BUTTONDRAW ) )
				DrawFafaButton( w ,h) ;
			else	DrawFafaCheck( w ,h) ;
		        ReleaseDC( w, h ) ;
			break ;
		}
		case WM_GETFONT:
			return (LRESULT)GetFont() ;
		case WM_PAINT :
			if ( TstF( GetStyle(), FC_BUTTONDRAW ) )
				RedrawFafaButton( w ) ;
			else	RedrawFafaCheck( w ) ;
			break ;

		case WM_SETFOCUS:
			ChangeCheckFocus( w, 1 ) ;
			if ( GetAcc() && KeyIsDown( GetAcc() ) )
				CheckKeyDown( w, 1 ) ;
			break ;
		case WM_KILLFOCUS:
			ChangeCheckFocus( w, 0 ) ;
			break ;

		case WM_ENABLE:
			if ( ( mw != 0 ) ^ IsDisabled() )
				InvalidateRect( w, 0, 0 ) ;
			break ;

		case WM_RBUTTONDOWN:
			if ( ! TstF( GetStyle(), FC_RIGHTBUT ) )
				break ;

		case WM_LBUTTONDOWN:
			SetFocus( w ) ;
			MouseDown( w ) ;
			break ;

		case WM_MOUSEMOVE:
			MouseMove( w, ml ) ;
			break ;

		case WM_RBUTTONUP:
			if ( ! TstF( GetStyle(), FC_RIGHTBUT ) )
				break ;

		case WM_LBUTTONUP:
			MouseUp( w, ml ) ;
			break ;

		case FAFA_GETCHECK :
#ifdef DEBUG_FAFA
MyDebugMsg("State of check %x is %d\n",w,TstState(FB_SELECTED));
#endif
			return ( LONG ) TstState( FB_SELECTED ) ;

		case FAFA_SETCHECK :
#ifdef DEBUG_FAFA
MyDebugMsg("Setting Check %x to %d\n",w,mw) ;
#endif
			if ( ChangeCheckSelect( w, ( mw != 0 ) ) && mw )
				MakeRadioIteration( w ) ;
			break ;

		case WM_KEYDOWN:
		case WM_SYSKEYDOWN:
		case WM_KEYUP:
		case WM_SYSKEYUP:
			if ( mw == ' ' || KeyIsAcc( w, mw ) )
				CheckKeyDown( w, IsMessDown( msg ) ) ;
			else	return DefWindowProc( w, msg, mw, ml ) ;
			break;

		case WM_WHOAREYOU :
			return ( LONG ) FB_CHECK ;

		case WM_SETTEXT :
			InvalidateRect( w, 0, 0 ) ;
		default:
			return DefWindowProc( w, msg, mw, ml ) ;
		}

	return 0l ;
}
Пример #3
0
void DoSetRepStuff(HWND hwnd, LPINSERTITEM pfr)
{                 
    HD_ITEM hi;
    int ret;
    HD_ITEM di = {
    HDI_WIDTH,
    50,
    NULL,
    NULL,
    128,
    HDF_CENTER|HDF_BITMAP,
    0
    };
    HD_ITEM FAR* pitem;
    HGLOBAL hglb;
    int iAlloc;
    
    hi.pszText="One";   
    
    hi.mask = pfr->mask;
    hi.cxy = pfr->cxy;
    if (pfr->Nullpitem)
        pitem = NULL;
    else
        pitem = &hi;
        
    hi.cchTextMax = pfr->cchTextMax;
    hi.fmt = pfr->fmt;
    hi.lParam = pfr->lParam;
    
    if (hi.cchTextMax)
    iAlloc = hi.cchTextMax;
    else
    iAlloc = MAX_PSZTEXT;    
    if (pfr->Nullhbm)
    hi.hbm = NULL;
    else
    hi.hbm = pfr->hbm;
    
    if (pfr->NullpszText) 
    hi.pszText = NULL;                              // can this be done ??
    else {
    hglb = GlobalAlloc(GPTR, iAlloc);
    hi.pszText = GlobalLock(hglb);
#ifdef WIN32        
    strcpy(hi.pszText, pfr->pszText);
#else
    _fstrcpy(hi.pszText, pfr->pszText);
#endif    
    } 
    
    di.pszText = "Four";
    if (pfr->NullHwd) 
    ret = Header_SetItem(NULL, pfr->index, pitem);
    else
    ret = Header_SetItem(pfr->hwnd, pfr->index, pitem);
    wsprintf(szDbgMsg, "%d = Header_SetItem(index = %d,  \n\
    mask = %x cxy = %d pszText = %s hbm = %lx cchTextMax = %d fmt = %x\n \
    lParam = %ld )", ret, pfr->index, hi.mask, hi.cxy, hi.pszText, hi.hbm, hi.cchTextMax,
    hi.fmt, hi.lParam);
    MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
    
    SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
    if (!pfr->NullpszText) {
    GlobalUnlock(hglb);
    GlobalFree(hglb); 
    }
/****
  wsprintf(szTemp, szLongFilter, hwndFind) ;
  SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
**/
}
Пример #4
0
void DoGetRepStuff(HWND hwnd, LPINSERTITEM pfr)
{                 
    HD_ITEM hi;
    int ret;
    HD_ITEM FAR* pitem;
    HGLOBAL hglb;
    int iAlloc;
    
    
    hi.mask = pfr->mask;
    hi.cxy = pfr->cxy;
    if (pfr->Nullpitem)
        pitem = NULL;
    else
        pitem = &hi;
            
    hi.cchTextMax = pfr->cchTextMax;
//  hi.cchTextMax = MAX_PSZTEXT;
    hi.fmt = pfr->fmt;
    hi.lParam = pfr->lParam;
    
    
    if (hi.cchTextMax == 0)
        iAlloc = MAX_PSZTEXT;
    else 
        iAlloc = hi.cchTextMax;
            
    if (pfr->NullpszText) 
        hi.pszText = NULL;              // can this be done ??
    else {
        hglb = GlobalAlloc(GPTR, iAlloc);
        hi.pszText = (LPSTR) GlobalLock(hglb);
//      _fstrcpy(hi.pszText, pfr->pszText);
    } 
    
    if (pfr->NullHwd) 
        ret = Header_GetItem(NULL, pfr->index, pitem);
    else
        ret = Header_GetItem(pfr->hwnd, pfr->index, pitem);

    wsprintf(szDbgMsg, "%d = Header_GetItem(index = %d,  \n\
    mask = %x )", ret, pfr->index, hi.mask);
    MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
    SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
    
    if (ret) {
        SetDlgItemInt(hwnd, IDC_INSERTCXY, hi.cxy, TRUE);  
        SetDlgItemInt(hwnd, IDC_INSERTCCHTEXTMAX, hi.cchTextMax, TRUE);
        wsprintf(szTemp, szLongFilter, hi.lParam);
        SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
        SetDlgItemText(hwnd, IDC_INSERTTEXT, hi.pszText);
        wsprintf(szTemp, "%04hx", hi.mask);
        SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
        CheckDlgButton(hwnd, IDC_INSERTHDRIGHT, hi.fmt & HDF_RIGHT);
        CheckDlgButton(hwnd, IDC_INSERTHDLEFT, hi.fmt & HDF_LEFT);
        CheckDlgButton(hwnd, IDC_INSERTHDCENTER, hi.fmt & HDF_CENTER);
        CheckDlgButton(hwnd, IDC_INSERTHDJUSTIFYMASK, hi.fmt & HDF_JUSTIFYMASK);
        CheckDlgButton(hwnd, IDC_INSERTHDOWNERDRAW, hi.fmt & HDF_OWNERDRAW);
        CheckDlgButton(hwnd, IDC_INSERTHDSTRING, hi.fmt & HDF_STRING);
        CheckDlgButton(hwnd, IDC_INSERTHDBITMAP, hi.fmt & HDF_BITMAP);
        wsprintf(szTemp, szLongFilter, (DWORD)  hi.hbm);
        SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);        
        wsprintf(szTemp, "%04x", hi.fmt);
//      SetDlgItemInt(hwnd, IDC_INSERTFMT, hi.fmt, TRUE); 
        SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
    }
    
    if (!pfr->NullpszText) {
        GlobalUnlock(hglb);
        GlobalFree(hglb); 
    }
/****
  wsprintf(szTemp, szLongFilter, hwndFind) ;
  SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
**/
}
Пример #5
0
void DoLayoutRepStuff(HWND hwnd, LPLAYOUT pfr)
{                 
    HD_LAYOUT FAR* playout;
    HD_LAYOUT lay;
    RECT rc = {
        0,
        0,
        0,
        0
    };
    WINDOWPOS wpos = {
        NULL,
        NULL,
        0,
        0,
        0,
        0,
        0
    };                      
    int ret;
    
    HGLOBAL hglb;
    
    rc.left = pfr->left;
    rc.right = pfr->right;
    rc.top = pfr->top;
    rc.bottom = pfr->bottom;
    
    if (pfr->NullHDLAYOUT)
        playout = NULL;
    else
        playout = &lay;
 
 
    if (pfr->NullWindowPOS) 
        lay.pwpos = NULL;               // can this be done ??
    else {
        lay.pwpos = &wpos;
    } 
    
    if (pfr->NullRECT)
        lay.prc = NULL;
    else 
        lay.prc = &rc;
        
    if (pfr->NullHwd) 
        ret = Header_Layout(NULL, playout);
    else
        ret = Header_Layout(pfr->hwnd, playout);

    wsprintf(szDbgMsg, "%d = Header_LayoutItem()", ret);
    MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
    SetDlgItemInt(hwnd, IDC_LAYOUTRET, ret, TRUE) ;
    
    if (ret) {
        
        // RECT struct
        SetDlgItemInt(hwnd, IDC_LAYOUTLEFT, rc.left, TRUE);
        SetDlgItemInt(hwnd, IDC_LAYOUTRIGHT, rc.right, TRUE);
        SetDlgItemInt(hwnd, IDC_LAYOUTTOP, rc.top, TRUE);
        SetDlgItemInt(hwnd, IDC_LAYOUTBOTTOM, rc.bottom, TRUE);
        
        // WindowPOS struct
        wsprintf(szTemp, szLongFilter, (DWORD) wpos.hwnd) ;
        SetDlgItemText(hwnd, IDC_LAYOUTHWND, szTemp);
        
        wsprintf(szTemp, szLongFilter, wpos.hwndInsertAfter);
        SetDlgItemText(hwnd, IDC_LAYOUTHWNDINSERTAFTER, szTemp);
        
        SetDlgItemInt(hwnd, IDC_LAYOUTX, wpos.x, TRUE);
        SetDlgItemInt(hwnd, IDC_LAYOUTY, wpos.y, TRUE);
        
        SetDlgItemInt(hwnd, IDC_LAYOUTCX, wpos.cx, TRUE);
        SetDlgItemInt(hwnd, IDC_LAYOUTCY, wpos.cy, TRUE);
        
        CheckDlgButton(hwnd, IDC_LAYOUTDRAWFRAME, wpos.flags & SWP_DRAWFRAME);
        CheckDlgButton(hwnd, IDC_LAYOUTHIDEWINDOW, wpos.flags & SWP_HIDEWINDOW);
        CheckDlgButton(hwnd, IDC_LAYOUTNOACTIVATE, wpos.flags & SWP_NOACTIVATE);
        CheckDlgButton(hwnd, IDC_LAYOUTNOZORDER, wpos.flags & SWP_NOOWNERZORDER);
        CheckDlgButton(hwnd, IDC_LAYOUTNOSIZE, wpos.flags & SWP_NOSIZE);
        CheckDlgButton(hwnd, IDC_LAYOUTNOREDRAW, wpos.flags & SWP_NOREDRAW);
        CheckDlgButton(hwnd, IDC_LAYOUTNOREPOSITION, wpos.flags & SWP_NOREPOSITION);
        CheckDlgButton(hwnd, IDC_NOZORDER, wpos.flags & SWP_NOZORDER);
            
    }
}