Ejemplo n.º 1
0
BOOL CPropTreeItemCombo::CreateComboBoxBool()
{
	ASSERT(m_pProp!=NULL);

	if (IsWindow(m_hWnd))
		DestroyWindow();

	// force as a non-visible child window
	DWORD dwStyle = WS_CHILD|WS_VSCROLL|CBS_SORT|CBS_DROPDOWNLIST;

	if (!Create(dwStyle, CRect(0,0,0,0), m_pProp->GetCtrlParent(), GetCtrlID()))
	{
		TRACE0("CPropTreeItemCombo::CreateComboBoxBool() - failed to create combo box\n");
		return FALSE;
	}

	SendMessage(WM_SETFONT, (WPARAM)m_pProp->GetNormalFont()->m_hObject);

	// file the combo box
	LONG idx;
	CString s;

	s.LoadString(IDS_TRUE);
	idx = AddString(s);
	SetItemData(idx, TRUE);

	s.LoadString(IDS_FALSE);
	idx = AddString(s);
	SetItemData(idx, FALSE);

	return TRUE;
}
bool CPropTreeItemCheck::CreateCheckBox() {
	ASSERT( m_pProp != NULL );
	if( IsWindow( m_hWnd ) ) {
		DestroyWindow();
	}
	DWORD dwStyle = ( WS_CHILD | BS_CHECKBOX | BS_NOTIFY | BS_FLAT );
	if( !Create( NULL, dwStyle, CRect( 0, 0, 0, 0 ), m_pProp->GetCtrlParent(), GetCtrlID() ) ) {
		TRACE0( "CPropTreeItemCombo::CreateComboBox() - failed to create combo box\n" );
		return FALSE;
	}
	return TRUE;
}
Ejemplo n.º 3
0
void COptionTreeItemFont::OnActivate()
{
	// Declare variables
	CWnd *pWnd;

	// Set apply window
	if (m_pApplyWindow != NULL)
	{
		pWnd = m_pApplyWindow;
	}
	else
	{
		pWnd = m_otOption;
	}

	// Show dialog
	COptionTreeFontSel fDialog(m_dwOptions, m_lfFont, m_lfDefaultFont, pWnd);
	// -- Default Font Color
	fDialog.SetDefaultTextColor(m_crDefTextColor);
	// -- Font Color
	fDialog.SetTextColor(m_crTextColor);
	// -- Control ID
	fDialog.SetControlID(GetCtrlID());

	// Show dialog
	if (fDialog.DoModal() == ID_FONTSEL_OK)	
	{
		// -- Get font
		fDialog.GetLogFont(m_lfFont);

		// -- Get font color
		m_crTextColor = fDialog.GetTextColor();

		// -- Set item height
		if ((abs(m_lfFont.lfHeight) + (OT_SPACE * 2)) > m_lDefaultHeight)
		{
			SetItemHeight(abs(m_lfFont.lfHeight) + (OT_SPACE * 2));
			SetDrawMultiline(TRUE);
		}
		else
		{
			SetItemHeight(m_lDefaultHeight);
			SetDrawMultiline(FALSE);
		}
	}

	// Update items
	if (m_otOption != NULL)
	{
		m_otOption->UpdatedItems();
	}
}
Ejemplo n.º 4
0
BOOL CPropTreeItemCombo::CreateComboBox( DWORD dwStyle ) {
	ASSERT( m_pProp != NULL );
	if( IsWindow( m_hWnd ) ) {
		DestroyWindow();
	}
	// force as not visible child window
	dwStyle = ( WS_CHILD | WS_VSCROLL | dwStyle ) & ~WS_VISIBLE;
	if( !Create( dwStyle, CRect( 0, 0, 0, 0 ), m_pProp->GetCtrlParent(), GetCtrlID() ) ) {
		TRACE0( "CPropTreeItemCombo::CreateComboBox() - failed to create combo box\n" );
		return FALSE;
	}
	SendMessage( WM_SETFONT, ( WPARAM )m_pProp->GetNormalFont()->m_hObject );
	return TRUE;
}
void CPropTreeItemEdit::OnActivate( int activateType, CPoint point ) {
	// Check if the edit control needs creation
	if( !IsWindow( m_hWnd ) ) {
		DWORD dwStyle;
		dwStyle = WS_CHILD | ES_AUTOHSCROLL;
		Create( dwStyle, m_rc, m_pProp->GetCtrlParent(), GetCtrlID() );
	}
	SendMessage( WM_SETFONT, ( WPARAM )m_pProp->GetNormalFont()->m_hObject );
	SetPasswordChar( ( TCHAR )( m_bPassword ? '*' : 0 ) );
	SetWindowText( m_sEdit );
	SetSel( 0, -1 );
	SetWindowPos( NULL, m_rc.left, m_rc.top, m_rc.Width(), m_rc.Height(), SWP_NOZORDER | SWP_SHOWWINDOW );
	SetFocus();
}
Ejemplo n.º 6
0
BOOL COptionTreeItemListBox::CreateListItem(DWORD dwAddStyle,const int Height)
{
	// Declare variables
	//DWORD dwStyle = WS_CHILD | WS_VISIBLE | LBS_STANDARD | WS_VSCROLL|WS_HSCROLL;
  // no sort but multiselect
  DWORD dwStyle = WS_CHILD | WS_VISIBLE | LBS_NOTIFY | LBS_EXTENDEDSEL | WS_VSCROLL | WS_HSCROLL;

     
	BOOL bRet = FALSE;

	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Create edit control
	if (!IsWindow(GetSafeHwnd()))
	{
		// -- Add style
		if (dwAddStyle != 0)
		{
			dwStyle |= dwAddStyle;
		}
		
		// -- Create the list box
		bRet = Create(dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

		// -- Setup list
		if (bRet == TRUE)
		{
			// -- -- Set font
			SetFont(m_otOption->GetNormalFont(), TRUE);

      COptionTreeItem::SetItemHeight(Height > OT_DEFHEIGHT ? Height : OT_LISTBOX_HEIGHT);

			// -- -- Set window position
			MoveWindow(m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height());		

      ShowWindow(SW_SHOW);
		}
	}


	return bRet;
}
Ejemplo n.º 7
0
BOOL COptionTreeItemDate::CreateDateItem(CString strFormat, DWORD dwDateStyle)
{
	// Declare variables
	DWORD dwStyle = WS_CHILD | WS_VISIBLE;
	BOOL bRet = FALSE;

	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Add styles
	if (dwStyle != 0)
	{
		dwStyle |= dwDateStyle;
	}

	// Create edit control
	if (!IsWindow(GetSafeHwnd()))
	{
		// -- Create the edit view
		bRet = Create(dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

		// -- Setup window
		if (bRet == TRUE)
		{
			// -- -- Set font
			SetFont(m_otOption->GetNormalFont(), TRUE);

			// -- Set format
			SetFormat(strFormat);

			// -- -- Set window position
			MoveWindow(m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height());

			// -- -- Hide window
			ShowWindow(SW_HIDE);
		}
	}

	return bRet;
}
BOOL COptionTreeItemLineThikComboBox::CreateComboItem(DWORD dwAddStyle)
{
	// Declare variables
	DWORD dwStyle = WS_CHILD | WS_VISIBLE | 
		CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED|WS_VSCROLL;
	BOOL bRet = FALSE;

	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Create edit control
	if (!IsWindow(GetSafeHwnd()))
	{
		// -- Add style
		if (dwAddStyle != 0)
		{
			dwStyle |= dwAddStyle;
		}
		
		// -- Create the combo box
		bRet = Create(dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

		// -- Setup combo
		if (bRet == TRUE)
		{
			// -- -- Set font
			SetFont(m_otOption->GetNormalFont(), TRUE);

			// -- -- Set window position
			MoveWindow(m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height());		

			// -- -- Hide window
			ShowWindow(SW_HIDE);
		}
	}


	return bRet;
}
Ejemplo n.º 9
0
BOOL COptionTreeItemColor::CreateColorItem(DWORD dwOptions, COLORREF rcColor, COLORREF rcAutomatic)
{
	// Declare variables
	DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
	BOOL bRet = FALSE;

	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Create window
	if (!IsWindow(GetSafeHwnd()))
	{
		// -- Create the edit view
		bRet = Create(AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, ::LoadCursor(NULL, IDC_ARROW)), _T(""), dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

		// -- Setup window
		if (bRet == TRUE)
		{
			// -- -- Set font
			SetFont(m_otOption->GetNormalFont(), TRUE);

			// -- -- Set color
			SetColor(rcColor);

			// -- -- Set automatic color
			SetAutomaticColor(rcAutomatic);

			// -- -- Save options
			m_dwOptions = dwOptions;

			// -- -- Set window position
			MoveWindow(m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height());

			// -- -- Hide window
			ShowWindow(SW_HIDE);
		}
	}

	return bRet;
}
Ejemplo n.º 10
0
BOOL COptionTreeItemRadio::CreateRadioItem()
{
	// Declare variables
	DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
	BOOL bRet = FALSE;

	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Create edit control
	if (!IsWindow(GetSafeHwnd()))
	{
		// -- Create the edit view
		bRet = Create(AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, ::LoadCursor(NULL, IDC_ARROW)), _T(""), dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

		// -- Setup window
		if (bRet == TRUE)
		{

			// -- -- Set draw multiline
			SetDrawMultiline(TRUE);		

			// -- -- Set font
			SetFont(m_otOption->GetNormalFont(), TRUE);

			// -- -- Set check options owner
			SetRadioOptionsOwner(m_otOption);

			// -- -- Set window position
			SetWindowPos(NULL, m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height(), SWP_NOZORDER | SWP_SHOWWINDOW);

			// -- -- Hide window
			ShowWindow(SW_HIDE);
		}
	}

	return bRet;
}
Ejemplo n.º 11
0
BOOL COptionTreeItemImage::CreateImageItem(DWORD dwOptions, CSize sImageSizes, int nNumberColumns)
{
    // Declare variables
    DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
    BOOL bRet = FALSE;

    // Make sure options is not NULL
    if (m_otOption == NULL)
    {
        return FALSE;
    }

    // Create window
    if (!IsWindow(GetSafeHwnd()))
    {
        // -- Create the edit view
        bRet = Create(AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, ::LoadCursor(NULL, IDC_ARROW)), _T(""), dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

        // -- Setup window
        if (bRet == TRUE)
        {
            // -- -- Set font
            SetFont(m_otOption->GetNormalFont(), TRUE);

            // -- -- Save options
            m_dwOptions = dwOptions;

            // -- -- Create imagelist
            if (m_imgImages.GetSafeHandle() != NULL)
            {
                m_imgImages.DeleteImageList();
            }
            if (!m_imgImages.Create(sImageSizes.cx, sImageSizes.cy, ILC_COLORDDB | ILC_MASK, 1, OT_IMAGE_MAXIMAGES))
            {
                bRet = FALSE;
            }

            // -- -- Set item height
            SetItemHeight((long) sImageSizes.cy + (OT_IMAGE_IMAGESPACE * 2));

            // -- -- Set number of columns
            SetNumberColumns(nNumberColumns);

            // Set image height
            SetImageSize(sImageSizes);

            // -- -- Set window position
            SetWindowPos(NULL, m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height(), SWP_NOZORDER | SWP_SHOWWINDOW);

            // -- -- Hide window
            ShowWindow(SW_HIDE);
        }
    }

    return bRet;
}
Ejemplo n.º 12
0
BOOL COptionTreeItemEdit::CreateEditItem(DWORD dwOptions, DWORD dwAddStyle)
{
	// Declare variables
	DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;
	BOOL bRet = FALSE;


	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Create edit control
	if (!IsWindow(GetSafeHwnd()))
	{
		// -- Create edit style
		// -- -- Multiline
		if (dwOptions & OT_EDIT_MULTILINE)
		{
			dwStyle |= ES_MULTILINE;
		}
		// -- -- Password
		if (dwOptions & OT_EDIT_PASSWORD)
		{
			dwStyle |= ES_PASSWORD;
		}
		// -- -- Numeical
		if (dwOptions & OT_EDIT_NUMERICAL)
		{
			dwStyle |= ES_NUMBER;
		}
		// -- -- Additional style
		if (dwAddStyle != 0)
		{
			dwStyle |= dwAddStyle;
		}

		// -- Create the edit view
		bRet = Create(dwStyle, m_rcAttribute, m_otOption->GetCtrlParent(), GetCtrlID());

		// -- Setup edit
		if (bRet == TRUE)
		{
			// -- -- Set font
			SetFont(m_otOption->GetNormalFont(), TRUE);

			// -- -- Modify style
			ModifyStyleEx(0, WS_EX_CLIENTEDGE, SWP_FRAMECHANGED);

			// -- -- Save options
			m_dwOptions = dwOptions;

			// -- -- Set selection
			SetSel(0, 0);

			// -- -- Set multiline
			if (GetOption(OT_EDIT_MULTILINE) == TRUE)
			{
				SetItemHeight(OT_EDIT_MLHEIGHT);
			}

			// -- -- Set window position
			MoveWindow(m_rcAttribute.left, m_rcAttribute.top, m_rcAttribute.Width(), m_rcAttribute.Height());

			// -- -- Hide window
			ShowWindow(SW_HIDE);
		}
	}

	return bRet;
}