コード例 #1
0
/**
 *  This method is called to get the contacts service icon data.
 *
 *  The parameters sent to us are:
 *  pValues - An IPortableDeviceValues to be populated with the icon data
 *
 *  The driver should:
 *  Retrieve the icon data and set it in pValues for PKEY_Services_ServiceIcon
 */
HRESULT FakeContactsServiceContent::GetIconData(
    __out   IPortableDeviceValues* pStore)
{
    HRESULT hr         = S_OK;
    PBYTE   pIconData  = NULL;
    DWORD   cbIconData = 0;

    if (pStore == NULL)
    {
        hr = E_POINTER;
        CHECK_HR(hr, "Cannot have NULL parameter");
        return hr;
    }

    pIconData = GetResourceData(IDR_WPD_SAMPLEDRIVER_SERVICE_ICON);
    cbIconData = GetResourceSize(IDR_WPD_SAMPLEDRIVER_SERVICE_ICON);

    if ((pIconData == NULL) || (cbIconData == 0))
    {
        hr = E_UNEXPECTED;
        CHECK_HR(hr, "Failed to get resource representing the service icon data");
    }

    if (hr == S_OK)
    {
        hr = pStore->SetBufferValue(PKEY_Services_ServiceIcon, pIconData, cbIconData);
        CHECK_HR(hr, "Failed to copy the icon data to IPortableDeviceValues");
    }

    return hr;
}
コード例 #2
0
//************************************************************************
BOOL CCreditsScene::OnInitDialog( HWND hWnd, HWND hWndControl, LPARAM lParam )
//************************************************************************
{
	CScene::OnInitDialog(hWnd, hWndControl, lParam);
	if ( !m_pAnimator )
		return( TRUE );

	// read in the name information
	HGLOBAL hData;
	LPSTR lpTableData;
	if ( lpTableData = GetResourceData(m_nSceneNo, "gametbl", &hData) )
	{
		CCreditsParser parser(lpTableData);
		if (m_nContributors = parser.GetNumEntries())
		{
			--m_nContributors;
			m_pContributors = new CContributor[m_nContributors];
			if (m_pContributors)
				parser.ParseTable((DWORD)this);
		}
	}
	if (hData)
	{
		UnlockResource( hData );
		FreeResource( hData );
	}

	return( TRUE );
}
コード例 #3
0
ファイル: wxstreectrl.cpp プロジェクト: gk7huki/codeblocks_sf
/*! \brief Find all tools that are image lists and return their names.
 *
 * \param aNames wxArrayString&
 * \return void
 *
 */
