Beispiel #1
0
void RebrandingHelper::ApplyBranding(wxRibbonButtonBar * buttonBar, wxString scope)
{
	size_t buttonIndex = 0;
	size_t nameIndex = 0;
	while(buttonIndex < buttonBar->GetButtonCount())
	{
		bool deleted = false;
		wxRibbonButtonBarButtonBase * button = buttonBar->GetItem(buttonIndex);
		if (button)
		{
			wxString buttonScope = scope + ".";
			buttonScope << nameIndex;
			if (ShouldDelete(buttonScope))
			{
				buttonBar->DeleteButton(buttonBar->GetItemId(button));
				deleted = true;
			}
		}

		if (!deleted) ++buttonIndex;
		++nameIndex;
	}

	buttonBar->Realize();
}
Beispiel #2
0
void RebrandingHelper::ApplyBranding(wxRibbonPanel * panel, wxString scope)
{
	if (!panel) return;

	wxString panelScope = scope + "." + panel->GetLabel();
	if (ShouldDelete(panelScope))
    {
    	panel->Destroy();
    	return;
    }

    if (ShouldRename(panelScope)) panel->SetLabel(GetNewName(panelScope));

    wxWindowList & children = panel->GetChildren();
    for(auto childIt = children.begin();childIt != children.end();++childIt)
    {
        wxWindow * child = *childIt;
        if (!child) continue;

	    if (wxRibbonButtonBar * buttonBar = dynamic_cast<wxRibbonButtonBar*>(child))
	    {
	        ApplyBranding(buttonBar, panelScope + ".ButtonBar");
	    }
    }
	panel->Realize();
}
Beispiel #3
0
void RebrandingHelper::ApplyBranding(wxRibbonBar * bar, wxString scope)
{
    for (size_t pageIndex = 0;pageIndex < bar->GetPageCount();pageIndex++)
    {
        wxRibbonPage * page = bar->GetPage(pageIndex);
        if (page)
        {
	        wxString pageScope = scope + "." + page->GetLabel();
	        if (ShouldDelete(pageScope)) bar->HidePage(pageIndex);
			else if (ShouldRename(pageScope)) page->SetLabel(GetNewName(pageScope));

	        wxWindowList & children = page->GetChildren();
	        for(auto childIt = children.begin();childIt != children.end();++childIt)
	        {
	            wxWindow * child = *childIt;
	            if (!child) continue;

			    if (wxRibbonPanel * panel = dynamic_cast<wxRibbonPanel*>(child))
			    {
			        ApplyBranding(panel, pageScope);
			    }
	        }
        }
    }
	bar->Realize();
}
Beispiel #4
0
void RebrandingHelper::ApplyBranding(wxPropertyGrid * grid, wxString scope)
{
    wxPropertyGridIterator it = grid->GetIterator();
    while (!it.AtEnd())
    {
        wxPGProperty * property = it.GetProperty();
        it.Next();
        if (property) {
            wxString propertyScope = scope + "." + property->GetName();
            if (ShouldDelete(propertyScope)) property->Hide(true);
            else if(ShouldRename(propertyScope)) property->SetLabel(GetNewName(propertyScope));
        }
    }

}
Beispiel #5
0
uint64_t EventableDescriptor::GetNextHeartbeat()
{
	if (NextHeartbeat)
		MyEventMachine->ClearHeartbeat(NextHeartbeat);

	NextHeartbeat = 0;

	if (!ShouldDelete()) {
		uint64_t time_til_next = GetCommInactivityTimeout() * 1000;
		if (IsConnectPending()) {
			if (time_til_next == 0 || PendingConnectTimeout < time_til_next)
				time_til_next = PendingConnectTimeout;
		}
		if (time_til_next == 0)
			return 0;
		NextHeartbeat = time_til_next + MyEventMachine->GetRealTime();
	}

	return NextHeartbeat;
}
Beispiel #6
0
void RebrandingHelper::ApplyBranding(wxTreeCtrl * treeCtrl, wxTreeItemId item, wxString scope)
{
    while(item.IsOk())
    {
        wxTreeItemId next = treeCtrl->GetNextSibling(item);

        wxString itemScope = scope + "." + treeCtrl->GetItemText(item);
        if (ShouldDelete(itemScope)) treeCtrl->Delete(item);
        else
        {
        	if (treeCtrl->ItemHasChildren(item))
            {
                void * cookie;
                ApplyBranding(treeCtrl, treeCtrl->GetFirstChild(item, cookie), itemScope);
            }

        	if (ShouldRename(itemScope)) treeCtrl->SetItemText(item, GetNewName(itemScope));
        }


        item = next;
    }
}
Beispiel #7
0
void RebrandingHelper::ApplyBranding(wxMenu & menu, wxString scope)
{
    size_t separatorIndex = 0;

	wxMenuItemList & itemsList = menu.GetMenuItems();
	for(auto itemIt = itemsList.begin(); itemIt != itemsList.end();++itemIt)
	{
	    wxMenuItem * item = *itemIt;
	    if (!item) continue;

        wxString name = menu.GetLabelText(item->GetId());
        if (item->GetId() == wxID_SEPARATOR)
        {
            name = "Separator_";
            name << separatorIndex;
            separatorIndex++;
        }

	    wxString itemScope = scope + "." + name;

	    if (ShouldDelete(itemScope)) menu.Destroy(item);
	    else if (ShouldRename(itemScope)) item->SetItemLabel(GetNewName(itemScope));
	}
}