void OpPersonalbar::OnTreeChanged(OpTreeModel* tree_model) { if( tree_model == g_hotlist_manager->GetBookmarksModel() ) { for( INT32 i=GetWidgetCount()-1; i>=0; i-- ) { OpWidget* widget = GetWidget(i); if( widget && widget->GetType() != WIDGET_TYPE_SEARCH_EDIT ) { RemoveWidget(i); } } } #ifdef DESKTOP_UTIL_SEARCH_ENGINES else if( tree_model == g_searchEngineManager ) { for( INT32 i=GetWidgetCount()-1; i>=0; i-- ) { OpWidget* widget = GetWidget(i); if( widget && widget->GetType() == WIDGET_TYPE_SEARCH_EDIT ) { RemoveWidget(i); } } } #endif // DESKTOP_UTIL_SEARCH_ENGINES for (INT32 i = 0; i < tree_model->GetItemCount(); i++) { AddItem(tree_model, i, TRUE); } }
void UGUIDynamicCanvas::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) { Super::NativeTick(MyGeometry, InDeltaTime); if (AttachedWidgetDataList.Num() > 0) { for (const auto& Data : AttachedWidgetDataList) { UpdateAttachedWidget(Data); } if (AttachedWidgetDataListIsDirty) { TArray<FAttachedWidgetData> CleanedList; for (int32 Index = 0; Index < AttachedWidgetDataList.Num(); Index++) { FAttachedWidgetData& Data = AttachedWidgetDataList[Index]; if (Data.IsValid()) { CleanedList.Add(Data); } else { if (Data.Widget.IsValid() && WidgetCanvasPanel.IsValid()) { RemoveWidget(Data.Widget.Get()); } } } AttachedWidgetDataList = CleanedList; AttachedWidgetDataListIsDirty = false; } } }
void Context::DropAllLayers() { for (std::vector<Layer*>::iterator i = m_layers.begin(); i != m_layers.end(); ++i) RemoveWidget(*i); m_layers.clear(); NewLayer(); m_needsLayout = true; }
void Context::DropLayer() { // dropping the last layer would be bad assert(m_layers.size() > 1); RemoveWidget(m_layers.back()); m_layers.pop_back(); m_needsLayout = true; }
void Grid::ClearCell(unsigned int colNum, unsigned int rowNum) { assert(colNum >= 0 && colNum < m_numCols); assert(rowNum >= 0 && rowNum < m_numRows); const unsigned int n = rowNum*m_numCols+colNum; if (m_widgets[n]) RemoveWidget(m_widgets[n]); m_widgets[n] = 0; }
void Box::Remove(Widget *widget) { for (std::list<Child>::iterator i = m_children.begin(); i != m_children.end(); ++i) if ((*i).widget == widget) { if ((*i).flags & BOX_EXPAND) m_countExpanded--; m_children.erase(i); RemoveWidget(widget); return; } }
Grid *Grid::SetCell(unsigned int colNum, unsigned int rowNum, Widget *widget) { assert(colNum >= 0 && colNum < m_numCols); assert(rowNum >= 0 && rowNum < m_numRows); const unsigned int n = rowNum*m_numCols+colNum; if (m_widgets[n]) RemoveWidget(m_widgets[n]); m_widgets[n] = widget; AddWidget(m_widgets[n]); return this; }
BOOL OpPersonalbar::RemoveItem(OpTreeModel* model, INT32 model_pos) { OpTreeModelItem* model_item = model->GetItemByPosition(model_pos); INT32 pos = FindItem(model_item->GetID(), model); if (pos != -1) { RemoveWidget(pos); return TRUE; } return FALSE; }
void Context::SetMousePointer(const std::string &filename, const Point &hotspot) { Point pos(0); if (m_mousePointer) { pos = m_mousePointer->GetPosition() + m_mousePointer->GetHotspot(); RemoveWidget(m_mousePointer); } m_mousePointer = new MousePointer(this, filename, hotspot); AddWidget(m_mousePointer); SetWidgetDimensions(m_mousePointer, pos - m_mousePointer->GetHotspot(), m_mousePointer->PreferredSize()); }
Grid *Grid::SetColumn(unsigned int colNum, const WidgetSet &set) { assert(set.numWidgets <= m_colSpec.numCells); assert(colNum >= 0 && colNum < m_numCols); for (unsigned int i = 0; i < set.numWidgets; i++) { const unsigned int n = i*m_numCols+colNum; if (m_widgets[n]) RemoveWidget(m_widgets[n]); m_widgets[n] = set.widgets[i]; AddWidget(m_widgets[n]); } return this; }
Grid *Grid::SetRow(unsigned int rowNum, const WidgetSet &set) { assert(set.numWidgets <= m_rowSpec.numCells); assert(rowNum >= 0 && rowNum < m_numRows); for (unsigned int i = 0; i < set.numWidgets; i++) { const unsigned int n = rowNum*m_numCols+i; if (m_widgets[n]) RemoveWidget(m_widgets[n]); m_widgets[n] = set.widgets[i]; AddWidget(m_widgets[n]); } return this; }
Scroller *Scroller::SetInnerWidget(Widget *widget) { assert(widget); if (m_innerWidget) { m_onMouseWheelConn.disconnect(); RemoveWidget(m_innerWidget); } AddWidget(widget); m_innerWidget = widget; m_onMouseWheelConn = m_innerWidget->onMouseWheel.connect(sigc::mem_fun(this, &Scroller::OnMouseWheel)); return this; }
//----------------------------------------------------------------------- // //----------------------------------------------------------------------- void tWifiClientSettingsDialog::RefreshClients() { if( m_pNoClientsWidget != 0 ) { RemoveWidget( m_pNoClientsWidget ); m_pNoClientsWidget = 0; } m_widgetOrgSSID.clear(); bool clientFound = false; tWifiClientSettings* pWifiClientSettings = g_xWirelessMgr->WifiClientSettings(); if( pWifiClientSettings != 0 ) { unsigned int clients = pWifiClientSettings->ClientCount(); if( clients > 0 ) { for( unsigned int count = 0; count < clients; ++count ) { QString orgSSID = pWifiClientSettings->GetClientSSID(count); QString SSID = orgSSID; if (SSID.startsWith("0x", Qt::CaseInsensitive)) { QString hex = SSID.mid(2); QByteArray temp = QByteArray::fromHex(hex.toLatin1().constData()); SSID = temp; } if( orgSSID.isEmpty() != true ) { clientFound = true; tDialogWidget* pWidget = AddText( SSID, GetClientText(orgSSID) ); m_widgetOrgSSID[pWidget] = orgSSID; Connect( pWidget, SIGNAL( Triggered() ), this, SLOT( OnTriggered() ) ); } } } } if( clientFound == false ) { m_pNoClientsWidget = AddText( tr( "No client settings" ), tr( "No settings for Wireless client mode have been stored" ) ); } }
void ListWidget::Update( void ) { nodes = list->CountNodes(); if ( current >= nodes ) { current = nodes - 1; if ( hook ) hook->WidgetActivated( this, surface ); } rows = ItemHeight() * nodes + 2 * spacing + 2; visrows = h - 2 * spacing - 2; if ( visrows > rows ) { visrows = rows; toprow = 0; } else if ( visrows > rows - toprow ) { toprow = rows - visrows; } else if ( current != -1 ) { short selrow = 1 + spacing + current * ItemHeight(); if ( selrow < toprow ) toprow = selrow; else if ( selrow + ItemHeight() >= toprow + visrows ) toprow = selrow - visrows + ItemHeight(); } SliderWidget *slider = static_cast<SliderWidget *>( GetWidget(0) ); if ( rows > visrows ) { if ( slider ) slider->Adjust( 0, rows - visrows, visrows ); else { // create the corresponding slider widget slider = new SliderWidget( 0, x + w - DEFAULT_SLIDER_SIZE, y, DEFAULT_SLIDER_SIZE, h, 0, rows - visrows, toprow, visrows, WIDGET_VSCROLL | WIDGET_COMPOSITE | (flags & WIDGET_HSCROLLKEY ? 0 : WIDGET_HSCROLLKEY) | (flags & WIDGET_VSCROLLKEY ? 0 : WIDGET_VSCROLLKEY), NULL, surface ); slider->SetHook( this ); listboxw = w - DEFAULT_SLIDER_SIZE; // adjust list box size AddWidget( slider ); } } else if ( slider ) { // delete the slider; we don't need it any more listboxw += slider->Width(); // adjust list box size RemoveWidget( slider ); delete slider; } }
void CFWL_WidgetMgr::RemoveWidget(IFWL_Widget* pWidget) { CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); if (!pItem) { return; } if (pItem->pPrevious) { pItem->pPrevious->pNext = pItem->pNext; } if (pItem->pNext) { pItem->pNext->pPrevious = pItem->pPrevious; } if (pItem->pParent && pItem->pParent->pChild == pItem) { pItem->pParent->pChild = pItem->pNext; } CFWL_WidgetMgrItem* pChild = pItem->pChild; while (pChild) { CFWL_WidgetMgrItem* pNext = pChild->pNext; RemoveWidget(pChild->pWidget); pChild = pNext; } m_mapWidgetItem.erase(pWidget); }
void AsyncPluginImpl::WidgetRemoved(AnymauDMX *widget) { RemoveWidget(widget); }
void AsyncPluginImpl::WidgetRemoved(EurolitePro *widget) { RemoveWidget(widget); }
/** * @breif スタート時処理. */ bool FontCreatorPlugin::OnClose() { RemoveWidget(m_window); m_window->OnClose(); return true; }
void AsyncPluginImpl::WidgetRemoved(JaRuleWidget *widget) { RemoveWidget(widget); }
void AsyncPluginImpl::WidgetRemoved(VellemanK8062 *widget) { RemoveWidget(widget); }
void AsyncPluginImpl::WidgetRemoved(Sunlite *widget) { RemoveWidget(widget); }
void AsyncPluginImpl::WidgetRemoved(ScanlimeFadecandy *widget) { RemoveWidget(widget); }
/******************************************************************************* * Slot function. Translates command object recevied from the parser thread * to appropriate function call. * ****************************************************************************/ void DialogBox::ExecuteCommand(DialogCommand command) { QWidget* widget=NULL; if(empty) { ClearDialog(); empty=false; } switch(command.command & DialogCommand::command_mask) { case DialogCommand::add: if(command.command & DialogCommand::option_space & DialogCommand::option_mask) { // Seems sscanf %d in some versions of standard C library has a bug // returning 32k on sero-size strings if(command.GetText()[0]) { int size; sscanf(command.GetText(), "%d", &size); AddSpace(size); } else AddSpace(); break; } if(command.command & DialogCommand::option_stretch & DialogCommand::option_mask) { AddStretch(); break; } switch(command.control & ~DialogCommand::property_mask) { case DialogCommand::label: AddLabel(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_picture & DialogCommand::property_mask ? DialogBox::pixmap : command.control & DialogCommand::property_animation & DialogCommand::property_mask ? DialogBox::movie : DialogBox::text); break; case DialogCommand::groupbox: AddGroupbox(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_vertical & DialogCommand::property_mask, command.control & DialogCommand::property_checkable & DialogCommand::property_mask, command.control & DialogCommand::property_checked & DialogCommand::property_mask); break; case DialogCommand::frame: AddFrame(command.GetTitle(), command.control & DialogCommand::property_vertical & DialogCommand::property_mask, command.control); break; case DialogCommand::pushbutton: AddPushbutton(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_apply & DialogCommand::property_mask, command.control & DialogCommand::property_exit & DialogCommand::property_mask, command.control & DialogCommand::property_default & DialogCommand::property_mask); break; case DialogCommand::checkbox: AddCheckbox(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_checked & DialogCommand::property_mask); break; case DialogCommand::radiobutton: AddRadiobutton(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_checked & DialogCommand::property_mask); break; case DialogCommand::textbox: AddTextbox(command.GetTitle(), command.GetName(), command.GetText(), command.GetAuxText(), command.control & DialogCommand::property_password & DialogCommand::property_mask); break; case DialogCommand::listbox: AddListbox(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_activation & DialogCommand::property_mask, command.control & DialogCommand::property_selection & DialogCommand::property_mask); break; case DialogCommand::combobox: AddCombobox(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_editable & DialogCommand::property_mask, command.control & DialogCommand::property_selection & DialogCommand::property_mask); break; case DialogCommand::item: AddItem(command.GetTitle(), command.GetName(), command.control & DialogCommand::property_current & DialogCommand::property_mask); break; case DialogCommand::separator: AddSeparator(command.GetTitle(), command.control & DialogCommand::property_vertical & DialogCommand::property_mask, command.control); break; case DialogCommand::progressbar: AddProgressbar(command.GetTitle(), command.control & DialogCommand::property_vertical & DialogCommand::property_mask, command.control & DialogCommand::property_busy & DialogCommand::property_mask); break; case DialogCommand::slider: { int min(0), max(100); if(command.GetName()[0]) sscanf(command.GetName(), "%d", &min); if(command.GetText()[0]) sscanf(command.GetText(), "%d", &max); AddSlider(command.GetTitle(), command.control & DialogCommand::property_vertical & DialogCommand::property_mask, min, max); } break; case DialogCommand::textview: AddTextview(command.GetTitle(), command.GetName()); break; case DialogCommand::tabs: AddTabs(command.GetTitle(), command.control); break; case DialogCommand::page: AddPage(command.GetTitle(), command.GetName(), command.GetText(), command.control & DialogCommand::property_current & DialogCommand::property_mask); break; } break; case DialogCommand::clear: Clear(command.GetName()); break; case DialogCommand::end: switch(command.control & ~DialogCommand::property_mask) { case DialogCommand::groupbox: case DialogCommand::frame: EndGroup(); break; case DialogCommand::listbox: case DialogCommand::combobox: EndList(); break; case DialogCommand::tabs: EndTabs(); break; case DialogCommand::page: EndPage(); break; case DialogCommand::widget_mask: // none type mentioned if(current_view) EndList(); else if(group_layout) EndGroup(); else if(current_tab_widget) { if(current_tab_widget->indexOf(current_layout->parentWidget())==-1) EndTabs(); else EndPage(); } break; } break; case DialogCommand::step: if(command.command & DialogCommand::option_vertical & DialogCommand::option_mask) StepVertical(); else StepHorizontal(); break; case DialogCommand::set: if(command.GetName()[0]) { if(!(widget=FindWidget(command.GetName()))) break; } else widget=this; if(command.command & DialogCommand::option_enabled & DialogCommand::option_mask) SetEnabled(widget, true); if(command.command & DialogCommand::option_focus & DialogCommand::option_mask) { QTimer::singleShot(0, widget, SLOT(setFocus())); // select text for QLineEdit objects // selectedText property is not writable and this must be done in the class specific way if(QWidget* proxywidget=widget->focusProxy()) { switch(WidgetType(proxywidget)) { case DialogCommand::combobox: proxywidget=((QComboBox*)proxywidget)->lineEdit(); break; case DialogCommand::textbox: break; default: proxywidget=NULL; break; } if(proxywidget) ((QLineEdit*)proxywidget)->selectAll(); } } // see http://doc.qt.io/qt-4.8/stylesheet.html for reference if(command.command & DialogCommand::option_stylesheet & DialogCommand::option_mask) { widget->setStyleSheet(command.GetText()); if(QWidget* proxywidget=widget->focusProxy()) proxywidget->setStyleSheet(command.GetText()); } if(command.command & DialogCommand::option_visible & DialogCommand::option_mask) { widget->show(); if(QWidget* proxywidget=widget->focusProxy()) proxywidget->show(); } if(command.control) SetOptions(widget, command.control, command.control, command.GetText()); // setting of some properties (calls like show and hide) generates events which are optimised next // or sets widget attributes which might impact next calls // to avoid races and to ensure the command is executed as expected we process all events that // have been generated: QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); break; case DialogCommand::unset: if(command.GetName()[0]) { if(!(widget=FindWidget(command.GetName()))) break; } else widget=this; if(command.command & DialogCommand::option_enabled & DialogCommand::option_mask) SetEnabled(widget, false); // see http://doc.qt.io/qt-4.8/stylesheet.html for reference if(command.command & DialogCommand::option_stylesheet & DialogCommand::option_mask) { // rarely it was seen this fails (unset stylesheet or set it to empty string) // hopefully this was caused by the race which is now fixed // (queued signaling between threads and optimisation of queued GUI events) widget->setStyleSheet(QString()); if(QWidget* proxywidget=widget->focusProxy()) proxywidget->setStyleSheet(QString()); } if(command.command & DialogCommand::option_visible & DialogCommand::option_mask) { widget->hide(); if(QWidget* proxywidget=widget->focusProxy()) proxywidget->hide(); } if(command.control) SetOptions(widget, 0, command.control, NULL); // setting of some properties (calls like show and hide) generates events which are optimised next // or sets widget attributes which might impact next calls // to avoid races and to ensure the command is executed as expected we process all events that // have been generated: QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); break; case DialogCommand::remove: RemoveWidget(command.GetName()); break; case DialogCommand::position: Position(command.GetText(), command.command & DialogCommand::option_behind & DialogCommand::option_mask, command.command & DialogCommand::option_onto & DialogCommand::option_mask); break; case DialogCommand::query: Report(); break; case DialogCommand::noop: default: ; } // clean up after possible FindWidget call chosen_view=NULL; chosen_row_flag=false; }
//************************************************************************************ bool CCreditsScreen::SetForActivate() //Called before screen is activated and first paint. // //Returns: //True if activation should continue, false if not. { HideCursor(); //Return to title screen when done. g_pTheSM->ClearReturnScreens(); g_pTheSM->InsertReturnScreen(SCR_Title); g_pTheSound->PlaySong(SONGID_CREDITS); //Fix up scrolling text widget state in case screen was activated before. this->pScrollingText->SetBackground(this->images[0]); this->pScrollingText->ClearText(); this->pScrollingText->ScrollAbsolute(0,0); this->pScrollingText->Show(); //For face image display preparation. CFaceWidget *pFaceWidget = new CFaceWidget(0, 0, 0, CX_FACE, CY_FACE); AddWidget(pFaceWidget, true); //Add some text to the scrolling text widget. # define A_TEXT(mid) \ this->pScrollingText->AddText(g_pTheDB->GetMessageText(mid), F_CreditsText);\ this->pScrollingText->AddText(wszCRLF, F_CreditsText) //Add a contributor header. # define A_CONTRIBUTOR_NAMEONLY(midName) \ this->pScrollingText->AddText(g_pTheDB->GetMessageText(midName), F_CreditsHeader, CLabelWidget::TA_CenterGroup) \ # define A_CONTRIBUTOR(midName, midC) \ this->pScrollingText->AddText(g_pTheDB->GetMessageText(midName), F_CreditsHeader, CLabelWidget::TA_CenterGroup); \ this->pScrollingText->AddText(g_pTheDB->GetMessageText(midC), F_CreditsSubheader, CLabelWidget::TA_CenterGroup) \ //Add optional face image below name. # define A_FACEIMAGE(eSpeaker) { \ SDL_Surface *pFaceSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, CX_FACE, CY_FACE, g_pTheBM->BITS_PER_PIXEL, 0, 0, 0, 0); \ pFaceWidget->SetDestSurface(pFaceSurface); \ pFaceWidget->SetCharacter(eSpeaker, false); \ pFaceWidget->Paint(); \ CImageWidget *pImage = new CImageWidget(0, (this->pScrollingText->GetW()-CX_FACE)/2, 0, pFaceSurface); \ this->pScrollingText->Add(pImage); } A_TEXT(MID_CreditsIntro); A_CONTRIBUTOR(MID_ErikH, MID_ErikH_C); A_FACEIMAGE(Speaker_Beethro); A_TEXT(MID_ErikH_Text); A_CONTRIBUTOR(MID_MikeR, MID_MikeR_C); A_FACEIMAGE(Speaker_Halph); A_TEXT(MID_MikeR_Text); A_CONTRIBUTOR(MID_MattS, MID_MattS_C); A_FACEIMAGE(Speaker_Stalwart); A_TEXT(MID_MattS_Text); A_CONTRIBUTOR(MID_JacobG, MID_JacobG_C); A_FACEIMAGE(Speaker_RockGiant); A_TEXT(MID_JacobG_Text); A_CONTRIBUTOR(MID_TerenceF, MID_TerenceF_C); A_FACEIMAGE(Speaker_Brain); A_TEXT(MID_TerenceF_Text); A_CONTRIBUTOR(MID_LarryM_HenriK, MID_LarryM_HenriK_C); A_FACEIMAGE(Speaker_Aumtlich); A_TEXT(MID_LarryM_HenriK_Text); A_CONTRIBUTOR(MID_JonS, MID_JonS_C); A_FACEIMAGE(Speaker_RockGolem); A_TEXT(MID_JonS_Text); A_CONTRIBUTOR(MID_GerryJ, MID_GerryJ_C); A_FACEIMAGE(Speaker_GoblinKing); A_TEXT(MID_GerryJ_Text); A_CONTRIBUTOR(MID_LoganW, MID_LoganW_C); A_FACEIMAGE(Speaker_Gunthro); A_TEXT(MID_LoganW_Text); A_CONTRIBUTOR(MID_EytanZ, MID_EytanZ_C); A_FACEIMAGE(Speaker_TarTechnician); A_TEXT(MID_EytanZ_Text); A_CONTRIBUTOR(MID_NeilF, MID_NeilF_C); A_FACEIMAGE(Speaker_Citizen2); A_TEXT(MID_NeilF_Text); A_CONTRIBUTOR(MID_BrettB, MID_BrettB_C); A_FACEIMAGE(Speaker_Citizen3); A_TEXT(MID_BrettB_Text); A_CONTRIBUTOR(MID_WaiL, MID_WaiL_C); A_FACEIMAGE(Speaker_Citizen1); A_TEXT(MID_WaiL_Text); A_CONTRIBUTOR(MID_JenniferL, MID_JenniferL_C); A_FACEIMAGE(Speaker_Citizen4); A_TEXT(MID_JenniferL_Text); A_CONTRIBUTOR_NAMEONLY(MID_VoiceTalent); A_FACEIMAGE(Speaker_Negotiator); A_TEXT(MID_VoiceTalent_Text); A_CONTRIBUTOR(MID_LevelDescriptionWriters, MID_LevelDescriptionWriters_C); A_FACEIMAGE(Speaker_Citizen); A_TEXT(MID_LevelDescriptionWriters_Text); A_CONTRIBUTOR(MID_Testers, MID_Testers_C); A_FACEIMAGE(Speaker_Slayer2); A_TEXT(MID_Testers_Text); A_TEXT(MID_CreditsLastWords); A_TEXT(MID_CreditsTheEnd); #undef A_TEXT #undef A_CONTRIBUTOR #undef A_FACEIMAGE RemoveWidget(pFaceWidget); ClearEvents(); //don't let an extra keypress during transition cause quick exit return true; }