Пример #1
0
/* static */
bool wxGLCanvasBase::IsExtensionSupported(const char *extension)
{
    static const char *s_extensionsList = (char *)wxUIntPtr(-1);
    if ( s_extensionsList == (char *)wxUIntPtr(-1) )
    {
        typedef const char * (WINAPI *wglGetExtensionsStringARB_t)(HDC hdc);

        wxDEFINE_WGL_FUNC(wglGetExtensionsStringARB);
        if ( wglGetExtensionsStringARB )
        {
            s_extensionsList = wglGetExtensionsStringARB(wglGetCurrentDC());
        }
        else
        {
            typedef const char * (WINAPI * wglGetExtensionsStringEXT_t)();

            wxDEFINE_WGL_FUNC(wglGetExtensionsStringEXT);
            if ( wglGetExtensionsStringEXT )
            {
                s_extensionsList = wglGetExtensionsStringEXT();
            }
            else
            {
                s_extensionsList = NULL;
            }
        }
    }

    return s_extensionsList && IsExtensionInList(s_extensionsList, extension);
}
void CTimerControlRepeaterPanel::insertItem(CTimerControlItem* item)
{
	switch (item->m_day) {
		case 0U: m_list->InsertItem(0L, _("Sunday")); break;
		case 1U: m_list->InsertItem(0L, _("Monday")); break;
		case 2U: m_list->InsertItem(0L, _("Tuesday")); break;
		case 3U: m_list->InsertItem(0L, _("Wednesday")); break;
		case 4U: m_list->InsertItem(0L, _("Thursday")); break;
		case 5U: m_list->InsertItem(0L, _("Friday")); break;
		case 6U: m_list->InsertItem(0L, _("Saturday")); break;
		case 7U: m_list->InsertItem(0L, _("Every day")); break;
		case 8U: m_list->InsertItem(0L, _("Mon-Fri")); break;
		case 9U: m_list->InsertItem(0L, _("Sat-Sun")); break;
		default: m_list->InsertItem(0L, wxT("??????")); break;
	}

	wxString text;
	text.Printf(wxT("%02u:%02u"), item->m_hour, item->m_minute);
	m_list->SetItem(0L, 1, text);

	switch (item->m_reconnect) {
		case RECONNECT_NEVER:   m_list->SetItem(0L, 2, _("Never")); break;
		case RECONNECT_FIXED:   m_list->SetItem(0L, 2, _("Fixed")); break;
		case RECONNECT_5MINS:   m_list->SetItem(0L, 2, _("5 minutes")); break;
		case RECONNECT_10MINS:  m_list->SetItem(0L, 2, _("10 minutes")); break;
		case RECONNECT_15MINS:  m_list->SetItem(0L, 2, _("15 minutes")); break;
		case RECONNECT_20MINS:  m_list->SetItem(0L, 2, _("20 minutes")); break;
		case RECONNECT_25MINS:  m_list->SetItem(0L, 2, _("25 minutes")); break;
		case RECONNECT_30MINS:  m_list->SetItem(0L, 2, _("30 minutes")); break;
		case RECONNECT_60MINS:  m_list->SetItem(0L, 2, _("60 minutes")); break;
		case RECONNECT_90MINS:  m_list->SetItem(0L, 2, _("90 minutes")); break;
		case RECONNECT_120MINS: m_list->SetItem(0L, 2, _("120 minutes")); break;
		case RECONNECT_180MINS: m_list->SetItem(0L, 2, _("180 minutes")); break;
		default:                m_list->SetItem(0L, 2, wxT("????????")); break;
	}

	if (item->m_reflector.IsEmpty())
		m_list->SetItem(0L, 3, _("None"));
	else
		m_list->SetItem(0L, 3, item->m_reflector);

	m_list->SetItemPtrData(0L, wxUIntPtr(item));
}
void ExternalToolDlg::DoUpdateEntry(const wxString& id,
                                    const wxString& name,
                                    const wxString& path,
                                    const wxString& workingDirectory,
                                    const wxString& arguments,
                                    const wxString& icon16,
                                    const wxString& icon24,
                                    bool captureOutput,
                                    bool saveAllFiles,
                                    bool callOnFileSave)
{
    // try to see if 'id' already exist in the list control
    long item(wxNOT_FOUND);
    for(size_t i = 0; i < (size_t)m_listCtrlTools->GetItemCount(); i++) {
        if(GetColumnText(m_listCtrlTools, i, 0) == id) {
            item = i;

            // Delete old data
            ExternalToolData* data = (ExternalToolData*)m_listCtrlTools->GetItemData(item);
            if(data) delete data;

            break;
        }
    }

    // append new row
    if(item == wxNOT_FOUND) {
        item = AppendListCtrlRow(m_listCtrlTools);
    }

    SetColumnText(m_listCtrlTools, item, 0, id);
    SetColumnText(m_listCtrlTools, item, 1, name);
    SetColumnText(m_listCtrlTools, item, 2, path);

    ExternalToolData* data = new ExternalToolData(
        id, name, path, workingDirectory, arguments, icon16, icon24, captureOutput, saveAllFiles, callOnFileSave);
    m_listCtrlTools->SetItemPtrData(item, wxUIntPtr(data));
}
void ExternalToolDlg::SetTools(const std::vector<ToolInfo>& tools)
{
    m_listCtrlTools->Freeze();
    for(size_t i = 0; i < (size_t)m_listCtrlTools->GetItemCount(); i++) {
        ExternalToolData* data = (ExternalToolData*)m_listCtrlTools->GetItemData(i);
        wxDELETE(data);
    }
    
    m_listCtrlTools->DeleteAllItems();

    for(size_t i = 0; i < tools.size(); i++) {
        ToolInfo ti = tools.at(i);
        long item = AppendListCtrlRow(m_listCtrlTools);

        ExternalToolData* data = new ExternalToolData(ti);
        m_listCtrlTools->SetItemPtrData(item, wxUIntPtr(data));

        SetColumnText(m_listCtrlTools, item, 0, ti.GetId());
        SetColumnText(m_listCtrlTools, item, 1, ti.GetName());
        SetColumnText(m_listCtrlTools, item, 2, ti.GetPath());
    }

    m_listCtrlTools->Thaw();
}