コード例 #1
0
ファイル: mainwnd.c プロジェクト: HBelusca/NasuTek-Odyssey
static BOOL
pCreateToolbar(PMAIN_WND_INFO Info)
{
    INT numButtons = sizeof(Buttons) / sizeof(Buttons[0]);

    Info->hTool = CreateWindowEx(0,
                                 TOOLBARCLASSNAME,
                                 NULL,
                                 WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS,
                                 0, 0, 0, 0,
                                 Info->hMainWnd,
                                 0,
                                 hInstance,
                                 NULL);
    if(Info->hTool != NULL)
    {
        HIMAGELIST hImageList;

        SendMessage(Info->hTool,
                    TB_SETEXTENDEDSTYLE,
                    0,
                    TBSTYLE_EX_HIDECLIPPEDBUTTONS);

        SendMessage(Info->hTool,
                    TB_BUTTONSTRUCTSIZE,
                    sizeof(Buttons[0]),
                    0);

        hImageList = InitImageList(IDB_PROP,
                                   IDB_RESTART,
                                   GetSystemMetrics(SM_CXSMICON),
                                   GetSystemMetrics(SM_CXSMICON),
                                   IMAGE_BITMAP);
        if (hImageList == NULL)
            return FALSE;

        ImageList_Destroy((HIMAGELIST)SendMessage(Info->hTool,
                                                  TB_SETIMAGELIST,
                                                  0,
                                                  (LPARAM)hImageList));

        SendMessage(Info->hTool,
                    TB_ADDBUTTONS,
                    numButtons,
                    (LPARAM)Buttons);

        return TRUE;
    }

    return FALSE;
}
コード例 #2
0
ファイル: toolbar.c プロジェクト: RPG-7/reactos
BOOL
CreateToolBar(HWND hwnd)
{
    INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
    HIMAGELIST hImageList;

    LoadStringW(hInst, IDS_INSTALL, szInstallBtn, sizeof(szInstallBtn) / sizeof(WCHAR));
    LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, sizeof(szUninstallBtn) / sizeof(WCHAR));
    LoadStringW(hInst, IDS_MODIFY, szModifyBtn, sizeof(szModifyBtn) / sizeof(WCHAR));

    hToolBar = CreateWindowExW(0,
                               TOOLBARCLASSNAMEW,
                               NULL,
                               WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | TBSTYLE_LIST,
                               0, 0, 0, 0,
                               hwnd,
                               0,
                               hInst,
                               NULL);

    if (!hToolBar)
    {
        /* TODO: Show error message */
        return FALSE;
    }

    SendMessageW(hToolBar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS);
    SendMessageW(hToolBar, TB_BUTTONSTRUCTSIZE, sizeof(Buttons[0]), 0);

    hImageList = InitImageList();

    if (!hImageList)
    {
        /* TODO: Show error message */
        return FALSE;
    }

    ImageList_Destroy((HIMAGELIST)SendMessageW(hToolBar,
                                               TB_SETIMAGELIST,
                                               0,
                                               (LPARAM)hImageList));

    SendMessageW(hToolBar, TB_ADDBUTTONS, NumButtons, (LPARAM)Buttons);

    CreateSearchBar();

    return TRUE;
}
コード例 #3
0
static VOID
InitDependPage(PDEPENDDATA pDependData)
{
    /* Initialize the image list */
    pDependData->hDependsImageList = InitImageList(IDI_NODEPENDS,
                                                   IDI_DRIVER,
                                                   GetSystemMetrics(SM_CXSMICON),
                                                   GetSystemMetrics(SM_CXSMICON),
                                                   IMAGE_ICON);

    /* Set the first tree view */
    TV1_Initialize(pDependData, pDependData->pDlgInfo->pService->lpServiceName);

    /* Set the second tree view */
    TV2_Initialize(pDependData, pDependData->pDlgInfo->pService->lpServiceName);
}
コード例 #4
0
ファイル: TbcShare.cpp プロジェクト: litaobj/easymule
int CTbcShare::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CToolBarCtrlZ::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码
	theWndMgr.m_pTbcShare = this;

	int	i = 0;

	InitImageList();

	AddSingleString(GetResString(IDS_OPEN));
	AddSingleString(GetResString(IDS_OPENFOLDER));
	AddSingleString(GetResString(IDS_RENAME));
	AddSingleString(GetResString(IDS_DELETE_FILE));
	AddSingleString(GetResString(IDS_SF_RELOAD));


	TBBUTTON	tbb[BUTTON_COUNT];
	CString		str;

	tbb[0].idCommand = MP_OPEN;
	tbb[1].idCommand = MP_OPENFOLDER;
	tbb[2].idCommand = MP_RENAME;
	tbb[3].idCommand = MP_REMOVE;
	tbb[4].idCommand = MP_REFRESH;

	for (i = 0; i < BUTTON_COUNT; i++)
	{
		tbb[i].iString = i;
		tbb[i].iBitmap = i;
		tbb[i].fsState = 0;
		tbb[i].fsStyle = TBSTYLE_BUTTON | BTNS_AUTOSIZE;
	}
	AddButtons(BUTTON_COUNT, tbb);

	EnableButton(MP_REFRESH);

	Localize();
	return 0;
}
コード例 #5
0
/*
 *******************************************************************
 * Function: PluginInfo* GetVirtoolsPluginInfo( int index ) 
 *
 * Description : Returns the ptr of the ( index ) th plugininfo structure of this dll
 *               this function must be exported ( have a .def file with its name or 
 *               use __declspec( dllexport ) 
 *		
 *
 * Parameters :
 *   index    r    index of the plugin info that the caller wishes to obtain
 * Returns : 
 *   pointer to the PluginInfo structure
 *
 *******************************************************************
 */