void wxsTreeCtrl::FindAllImageLists(wxArrayString &aNames)
{
    int             i, n;
    wxsItemResData  *res;
    wxsTool         *tool;
    wxString        ss, tt;

    // start the list with a chance to de-select any old list
    aNames.Clear();
    aNames.Add(_("<none>"));

    // find all tools that are "wxImageList"
    res = GetResourceData();
    n   = res->GetToolsCount();
    for (i = 0;i < n;i++)
    {
        tool = res->GetTool(i);
        ss   = tool->GetUserClass();

        if ((ss == wxT("wxImageList")) && (n < 127))
        {
            ss = tool->GetVarName();
            aNames.Add(ss);
        }
    }
}
コード例 #4
0
bool wxsChoicebook::OnMouseClick(wxWindow* Preview,int PosX,int PosY)
{
    UpdateCurrentSelection();
    if ( GetChildCount()<2 ) return false;
    int NewIndex = GetChildIndex(m_CurrentSelection)+1;
    if ( NewIndex >= GetChildCount() ) NewIndex = 0;
    m_CurrentSelection = GetChild(NewIndex);
    GetResourceData()->SelectItem(m_CurrentSelection,true);
    return true;
}
コード例 #5
0
ファイル: wxsmenu.cpp プロジェクト: DowerChest/codeblocks
bool wxsMenu::OnXmlReadChild(TiXmlElement* Elem,bool IsXRC,bool IsExtra)
{
    if ( IsXRC )
    {
        wxString ClassName = cbC2U(Elem->Attribute("class"));
        if ( ClassName == _T("separator") || ClassName == _T("break") )
        {
            wxsMenuItem* Child = new wxsMenuItem(GetResourceData(),true);
            AddChild(Child);
            return Child->XmlRead(Elem,IsXRC,IsExtra);
        }

        if ( ClassName == _T("wxMenu") || ClassName == _T("wxMenuItem") )
        {
            wxsMenuItem* Child = new wxsMenuItem(GetResourceData(),false);
            AddChild(Child);
            return Child->XmlRead(Elem,IsXRC,IsExtra);
        }
    }

    return true;
}
コード例 #6
0
XGWindow *XGWindowFactory::CreateFromResource(short resID, XGForm *form)
{
#if OPT_MACOS == 1
    Handle h;
    XGWindow *w;

    h = ::GetResource('VRes',resID);
    Assert(h != NULL);

    ::HLock(h);
    w = CreateFromData((unsigned char *)(*h),form);
    ::HUnlock(h);
    ::ReleaseResource(h);
    return w;
#endif

#if OPT_WINOS == 1
    HRSRC hsrc;
    HGLOBAL h;
    void *data;
    XGWindow *w;

    hsrc = ::FindResource(_GInstance,MAKEINTRESOURCE(resID),"VRes");
    Assert(hsrc != NULL);
    h = LoadResource(_GInstance,hsrc);
    Assert(h != NULL);
    data = LockResource(h);

    /*
     *	Now create the object
     */

    w = CreateFromData((unsigned char *)data,form);

    /*
     *	Release the resource
     */

    UnlockResource(h);
    FreeResource(h);
    return w;
#endif

#if OPT_XWIN == 1
    void *data;

    data = GetResourceData('VRes',resID);
    Assert(data != NULL);
    return CreateFromData((unsigned char *)data,form);
#endif
}
コード例 #7
0
//************************************************************************
BOOL CNutDropScene::OnInitDialog (HWND hWnd, HWND hWndControl, LPARAM lParam)
//************************************************************************
{
	CGBScene::OnInitDialog (hWnd, hWndControl, lParam);
	
	m_pSound = new CSound (TRUE);
	if (m_pSound)
		m_pSound->Open (NULL);

	// Keyboard keys that we want
	App.SetKeyMapEntry (m_hWnd, VK_UP);
	App.SetKeyMapEntry (m_hWnd, VK_DOWN);
	App.SetKeyMapEntry (m_hWnd, VK_RIGHT);
	App.SetKeyMapEntry (m_hWnd, VK_LEFT);
	
	if (m_pAnimator)
	{
		HGLOBAL hData;
		LPSTR lpTableData;

		if (GetToon())
			GetToon()->SetSendMouseMode (TRUE);

		// Read in the game table information
		lpTableData = GetResourceData (m_nSceneNo, "gametbl", &hData);
		if (lpTableData)
		{
			CNutDropParser parser (lpTableData);
			parser.ParseTable ((DWORD)this);
		}
		if (hData)
		{
			UnlockResource (hData);
			FreeResource (hData);
		}

		m_pAnimator->SetClipRect (&m_rGameArea);
	}

	if (m_nSceneNo == IDD_NUTDROPI || m_nSceneNo == IDD_NUTDROP1)
		m_iLevel = 0;
	else if (m_nSceneNo == IDD_NUTDROP2)
		m_iLevel = 1;
	else if (m_nSceneNo == IDD_NUTDROP3)
		m_iLevel = 2;

	// Seed the random number generator
	wRandomSeed = GetRandomNumber (MAX_PIECES);

	return (TRUE);
}
コード例 #8
0
//************************************************************************
BOOL CBelongsScene::OnInitDialog( HWND hWnd, HWND hWndControl, LPARAM lParam )
//************************************************************************
{
	HGLOBAL hData;
	LPSTR lpTableData;

	// we don't call CGBScene::OnInitDialog, because it remaps
	// VK_SPACE.  It's strange if you type a space in the edit
	// box and it causes you to go to the main menu.
	CScene::OnInitDialog(hWnd, hWndControl, lParam);
	GetApp()->SetKeyMapEntry(hWnd, VK_ESCAPE);
	GetApp()->SetKeyMapEntry(hWnd, VK_RETURN, WM_COMMAND, IDC_PLAYBELONGS, 0L, YES/*fOnDown*/);
#ifdef _DEBUG
	GetApp()->SetKeyMapEntry(hWnd, VK_SPACE, WM_COMMAND, VK_SPACE, 0L, YES/*fOnDown*/);
#endif

	// hide the buttons until the scene comes up
	ShowDlgItem(hWnd, IDC_EDIT, FALSE);

	// Set a font for the edit control based on a font with a known size, fixes the
	// problem where a PC has some weird large font for the system font (SMS).
	m_hFont = (HFONT)GetStockObject (ANSI_VAR_FONT);
	LOGFONT lf;
	GetObject (m_hFont, sizeof(LOGFONT), &lf);
	lf.lfHeight *= 2;
	lf.lfWeight = FW_BOLD;
	m_hFont = CreateFontIndirect (&lf);
	SendDlgItemMessage (hWnd, IDC_EDIT, WM_SETFONT, (WPARAM)m_hFont, 0L);
	
	// read in the name information
	lpTableData = GetResourceData(m_nSceneNo, "gametbl", &hData);
	if (lpTableData)
	{
		CBelongsParser parser(lpTableData);
		if (m_nNames = parser.GetNumEntries())
		{
			m_pNames = new CBelongsName[m_nNames];
			if (m_pNames)
				parser.ParseTable((DWORD)m_pNames);
		}
	}
	if (hData)
	{
		UnlockResource( hData );
		FreeResource( hData );
	}

	return( TRUE );
}
コード例 #9
0
bool wxsListbook::OnMouseClick(wxWindow* Preview,int PosX,int PosY)
{
    UpdateCurrentSelection();
    wxListbook* Listbook = (wxListbook*)Preview;
    // for some reason, HitTest() is public in wxBookCtrlBase but they chose to make it protected in wxListbook...
    int Hit = ((wxBookCtrlBase*)Listbook)->HitTest(wxPoint(PosX,PosY));
    if ( Hit != wxNOT_FOUND )
    {
        wxsItem* OldSel = m_CurrentSelection;
        m_CurrentSelection = GetChild(Hit);
        GetResourceData()->SelectItem(m_CurrentSelection,true);
        return OldSel != m_CurrentSelection;
    }
    return false;
}
コード例 #10
0
bool wxsMenuBar::OnXmlReadChild(TiXmlElement* Elem,bool IsXRC,bool IsExtra)
{
    if ( IsXRC )
    {
        wxString ClassName = cbC2U(Elem->Attribute("class"));
        if ( ClassName == _T("wxMenu") )
        {
            wxsMenu* Child = new wxsMenu(GetResourceData());
            if ( !AddChild(Child) )
            {
                delete Child;
                return false;
            }
            return Child->XmlRead(Elem,IsXRC,IsExtra);
        }
    }

    return true;
}
コード例 #11
0
ファイル: getstr.c プロジェクト: 0xDEC0DE/uqm-0.6.4-ee
void *
_GetBinaryTableData (uio_Stream *fp, DWORD length)
{
	void *result;
	result = GetResourceData (fp, length);

	if (result)
	{
		DWORD *fileData;
		STRING_TABLE lpST;

		fileData = (DWORD *)result;

		dword_convert (fileData, 1); /* Length */

		lpST = AllocStringTable (fileData[0], 0);
		if (lpST)
		{
			int i, size;
			BYTE *stringptr;

			size = lpST->size;

			dword_convert (fileData+1, size + 1);
			stringptr = (BYTE *)(fileData + 2 + size + fileData[1]);
			for (i = 0; i < size; i++)
			{
				set_strtab_entry (lpST, i, stringptr, fileData[2+i]);
				stringptr += fileData[2+i];
			}
		}
		HFree (result);
		result = lpST;
	}

	return (result);
}
コード例 #12
0
void wxsImagePanel::OnEnumContainerProperties(cb_unused long Flags) {
static wxString         sImageNames[128];
static const wxChar    *pImageNames[128];

int                     i,n,k;
wxsItemResData         *res;
wxsTool                *tool;
wxString                ss, tt;


// find available images, and pointer to current imagelist

    res = GetResourceData();
    n = 0;
    sImageNames[n] = _("<none>");
    pImageNames[n] = (const wxChar *) sImageNames[n];
    n += 1;
    k = res->GetToolsCount();
    for(i=0; i<k; i++) {
        tool = res->GetTool(i);
        ss = tool->GetUserClass();

        if ((ss == _T("wxImage")) && (n < 127)) {
            ss = tool->GetVarName();
            sImageNames[n] = ss;
            pImageNames[n] = (const wxChar *) sImageNames[n];
            n += 1;
        };
    };
    pImageNames[n] = NULL;

    WXS_EDITENUM(wxsImagePanel, mImage, _("Image"), _T("image"), pImageNames, _("<none>"))

// stretch to fit panel?

    WXS_BOOL(wxsImagePanel, mStretch, _("Stretch"), _T("stretch"), false);
};
コード例 #13
0
//***********************************************************************
BOOL CLGBApp::InitInstance()
//***********************************************************************
{
	HGLOBAL hData;
	LPSTR lpTableData;

	// load the scene table
	lpTableData = GetResourceData(IDR_SCENETABLE, "gametbl", &hData);
	if (lpTableData)
	{
		CSceneTableParser parser(lpTableData);
		if (m_nScenes = parser.GetNumEntries())
		{
			m_pSceneTable = new CSceneEntry[m_nScenes];
			if (m_pSceneTable)
				parser.ParseTable((DWORD)m_pSceneTable);
		}
	}
	if (hData)
	{
		UnlockResource( hData );
		FreeResource( hData );
	}
	if (!m_pSceneTable)
		return(FALSE);
	
	m_Language = (Language)GetSettingInt("Language", English);
	m_nBookmark = GetSettingInt("Bookmark", 0);
	if (m_Language != English && m_Language != Spanish)
		m_Language = English;
	if (!CPHApp::InitInstance())
		return(FALSE);
	m_hAccel = LoadAccelerators(GetInstance(), MAKEINTRESOURCE(IDR_ACCEL)); 

	return TRUE;
}
コード例 #14
0
void wxsContainer::AddChildrenPreview(wxWindow* This,long Flags)
{
    for ( int i=0; i<GetChildCount(); i++ )
    {
        wxsItem* Child = GetChild(i);
        wxObject* ChildPreviewAsObject = Child->BuildPreview(This,Flags);
        if ( Child->GetType() == wxsTSizer )
        {
            wxSizer* ChildPreviewAsSizer = wxDynamicCast(ChildPreviewAsObject,wxSizer);
            if ( ChildPreviewAsSizer )
            {
                This->SetSizer(ChildPreviewAsSizer);
            }
        }
    }

    if ( IsRootItem() )
    {
        // Adding all tools before calling Fit and SetSizeHints()

        wxsItemResData* Data = GetResourceData();
        if ( Data )
        {
            for ( int i=0; i<Data->GetToolsCount(); i++ )
            {
                Data->GetTool(i)->BuildPreview(This,Flags);
            }
        }

    }

    for ( int i=0; i<GetChildCount(); i++ )
    {
        wxsItem* Child = GetChild(i);
        if ( Child->GetType() == wxsTSizer )
        {
            wxObject* ChildPreviewAsObject = Child->GetLastPreview();
            wxSizer*  ChildPreviewAsSizer  = wxDynamicCast(ChildPreviewAsObject,wxSizer);
            wxWindow* ChildPreviewAsWindow = wxDynamicCast(ChildPreviewAsObject,wxWindow);

            if ( ChildPreviewAsSizer )
            {
                // Child preview was created directly as sizer, we use it to
                // call Fit() and SetSizeHints() directly
                if ( GetBaseProps()->m_Size.IsDefault )
                {
                    ChildPreviewAsSizer->Fit(This);
                }
                ChildPreviewAsSizer->SetSizeHints(This);
            }
            else if ( ChildPreviewAsWindow )
            {
                // Preview of sizer is given actually as some kind of panel which paints
                // some extra data of sizer. So we have to create out own sizer to call
                // Fit and SetSizeHints

                wxSizer* IndirectSizer = new wxBoxSizer(wxHORIZONTAL);
                IndirectSizer->Add(ChildPreviewAsWindow,1,wxEXPAND,0);
                This->SetSizer(IndirectSizer);

                if ( GetBaseProps()->m_Size.IsDefault )
                {
                    IndirectSizer->Fit(This);
                }

                IndirectSizer->SetSizeHints(This);
            }
        }
    }
}
コード例 #15
0
void wxsContainer::AddChildrenCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            wxsCoderContext* Context = GetCoderContext();
            if ( !Context ) return;

            // Update parent in context and clear flRoot flag
            wxString PreviousParent = Context->m_WindowParent;
            Context->m_WindowParent = Codef(Context,_T("%O"));

            for ( int i=0; i<GetChildCount(); i++ )
            {
                wxsItem* Child = GetChild(i);
                Child->BuildCode(Context);
                if ( Child->GetType() == wxsTSizer )
                {
                    // TODO: Is this right place to set-up sizer ?
                    Codef(_T("%ASetSizer(%o);\n"),i);
                }
            }

            if ( IsRootItem() )
            {
                // Adding all tools before calling Fit and SetSizeHints()
                wxsItemResData* Data = GetResourceData();
                if ( Data )
                {
                    for ( int i=0; i<Data->GetToolsCount(); i++ )
                    {
                        Data->GetTool(i)->BuildCode(Context);
                    }
                }
            }

            for ( int i=0; i<GetChildCount(); i++ )
            {
                wxsItem* Child = GetChild(i);
                if ( Child->GetType() == wxsTSizer )
                {
                    if ( GetBaseProps()->m_Size.IsDefault )
                    {
                        wxString ChildAccessPrefix = Child->GetAccessPrefix(GetLanguage());
                        Codef(_T("%sFit(%O);\n"),ChildAccessPrefix.wx_str());

                        Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.wx_str());
                    }
                    else
                    {
                        wxString ChildVarName = Child->GetVarName();
                        Codef(_T("SetSizer(%s);\n"), ChildVarName.wx_str());

                        Codef(_T("Layout();\n"));
                    }
                }
            }

            Context->m_WindowParent = PreviousParent;
            return;
        }

        case wxsUnknownLanguage:
        default:
        {
            wxsCodeMarks::Unknown(_T("wxsContainer::AddChildrenCode"),GetLanguage());
        }
    }
}