Exemple #1
0
BOOL CDlgVidMan::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m_wndVol.SetRange (0, 100);
	m_wndVol.SetPos (_App.MP_Volume ());
	UpdateVolumePerc ();
	
	CreateBars ();
	Update ();

	LOGFONT lf;
	GetFont ()->GetLogFont (&lf);
	lf.lfWeight = FW_BOLD;
	m_fntBold.CreateFontIndirect (&lf);

	m_brClrWindow.CreateSolidBrush (GetSysColor (COLOR_WINDOW));

	m_bMute = _App.MP_Mute ();
	UpdateMuteImage ();

	if (m_bInFVDownloads)
	{
		GetDlgItem (IDC_SWITCH_AUTO)->ShowWindow (SW_HIDE);
	}
	else
	{
		if (_App.View_AutoSwitchToMediaPreview ())
			CheckDlgButton (IDC_SWITCH_AUTO, BST_CHECKED);
	}

	ApplyLanguage ();
	
	return TRUE;  
	              
}
void CAddTracksDialog::OnInitDialog()
{
    if (NULL == m_pModPlaylist)
    {
        PostMessage(m_hwndDlg, WM_COMMAND, IDCANCEL, 0);

        return;
    }

    m_hwndTitle     = GetDlgItem(m_hwndDlg, IDC_ADD_TRACKS);
    m_hwndTrackList = GetDlgItem(m_hwndDlg, IDC_TRACK_LIST);

    //
    // Check to see if the screen is small
    //
    if (g_bSmallScreen)
    {
        RECT rcWorkArea;
        RECT rcWnd, rcList;

        GetWindowRect(m_hwndDlg,       &rcWnd);
        GetWindowRect(m_hwndTrackList, &rcList);

        if (!SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, 0))
        {
            HDC hdc = ::GetDC(NULL);

            rcWorkArea.left = 0;
            rcWorkArea.top  = 0;

            rcWorkArea.right  = GetDeviceCaps(hdc, HORZRES);
            rcWorkArea.bottom = GetDeviceCaps(hdc, VERTRES) - GetSystemMetrics(SM_CYMENU);

            ::ReleaseDC(NULL, hdc);
        }

        MoveWindow(m_hwndDlg,
                   rcWorkArea.left,
                   rcWorkArea.top,
                   rcWorkArea.right,
                   rcWorkArea.bottom,
                   TRUE);

        rcWorkArea.left   += rcList.left - rcWnd.left;
        rcWorkArea.right  -= rcList.left - rcWnd.left;
        rcWorkArea.right  += rcList.right - rcWnd.right - 2*GetSystemMetrics(SM_CXDLGFRAME);

        rcWorkArea.top    += rcList.top  - rcWnd.top - GetSystemMetrics(SM_CYCAPTION);
        rcWorkArea.bottom -= rcList.top  - rcWnd.top;
        rcWorkArea.bottom += rcList.bottom - rcWnd.bottom;

        MoveWindow(m_hwndTrackList,
                   rcWorkArea.left,
                   rcWorkArea.top,
                   rcWorkArea.right,
                   rcWorkArea.bottom,
                   TRUE);
    }

    ListView_SetExtendedListViewStyle(m_hwndTrackList, LVS_EX_CHECKBOXES);

    HRESULT hr;

    hr = CreateBars();

    if (FAILED(hr))
    {
        return;
    }

    if (m_himgLocationList)
    {
        ListView_SetImageList(m_hwndTrackList, m_himgLocationList, LVSIL_SMALL);
    }

    TCHAR szTitle[MAX_PATH];

    ULONG cchTitleLength = SendMessage(m_hwndTitle, WM_GETTEXT, MAX_PATH, (LPARAM)szTitle);

    LPCTSTR pszShortName = NULL;

    if (NULL != m_pModPlaylist)
    {
        pszShortName = m_pModPlaylist->GetName();
    }

    if (SUCCEEDED(hr) && NULL != pszShortName)
    {
        // cchTitleLength is the length of the string retrieved by WM_GETTEXT
        // to avoid overrunning szTitle, we limit the copy to the remaining room in the array 
        StringCchCopy(&szTitle[cchTitleLength], MAX_PATH - cchTitleLength, pszShortName);
        szTitle[MAX_PATH - 1] = TEXT('\0');
    }

    SendMessage(m_hwndTitle, WM_SETTEXT, 0, (LPARAM)szTitle);

    LVCOLUMN lvc;

    memset(&lvc, 0, sizeof (lvc));

    lvc.mask = LVCF_FMT;
    lvc.fmt  = LVCFMT_LEFT;

    ListView_InsertColumn(m_hwndTrackList, 0, &lvc);

    lvc.mask     = LVCF_WIDTH | LVCF_FMT | LVCF_SUBITEM;
    lvc.fmt      = LVCFMT_LEFT;
    lvc.iSubItem = 1;
    lvc.cx       = FILENAME_WIDTH;
    ListView_SetColumn(m_hwndTrackList, 0, &lvc);

    UpdateInfo();

    SetFocus(m_hwndTrackList);
}
Exemple #3
0
BOOL CWinFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	
	if (!CreateBars(Panels,2))
		return -1;
	
	if ( !m_ToolBar.Create(m_ReBar->GetSafeHwnd()))
		return -1;


	m_ToolBar.LoadToolBar(IDR_TOOLBAR);
	m_ToolBar.AddTrueColor(IDB_TOOLBAR,TB_SETIMAGELIST);
	m_ToolBar.CreateCombo(&m_comboDebug,ID_COMBOBOX,150,WS_CHILD|WS_VISIBLE|CBS_DROPDOWN  | 
							WS_VSCROLL | CBS_HASSTRINGS |CBS_OWNERDRAWVARIABLE);

	AddBar(&m_ToolBar, IDR_TOOLBAR);

	SetPanelText(0,_T("nueva cadena ") );
	SetIcon(theApp->LoadIcon((LPCSTR)IDI_SMALL),FALSE);

	if (!m_Splitter.Create(this))
			return -1;

	if (!m_Splitright.Create(&m_Splitter))
		return -1;
	
	if (!m_SplitterList.Create(&m_Splitright))
		return -1;

	if (!cf.Create( &m_Splitter, CRect(0,0,0,0) ,WS_CHILD|WS_VISIBLE, 1000))
		return -1;

	if (!tc.Create(cf.GetSafeHwnd(),WS_CHILD | WS_VISIBLE | TVS_HASLINES | 
								TVS_LINESATROOT | TVS_HASBUTTONS, 2))
		return -1;

	if (!FolderList.Create(m_Splitright.GetSafeHwnd(),WS_CHILD | WS_VISIBLE | TVS_HASLINES | 
								TVS_LINESATROOT | TVS_HASBUTTONS, 2))
		return -1;
	
	
	if (!out2.Create(WS_VISIBLE,
		CRect(0,0,0,0), &cf, 1))
		return -1;
	
	if (!out1.Create(WS_VISIBLE,
		CRect(0,0,0,0), &cf, 2))
		return -1;
	out1.SetTypeLook(FALSE);
	if (!m_up.Create(m_SplitterList.GetSafeHwnd(), WS_CHILD|WS_VISIBLE, 1000))
		return -1;
	
	if (!m_down.Create(m_SplitterList.GetSafeHwnd(), WS_CHILD|WS_VISIBLE, 2000))
		return -1;

	

	out2.SetImageList(IDB_BITMAP1, 32, 0, RGB(255,0,0));
	out2.AddItem(IDO_OUTODAY,"Home",7);
	out2.AddItem(IDO_CALENDARIO,"Calendar",1);
	out2.AddItem(IDO_CONTACTO,"Contacts",2);
	out2.AddItem(IDO_TAREAS,"Tasks",3);
	out2.AddItem(IDO_NOTAS,"Notes",5);
	out2.AddItem(IDO_ELIMINAR,"Delete",6);
	
	cf.AddFolder(&out2,"Outlook Shortcuts");
	cf.AddFolder(&tc,"Other Shortcuts");
	
	m_Splitter.SetStyleSeparator(CSplitter::STYLE3D);

	m_Splitright.SeTypeALing(CSplitter::ALINGHORZ);
	m_Splitright.AddLeftCtrl(&m_up,3);
	m_Splitright.AddRightCtrl(&m_down,4);
	m_Splitright.SetStyleSeparator(CSplitter::STYLEFLAT);
	
	m_SplitterList.SeTypeALing(CSplitter::ALINGVERT);

	m_up.Create (m_SplitterList.GetSafeHwnd(),WS_CHILD | WS_VISIBLE | WS_VSCROLL | LVS_REPORT,7000);
	m_up.SendMessage (LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT );
	m_up.InsertColumn (0, _T("From"), LVCFMT_LEFT, 100,0);
	m_up.InsertColumn (1, _T("Subject"), LVCFMT_LEFT, 200,0);
	m_up.InsertColumn (2, _T("Received"), LVCFMT_LEFT, 100,0);
	m_up.InsertItemText (0, _T("francisco.campos"));
	m_up.InsertItemText (0, 1, _T("Pretty Winapi Class has been launched"));
	m_up.InsertItemText (0, 2, _T("May 30, 2007"));
	m_up.InsertItemText (1, _T("*****@*****.**"));
	m_up.InsertItemText (1, 1, _T("Bugs reporting"));
	m_up.InsertItemText (1, 2, _T("May 29, 2007"));

	//subclass the Header list
	HWND hWndHeader = m_up.GetDlgItem(0);
	m_header.SubclassWnd(hWndHeader);

	m_Splitter.AddLeftCtrl(&cf,200);
	m_Splitter.AddRightCtrl(&m_Splitright,400);
	m_Splitright.AddLeftCtrl(&FolderList,150);
	m_Splitright.AddRightCtrl(&m_SplitterList,350);
	m_SplitterList.AddLeftCtrl(&m_up,400);
	m_SplitterList.AddRightCtrl(&m_down,200);
	m_ClientView=(CSplitter*)&m_Splitter;
	cSpawn.LoadToolBarResource(IDR_TOOLBAR,IDB_TOOLBAR);

	//--------------------populate the tree

	if(!Image.CreateColor(IDB_TREE)) 
			return FALSE;
	FolderList.SetImageList(Image.GetImageHandle(),TVSIL_NORMAL);
	//FolderList.SetImageList(IDB_TREE, 32, 0, RGB(255,0,0));
	HTREEITEM hRoot = FolderList.InsertItem (_T("Outlook Today"), 0, 0);
		
		FolderList.InsertItem (_T("Calendar"), 1, 1, hRoot);
		FolderList.InsertItem (_T("Drafts"), 2, 2, hRoot);
		FolderList.InsertItem (_T("Inbox"), 3, 3, hRoot);
		FolderList.InsertItem (_T("Journal"), 4, 4, hRoot);
		FolderList.InsertItem (_T("Notes"), 5, 5, hRoot);
		FolderList.InsertItem (_T("Outbox"),6, 6, hRoot);
		FolderList.InsertItem (_T("Send Items"), 7, 7, hRoot);
		FolderList.InsertItem (_T("Tasks"), 8, 8, hRoot);
		FolderList.Expand (hRoot, TVE_EXPAND);
	//--------------------End populate tree	
	
	//--------------------populate the tree2

	tc.SetImageList(Image.GetImageHandle(),TVSIL_NORMAL);
	//FolderList.SetImageList(IDB_TREE, 32, 0, RGB(255,0,0));
	HTREEITEM hRoot1 = tc.InsertItem (_T("My PC"), 9, 9);
		
		tc.InsertItem (_T("Program Files"), 10, 10, hRoot1);
		tc.InsertItem (_T("Temp"), 10, 10, hRoot1);
		tc.InsertItem (_T("Windows"), 10, 10, hRoot1);
		tc.InsertItem (_T("Winold"), 10, 10, hRoot1);
		tc.Expand (hRoot1, TVE_EXPAND);
	//--------------------End populate tree	
	return 0;
}