コード例 #1
0
ファイル: KeySequences.cpp プロジェクト: TReKiE/freecompose
BOOL CKeySequences::OnInitDialog( ) {
	if ( ! CPropertyPage::OnInitDialog( ) )
		return FALSE;

	DWORD dwExtendedStyles =
		  LVS_EX_FLATSB
		| LVS_EX_FULLROWSELECT
		| LVS_EX_GRIDLINES
		| LVS_EX_HEADERDRAGDROP
		| LVS_EX_LABELTIP
		| LVS_EX_TWOCLICKACTIVATE;
	if ( GetComCtl32Version( ) >= 0x00060000 ) {
		dwExtendedStyles |= LVS_EX_DOUBLEBUFFER;
	}
	m_KeyComboList.SetExtendedStyle( m_KeyComboList.GetExtendedStyle( ) | dwExtendedStyles );

	CString strLabels[3] = {
		CString( (LPCWSTR) IDS_KEYSEQUENCES_CHARACTER ),
		CString( (LPCWSTR) IDS_KEYSEQUENCES_KEY1 ),
		CString( (LPCWSTR) IDS_KEYSEQUENCES_KEY2 ),
	};

	int widths[3];
	for ( int n = 0; n < 3; n++ ) {
		widths[n] = m_KeyComboList.GetStringWidth( strLabels[n] ) + HEADER_FUDGE_FACTOR;
		m_KeyComboList.InsertColumn( n, strLabels[n], LVCFMT_LEFT, widths[n] );
	}
	m_nColumnWidths[0] = widths[0];
	m_nColumnWidths[1] = std::max( widths[0], widths[1] );

	_FillKeyComboList( );
	
	return TRUE;
}
コード例 #2
0
BOOL OnCommand(HWND hDlg, WORD wID, WORD code)
{
    //DEBUGMESSAGE(("OnCommand"));

    DocumentPropDialogData *data = 
        (DocumentPropDialogData *) GetWindowLongPtr(hDlg, DWL_USER);

    switch (wID)
    {
    case IDC_COMBO_VECTOR_FORMAT:
    case IDC_COMBO_RASTER_FORMAT:
        {
            DEBUGMESSAGE(("OnCommand - combo command"));
            switch (code)
            {
            case CBN_SELCHANGE:
                {
                    DWORD nId = 
                        (wID==IDC_COMBO_VECTOR_FORMAT) ? 
                            IDC_VECTOR_FORMAT_RADIOBOX : 
                            IDC_RASTER_FORMAT_RADIOBOX;

                    // select the radio button next to the combo which changed
                    CheckRadioButton(hDlg, 
                             IDC_VECTOR_FORMAT_RADIOBOX, IDC_RASTER_FORMAT_RADIOBOX,
                             nId);
                }
                break;

            default:
                break;
            }
        }
        break;

    case IDC_BROWSE_BUTTON:
        {
            BROWSEINFO bi;
            bi.hwndOwner      = hDlg;
            bi.pidlRoot       = NULL;
            bi.pszDisplayName = NULL;
            bi.lpszTitle      = TEXT("Choose output folder");
            bi.ulFlags        = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
            bi.lpfn           = BrowseCallbackProc;

            LPTSTR folder = NULL;
            if (!GetEditControlText(&folder, GetDlgItem(hDlg, IDC_OUTPUT_FOLDER))) {
                DEBUGMESSAGE(("DocPropDlgProc - could not get output folder text"));
                return FALSE;
            }

            bi.lParam         = (LPARAM)folder; // param for the callback

            const int verComCtl32 = GetComCtl32Version();

            // we always add the edit box (it doesn't hurt anybody, does it?) if it is
            // supported by the system
            if ( verComCtl32 >= 471 )
            {
                bi.ulFlags |= BIF_EDITBOX;
            }

            // to have the "New Folder" button we must use the "new" dialog style which
            // is also the only way to have a resizable dialog
            if (verComCtl32 >= 500)
            {
                bi.ulFlags |= BIF_NEWDIALOGSTYLE;
            }

            // do show the dialog
            wxItemIdList pidl(SHBrowseForFolder(&bi));

            // cleanup
            wxItemIdList::Free((LPITEMIDLIST)bi.pidlRoot);
            strFree((LPTSTR)bi.lParam);

            if ( !pidl )
            {
                DEBUGMESSAGE(("user hit cancel"));
                return TRUE;
            }

            LPTSTR newPath = pidl.GetPath();
            if (newPath)
            {
                // change the text in the associated control
                SendMessage(GetDlgItem(hDlg, IDC_OUTPUT_FOLDER), 
                            WM_SETTEXT, 0, (LPARAM)newPath);
                strFree(newPath);
            }
        }
        break;

    default:
        break;
    }

    return FALSE;
}