PluginInfo* GetVirtoolsPluginInfo( int index ) 
{
    switch( index ) 
    {
        case 0:
            return &thePluginInfo;


    // TODO: Add your specialized code here and/or call the base class
    
    strcpy( thePluginInfo.m_Name, "MyPlugin" ) ;
    thePluginInfo.m_PluginType = PluginInfo::PT_EDITOR;
    thePluginInfo.m_PluginType = ( PluginInfo::PLUGIN_TYPE ) ( thePluginInfo.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION ) ;
    thePluginInfo.m_PluginCallback = PluginCallback;
    
    //EDITOR
    {
        thePluginInfo.m_EditorInfo.m_Guid[1] = 0xb27bc6c8;
        thePluginInfo.m_EditorInfo.m_Guid[2] = 0x4a696ab2;
        strcpy( thePluginInfo.m_EditorInfo.m_EditorName, "MyEditor" ) ;
        
        thePluginInfo.m_EditorInfo.m_CreateEditorDlgFunc = CreateEditorDlg;
        thePluginInfo.m_EditorInfo.m_CreateToolbarDlgFunc = CreateToolbarDlg;
        
        thePluginInfo.m_EditorInfo.m_bUnique = 1;
        thePluginInfo.m_EditorInfo.m_bIndestructible = 0;
        thePluginInfo.m_EditorInfo.m_bManageScrollbar = 0;
        
        thePluginInfo.m_EditorInfo.m_Width = 400;
        thePluginInfo.m_EditorInfo.m_Height = 200;
        
        thePluginInfo.m_EditorInfo.m_ToolbarHeight = 21;
        
        InitImageList() ;
        thePluginInfo.m_EditorInfo.m_IconList = &imageList;
        thePluginInfo.m_EditorInfo.m_IconIndex = 0;
    }


    }
    return NULL;
}
コード例 #6
0
BOOL CTTSApp::OnInitDialog( HWND hWnd )
/////////////////////////////////////////////////////////////////
{
    HRESULT                         hr          = S_OK;
        
    // Store this as the "Main Dialog"
    m_hWnd  = hWnd;

    // Add some default text to the main edit control
    SetDlgItemText( hWnd, IDE_EDITBOX, _T("Enter text you wish spoken here.") );

    // Set the event mask in the rich edit control so that it notifies us when text is
    // changed in the control
    SendMessage( GetDlgItem( hWnd, IDE_EDITBOX ), EM_SETEVENTMASK, 0, ENM_CHANGE );

    // Initialize the Output Format combo box
    int i;
    for( i=0; i<NUM_OUTPUTFORMATS; i++ )
    {
        SendDlgItemMessage( hWnd, IDC_COMBO_OUTPUT, CB_ADDSTRING, 0,
                    (LPARAM)g_aszOutputFormat[i] );

        SendDlgItemMessage( hWnd, IDC_COMBO_OUTPUT, CB_SETITEMDATA, i, 
                    (LPARAM)g_aOutputFormat[i] );
    }

    if ( !m_cpVoice )
    {
        hr = E_FAIL;
    }

    // Set the default output format as the current selection.
    if( SUCCEEDED( hr ) )
    {
        CComPtr<ISpStreamFormat> cpStream;
        HRESULT hrOutputStream = m_cpVoice->GetOutputStream(&cpStream);

        if (hrOutputStream == S_OK)
        {
            CSpStreamFormat Fmt;
            hr = Fmt.AssignFormat(cpStream);
            if (SUCCEEDED(hr))
            {
                SPSTREAMFORMAT eFmt = Fmt.ComputeFormatEnum();
                for( i=0; i<NUM_OUTPUTFORMATS; i++ )
                {
                    if( g_aOutputFormat[i] == eFmt )
                    {
                        m_DefaultFormatIndex = i;
                        SendDlgItemMessage( hWnd, IDC_COMBO_OUTPUT, CB_SETCURSEL, m_DefaultFormatIndex, 0 );
                    }
                }
            }
        }
        else
        {
            SendDlgItemMessage( hWnd, IDC_COMBO_OUTPUT, CB_SETCURSEL, 0, 0 );
        }
    }

    // Use the SAPI5 helper function in sphelper.h to initialize the Voice combo box.
    if ( SUCCEEDED( hr ) )
    {
        hr = SpInitTokenComboBox( GetDlgItem( hWnd, IDC_COMBO_VOICES ), SPCAT_VOICES );
    }
    
    if ( SUCCEEDED( hr ) )
    {
        SpCreateDefaultObjectFromCategoryId( SPCAT_AUDIOOUT, &m_cpOutAudio );
    }

    // Set default voice data 
    VoiceChange();

    // Set Range for Skip Edit Box...
    SendDlgItemMessage( hWnd, IDC_SKIP_SPIN, UDM_SETRANGE, TRUE, MAKELONG( 50, -50 ) );

    // Set the notification message for the voice
    if ( SUCCEEDED( hr ) )
    {
        m_cpVoice->SetNotifyWindowMessage( hWnd, WM_TTSAPPCUSTOMEVENT, 0, 0 );
    }

    // We're interested in all TTS events
    if( SUCCEEDED( hr ) )
    {
        hr = m_cpVoice->SetInterest( SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS );
    }

    // Get default rate and volume
    if( SUCCEEDED( hr ) )
    {
        hr = m_cpVoice->GetRate( &m_DefaultRate );
        // initialize sliders and edit boxes with default rate
        if ( SUCCEEDED( hr ) )
        {
            SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG( SPMIN_RATE, SPMAX_RATE ) );
            SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETPOS, TRUE, m_DefaultRate );
            SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETPAGESIZE, TRUE, 5 );
        }
    }

    if( SUCCEEDED( hr ) )
    {
        hr = m_cpVoice->GetVolume( &m_DefaultVolume );
        // initialize sliders and edit boxes with default volume
        if ( SUCCEEDED( hr ) )
        {
            SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETRANGE, TRUE, MAKELONG( SPMIN_VOLUME, SPMAX_VOLUME ) );
            SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETPOS, TRUE, m_DefaultVolume );
            SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETPAGESIZE, TRUE, 10 );
        }
    }

    // If any SAPI initialization failed, shut down!
    if( FAILED( hr ) )
    {
        MessageBox( NULL, _T("Error initializing speech objects. Shutting down."), _T("Error"), MB_OK );
        SendMessage( hWnd, WM_CLOSE, 0, 0 );
        return(FALSE);
        
    }
    else
    {
        //
        // Create the child windows to which we'll blit our result
        //
        HWND hCharWnd = GetDlgItem(hWnd, IDC_CHARACTER);
        RECT rc;

        GetClientRect(hCharWnd, &rc);
        rc.left = (rc.right - CHARACTER_WIDTH) / 2;
        rc.top = (rc.bottom - CHARACTER_HEIGHT) / 2;
        m_hChildWnd = CreateWindow( CHILD_CLASS, NULL, 
                            WS_CHILDWINDOW | WS_VISIBLE,
                            rc.left, rc.top,
                            rc.left + CHARACTER_WIDTH, rc.top + CHARACTER_HEIGHT,
                            hCharWnd, NULL, m_hInst, NULL );

        if ( !m_hChildWnd )
        {
            MessageBox( hWnd, _T("Error initializing speech objects. Shutting down."), _T("Error"), MB_OK );
            SendMessage( hWnd, WM_CLOSE, 0, 0 );
            return(FALSE);
            
        }
        else
        {
            // Load Mouth Bitmaps and use and ImageList since we'll blit the mouth
            // and eye positions over top of the full image
            g_hListBmp = InitImageList();
        }
    }
    return(TRUE);
    
}
コード例 #7
0
ファイル: floatwindow.c プロジェクト: hoangduit/reactos
BOOL
FloatToolbarCreateHistoryGui(PMAIN_WND_INFO Info)
{
    HWND hList;
    HWND hButtons;
    HIMAGELIST hImageList;
    INT NumButtons;

    hList = CreateWindowEx(0,
                           WC_LISTBOX,
                           NULL,
                           WS_CHILD | WS_VISIBLE | LBS_EXTENDEDSEL,
                           0, 0, 143, 100,
                           Info->fltHistory->hSelf,
                           NULL,
                           hInstance,
                           NULL);
    if (hList == NULL)
        return FALSE;

    NumButtons = sizeof(HistoryButtons) / sizeof(HistoryButtons[0]);
    hButtons = CreateWindowEx(0,
                              TOOLBARCLASSNAME,
                              NULL,
                              WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | CCS_BOTTOM | CCS_NODIVIDER,
                              0, 0, 0, 0,
                              Info->fltHistory->hSelf,
                              NULL,
                              hInstance,
                              NULL);
    if (hButtons != NULL)
    {
        SendMessage(hButtons,
                    TB_BUTTONSTRUCTSIZE,
                    sizeof(ToolsButtons[0]),
                    0);

        SendMessage(hButtons,
                    TB_SETBITMAPSIZE,
                    0,
                    (LPARAM)MAKELONG(10, 10));

        hImageList = InitImageList(NumButtons,
                                   IDB_HISTBACK);

        ImageList_Destroy((HIMAGELIST)SendMessage(hButtons,
                                                  TB_SETIMAGELIST,
                                                  0,
                                                  (LPARAM)hImageList));

        SendMessage(hButtons,
                    TB_SETBUTTONSIZE,
                    0,
                    MAKELONG(18, 16));

        SendMessage(hButtons,
                    TB_ADDBUTTONS,
                    NumButtons,
                    (LPARAM)HistoryButtons);

        return TRUE;
    }

    return FALSE;
}
コード例 #8
0
ファイル: treelist.cpp プロジェクト: ruifig/nutcracker
MyFrame::MyFrame()
       : wxFrame(NULL, wxID_ANY, "wxWidgets tree/list control sample",
                 wxDefaultPosition, wxSize(600, 450))
{
    m_isFlat = false;

    // Create menus and status bar.
    SetIcon(wxICON(sample));

    wxMenu* fileMenu = new wxMenu;
    fileMenu->Append(wxID_EXIT);

    wxMenu* treeStyle = new wxMenu;
    treeStyle->AppendCheckItem(Id_MultiSelect, "&Multiple selections\tCtrl-M");
    treeStyle->AppendSeparator();
    treeStyle->AppendRadioItem(Id_NoCheckboxes,
                               "&No checkboxes\tCtrl-1");
    treeStyle->AppendRadioItem(Id_Checkboxes2State,
                               "&2-state checkboxes\tCtrl-2");
    treeStyle->AppendRadioItem(Id_Checkboxes3State,
                               "&3-state checkboxes\tCtrl-3");
    treeStyle->AppendRadioItem(Id_CheckboxesUser3State,
                               "&User-settable 3-state checkboxes\tCtrl-4");
    treeStyle->AppendSeparator();
    treeStyle->AppendCheckItem(Id_FlatList, "&Flat list");

    wxMenu* treeOper = new wxMenu;
    treeOper->Append(Id_DumpSelection, "&Dump selection\tCtrl-D");
    treeOper->AppendSeparator();
    treeOper->Append(Id_Check_HTMLDocs, "&Check Doc/HTML item\tCtrl-C");
    treeOper->Append(Id_Uncheck_HTMLDocs, "&Uncheck Doc/HTML item\tCtrl-U");
    treeOper->Append(Id_Indet_HTMLDocs, "Make Doc/HTML &indeterminate\tCtrl-I");
    treeOper->Append(Id_Select_HTMLDocs, "&Select Doc/HTML item\tCtrl-S");

    wxMenu* helpMenu = new wxMenu;
    helpMenu->Append(wxID_ABOUT);

    wxMenuBar* menuBar = new wxMenuBar();
    menuBar->Append(fileMenu, "&File");
    menuBar->Append(treeStyle, "&Style");
    menuBar->Append(treeOper, "&Operations");
    menuBar->Append(helpMenu, "&Help");
    SetMenuBar(menuBar);

    CreateStatusBar(1);


    // Construct the image list with the standard images.
    InitImageList();


    // Create and layout child controls.
    m_treelist = CreateTreeListCtrl(wxTL_DEFAULT_STYLE);

    wxTextCtrl* textLog = new wxTextCtrl(this, wxID_ANY, "",
                                         wxDefaultPosition, wxDefaultSize,
                                         wxTE_READONLY | wxTE_MULTILINE);
    m_oldLogTarget = wxLog::SetActiveTarget(new wxLogTextCtrl(textLog));

    wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
    sizer->Add(m_treelist, wxSizerFlags(2).Expand());
    sizer->Add(textLog, wxSizerFlags(1).Expand());
    SetSizer(sizer);


    // Finally show everything.
    Show();
}