Esempio n. 1
0
void StormGETURLBox::OnBnClickedAdd()
{	
	CWnd* pwnd = AfxGetMainWnd(); // Pointer to main window
	HWND hWnd = pwnd->GetSafeHwnd();

	CListCtrl* m_FileQueue = (CListCtrl*)pwnd->GetDlgItem(IDC_LIST3);
	CSliderCtrl* m_Connections = (CSliderCtrl*)pwnd->GetDlgItem(IDC_SLIDER1);
	CString FileURLs;

	this->GetDlgItemTextW(IDC_LIST,FileURLs);

	while (!FileURLs.IsEmpty()) {
		LVITEM lvItem;

		int nItem = m_FileQueue->GetItemCount();

		lvItem.mask = LVIF_TEXT;
		lvItem.iItem = nItem;
		nItem++;
		lvItem.iSubItem = 0;

		lvItem.pszText = L"Queued";
		nItem = m_FileQueue->InsertItem(&lvItem);

		CString connPos;
		connPos.Format(L"%i", m_Connections->GetPos());

		m_FileQueue->SetItemText(nItem, 1, connPos);
		m_FileQueue->SetItemText(nItem, 2, GetLine(FileURLs));
	}
}
Esempio n. 2
0
void CImportDialog::OnInitDone()
{
	CRect rct;                          // Used to move/resize controls
	CWnd *pp;                           // Parent = the dialog window itself
	VERIFY(pp = GetParent());

	ASSERT(pp->GetDlgItem(cmb1) != NULL && pp->GetDlgItem(IDOK) != NULL);

	// Create a new button below the "Type" drop down list
	pp->GetDlgItem(cmb1)->GetWindowRect(rct); // Get button rectangle
	pp->ScreenToClient(rct);
	rct.InflateRect(0, 4, -rct.Width()/3, 4);   // Make 2/3 width, + make higher for 2 lines of text
	rct.OffsetRect(0, 30);

	m_discon.Create(_T("Use import addresses\r\n(for non-adjoining records)"),
					WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE, rct, pp, IDC_DISCON);
	m_discon.SetFont(pp->GetDlgItem(IDOK)->GetFont());
	m_discon.SetCheck(theApp.import_discon_);

	rct.OffsetRect(rct.Width()+4, 0);
	rct.InflateRect(0, 0, -(rct.Width()/2), 0);  // Make half width of IDC_DISCON checkbox (= 1/3 of cmb1 width)
	m_highlight.Create(_T("Highlight"),
					WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE, rct, pp, IDC_IMPORT_HIGHLIGHT);
	m_highlight.SetFont(pp->GetDlgItem(IDOK)->GetFont());
	m_highlight.SetCheck(theApp.import_highlight_);
	CHexFileDialog::OnInitDone();
}
Esempio n. 3
0
void CDirDialog::OnFolderChange()
{
	CWnd *pp;                           // Parent window = the dialog itself
	VERIFY(pp = GetParent());
	ASSERT(::IsWindow(pp->m_hWnd));

	ASSERT(pp->GetDlgItem(IDC_DIR) != NULL);
	m_strPath = GetFolderPath();
	int len = m_strPath.GetLength();
	if (len > 0 && m_strPath[len-1] != '\\')
	{
		m_strPath += "\\";
		++len;
	}
	pp->GetDlgItem(IDC_DIR)->SetWindowText(m_strPath);
	if (m_first_time)
	{
		// Initially select whole name so user can remove by just typing
		m_Edit.SetSel(0, -1);
		m_first_time = FALSE;
	}
	else
		m_Edit.SetSel(len, len);    // Move caret to end of name

	CFileDialog::OnFolderChange();

	m_Edit.SetFocus();
}
Esempio n. 4
0
void CExportDialog::OnInitDone()
{
	CRect rct;                          // Used to move/resize controls
	CWnd *pp;                           // Parent = the dialog window itself
	VERIFY(pp = GetParent());

	ASSERT(pp->GetDlgItem(cmb1) != NULL && pp->GetDlgItem(IDOK) != NULL);

	// Create a new button below the "Type" drop down list
	pp->GetDlgItem(cmb1)->GetWindowRect(rct); // Get button rectangle
	pp->ScreenToClient(rct);
	rct.InflateRect(0, 4, -(rct.Width()/2), 4);   // make higher for 2 lines of text and half the width
	rct.OffsetRect(0, 30);

	m_discon_hl.Create(_T("Export (non-adjoining)\r\nhighlighted areas only"),
					WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE, rct, pp, IDC_DISCON);
	m_discon_hl.SetFont(pp->GetDlgItem(IDOK)->GetFont());
	m_discon_hl.SetCheck(theApp.import_discon_);

	FILE_ADDRESS start, end;
	m_pview->GetSelAddr(start, end);
	if (start >= end)
		m_discon_hl.SetCheck(1);
	if (!m_pview->HasHighlights())
	{
		// If no highlights disable the checkbox
		m_discon_hl.SetCheck(0);
		m_discon_hl.EnableWindow(FALSE);
	}

	CHexFileDialog::OnInitDone();
}
Esempio n. 5
0
void COptionsDlg::ClearCurrentPage ()
{
	CWnd * parentGroupBox = GetDlgItem (IDC_OPTIONGROUP);
	for (size_t i=0;i<m_currentPageControls.size ();i++)
	{
		CWnd *item = parentGroupBox->GetDlgItem  ( ((CWnd*)(m_currentPageControls[i].first))->GetDlgCtrlID ());
		if (item)
		{				
				if (m_currentPageControls[i].second.UIType == avocado::AvocadoOption::CHECKBOX)
				{
					CButton *obj = (CButton*)(m_currentPageControls[i].first);
					
				    bool ischek = (obj->GetCheck () > 0);

					m_currentPageControls[i].second.valueBool = ischek;

					item->DestroyWindow ();
					
					delete obj;
				}
				else if (m_currentPageControls[i].second.UIType == avocado::AvocadoOption::EDITBOX)
				{
					 int labelID = ((CWnd*)(m_currentPageControls[i].first))->GetDlgCtrlID () - 1100 + 2200;

					CWnd *labelitem = parentGroupBox->GetDlgItem  (labelID);
					
					if (labelitem)
					{
						labelitem->DestroyWindow ();
						CStatic *css = (CStatic*) labelitem;
						delete css;
					}
					CEdit *obj = (CEdit*)(m_currentPageControls[i].first);

					wchar_t buf[MAX_PATH];
					obj->GetWindowTextW (buf, MAX_PATH);
					char cbuf [MAX_PATH];
					::wcstombs (cbuf,buf,MAX_PATH);
					
					if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::STRING)
						m_currentPageControls[i].second.valueString = string (cbuf);
					else if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::FLOAT)
					{
						stringstream ss ( cbuf);
						ss >> m_currentPageControls[i].second.valueFloat;
					}
					else if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::BOOL)
					{
						string ss ( cbuf);
						bool bv = false;
						if (ss == "Yes")
							bv = true; else bv = false;
						m_currentPageControls[i].second.valueBool = bv;
					}
					else if (m_currentPageControls[i].second.Type == avocado::AvocadoOption::INT)
					{
						stringstream ss ( cbuf);
						ss >> m_currentPageControls[i].second.valueInt;
					}
Esempio n. 6
0
void COrderListBoxItem::PaintItem(COwnerDrawListBox* pList, CDC* pDC, LPDRAWITEMSTRUCT pDrawItemStruct, CRect& crBounds, COLORREF clForeground, COLORREF clBackground)
{
	CProductItem* pItem = Item();
	
	if (pItem != NULL)
	{
		CRect crListBox;
		pList->GetWindowRect(crListBox);
		
		CWnd* pDialog = pList->GetParent();
		
		CWnd* pPriceAlign = pDialog->GetDlgItem(IDC_PRICE_ALIGN);
		CRect crPriceAlign;
		pPriceAlign->GetWindowRect(crPriceAlign);
		
		CWnd* pExtensionAlign = pDialog->GetDlgItem(IDC_EXTENSION_ALIGN);
		CRect crExtensionAlign;
		pExtensionAlign->GetWindowRect(crExtensionAlign);
		
		CString csName = pItem->Name();
		
//		if (Indent() == 0)
//		{
//			csName += " *";
//		}

		int nNameAlign = crBounds.left;
		BOOL fFree = pItem->TestFlag(PRODUCT_ITEM_Free);
		LPCSTR szZero = fFree ? "Free" : "";

		CString csPrice;
		Util::PriceString(csPrice, pItem->Price(), TRUE, szZero);
		int nPriceAlign = crPriceAlign.left-crListBox.left-pDC->GetTextExtent(csPrice, csPrice.GetLength()).cx;
		
		CString csExtension = "";
		Util::PriceString(csExtension, pItem->Price(), TRUE, szZero);
		int nExtensionAlign = crExtensionAlign.left-crListBox.left-pDC->GetTextExtent(csExtension, csExtension.GetLength()).cx;
		
		COLORREF clOldForeground = pDC->SetTextColor(clForeground);
		COLORREF clOldBackground = pDC->SetBkColor(clBackground);
	
		pDC->TextOut(nNameAlign,  crBounds.top, csName,  csName.GetLength());

		if (fFree && !pItem->TestFlag(PRODUCT_ITEM_Licensed))
		{
		/* "Free" should be red. */
			pDC->SetTextColor(RGB(255, 0, 0));
		}
		pDC->TextOut(nPriceAlign, crBounds.top, csPrice, csPrice.GetLength());
		
		if (Select())
		{
			pDC->TextOut(nExtensionAlign, crBounds.top, csExtension, csExtension.GetLength());
		}
		
		pDC->SetTextColor(clOldForeground);
		pDC->SetBkColor(clOldBackground);
	}
}
Esempio n. 7
0
// =============================================
// CallbackSelectDir
// 概要  : フォルダ参照で使用するコールバック関数
//       : 開いたときにフォルダを選択した状態で開かせる処理をする場合に必要
// 引数  : ...
// 戻り値: int CALLBACK
// =============================================
int CALLBACK CSHBrowseForFolder::CallbackSelectDir(HWND hWnd, UINT uMsg, LPARAM, LPARAM lpData)
{
	if (uMsg == BFFM_INITIALIZED) {
		// デフォルトのフォルダを選択させる
		SendMessage(hWnd, BFFM_SETSELECTION, (WPARAM)TRUE, lpData);
		{
			// フォルダーツリーで常に選択状態を表示
			HWND hwndTree = FindWindowEx(hWnd, NULL, "SysTreeView32", NULL);
			if (hwndTree != NULL) {
				LONG style;
				style = GetWindowLong(hwndTree, GWL_STYLE);
				style |= TVS_SHOWSELALWAYS;
				SetWindowLong(hwndTree, GWL_STYLE, style);
			}
		}

		// [サブディレクトリを検索] ボタンを追加
		if (GetEnableSubDirButton()) {
			pSubDir = new CButton; /* WildCherry2 080 */
			if (pSubDir) {
				RECT	rectClient, rectOK, rectCancel, rect;
				CWnd	*pClient	= CWnd::FromHandle(hWnd);
				CWnd	*pOK		= pClient->GetDlgItem(IDOK);
				CWnd	*pCANCEL	= pClient->GetDlgItem(IDCANCEL);
				// クライアントウィンドウサイズを取得
				pClient->GetClientRect(&rectClient);
				// [OK] / [CANCEL] のウィンドウ位置を取得
				pOK->GetWindowRect(&rectOK);
				pCANCEL->GetWindowRect(&rectCancel);
				pClient->ScreenToClient(&rectOK) ;
				pClient->ScreenToClient(&rectCancel) ;
				// サブディレクトリ対象チェックボタンの RECT を求める
				rect = CRect(rectClient.right - rectCancel.right,
				             rectCancel.top,
				             rectOK.left,
				             rectCancel.bottom);
				// チェックボタン作成
				if (pSubDir->Create(GetCheckBoxTitle(),
				                    WS_CHILD | WS_VISIBLE | BS_CHECKBOX | WS_TABSTOP,
				                    rect, pClient, IDC_CH_SUB_DIR)) {
					// フォントを設定
					HFONT hFontCurr = (HFONT)pClient->SendMessage(WM_GETFONT, 0, 0);
					if (hFontCurr != NULL) pSubDir->PostMessage(WM_SETFONT, (WPARAM)hFontCurr, 0); 

					// チェック状態を設定
					pSubDir->SetCheck(GetSearchSubDirState() ? TRUE : FALSE);

					// サブクラス化
					m_VSSelectOrgProc = (WNDPROC)SetWindowLong(hWnd, GWL_WNDPROC, (LONG)VSSelectFolderSubProc);
				}
			}
		}
	}
	return 0;
}
Esempio n. 8
0
void CDLgBarH::SetViewTimeGlub()
{
	HideShowTimeDeepnessButtons(true);

	int style = gflgViewTimeGlub ? SW_SHOW : SW_HIDE;
	CWnd* w = &m_wndDialogBarDB;
	w->GetDlgItem(IDC_STATIC_R)->ShowWindow(style);
	w->GetDlgItem(IDC_RADIO_SELCT_TIMEGLUB2)->ShowWindow(style);
	w->GetDlgItem(IDC_EDIT_START_GLUB)->ShowWindow(style);
	w->GetDlgItem(IDC_STATIC_START_GLUB)->ShowWindow(style);
	w->GetDlgItem(IDC_EDIT_LEN_GLUB)->ShowWindow(style);
	w->GetDlgItem(IDC_STATIC_MONTH2)->ShowWindow(style);
}
/* OnInitDone
 * ----------------------------------------------------------------------------
 */
void CFolderDialog::OnInitDone()
{
    HideControl(stc2);
    HideControl(cmb1);

    CWnd* pFD = GetParent();

    LCID lcid = GetSystemDefaultLCID();

    switch(PRIMARYLANGID(LANGIDFROMLCID(lcid)))
    {
    default:
    case LANG_ENGLISH:
        SetControlText(stc3, "Folder:");
        SetControlText(IDOK, "&Select");
        pFD->SetWindowText("Select Folder");
        break;

    case LANG_GERMAN:
        SetControlText(stc3, "Verzeichnis:");
        SetControlText(IDOK, "&Auswahl");
        pFD->SetWindowText("Verzeichnis auswählen");
        break;
    }

    SetControlText(edt1, m_sSelPath);

    CRect rStatic;
    pFD->GetDlgItem(stc3)->GetWindowRect(rStatic);
    pFD->ScreenToClient(rStatic);
    rStatic.right -= 10;
    pFD->GetDlgItem(stc3)->SetWindowPos(0, 0, 0, rStatic.Width(), rStatic.Height(), SWP_NOMOVE | SWP_NOZORDER);

    CRect rectCancel;
    pFD->GetDlgItem(IDCANCEL)->GetWindowRect(rectCancel);
    pFD->ScreenToClient(rectCancel);

    CRect rectOK;
    pFD->GetDlgItem(IDOK)->GetWindowRect(rectOK);
    pFD->ScreenToClient(rectOK);
    pFD->GetDlgItem(IDOK)->SetWindowPos(0,rectCancel.left - rectOK.Width() - 4, rectCancel.top, 0,0, SWP_NOZORDER | SWP_NOSIZE);

    CRect rList;
    pFD->GetDlgItem(lst1)->GetWindowRect(rList);
    pFD->ScreenToClient(rList);

    CRect rEdit;
    pFD->GetDlgItem(edt1)->GetWindowRect(rEdit);
    pFD->ScreenToClient(rEdit);
    rEdit.left = rStatic.right + 10;
    pFD->GetDlgItem(edt1)->SetWindowPos(0, rEdit.left, rEdit.top, rList.right - rEdit.left, rEdit.Height(), SWP_NOZORDER);

    m_fpWndProcDiag = (WNDPROC)SetWindowLong(pFD->m_hWnd, GWL_WNDPROC, (long)WindowProcDiag);
    m_fpWndProcEdit = (WNDPROC)SetWindowLong(pFD->GetDlgItem(edt1)->m_hWnd, GWL_WNDPROC, (long)WindowProcEdit);
}
void DFUFileDialog::OnSize(UINT nType, int cx, int cy) 
{
	// Pass on to the base class first
	CFileDialog::OnSize(nType, cx, cy);

	// Move the preview control
	CWnd *parent = GetParent();
	WINDOWPLACEMENT placement;
	RECT rect;
	parent->GetDlgItem(cmb1)->GetWindowPlacement(&placement);
	rect = placement.rcNormalPosition;
	parent->GetDlgItem(stc2)->GetWindowPlacement(&placement);
	rect.left = placement.rcNormalPosition.left;
	editPreview.MoveWindow(&rect);
}
//=============================================================================
// OnTimer - adjust dialog size so placebar fits
void CXFolderDialog::OnTimer(UINT_PTR nIDEvent)
//=============================================================================
{
	KillTimer(nIDEvent);

	if (nIDEvent == 1)
	{
		CWnd *pWndParent = GetParent();
		if (pWndParent && IsWindow(pWndParent->m_hWnd))
		{
			CRect rectPlaceBar;
			CWnd *pWnd = pWndParent->GetDlgItem(m_nIdPlaceBar);

			if (pWnd && IsWindow(pWnd->m_hWnd))
			{
				pWnd->GetWindowRect(&rectPlaceBar);

				CToolBarCtrl *ptb = (CToolBarCtrl *) pWndParent->GetDlgItem(m_nIdPlaceBar);

				if (ptb && IsWindow(ptb->m_hWnd))
				{
					int nCount = ptb->GetButtonCount();

					DWORD dwSize = ptb->GetButtonSize();
					UINT nButtonHeight = HIWORD(dwSize);

					int nMinHeight = nCount * nButtonHeight + 2;

					CRect rectDialog;
					pWndParent->GetWindowRect(&rectDialog);

					if ((rectPlaceBar.Height() < nMinHeight) &&
						(nMinHeight < GetSystemMetrics(SM_CYSCREEN)))	// might not work on multiple monitors
					{
						// adjust dialog so all buttons are visible
						rectDialog.bottom += nMinHeight - rectPlaceBar.Height();
						pWndParent->MoveWindow(&rectDialog);
					}

					ptb->ShowWindow(SW_SHOW);
				}
			}
		}
		SetFocus();		// set focus back to dialog
	}

	CFileDialog::OnTimer(nIDEvent);
}
//=============================================================================
void CXFolderDialog::OnCbnKillfocusMruCombo()
//=============================================================================
{
	CString strFolder = _T("");
	m_cmbRecentFolders.GetWindowText(strFolder);
	
	if (!strFolder.IsEmpty() && (_taccess(strFolder, 00) == 0))
	{
		CWnd *pWnd = GetParent();
		if (pWnd && ::IsWindow(pWnd->m_hWnd))
		{
			// change to new folder, leave file name control unchanged
			TCHAR szText[MAX_PATH*2];
			szText[0] = _T('\0');
			pWnd->GetDlgItem(m_nIdFileNameCombo)->SendMessage(WM_GETTEXT,
				sizeof(szText)/sizeof(TCHAR)-2, (LPARAM)szText);
			pWnd->SendMessage(CDM_SETCONTROLTEXT, m_nIdFileNameCombo,
				(LPARAM)(LPCTSTR)strFolder);
			pWnd->SendMessage(WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED),
				(LPARAM)GetDlgItem(IDOK)->GetSafeHwnd());
			pWnd->SendMessage(CDM_SETCONTROLTEXT, m_nIdFileNameCombo,
				(LPARAM)szText);
			
			m_strPath = strFolder;
		}
	}
}
Esempio n. 13
0
void COXRollup::ReArrangeArranged()
	{
	POSITION pos = m_ArrangedRollups.GetHeadPosition();
	if (pos == NULL)
		return;	// this function has to be as fast as possible
	
	CWnd* pMainWnd = AfxGetMainWnd();
	ASSERT((pMainWnd != NULL) && ::IsWindow(pMainWnd->m_hWnd));		// don´t care about OLE
	if (!pMainWnd->IsWindowEnabled() && pMainWnd->IsIconic())
		return;
	
	// set out new top point; because we have to move to first position
	CWnd* pWndLeftOverPane = pMainWnd->GetDlgItem(AFX_IDW_PANE_FIRST);
	ASSERT(pWndLeftOverPane != NULL);
	
	CRect rcWndNewPos;
	pWndLeftOverPane->GetWindowRect(&rcWndNewPos);
	int nLeft = rcWndNewPos.left;
	int nNewTop = rcWndNewPos.top;
	
	COXRollup* pRoll = NULL;
	while (pos != NULL)
		{
		pRoll = (COXRollup*)m_ArrangedRollups.GetNext(pos);
		pRoll->GetWindowRect(&rcWndNewPos);
		pRoll->SetWindowPos(NULL, nLeft, nNewTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
		nNewTop += rcWndNewPos.Height() - 1;
		}
	}
Esempio n. 14
0
CScrollBar* CView::GetScrollBarCtrl(int nBar) const
{
	ASSERT(nBar == SB_HORZ || nBar == SB_VERT);
	if (GetStyle() & ((nBar == SB_HORZ) ? WS_HSCROLL : WS_VSCROLL))
	{
		// it has a regular windows style scrollbar (no control)
		return NULL;
	}

	CWnd* pParent = GetParentSplitter(this, TRUE);
	if (pParent == NULL)
		return NULL;            // no splitter

	UINT nID = _AfxGetDlgCtrlID(m_hWnd);
	if (nID < AFX_IDW_PANE_FIRST || nID > AFX_IDW_PANE_LAST)
		return NULL;            // not a standard pane ID

	// appropriate PANE id - look for sibling (splitter, or just frame)
	UINT nIDScroll;
	if (nBar == SB_HORZ)
		nIDScroll = AFX_IDW_HSCROLL_FIRST + (nID - AFX_IDW_PANE_FIRST) % 16;
	else
		nIDScroll = AFX_IDW_VSCROLL_FIRST + (nID - AFX_IDW_PANE_FIRST) / 16;

	// return shared scroll bars that are immediate children of splitter
	return (CScrollBar*)pParent->GetDlgItem(nIDScroll);
}
/**
 *  This function 'subclasses' an existing control with the toolbar.  This is
 *  not proper subclassing, as we hide the subclassed control, but borrow its
 *  position.
 *
 *  @param id       The id of the control to subclass.
 */
void DialogToolbar::Subclass(UINT id)
{
    CWnd  *parent        = GetParent();
    CWnd  *toolbarHolder = parent->GetDlgItem(id);
    CSize sizeBar        = CalcFixedLayout(FALSE, TRUE);
    WINDOWPLACEMENT wpl;
    toolbarHolder->GetWindowPlacement(&wpl);
    wpl.rcNormalPosition.bottom = wpl.rcNormalPosition.top  + sizeBar.cy + 4;
    wpl.rcNormalPosition.right  = wpl.rcNormalPosition.left + sizeBar.cx + 4;
    toolbarHolder->SetWindowPlacement(&wpl);
    SetWindowPlacement(&wpl);
    RepositionBars
    (
        AFX_IDW_CONTROLBAR_FIRST, 
        AFX_IDW_CONTROLBAR_LAST, 
        0
    );
    toolbarHolder->ShowWindow(SW_HIDE);
    SetWindowPos
    (
        &CWnd::wndTop,
        0, 0, 0, 0,
        SWP_NOACTIVATE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOMOVE
    );
    INIT_AUTO_TOOLTIP();
}
Esempio n. 16
0
// Author & Date:   Almut Branner    12 May 2003
// Purpose: Replace this static control with this window
// Inputs:
//  rcParentWindow - the window this is going to be placed into
//  rcNewWindow - the window that is to be created
//  nControlID - the ID of the control (from the resource editor)
void ReplaceWindowControl(const CWnd &rcParentWindow, CWnd &rcNewWindow, int nControlID)
{
    CWnd *pStatic = rcParentWindow.GetDlgItem(nControlID);

    // For debug mode
    ASSERT(pStatic != 0);

    // For released code
    if (pStatic == 0)
        return;

    CRect rctWindowSize;

    DWORD frmstyle   = pStatic->GetStyle();
    DWORD frmexstyle = pStatic->GetExStyle();

    pStatic->GetWindowRect(rctWindowSize);      // Get window coord.
    rcParentWindow.ScreenToClient(rctWindowSize);              // change to client coord.
    pStatic->DestroyWindow();

    CWnd *pParent = const_cast<CWnd *>(&rcParentWindow);
    rcNewWindow.CreateEx(frmexstyle, NULL, NULL, frmstyle, rctWindowSize, pParent, nControlID);

    // Use for debugging
    // AllocConsole();
}
Esempio n. 17
0
void SetWidthByContentInListBox(CDialog* pDlg, int nID)
{
	if (nID <= 0|| pDlg == NULL) return;
	CWnd* pWnd = (CWnd*)pDlg;

	CListBox* pCB = (CListBox*)pWnd->GetDlgItem(nID);
	if (pCB == NULL) return;

	int origSize = pCB->GetHorizontalExtent();
	int maxSize = origSize;

	CDC* pDC = pWnd->GetDC();
	CString cStr;
	int str_num = pCB->GetCount();
	for (int i = 0; i < str_num; i++)
	{
		pCB->GetText(i, cStr);

		CSize strSize = pDC->GetOutputTextExtent(cStr);
		if (strSize.cx > maxSize)
			maxSize = strSize.cx;
	}

	// in case when adding to list, existing items may be
	// longer than newer ones, so may not want to resize
	if (maxSize > origSize)
		pCB->SetHorizontalExtent(maxSize);
}
/* OnFileNameChange
 * ----------------------------------------------------------------------------
 */
void CFolderDialog::OnFileNameChange()
{
    TCHAR szPath[MAX_PATH];

    GetCurrentDirectory (MAX_PATH, szPath);
    m_sSelPath = CString(szPath);

    // get the list control
    CWnd *pParent = GetParent()->GetDlgItem(lst2);
    CListCtrl *pList = (CListCtrl *)pParent->GetDlgItem(1);

    // currently selected item
    int pos = pList->GetNextItem(-1, LVNI_ALL | LVNI_SELECTED);

    if (pos != -1)
    {
        // create the full path...
        CString sSel(pList->GetItemText(pos, 0));
        CString sPath(szPath);

        if (m_sSelPath.GetAt(m_sSelPath.GetLength() - 1) == '\\')
        {
            sPath = CString (szPath) + sSel;
        }
        else
        {
            sPath = CString (szPath) + _T ( "\\" ) + sSel;
        }

        if (::IsDirectory(sPath))
            m_sSelPath = sPath;
    }

    SetControlText(edt1, m_sSelPath);
}
void CTestDLGDlg::OnBnClickedButton2()
{
	CString strClassName = L"#32770";
	CString strWndName = L"TestDLG";

	int iEdtUserNameID = 0x000003E9;
	int iEdtPasswordID = 0x00003EA;
	int iBtnLogin = 0x000003E8;
	int iCheckBlueID = 0x000003ED;

	CWnd *pWnd = CWnd::FindWindow(strClassName, strWndName);
	if (pWnd != NULL) {


		CEdit * pEdit = (CEdit*)pWnd->GetDlgItem(iEdtUserNameID);
		if (NULL != pEdit) {
			pEdit->SendMessage(WM_SETTEXT, NULL, (LPARAM)L"AnLNT");
		}

		pEdit = (CEdit *)pWnd->GetDlgItem(iEdtPasswordID);
		if (NULL != pEdit) {
			pEdit->SendMessage(WM_SETTEXT, NULL, (LPARAM)L"123456");
		}

		CButton *pButton = (CButton*)GetDlgItem(iCheckBlueID);
		if (pButton != NULL) {
	
			//::SendMessage(pButton->m_hWnd, BM_SETCHECK,  BST_CHECKED, 0);
			::SendMessage(pButton->m_hWnd, 241,  0, 0);
		}

		/*
		CButton *pButton = (CButton*)GetDlgItem(iBtnLogin);
		if (NULL != pButton) {

			WORD lParam  = (WORD)pButton->m_hWnd;
			WORD wParam = MAKEWPARAM(iBtnLogin, BN_CLICKED);

			pWnd->SendMessage(WM_COMMAND, wParam, lParam);
			//pButton->SendMessage(WM_LBUTTONDOWN);
			//pButton->SendMessage(WM_LBUTTONUP);
			//pButton->PostMessage(BM_CLICK);
		}
		*/
	}
}
Esempio n. 20
0
File: TT3Dlg.cpp Progetto: 12019/TT3
void connlost(void *context, char *cause)
{
    CWnd *tA = theApp.GetMainWnd();

	// Disable pushbuttons
	CButton *pButton = (CButton*)tA->GetDlgItem(IDC_BUTTON1);
	pButton->EnableWindow(FALSE);
	pButton = (CButton*)tA->GetDlgItem(IDC_BUTTON2);
	pButton->EnableWindow(FALSE);
	pButton = (CButton*)tA->GetDlgItem(IDC_BUTTON3);
	pButton->EnableWindow(FALSE);
	CTT3Dlg *tA2 = (CTT3Dlg *)tA;
	tA2->MQTTConnected = FALSE;
	tA->SetDlgItemText(IDC_EDIT5, "Not connected");
	
	pMainDlg->PostMessageA(USER_1, 0, 0);
}
Esempio n. 21
0
/////////////////////////////////////////////////////////////////////////////
// CFileOpenDialog - derived from CFileDialog (via CHexFileDialog) for handling extra control
void CFileOpenDialog::OnInitDone()
{
	CRect rct;                          // Used to move/resize controls
	CWnd *pp;                           // Parent = the dialog window itself
	VERIFY(pp = GetParent());

	ASSERT(pp->GetDlgItem(cmb1) != NULL && pp->GetDlgItem(chx1) != NULL && pp->GetDlgItem(IDOK) != NULL);

	// Create a new check box next to Read only check box
	pp->GetDlgItem(cmb1)->GetWindowRect(rct); // Get "Type" drop down list width
	int width = rct.Width();
	pp->GetDlgItem(chx1)->GetWindowRect(rct); // Get "Read only" rectangle
	pp->ScreenToClient(rct);
	// Make read only check box half the width of "Type" box (it is sometimes much wider than it needs to be)
	rct.right = rct.left + width/2 - 2;
	pp->GetDlgItem(chx1)->MoveWindow(rct);
	// Work out rect of new check box
	rct.OffsetRect(width/2, 0);              // move over (so not on top of "read only" checkbox)
	//rct.InflateRect(0, 0, 10, 0);

	m_open_shared.Create(_T("Open shareable"),
					WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX | BS_MULTILINE, rct, pp, IDC_OPEN_SHARED);
	m_open_shared.SetFont(pp->GetDlgItem(IDOK)->GetFont());
	m_open_shared.SetCheck(theApp.open_file_shared_);

	CHexFileDialog::OnInitDone();
}
Esempio n. 22
0
/**
 *  This sets the text of a child control.
 *
 *  @param parent       The parent control.
 *  @param id           The id of the child control.
 *  @param text         The new text of the control.
 */
void controls::setWindowText(CWnd &parent, UINT id, std::string const &text)
{
    if (parent.GetSafeHwnd() != 0)
    {
        CWnd *child = parent.GetDlgItem(id);
        if (child != NULL)
            child->SetWindowText(text.c_str());
    }
}
Esempio n. 23
0
CWnd* CXTPControlCustom::FindChildWindow(CXTPCommandBars* pCommandBars, UINT nID)
{
	CWnd* pWndSite = pCommandBars->GetSite();

	if (pWndSite->GetDlgItem(nID) != NULL)
		return pWndSite->GetDlgItem(nID);

	for (int i = 0; i < pCommandBars->GetCount(); i++)
	{
		CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

		if (pToolBar->GetDlgItem(nID) != NULL)
			return pToolBar->GetDlgItem(nID);
	}


	return NULL;
}
Esempio n. 24
0
/**
 *	This function shows/hides a child control.
 *
 *  @param parent   The parent window.
 *  @param id       The id of the child window to show or hide.
 *  @param show     The show/hide command.
 */
void controls::showWindow(CWnd &parent, UINT id, UINT show)
{
    if (parent.GetSafeHwnd() != 0)
    {
        CWnd *child = parent.GetDlgItem(id);
        if (child != NULL)
            child->ShowWindow(show);
    }
}
Esempio n. 25
0
/**
 *  This function enables/disables a child control.
 *
 *  @param parent   The parent window.
 *  @param id       The id of the child window to enable/disable.
 *  @param enable   If true the window is enabled, otherwise it is disabled.
 */
void controls::enableWindow(CWnd &parent, UINT id, bool enable)
{
    if (parent.GetSafeHwnd() != 0)
    {
        CWnd *child = parent.GetDlgItem(id);
        if (child != NULL)
            child->EnableWindow(enable ? TRUE : FALSE);
    }
}
Esempio n. 26
0
void CCoolMenuBarCtrl::UpdateWindowMenu(CMenu* pMenu)
{
	for ( UINT nItem = 0 ; nItem < (UINT)pMenu->GetMenuItemCount() ; nItem++ )
	{
		UINT nID = pMenu->GetMenuItemID( nItem );

		if ( nID >= AFX_IDM_FIRST_MDICHILD )
		{
			for ( UINT nRemove = nItem ; nRemove < (UINT)pMenu->GetMenuItemCount() ; )
				pMenu->RemoveMenu( nItem, MF_BYPOSITION );
			pMenu->RemoveMenu( nItem - 1, MF_BYPOSITION );
			break;
		}
	}

	CMainWnd* pFrame = theApp.SafeMainWnd();
	if ( ! pFrame->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) return;

    CWnd* pClient = pFrame->GetWindow( GW_CHILD );
	for ( ; pClient ; pClient = pClient->GetNextWindow() )
	{
		TCHAR szClass[64];
		GetClassName( pClient->GetSafeHwnd(), szClass, 64 );
		if ( _tcsicmp( szClass, _T("MDIClient") ) == 0 ) break;
	}

	if ( pClient == NULL ) return;

	CMDIChildWnd* pActive = pFrame->m_pWindows.GetActive();
	BOOL bSeparator = TRUE;

	for ( UINT nIndex = 1, nID = AFX_IDM_FIRST_MDICHILD ; nIndex <= 10 ; nIndex++, nID++ )
	{
		CChildWnd* pChildWnd = (CChildWnd*)pClient->GetDlgItem( nID );
		if ( ! pChildWnd ) break;

		if ( pChildWnd->m_bTabMode )
		{
			nIndex--;
			continue;
		}

		if ( bSeparator )
		{
			pMenu->AppendMenu( MF_SEPARATOR, ID_SEPARATOR );
			bSeparator = FALSE;
		}

		CString strMenu, strWindow;
		pChildWnd->GetWindowText( strWindow );

		strMenu.Format( _T("&%u %s"), nIndex, (LPCTSTR)strWindow );

		pMenu->AppendMenu( MF_STRING | ( pChildWnd == pActive ? MF_CHECKED : 0 ),
			nID, strMenu );
	}
}
Esempio n. 27
0
BOOL CElcSkinFrameBase::IsCtrlInPane(UINT nID)
{
	CWnd* pThis = CWnd::FromHandle(m_hDerive);
	if (!pThis) {
		ASSERT(0);
		return FALSE;
	}

	return IsCtrlInPane(pThis->GetDlgItem(nID));
}
Esempio n. 28
0
COLORREF CElcSkinFrameBase::GetCtrlBkColor(UINT nID)
{
	CWnd* pThis = CWnd::FromHandle(m_hDerive);
	if (!pThis) {
		ASSERT(0);
		return FALSE;
	}

	return GetCtrlBkColor(pThis->GetDlgItem(nID));
}
Esempio n. 29
0
/**
 *  This function gets the extens of a child window in the parent window's 
 *  coordinate system
 *
 *  @param parent   The parent window.
 *  @param id       The id of the child window.
 *  @returns        The extents of the child window.
 */
CRect controls::childExtents(CWnd const &parent, UINT id)
{
    if (parent.GetSafeHwnd() != 0)
    {
        CWnd *child = parent.GetDlgItem(id);
        if (child != NULL)
            return childExtents(*child);
    }
    return CRect();
}
Esempio n. 30
0
void CCheckBTGroup::GetPanelRect( CRect &rect )
{
    CWnd *Parent = m_ChkGrpInfo.Parent;
    Parent->GetDlgItem(m_ChkGrpInfo.AreaCtrlID)->GetWindowRect(&rect);
    Parent->ScreenToClient(&rect);
    rect.left = rect.left + 5;
    rect.top  = rect.top + 10;
    rect.right= rect.right - 2;
    rect.bottom = rect.bottom - 5;
}