void wxScrollBar::ChangeBackgroundColour() { wxWindow::ChangeBackgroundColour(); XtVaSetValues ((Widget) GetMainWidget(), XmNtroughColor, m_backgroundColour.AllocColour(XtDisplay((Widget) GetMainWidget())), NULL); }
void wxButton::SetDefaultShadowThicknessAndResize() { Widget buttonWidget = (Widget)GetMainWidget(); bool managed = XtIsManaged( buttonWidget ); if( managed ) XtUnmanageChild( buttonWidget ); XtVaSetValues( buttonWidget, XmNdefaultButtonShadowThickness, 1, NULL ); if( managed ) XtManageChild( buttonWidget ); // this can't currently be done, because user code that calls SetDefault // will break otherwise #if 0 wxSize best = GetBestSize(), actual = GetSize(); if( best.x < actual.x ) best.x = actual.x; if( best.y < actual.y ) best.y = actual.y; if( best != actual ) SetSize( best ); #endif InvalidateBestSize(); }
wxFrame::~wxFrame() { m_isBeingDeleted = true; if (m_clientArea) { XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, False, wxUniversalRepaintProc, (XtPointer) this); } if (GetMainWidget()) Show(false); if (m_frameMenuBar) { m_frameMenuBar->DestroyMenuBar(); // Hack to stop core dump on Ultrix, OSF, for some strange reason. #if MOTIF_MENUBAR_DELETE_FIX GetMenuBar()->SetMainWidget((WXWidget) NULL); #endif delete m_frameMenuBar; m_frameMenuBar = NULL; } if (m_frameStatusBar) { delete m_frameStatusBar; m_frameStatusBar = NULL; } PreDestroy(); DoDestroy(); }
void wxButton::SetDefault() { wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); if ( tlw ) tlw->SetDefaultItem(this); // We initially do not set XmNdefaultShadowThickness, to have // small buttons. Unfortunately, buttons are now mis-aligned. We // try to correct this now -- setting this ressource to 1 for each // button in the same row. Because it's very hard to find // wxButton in the same row, correction is straighforward: we set // resource for all wxButton in this parent (but not sub panels) wxWindow *parent = GetParent(); for (wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst (); node; node = node->GetNext ()) { wxWindow *win = node->GetData (); wxButton *item = wxDynamicCast(win, wxButton); if (item) item->SetDefaultShadowThicknessAndResize(); } XtVaSetValues ((Widget) parent->GetMainWidget(), XmNdefaultButton, (Widget) GetMainWidget(), NULL); }
// Since PopupMenu under Motif stills grab right mouse button events // after it was closed, we need to delete the associated widgets to // allow next PopUpMenu to appear... void wxMenu::DestroyWidgetAndDetach() { if (GetMainWidget()) { wxMenu *menuParent = GetParent(); if ( menuParent ) { wxMenuItemList::compatibility_iterator node = menuParent->GetMenuItems().GetFirst(); while ( node ) { if ( node->GetData()->GetSubMenu() == this ) { delete node->GetData(); menuParent->GetMenuItems().Erase(node); break; } node = node->GetNext(); } } DestroyMenu(true); } // Mark as no longer popped up m_menuId = -1; }
bool wxPopupWindow::Show( bool show ) { if( !wxWindowBase::Show( show ) ) return false; if( show ) { XtPopup( (Widget)GetMainWidget(), XtGrabNonexclusive ); } else { XtPopdown( (Widget)GetMainWidget() ); } return true; }
void wxStaticBox::SetLabel( const wxString& label ) { wxXmSizeKeeper sk( (Widget)GetMainWidget() ); wxStaticBoxBase::SetLabel( label ); sk.Restore(); }
wxFrame::~wxFrame() { m_isBeingDeleted = true; if (m_clientArea) { XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, False, wxUniversalRepaintProc, (XtPointer) this); } if (GetMainWidget()) Show(false); if (m_frameMenuBar) { m_frameMenuBar->DestroyMenuBar(); delete m_frameMenuBar; m_frameMenuBar = NULL; } if (m_frameStatusBar) { delete m_frameStatusBar; m_frameStatusBar = NULL; } PreDestroy(); Widget frameShell = (Widget)GetShellWidget(); if( frameShell ) XtRemoveEventHandler( frameShell, StructureNotifyMask, False, (XtEventHandler)wxFrameMapProc, (XtPointer)this ); if( m_clientArea ) { wxDeleteWindowFromTable( (Widget)m_clientArea ); XtDestroyWidget( (Widget)m_clientArea ); } if( m_workArea ) { XtVaSetValues( (Widget)m_mainWidget, XmNworkWindow, (Widget)NULL, NULL ); wxDeleteWindowFromTable( (Widget)m_workArea ); XtDestroyWidget( (Widget)m_workArea ); } if( m_mainWidget ) XtDestroyWidget( (Widget)m_mainWidget ); if( frameShell ) XtDestroyWidget( frameShell ); }
void wxRadioButton::ChangeBackgroundColour() { wxWindow::ChangeBackgroundColour(); // What colour should this be? int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget)); XtVaSetValues ((Widget) GetMainWidget(), XmNselectColor, selectPixel, NULL); }
wxChoice::~wxChoice() { // For some reason destroying the menuWidget // can cause crashes on some machines. It will // be deleted implicitly by deleting the parent form // anyway. // XtDestroyWidget (menuWidget); if (GetMainWidget()) { DetachWidget(GetMainWidget()); // Removes event handlers DetachWidget(m_formWidget); XtDestroyWidget((Widget) m_formWidget); m_formWidget = (WXWidget) 0; // Presumably the other widgets have been deleted now, via the form m_mainWidget = (WXWidget) 0; m_buttonWidget = (WXWidget) 0; } }
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) { wxCHECK_MSG( pos <= GetMenuCount(), false, wxT("invalid position") ); wxCHECK_MSG( menu, false, wxT("invalid menu") ); wxCHECK_MSG( !menu->GetParent() && !menu->GetButtonWidget(), false, wxT("menu already appended") ); if ( m_menuBarFrame ) { WXWidget w = menu->CreateMenu(this, GetMainWidget(), menu, pos, title, true); wxCHECK_MSG( w, false, wxT("failed to create menu") ); menu->SetButtonWidget(w); } m_titles.Insert(title, pos); return wxMenuBarBase::Insert(pos, menu, title); }
NS_IMETHODIMP nsGTKRemoteService::RegisterWindow(mozIDOMWindow* aWindow) { nsIWidget* mainWidget = GetMainWidget(nsPIDOMWindowInner::From(aWindow)); NS_ENSURE_TRUE(mainWidget, NS_ERROR_FAILURE); GtkWidget* widget = (GtkWidget*) mainWidget->GetNativeData(NS_NATIVE_SHELLWIDGET); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aWindow); NS_ENSURE_TRUE(weak, NS_ERROR_FAILURE); mWindows.Put(widget, weak); // If Startup() has already been called, immediately register this window. if (mServerWindow) { HandleCommandsFor(widget, weak); } return NS_OK; }
void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const { Dimension shadow, border; XtVaGetValues( (Widget) GetMainWidget(), XmNshadowThickness, &shadow, XmNborderWidth, &border, NULL); *borderOther = shadow + border; if( GetLabelWidget() ) { XtWidgetGeometry preferred; XtQueryGeometry( (Widget) GetLabelWidget(), NULL, &preferred ); *borderTop = preferred.height; } else { *borderTop = shadow; } }
// Since PopupMenu under Motif stills grab right mouse button events // after it was closed, we need to delete the associated widgets to // allow next PopUpMenu to appear... void wxMenu::DestroyWidgetAndDetach() { if (GetMainWidget()) { wxMenu *menuParent = GetParent(); if ( menuParent ) { wxMenuItemList::compatibility_iterator node = menuParent->GetMenuItems().GetFirst(); #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ while ( node ) { if ( node->GetData()->GetSubMenu() == this ) { delete node->GetData(); menuParent->GetMenuItems().Erase(node); break; } node = node->GetNext(); } } DestroyMenu(true); } // Mark as no longer popped up m_menuId = -1; }
NS_IMETHODIMP nsGTKRemoteService::RegisterWindow(nsIDOMWindow* aWindow) { nsIWidget* mainWidget = GetMainWidget(aWindow); NS_ENSURE_TRUE(mainWidget, NS_ERROR_FAILURE); // walk up the widget tree and find the toplevel window in the // hierarchy nsIWidget* tempWidget = mainWidget->GetParent(); while (tempWidget) { tempWidget = tempWidget->GetParent(); if (tempWidget) mainWidget = tempWidget; } GtkWidget* widget = (GtkWidget*) mainWidget->GetNativeData(NS_NATIVE_SHELLWIDGET); NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(aWindow); NS_ENSURE_TRUE(weak, NS_ERROR_FAILURE); if (!mWindows.IsInitialized()) mWindows.Init(); mWindows.Put(widget, weak); // If Startup() has already been called, immediately register this window. if (mServerWindow) { HandleCommandsFor(widget, weak); } return NS_OK; }
void wxDialog::ChangeForegroundColour() { if (GetMainWidget()) wxDoChangeForegroundColour(GetMainWidget(), m_foregroundColour); }
void wxDialog::ChangeBackgroundColour() { if (GetMainWidget()) wxDoChangeBackgroundColour(GetMainWidget(), m_backgroundColour); }