SlotManager::SlotManager(bool a_blLoading, ALLEGRO_PATH * a_pSearchpath,void (* a_pCallBack)(string)) { m_ColorInner = al_map_rgb(0,0,0); m_ColorOuter = al_map_rgb(100,100,255); m_ColorHighlight = al_map_rgb(0,0,255); m_pActiveSlot = NULL; m_blLoading = a_blLoading; m_pCallBack = a_pCallBack; m_nIndex = 1; if (a_pSearchpath!=NULL) { ALLEGRO_FS_ENTRY * pDir = al_create_fs_entry(al_path_cstr(a_pSearchpath,ALLEGRO_NATIVE_PATH_SEP)); if (al_open_directory(pDir)) { ALLEGRO_FS_ENTRY * pFile; while (pFile = al_read_directory(pDir)) { ALLEGRO_PATH * pPath = al_create_path(al_get_fs_entry_name(pFile)); AddSlot(al_get_path_basename(pPath)); al_destroy_path(pPath); al_destroy_fs_entry(pFile); } } al_destroy_fs_entry(pDir); } if (!a_blLoading) { AddSlot("NEW SAVE..."); } }
void SClippingHorizontalBox::AddWrapButton() { // Construct the wrap button used in toolbars and menubars WrapButton = SNew( SComboButton ) .HasDownArrow( false ) .ButtonStyle( StyleSet, ISlateStyle::Join(StyleName, ".Button") ) .ContentPadding( 0 ) .ToolTipText( NSLOCTEXT("Slate", "ExpandToolbar", "Click to expand toolbar") ) .OnGetMenuContent( OnWrapButtonClicked ) .Cursor( EMouseCursor::Default ) .ButtonContent() [ SNew( SImage ) .Image( StyleSet->GetBrush(StyleName, ".Expand") ) ]; // Add the wrap button AddSlot() .AutoWidth() .Padding( 0 ) [ WrapButton.ToSharedRef() ]; }
void PushMenu(TSharedRef<FMenuBase> InMenu, const FVector2D& InLocation) { check(InMenu->GetContent().IsValid()); TSharedPtr<SWindow> ParentWindow = InMenu->GetParentWindow(); check(ParentWindow.IsValid()); // Transform InLocation into a position local to this panel (assumes the panel is in an overlay that covers the whole of the panel window) FVector2D PanelInScreen = ParentWindow->GetRectInScreen().GetTopLeft(); FVector2D PanelInWindow = ParentWindow->GetLocalToScreenTransform().Inverse().TransformPoint(PanelInScreen); FVector2D LocationInWindow = ParentWindow->GetLocalToScreenTransform().Inverse().TransformPoint(InLocation); FVector2D LocationInPanel = LocationInWindow - PanelInWindow; // Add the new menu into a slot on this panel and set the padding so that its position is correct AddSlot() .HAlign(HAlign_Left) .VAlign(VAlign_Top) .Padding(LocationInPanel.X, LocationInPanel.Y, 0, 0) [ InMenu->GetContent().ToSharedRef() ]; // Make sure that the menu will remove itself from the panel when dismissed InMenu->GetOnMenuDismissed().AddSP(this, &SMenuPanel::OnMenuClosed); }
TabsDialog::TabsDialog(QList<TradeItem>& itemList,const QString& columnJsonFile,QWidget *parent):QDialog(parent) { ListTab* listTab = new ListTab(itemList,columnJsonFile,parent); GridTab* gridTab = new GridTab(itemList,parent); m_TabWidget = new QTabWidget; m_TabWidget->addTab(gridTab,tr("Card View")); m_TabWidget->addTab(listTab,tr("List View")); m_TabWidget->setMovable(true); m_TabWidget->setTabPosition(QTabWidget::South); QGridLayout *mainLayout = new QGridLayout; mainLayout->setSizeConstraint(QLayout::SetNoConstraint); mainLayout->addWidget(m_TabWidget); mainLayout->setMargin(5); setLayout(mainLayout); TradeTable* tradeTable = listTab->GetTable(); PriceDisplayBoardWindowBoxList* displayBoardList = gridTab->GetListViewPort()->GetList(); UpdateThread* realTimeUpdateThread = new UpdateThread(itemList); //注:itemList为引用参数,listTab或gridTab及UpdataThread线程均可修改此QList的内容与顺序; connect(realTimeUpdateThread,SIGNAL(SendPriceSignal(const TradeItem&)),displayBoardList,SLOT(RealTimeDisplay(const TradeItem&))); connect(realTimeUpdateThread,SIGNAL(SendPriceSignal(const TradeItem&)),tradeTable,SLOT(RealTimeDisplay(const TradeItem&))); realTimeUpdateThread->start(); connect(displayBoardList,SIGNAL(AddSignal()),tradeTable,SLOT(AddSlot())); connect(displayBoardList,SIGNAL(OrderSignal(int)),tradeTable,SLOT(OrderSlot(int))); //可注释掉; connect(displayBoardList,SIGNAL(ChartSignal(int)),tradeTable,SLOT(ChartSlot(int))); //可注释掉; connect(displayBoardList,SIGNAL(DeleteSignal(int)),tradeTable,SLOT(DeleteSlot(int))); connect(displayBoardList,SIGNAL(MoveUpSignal(int)),tradeTable,SLOT(MoveUpSlot(int))); connect(displayBoardList,SIGNAL(UpToTopSignal(int)),tradeTable,SLOT(UpToTopSlot(int))); connect(displayBoardList,SIGNAL(MoveDownSignal(int)),tradeTable,SLOT(MoveDownSlot(int))); connect(displayBoardList,SIGNAL(DownToBottomSignal(int)),tradeTable,SLOT(DownToBottomSlot(int))); connect(tradeTable,SIGNAL(AddSignal()),displayBoardList,SLOT(AddSlot())); connect(tradeTable,SIGNAL(OrderSignal(int)),displayBoardList,SLOT(OrderSlot(int))); connect(tradeTable,SIGNAL(ChartSignal(int)),displayBoardList,SLOT(ChartSlot(int))); connect(tradeTable,SIGNAL(DeleteSignal(int)),displayBoardList,SLOT(DeleteSlot(int))); connect(tradeTable,SIGNAL(MoveUpSignal(int)),displayBoardList,SLOT(MoveUpSlot(int))); connect(tradeTable,SIGNAL(UpToTopSignal(int)),displayBoardList,SLOT(UpToTopSlot(int))); connect(tradeTable,SIGNAL(MoveDownSignal(int)),displayBoardList,SLOT(MoveDownSlot(int))); connect(tradeTable,SIGNAL(DownToBottomSignal(int)),displayBoardList,SLOT(DownToBottomSlot(int))); // setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding) ; }
SkillInventory::SkillInventory(int x, int y, int colums, float slotSize) : HudItemContainer(x, y, colums, slotSize) { SetHooverInfoPos(XMFLOAT2(-slotSize/2, -110)); SetHooverBkgd("data/textures/white_transparent.png"); mPlayer = nullptr; mShop = nullptr; for(int i = 0; i < 8; i++) AddSlot(); }
void SFlarePlanetaryBox::ClearChildren() { Children.Empty(); if (PlanetImage) { AddSlot() [ SNew(SImage).Image(PlanetImage) ]; } }
void ConnectionManagerImpl::RegisterSlot(const int type, const QObject *obj, const QString &slot) { Q_ASSERT(obj != NULL); Q_ASSERT(!slot.isEmpty()); if(obj == NULL || slot.isEmpty()) { return; } connection_locker_.lock(); AddSlot(type, obj, slot); ConnectSlot(type, obj, slot); connection_locker_.unlock(); }
TSharedRef<SDockTab> SMergeGraphView::CreateMyBlueprintsViews(const FSpawnTabArgs& Args) { auto PanelContainer = SNew(SSplitter); for (auto& Panel : DiffPanels) { PanelContainer->AddSlot() [ Panel.GenerateMyBlueprintPanel() ]; } return SNew(SDockTab) [ PanelContainer ]; }
BOOL KCheerleadingMgr::OnBuySlotSuccess(DWORD dwSlotIndex) { BOOL bResult = false; BOOL bRetCode = false; bRetCode = AddSlot(dwSlotIndex); if (!bRetCode) { KGLogPrintf(KGLOG_ERR, "Player:%u BuySlot:%u Success, But AddFailed.\n", m_pOwner->m_dwID, dwSlotIndex); goto Exit0; } bResult = true; Exit0: return bResult; }
void tcStoresGui::InitializeGui() { tcStores* stores = GetStores(); wxASSERT(stores); if (stores == 0) return; // tcStoresDBObject* storesData = stores->GetDatabaseObject(); // wxASSERT(storesData); for (size_t n=0; n<maxSlots; n++) { tcRect slotLoc(upperLeft.x, upperLeft.x + slotSize, upperLeft.y, upperLeft.y + slotSize + float(n%slotsPerPage)*verticalSpacing); AddSlot(slotLoc, tcContainerGui::SMALL_ICON_SIZE); } SetCurrentPage(0); }
TSharedRef<SDockTab> SMergeGraphView::CreateGraphDiffViews(const FSpawnTabArgs& Args) { auto PanelContainer = SNew(SSplitter); for (auto& Panel : DiffPanels) { PanelContainer->AddSlot() [ SAssignNew(Panel.GraphEditorBorder, SBox) .VAlign(VAlign_Fill) [ SBlueprintDiff::DefaultEmptyPanel() ] ]; } return SNew(SDockTab) [ PanelContainer ]; }
void TGo4EventInfo::RefreshClicked() { RemoveAllLinks(); if (EventLbl->text().length()==0) return; QString evname = EventLbl->text(); bool isremote = RemoteButton->isChecked(); bool istree = TreeButton->isChecked(); TGo4Slot* tgtslot = 0; if (!isremote) tgtslot = AddSlot("Event"); TGo4BrowserProxy* br = Browser(); if (br==0) return; TString objname; TGo4ServerProxy* an = br->DefineAnalysisObject(evname.toLatin1().constData(), objname); if (an!=0) an->RequestEventStatus(objname.Data(), istree, tgtslot); }
void add_new_slot(SOCKET server_socket, SOCKET viewer_socket, unsigned char *challenge, uint32_t code) { thread_t repeater_thread = 0; const repeaterslot *current = AddSlot(server_socket, viewer_socket, challenge, code); if (current) { if (current->server != INVALID_SOCKET && current->viewer != INVALID_SOCKET) { if (notstopped) { if (thread_create(&repeater_thread, NULL, do_repeater, (LPVOID)current) != 0) { log(FATAL, "Unable to create the repeater thread."); notstopped = false; } } } else { logp(DEBUG, "%s (socket=%d) waiting for %s to connect...", server_socket == INVALID_SOCKET ? "Viewer" : "Server", server_socket == INVALID_SOCKET ? current->viewer : current->server, server_socket == INVALID_SOCKET ? "server" : "viewer"); } } }
DlgRegistries::DlgRegistries(SoaWg *_wg) : QDialog(_wg), wg(_wg), guard(false) { ui.setupUi(this); setWindowTitle("Run-time registries"); ui.tree->setHeaderLabels(QStringList() << "Name"); ui.intermediaryTree->setHeaderLabels(QStringList() << "Name"); connect(ui.addButton, SIGNAL(clicked()), this, SLOT(AddSlot())); connect(ui.editButton, SIGNAL(clicked()), this, SLOT(EditSlot())); connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(RemoveSlot())); connect(ui.closeButton, SIGNAL(clicked()), this, SLOT(CloseSlot())); connect(ui.tree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(StateSlot())); connect(ui.tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(EditSlot())); connect(ui.intermediaryTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(IntermediaryItemChangedSlot(QTreeWidgetItem*))); LoadIntermediaries(); Refresh(); }
void SMergeGraphView::Construct(const FArguments InArgs , const FBlueprintMergeData& InData , FOnMergeNodeSelected SelectionCallback , TArray< TSharedPtr<FBlueprintDifferenceTreeEntry> >& OutTreeEntries , TArray< TSharedPtr<FBlueprintDifferenceTreeEntry> >& OutRealDifferences , TArray< TSharedPtr<FBlueprintDifferenceTreeEntry> >& OutConflicts ) { const TSharedRef<SDockTab> MajorTab = SNew(SDockTab) .TabRole(ETabRole::MajorTab); TabManager = FGlobalTabmanager::Get()->NewTabManager(MajorTab); TabManager->RegisterTabSpawner(MergeGraphTabId, FOnSpawnTab::CreateRaw(this, &SMergeGraphView::CreateGraphDiffViews)) .SetDisplayName(LOCTEXT("MergeGraphsTabTitle", "Graphs")) .SetTooltipText(LOCTEXT("MergeGraphsTooltipText", "Differences in the various graphs present in the blueprint")); TabManager->RegisterTabSpawner(MergeMyBluerpintTabId, FOnSpawnTab::CreateRaw(this, &SMergeGraphView::CreateMyBlueprintsViews)) .SetDisplayName(LOCTEXT("MergeMyBlueprintTabTitle", "My Blueprint")) .SetTooltipText(LOCTEXT("MergeMyBlueprintTooltipText", "Differences in the 'My Blueprints' attributes of the blueprint")); Data = InData; bViewsAreLocked = true; TArray<FBlueprintRevPair> BlueprintsForDisplay; // EMergeParticipant::Remote BlueprintsForDisplay.Add(FBlueprintRevPair(InData.BlueprintRemote, InData.RevisionRemote)); // EMergeParticipant::Base BlueprintsForDisplay.Add(FBlueprintRevPair(InData.BlueprintBase, InData.RevisionBase)); // EMergeParticipant::Local BlueprintsForDisplay.Add(FBlueprintRevPair(InData.BlueprintLocal, FRevisionInfo())); const TSharedRef<FTabManager::FLayout> DefaultLayout = FTabManager::NewLayout("BlueprintMerge_Layout_v1") ->AddArea ( FTabManager::NewPrimaryArea() ->Split ( FTabManager::NewStack() ->AddTab(MergeMyBluerpintTabId, ETabState::OpenedTab) ->AddTab(MergeGraphTabId, ETabState::OpenedTab) ) ); for (int32 i = 0; i < EMergeParticipant::Max_None; ++i) { DiffPanels.Add(FDiffPanel()); FDiffPanel& NewPanel = DiffPanels[i]; NewPanel.Blueprint = BlueprintsForDisplay[i].Blueprint; NewPanel.RevisionInfo = BlueprintsForDisplay[i].RevData; NewPanel.bShowAssetName = false; } auto GraphPanelContainer = TabManager->RestoreFrom(DefaultLayout, TSharedPtr<SWindow>()).ToSharedRef(); for (auto& Panel : DiffPanels ) { Panel.InitializeDiffPanel(); } auto DetailsPanelContainer = SNew(SSplitter); for( auto& Panel : DiffPanels ) { DetailsPanelContainer->AddSlot() [ Panel.DetailsView.ToSharedRef() ]; } Differences = TSharedPtr< TArray< FMergeGraphEntry > >( new TArray< FMergeGraphEntry >( GenerateDiffListItems(BlueprintsForDisplay[EMergeParticipant::Remote] , BlueprintsForDisplay[EMergeParticipant::Base] , BlueprintsForDisplay[EMergeParticipant::Local]) ) ); for( const auto& Difference : *Differences) { TArray< TSharedPtr<FBlueprintDifferenceTreeEntry> > Children; for( const auto& Change : Difference.Changes ) { const auto ChangeWidget = [](FText Label, FLinearColor Color) -> TSharedRef<SWidget> { return SNew(STextBlock) .Text(Label) .ColorAndOpacity(Color); }; const auto SelectGraphNode = [](FOnMergeNodeSelected SelectionCallback, FMergeGraphRowEntry DiffEntry, SMergeGraphView* Parent) { SelectionCallback.ExecuteIfBound(); Parent->HighlightEntry( DiffEntry ); }; TSharedPtr<FBlueprintDifferenceTreeEntry> Entry = TSharedPtr<FBlueprintDifferenceTreeEntry>(new FBlueprintDifferenceTreeEntry( FOnDiffEntryFocused::CreateStatic(SelectGraphNode, SelectionCallback, Change, this) , FGenerateDiffEntryWidget::CreateStatic(ChangeWidget, Change.Label, Change.DisplayColor ) , TArray< TSharedPtr<FBlueprintDifferenceTreeEntry> >() )); Children.Push(Entry); OutRealDifferences.Push(Entry); if( Change.LocalNode && Change.RemoteNode ) { OutConflicts.Push(Entry); } } const auto Widget = []( const FMergeGraphEntry* Difference ) -> TSharedRef<SWidget> { // blue indicates added, red indicates changed, yellow indicates removed, white indicates no change: const auto ComputeColor = [](const bool bAnyConflicts, const bool bAnyDifferences) -> FLinearColor { if( bAnyConflicts ) { return DiffViewUtils::Conflicting(); } else if( bAnyDifferences ) { return DiffViewUtils::Differs(); } return DiffViewUtils::Identical(); }; const auto Box = [](bool bIsPresent, FLinearColor Color) -> SHorizontalBox::FSlot& { return SHorizontalBox::Slot() .AutoWidth() .HAlign(HAlign_Right) .VAlign(VAlign_Center) .MaxWidth(8.0f) [ SNew(SImage) .ColorAndOpacity(Color) .Image(bIsPresent ? FEditorStyle::GetBrush("BlueprintDif.HasGraph") : FEditorStyle::GetBrush("BlueprintDif.MissingGraph")) ]; }; FLinearColor RemoteColor = ComputeColor(Difference->bAnyConflics, Difference->bRemoteDifferences); FLinearColor BaseColor = ComputeColor(Difference->bAnyConflics, false); FLinearColor LocalColor = ComputeColor(Difference->bAnyConflics, Difference->bLocalDifferences); FLinearColor TextColor = ComputeColor(Difference->bAnyConflics, Difference->bLocalDifferences || Difference->bRemoteDifferences); return SNew(SHorizontalBox) + SHorizontalBox::Slot() [ SNew(STextBlock) .ColorAndOpacity( TextColor ) .Text(FText::FromString(Difference->GraphName.GetPlainNameString())) ] + DiffViewUtils::Box(Difference->bExistsInRemote, RemoteColor) + DiffViewUtils::Box(Difference->bExistsInBase, BaseColor) + DiffViewUtils::Box(Difference->bExistsInLocal, LocalColor); }; const auto FocusGraph = [](FOnMergeNodeSelected SelectionCallback, SMergeGraphView* Parent, FName GraphName) { SelectionCallback.ExecuteIfBound(); Parent->FocusGraph( GraphName ); }; if( Children.Num() == 0 ) { Children.Push(FBlueprintDifferenceTreeEntry::NoDifferencesEntry()); } OutTreeEntries.Push( TSharedPtr<FBlueprintDifferenceTreeEntry>(new FBlueprintDifferenceTreeEntry( FOnDiffEntryFocused::CreateStatic(FocusGraph, SelectionCallback, this, Difference.GraphName) , FGenerateDiffEntryWidget::CreateStatic(Widget, &Difference) , Children )) ); } ChildSlot [ SNew(SSplitter) .Orientation(Orient_Horizontal) + SSplitter::Slot() .Value(0.9f) [ SNew(SSplitter) .Orientation(Orient_Vertical) + SSplitter::Slot() .Value(.8f) [ GraphPanelContainer ] + SSplitter::Slot() .Value(.2f) [ DetailsPanelContainer ] ] ]; }
/** * static method SetParent must be called first */ tcContainerGui::tcContainerGui(const wxPoint& pos, const wxString& configFile, const wxString& name) : tcXmlWindow(parent, pos, wxSize(10, 10), configFile, name, parent), drawCount(0), dragIsArmed(false), parentItem(0), isLButtonDown(false), windowDragOn(false), protectDeselectIdx(999), draggingSelectionBox(false) { // put gui window on top SetBaseRenderBin(parent->GetBaseRenderBin() + windowLayer*10); wxWindow::Raise(); tc3DWindow2::SetStencilLayer(windowLayer-3); // assumes windowLayer starts at 4 windowLayer++; TiXmlNode* root = config->FirstChild("Window"); if (!root) { fprintf(stderr, "tcContainerGui::tcContainerGui - Missing top level <Window> tag\n"); return; } TiXmlNode* current = root; /* TiXmlElement* elt = current->ToElement(); // background image std::string imageName = elt->Attribute("BackgroundImage"); if (imageName.size() > 2) { LoadBackgroundImage(imageName.c_str()); } // size of window int xmlWidth, xmlHeight; elt->Attribute("Width", &xmlWidth); elt->Attribute("Height", &xmlHeight); SetSize(pos.x, pos.y, xmlWidth, xmlHeight); // set all size params */ // add slots current = root->FirstChild("Slot"); while (current) { int x = 0; int y = 0; int size = 0; TiXmlElement* elt = current->ToElement(); elt->Attribute("X", &x); elt->Attribute("Y", &y); elt->Attribute("Size", &size); tcRect loc; loc.Set(x, x+size, y, y+size); AddSlot(loc); current = current->NextSibling("Slot"); } SetUseRenderSurface(true); SetRenderSurfaceUpdateInterval(4); SetActive(true); RegisterGui(); #ifdef _DEBUG fprintf(stdout, "tcContainerGui::tcContainerGui - %s, %d slots\n", name.c_str(), slots.size()); #endif SetBorderDraw(true); }