Ejemplo n.º 1
0
UINT WINAPI DockWnd_SetStyle(HWND hwndMain, UINT uId, UINT uStyle, UINT uMask)
{
	DOCKPANEL *dpp;

	DOCKWND *dwp;
	
	if((dwp = DOCKWNDFromId(hwndMain, uId)) == 0)
		return 0;

	dpp = dwp->pDockPanel;
	
	if(dpp)
	{
		DWORD oldstyle = dpp->dwStyle;
		dpp->dwStyle = (dpp->dwStyle & ~uMask) | uStyle;

		if((uStyle & DWS_DRAWGRIPPER) || (uMask & DWS_DRAWGRIPPER))
		{
			SizeToContent(dpp);
		}

		return oldstyle;
	}

	return 0;
}
Ejemplo n.º 2
0
BOOL CTextCheckBox::AutoLoad(UINT nID, CWnd* pParent)
{
	// first attach the CBitmapCheckButton to the dialog control
	if (!SubclassDlgItem(nID, pParent))
		return FALSE;

	//
	// Load the bitmaps for the different states
	//
	m_bmpNormal.DeleteObject();
	m_bmpNormal.LoadBitmap( "CHECKBOXN" );

	m_bmpFocus.DeleteObject();
	m_bmpFocus.LoadBitmap( "CHECKBOXF" );

	m_bmpChecked.DeleteObject();
	m_bmpChecked.LoadBitmap( "CHECKBOXC" );

	//
	// Load the fonts and color
	//
	m_lfNormal.lfWeight = FW_DEMIBOLD;
	//m_lfNormal.lfQuality = ANTIALIASED_QUALITY;
	//strcpy( m_lfNormal.lfFaceName, "Arial" );

	SizeToContent();

	return TRUE;
}
Ejemplo n.º 3
0
BOOL DockWnd_CreateContent(DOCKPANEL *dpp, DOCKWND *dwp, HKEY hKey)
{
	HKEY hUserKey = 0;
	NMDOCKWNDCREATE nmdw = { {0}, dwp->uWndId, hUserKey };
	
	if(RegOpenKeyEx(hKey, TEXT("Settings"), 0, KEY_READ, &hUserKey) == S_OK)
		nmdw.hKey = hUserKey;

	// ask the main window to create the specified child-window
	dwp->hwndContents = (HWND)DockWnd_NotifyParent(dpp, dwp, DWN_CREATE_CONTENT, (NMHDR *)&nmdw);

	// don't set the dockpanel field yet!
	dpp->hwndContents = dwp->hwndContents;

	if(dwp->hwndContents == 0)
		return FALSE;

	DockWnd_NotifyParent(dpp, dwp, DWN_UPDATE_CONTENT, (NMHDR *)&nmdw);

	if(hUserKey)
		RegCloseKey(hUserKey);

	// set content's parent to be the dock-window
	SetParent(dpp->hwndContents, dpp->hwndPanel);

	// resize the dockwnd to fit around the content
	SizeToContent(dpp);		

	UpdateDockTabView(dpp);

	return TRUE;
}
Ejemplo n.º 4
0
DWORD CMySliderCtrl::SetBitmaps(HBITMAP hChannel, COLORREF crTransCh,
                                HBITMAP hThumb, COLORREF crTransThumb)
{
    int		nRetValue = 0;
    BITMAP	csBitmapSize;
    m_BgSet = FALSE;

    // Free any loaded resource
    FreeResources();

    if (hChannel)
    {
        m_csBitmaps[0].hBitmap = hChannel;
        m_csBitmaps[0].crTransparent = crTransCh;
        // Get bitmap size
        nRetValue = ::GetObject(hChannel, sizeof(csBitmapSize), &csBitmapSize);
        if (nRetValue == 0)
        {
            FreeResources();
            return BTNST_INVALIDRESOURCE;
        } // if
        m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth;
        m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight;

        // Create mask for bitmap In
        m_csBitmaps[0].hMask = CreateBitmapMask(hChannel, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransCh);
        if (m_csBitmaps[0].hMask == NULL)
        {
            FreeResources();
            return BTNST_FAILEDMASK;
        } // if
    }
    if (hThumb)
    {
        m_csBitmaps[3].hBitmap = hThumb;
        m_csBitmaps[3].crTransparent = crTransThumb;
        // Get bitmap size
        nRetValue = ::GetObject(hThumb, sizeof(csBitmapSize), &csBitmapSize);
        if (nRetValue == 0)
        {
            FreeResources();
            return BTNST_INVALIDRESOURCE;
        } // if
        m_csBitmaps[3].dwWidth = (DWORD)csBitmapSize.bmWidth;
        m_csBitmaps[3].dwHeight = (DWORD)csBitmapSize.bmHeight;

        // Create mask for bitmap Out
        m_csBitmaps[3].hMask = CreateBitmapMask(hThumb, m_csBitmaps[3].dwWidth, m_csBitmaps[3].dwHeight, crTransThumb);
        if (m_csBitmaps[3].hMask == NULL)
        {
            FreeResources();
            return BTNST_FAILEDMASK;
        } // if
    } // if
    SizeToContent();

    Invalidate();

    return BTNST_OK;
} // End of SetBitmaps
//*************************************************************************************
void CBCGPDateTimeCtrl::SetAutoResize(BOOL bSet)
{
	m_bAutoResize = bSet;

	if (GetSafeHwnd () != NULL)
	{
		SizeToContent ();
		RedrawWindow ();
	}
}
Ejemplo n.º 6
0
// Autoload will load the bitmap resources
BOOL CMappedBitmapButton::AutoLoad(UINT nID, CWnd* pParent, UINT idBitmapResource)
{
	// first attach the CMappedBitmapButton to the dialog control
	if (!SubclassDlgItem(nID, pParent))
		return FALSE;

	if (!LoadBitmap(idBitmapResource))
		return FALSE;

	// size to content
	SizeToContent();
	return TRUE;
}
Ejemplo n.º 7
0
void OBMButton::Create(CWnd *parent, int res, int resD, int resI, const CPoint &pos, UINT id, bool tabStop) {
  int flags = WS_CHILD | WS_VISIBLE | BS_NOTIFY | BS_OWNERDRAW;
  if(tabStop) flags |= WS_TABSTOP;

  if(!CBitmapButton::Create(EMPTYSTRING
                           ,flags
                           ,CRect(pos.x,pos.y,pos.x+16,pos.y+16)
                           ,parent
                           ,id)) {
    throwException(_T("%s:CBitmapButton::Create failed"), __TFUNCTION__);
  }
  loadBitmap(m_bitmap        ,res );
  loadBitmap(m_bitmapSel     ,resD);
  loadBitmap(m_bitmapFocus   ,res );
  loadBitmap(m_bitmapDisabled,resI);
  SizeToContent();
  SetPosition(pos.x,pos.y,false);
}
Ejemplo n.º 8
0
void CIconButton::SetBitmap(UINT nBmID)
{
	if(m_bitmap.GetSafeHandle())
	{
		m_bitmap.DeleteObject();
	}

	m_bitmap.LoadBitmap(nBmID);

	if(m_bitmap.GetSafeHandle())
	{
		BITMAP bm;
		m_bitmap.GetBitmap(&bm);
		m_nImageWidth = bm.bmWidth;
		m_nImageHeight = bm.bmHeight;
		SizeToContent();
	}
}
Ejemplo n.º 9
0
BOOL CBitmapButton::AutoLoad( UINT nID, CWnd *pParent )
/*****************************************************/
{
    if( !SubclassDlgItem( nID, pParent ) ) {
        return( FALSE );
    }

    CString strText;
    GetWindowText( strText );
    ASSERT( strText.GetLength() > 0 );

    if( !LoadBitmaps( strText + _T("U"), strText + _T("D"), strText + _T("F"),
                      strText + _T("X") ) ) {
        return( FALSE );
    }

    SizeToContent();
    return( TRUE );
}
//*************************************************************************************
void CBCGPDateTimeCtrl::SetState (UINT stateFlags, UINT stateMask)
{
	if(!(stateFlags & DTM_DATE) && !(stateFlags & DTM_TIME))
		stateFlags |= (DTM_DATE | DTM_TIME);

	if(stateMask & DTM_SPIN)
		m_spinButton = 
			((stateFlags & DTM_SPIN) != 0);

	if(stateMask & DTM_DROPCALENDAR)
		m_dropCalendar = 
			((stateFlags & DTM_DROPCALENDAR) != 0);

	if(stateMask & DTM_DATE)
		m_showDate = 
			((stateFlags & DTM_DATE) != 0);

	if(stateMask & DTM_TIME24H)
		m_b24HoursFormat = 
			((stateFlags & DTM_TIME24H) != 0);

	if(stateMask & DTM_CHECKBOX)
		m_checkButton = 
			((stateFlags & DTM_CHECKBOX) != 0);

	if(stateMask & DTM_TIME)
		m_showTime = 
			((stateFlags & DTM_TIME) != 0);

	if(stateMask & DTM_CHECKED)
		m_bIsChecked = 
			((stateFlags & DTM_CHECKED) != 0);

	if(stateMask & DTM_TIME24HBYLOCALE)
		m_b24HoursByLocale = 
			((stateFlags & DTM_TIME24HBYLOCALE) != 0);

	if(::IsWindow (m_hWnd))
	{
		SizeToContent();
	}
}
Ejemplo n.º 11
0
// Autoload will load the bitmap resources based on the text of
//  the button
// Using suffices "U", "D", "F" and "X" for up/down/focus/disabled
BOOL CBitmapButton::AutoLoad(UINT nID, CWnd* pParent)
{
	// first attach the CBitmapButton to the dialog control
	if (!SubclassDlgItem(nID, pParent))
		return FALSE;

	CString buttonName;
	GetWindowText(buttonName);
	ASSERT(!buttonName.IsEmpty());      // must provide a title

	LoadBitmaps(buttonName + _T("U"), buttonName + _T("D"),
	  buttonName + _T("F"), buttonName + _T("X"));

	// we need at least the primary
	if (m_bitmap.m_hObject == NULL)
		return FALSE;

	// size to content
	SizeToContent();
	return TRUE;
}
Ejemplo n.º 12
0
void CIconButton::SetIcon(UINT nIcon)
{
	if(m_hIcon)
	{
		::DestroyIcon(m_hIcon);
	}
		
	HINSTANCE	hInstResource	= NULL;
	// Find correct resource handle
	hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nIcon), RT_GROUP_ICON);
	
	if(hInstResource)
	{
		m_hIcon = (HICON)::LoadImage(hInstResource,
					MAKEINTRESOURCE(nIcon),
					IMAGE_ICON,
					0,
					0,
					0);

		if(m_hIcon)
		{
			ICONINFO iconinfo;
			::GetIconInfo(m_hIcon, &iconinfo);
			m_nImageWidth = iconinfo.xHotspot * 2;
			m_nImageHeight = iconinfo.yHotspot * 2;
			if (iconinfo.hbmColor)
			{
				::DeleteObject(iconinfo.hbmColor);
			}
			if (iconinfo.hbmMask)
			{
				::DeleteObject(iconinfo.hbmMask);
			}

			SizeToContent();
		}
	}
}
Ejemplo n.º 13
0
static BOOL DockWnd_CreatePanel(DOCKPANEL *dpp)
{
	DWORD dwStyleEx, dwStyle;
	RECT  rect = { 0 };

	DOCKWND *dwp;

	if(dpp->fDocked)
	{
		dwStyle		= CHILD_STYLES;
		dwStyleEx	= CHILD_EXSTYLES;
		rect.right	= 0;
		rect.bottom	= 0;
	}
	else
	{
		dwStyle		= POPUP_STYLES;
		dwStyleEx	= POPUP_EXSTYLES;
		rect.right	= dpp->FloatSize.cx;
		rect.bottom	= dpp->FloatSize.cy;
	}

	if(!IsRectEmpty(&rect))
	{
		//
		//	Add on room for borders/splitters
		//
		AdjustRectBorders(dpp, &rect, 1);

		// if it's floating then add on the non-client area
		if(dpp->fDocked == FALSE)
			AdjustWindowRectEx(&rect, POPUP_STYLES, FALSE, POPUP_EXSTYLES);
	}

	// create the DOCKPANEL
	dwp = DOCKWNDFromId(dpp->hwndMain, dpp->uCurrentTabId);

	dpp->hwndPanel = CreateWindowEx(dwStyleEx,
								WC_DOCKBAR, 
								dwp ? dwp->szTitle : TEXT(""),
								dwStyle,
								dpp->xpos, dpp->ypos, RectWidth(&rect), RectHeight(&rect),
								dpp->hwndMain, 
								(HMENU)0,//dpp->uPanelId, 
								0, dpp);

	ForceVisibleDisplay(dpp->hwndPanel);

	// reassign any open content-panels to the new dockwnd
	{
		DOCKWND *dwp;
		for(dwp = dpp->WndListHead->flink; dwp != dpp->WndListTail; dwp = dwp->flink)
		{
			SetParent(dwp->hwndContents, dpp->hwndPanel);
		}
	}
    

	if(dpp->hwndTabView)
		SetParent(dpp->hwndTabView, dpp->hwndPanel);

	// content might not exist. But if it does (i.e. we are
	// creating a new DOCKPANEL because of dock/undock) then we
	// will size appropriately
	SizeToContent(dpp);

	return TRUE; 
}