Esempio n. 1
0
void wxScrollBar::ChangeBackgroundColour()
{
    wxWindow::ChangeBackgroundColour();

    XtVaSetValues ((Widget) GetMainWidget(),
        XmNtroughColor, m_backgroundColour.AllocColour(XtDisplay((Widget) GetMainWidget())),
        NULL);
}
Esempio n. 2
0
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();
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
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);
}
Esempio n. 5
0
// 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;
}
Esempio n. 6
0
bool wxPopupWindow::Show( bool show )
{
    if( !wxWindowBase::Show( show ) )
        return false;

    if( show )
    {
        XtPopup( (Widget)GetMainWidget(), XtGrabNonexclusive );
    }
    else
    {
        XtPopdown( (Widget)GetMainWidget() );
    }

    return true;
}
Esempio n. 7
0
void wxStaticBox::SetLabel( const wxString& label )
{
    wxXmSizeKeeper sk( (Widget)GetMainWidget() );

    wxStaticBoxBase::SetLabel( label );

    sk.Restore();
}
Esempio n. 8
0
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 );
}
Esempio n. 9
0
void wxRadioButton::ChangeBackgroundColour()
{
    wxWindow::ChangeBackgroundColour();

    // What colour should this be?
    int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget));

    XtVaSetValues ((Widget) GetMainWidget(),
          XmNselectColor, selectPixel,
          NULL);
}
Esempio n. 10
0
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;
    }
}
Esempio n. 11
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);
}
Esempio n. 12
0
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;
}
Esempio n. 13
0
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;
    }
}
Esempio n. 14
0
// 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;
}
Esempio n. 15
0
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;
}
Esempio n. 16
0
void wxDialog::ChangeForegroundColour()
{
    if (GetMainWidget())
        wxDoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
}
Esempio n. 17
0
void wxDialog::ChangeBackgroundColour()
{
    if (GetMainWidget())
        wxDoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
}