]> git.saurik.com Git - wxWidgets.git/commitdiff
Removed menu.cpp and toolbar.cpp from X11.
authorRobert Roebling <robert@roebling.de>
Sun, 10 Feb 2002 10:53:07 +0000 (10:53 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 10 Feb 2002 10:53:07 +0000 (10:53 +0000)
  Compile fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/x11/app.cpp
src/x11/cursor.cpp
src/x11/evtloop.cpp
src/x11/menu.cpp [deleted file]
src/x11/toolbar.cpp [deleted file]

index b85b9855d615522f63b8080ce84db41facc2a5f6..30778b2cf231f8166c22e8d8239018e5a48294cc 100644 (file)
@@ -60,6 +60,8 @@ wxApp *wxTheApp = NULL;
 
 wxHashTable *wxWidgetHashTable = NULL;
 
+static Window wxGetParentWindow(Window window);
+
 IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 
 BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
@@ -650,7 +652,7 @@ WXColormap wxApp::GetMainColormap(WXDisplay* display)
     return (WXColormap) c;
 }
 
-Window wxGetWindowParent(Window window)
+Window wxGetParentWindow(Window window)
 {
     Window parent, root = 0;
     unsigned int noChildren = 0;
index cfb233207075f9ee74be960b67f3fa68bb7581bc..10f452ceb64e2ac164c4cfc8a902edd003caa7d4 100644 (file)
 #ifdef __VMS__
 #pragma message disable nosimpint
 #endif
-#include <X11/cursorfont.h>
-#include <X11/Xutil.h>
 #ifdef __VMS__
 #pragma message enable nosimpint
 #endif
 
 #include "wx/x11/private.h"
+#include <X11/cursorfont.h>
+#include <X11/Xutil.h>
 
 IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
 IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject)
index a6bdaeb2f78629b773eb61a342e4daef631ee73f..dd8a8f030ec59560324516b39206a510bc5a1259 100644 (file)
@@ -163,7 +163,9 @@ int wxEventLoop::Run()
         // anything else to do
         while ( ! Pending() )
         {
+#if wxUSE_TIMER
             wxTimer::NotifyTimers(); // TODO: is this the correct place for it?
+#endif
             if (!m_impl->SendIdleEvent())
             {
 #if 0 // wxUSE_THREADS
diff --git a/src/x11/menu.cpp b/src/x11/menu.cpp
deleted file mode 100644 (file)
index 84410f4..0000000
+++ /dev/null
@@ -1,767 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        menu.cpp
-// Purpose:     wxMenu, wxMenuBar, wxMenuItem
-// Author:      Julian Smart
-// Modified by:
-// Created:     17/09/98
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-#ifdef __GNUG__
-    #pragma implementation "menu.h"
-#endif
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-#include "wx/defs.h"
-
-#include "wx/menu.h"
-#include "wx/menuitem.h"
-#include "wx/log.h"
-#include "wx/utils.h"
-#include "wx/app.h"
-#include "wx/frame.h"
-#include "wx/settings.h"
-
-#ifdef __VMS__
-#pragma message disable nosimpint
-#define XtDisplay XTDISPLAY
-#define XtWindow XTWINDOW
-#endif
-#include <Xm/Label.h>
-#include <Xm/LabelG.h>
-#include <Xm/CascadeBG.h>
-#include <Xm/CascadeB.h>
-#include <Xm/SeparatoG.h>
-#include <Xm/PushBG.h>
-#include <Xm/ToggleB.h>
-#include <Xm/ToggleBG.h>
-#include <Xm/RowColumn.h>
-#ifdef __VMS__
-#pragma message enable nosimpint
-#endif
-
-#include "wx/motif/private.h"
-
-// other standard headers
-#include <string.h>
-
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// Menus
-// ----------------------------------------------------------------------------
-
-// Construct a menu with optional title (then use append)
-void wxMenu::Init()
-{
-    // Motif-specific members
-    m_numColumns = 1;
-    m_menuWidget = (WXWidget) NULL;
-    m_popupShell = (WXWidget) NULL;
-    m_buttonWidget = (WXWidget) NULL;
-    m_menuId = 0;
-    m_topLevelMenu  = (wxMenu*) NULL;
-    m_ownedByMenuBar = FALSE;
-
-    if ( !!m_title )
-    {
-        Append(wxID_SEPARATOR, m_title) ;
-        AppendSeparator() ;
-    }
-
-    m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENU);
-    m_foregroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT);
-    m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
-}
-
-// The wxWindow destructor will take care of deleting the submenus.
-wxMenu::~wxMenu()
-{
-    if (m_menuWidget)
-    {
-        if (m_menuParent)
-            DestroyMenu(TRUE);
-        else
-            DestroyMenu(FALSE);
-    }
-
-    // Not sure if this is right
-    if (m_menuParent && m_menuBar)
-    {
-        m_menuParent = NULL;
-        //      m_menuBar = NULL;
-    }
-}
-
-void wxMenu::Break()
-{
-    m_numColumns++;
-}
-
-// function appends a new item or submenu to the menu
-bool wxMenu::DoAppend(wxMenuItem *pItem)
-{
-    if (m_menuWidget)
-    {
-        // this is a dynamic Append
-        pItem->CreateItem(m_menuWidget, m_menuBar, m_topLevelMenu);
-    }
-
-    if ( pItem->IsSubMenu() )
-    {
-        pItem->GetSubMenu()->m_topLevelMenu = m_topLevelMenu;
-    }
-
-    return wxMenuBase::DoAppend(pItem);
-}
-
-wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
-{
-    item->DestroyItem(TRUE);
-
-    return wxMenuBase::DoRemove(item);
-}
-
-bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
-{
-    if ( !wxMenuBase::DoInsert(pos, item) )
-        return FALSE;
-
-    wxFAIL_MSG(wxT("not implemented"));
-
-    return FALSE;
-}
-
-void wxMenu::SetTitle(const wxString& label)
-{
-    m_title = label;
-
-    wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-    if ( !node )
-        return;
-
-    wxMenuItem *item = node->GetData ();
-    Widget widget = (Widget) item->GetButtonWidget();
-    if ( !widget )
-        return;
-
-    wxXmString title_str(label);
-    XtVaSetValues(widget,
-                  XmNlabelString, title_str(),
-                  NULL);
-}
-
-bool wxMenu::ProcessCommand(wxCommandEvent & event)
-{
-    bool processed = FALSE;
-
-#if wxUSE_MENU_CALLBACK
-    // Try a callback
-    if (m_callback)
-    {
-        (void) (*(m_callback)) (*this, event);
-        processed = TRUE;
-    }
-#endif // wxUSE_MENU_CALLBACK
-
-    // Try the menu's event handler
-    if ( !processed && GetEventHandler())
-    {
-        processed = GetEventHandler()->ProcessEvent(event);
-    }
-    // Try the window the menu was popped up from (and up
-    // through the hierarchy)
-    if ( !processed && GetInvokingWindow())
-        processed = GetInvokingWindow()->ProcessEvent(event);
-
-    return processed;
-}
-
-// ----------------------------------------------------------------------------
-// Menu Bar
-// ----------------------------------------------------------------------------
-
-void wxMenuBar::Init()
-{
-    m_eventHandler = this;
-    m_menuBarFrame = NULL;
-    m_mainWidget = (WXWidget) NULL;
-    m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENU);
-    m_foregroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUTEXT);
-    m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
-}
-
-wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
-{
-    Init();
-
-    for ( int i = 0; i < n; i++ )
-    {
-        m_menus.Append(menus[i]);
-        m_titles.Add(titles[i]);
-    }
-}
-
-wxMenuBar::~wxMenuBar()
-{
-    // nothing to do: wxMenuBarBase will delete the menus
-}
-
-void wxMenuBar::EnableTop(size_t WXUNUSED(pos), bool WXUNUSED(flag))
-{
-  //    wxFAIL_MSG("TODO");
-//  wxLogWarning("wxMenuBar::EnableTop not yet implemented.");
-}
-
-void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
-{
-    wxMenu *menu = GetMenu(pos);
-    if ( !menu )
-        return;
-
-    Widget w = (Widget)menu->GetButtonWidget();
-    if (w)
-    {
-        wxXmString label_str(label);
-
-        XtVaSetValues(w,
-                      XmNlabelString, label_str(),
-                      NULL);
-    }
-}
-
-wxString wxMenuBar::GetLabelTop(size_t pos) const
-{
-    wxString str;
-
-    wxMenu *menu = GetMenu(pos);
-    if ( menu )
-    {
-        Widget w = (Widget)menu->GetButtonWidget();
-        if (w)
-        {
-            XmString text;
-            XtVaGetValues(w,
-                          XmNlabelString, &text,
-                          NULL);
-
-            char *s;
-            if ( XmStringGetLtoR(text, XmSTRING_DEFAULT_CHARSET, &s) )
-            {
-                str = s;
-
-                XtFree(s);
-            }
-        }
-    }
-
-    return str;
-}
-
-bool wxMenuBar::Append(wxMenu * menu, const wxString& title)
-{
-    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, title, TRUE);
-        wxCHECK_MSG( w, FALSE, wxT("failed to create menu") );
-        menu->SetButtonWidget(w);
-    }
-
-    //menu->SetMenuBar(this);
-
-    m_titles.Add(title);
-
-    return wxMenuBarBase::Append(menu, title);
-}
-
-bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
-{
-    if ( !wxMenuBarBase::Insert(pos, menu, title) )
-        return FALSE;
-
-    wxFAIL_MSG(wxT("TODO"));
-
-    return FALSE;
-}
-
-wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
-{
-    if ( !wxMenuBarBase::Replace(pos, menu, title) )
-        return FALSE;
-
-    wxFAIL_MSG(wxT("TODO"));
-
-    return NULL;
-}
-
-wxMenu *wxMenuBar::Remove(size_t pos)
-{
-    wxMenu *menu = wxMenuBarBase::Remove(pos);
-    if ( !menu )
-        return NULL;
-
-    if ( m_menuBarFrame )
-        menu->DestroyMenu(TRUE);
-
-    menu->SetMenuBar(NULL);
-
-    m_titles.Remove(pos);
-
-    return menu;
-}
-
-// Find the menu menuString, item itemString, and return the item id.
-// Returns -1 if none found.
-int wxMenuBar::FindMenuItem (const wxString& menuString, const wxString& itemString) const
-{
-    char buf1[200];
-    char buf2[200];
-    wxStripMenuCodes ((char *)(const char *)menuString, buf1);
-
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-    {
-        wxStripMenuCodes ((char *)(const char *)m_titles[i], buf2);
-        if (strcmp (buf1, buf2) == 0)
-            return m_menus[i]->FindItem (itemString);
-    }
-    return -1;
-}
-
-wxMenuItem *wxMenuBar::FindItem(int id, wxMenu ** itemMenu) const
-{
-    if (itemMenu)
-        *itemMenu = NULL;
-
-    wxMenuItem *item = NULL;
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-        if ((item = m_menus[i]->FindItem(id, itemMenu)))
-            return item;
-        return NULL;
-}
-
-// Create menubar
-bool wxMenuBar::CreateMenuBar(wxFrame* parent)
-{
-    if (m_mainWidget)
-    {
-        XtVaSetValues((Widget) parent->GetMainWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL);
-        /*
-        if (!XtIsManaged((Widget) m_mainWidget))
-        XtManageChild((Widget) m_mainWidget);
-        */
-        XtMapWidget((Widget) m_mainWidget);
-        return TRUE;
-    }
-
-    Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWidget(), "MenuBar", NULL, 0);
-    m_mainWidget = (WXWidget) menuBarW;
-
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-    {
-        wxMenu *menu = GetMenu(i);
-        wxString title(m_titles[i]);
-        menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, title, TRUE));
-
-        if (strcmp (wxStripMenuCodes(title), "Help") == 0)
-            XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
-
-        // tear off menu support
-#if (XmVersion >= 1002)
-        if ( menu->IsTearOff() )
-        {
-            XtVaSetValues(GetWidget(menu),
-                          XmNtearOffModel, XmTEAR_OFF_ENABLED,
-                          NULL);
-            Widget tearOff = XmGetTearOffControl(GetWidget(menu));
-            wxDoChangeForegroundColour((Widget) tearOff, m_foregroundColour);
-            wxDoChangeBackgroundColour((Widget) tearOff, m_backgroundColour, TRUE);
-#endif
-        }
-    }
-
-    SetBackgroundColour(m_backgroundColour);
-    SetForegroundColour(m_foregroundColour);
-    SetFont(m_font);
-
-    XtVaSetValues((Widget) parent->GetMainWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL);
-    XtRealizeWidget ((Widget) menuBarW);
-    XtManageChild ((Widget) menuBarW);
-    SetMenuBarFrame(parent);
-
-    return TRUE;
-}
-
-// Destroy menubar, but keep data structures intact so we can recreate it.
-bool wxMenuBar::DestroyMenuBar()
-{
-    if (!m_mainWidget)
-    {
-        SetMenuBarFrame((wxFrame*) NULL);
-        return FALSE;
-    }
-
-    XtUnmanageChild ((Widget) m_mainWidget);
-    XtUnrealizeWidget ((Widget) m_mainWidget);
-
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-    {
-        wxMenu *menu = GetMenu(i);
-        menu->DestroyMenu(TRUE);
-
-    }
-    XtDestroyWidget((Widget) m_mainWidget);
-    m_mainWidget = (WXWidget) 0;
-
-    SetMenuBarFrame((wxFrame*) NULL);
-
-    return TRUE;
-}
-
-//// Motif-specific
-static XtWorkProcId WorkProcMenuId;
-
-/* 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...
-*/
-
-int PostDeletionOfMenu( XtPointer* clientData )
-{
-    XtRemoveWorkProc(WorkProcMenuId);
-    wxMenu *menu = (wxMenu *)clientData;
-
-    if (menu->GetMainWidget())
-    {
-        wxMenu *menuParent = menu->GetParent();
-        if ( menuParent )
-        {
-            wxMenuItemList::Node *node = menuParent->GetMenuItems().GetFirst();
-            while ( node )
-            {
-                if ( node->GetData()->GetSubMenu() == menu )
-                {
-                    menuParent->GetMenuItems().DeleteNode(node);
-
-                    break;
-                }
-
-                node = node->GetNext();
-            }
-        }
-
-        menu->DestroyMenu(TRUE);
-    }
-
-    // Mark as no longer popped up
-    menu->m_menuId = -1;
-
-    return TRUE;
-}
-
-void
-wxMenuPopdownCallback(Widget WXUNUSED(w), XtPointer clientData,
-                      XtPointer WXUNUSED(ptr))
-{
-    wxMenu *menu = (wxMenu *)clientData;
-
-    // Added by JOREL Jean-Charles <jjorel@silr.ireste.fr>
-    /* Since Callbacks of MenuItems are not yet processed, we put a
-    * background job which will be done when system will be idle.
-    * What awful hack!! :(
-    */
-
-    WorkProcMenuId = XtAppAddWorkProc(
-        (XtAppContext) wxTheApp->GetAppContext(),
-        (XtWorkProc) PostDeletionOfMenu,
-        (XtPointer) menu );
-    // Apparently not found in Motif headers
-    //  XtVaSetValues( w, XmNpopupEnabled, XmPOPUP_DISABLED, NULL );
-}
-
-/*
-* Create a popup or pulldown menu.
-* Submenus of a popup will be pulldown.
-*
-*/
-
-WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topMenu, const wxString& title, bool pullDown)
-{
-    Widget menu = (Widget) 0;
-    Widget buttonWidget = (Widget) 0;
-    Arg args[5];
-    XtSetArg (args[0], XmNnumColumns, m_numColumns);
-    XtSetArg (args[1], XmNpacking, XmPACK_COLUMN);
-
-    if (!pullDown)
-    {
-        menu = XmCreatePopupMenu ((Widget) parent, "popup", args, 2);
-        XtAddCallback(menu,
-            XmNunmapCallback,
-            (XtCallbackProc)wxMenuPopdownCallback,
-            (XtPointer)this);
-    }
-    else
-    {
-        char mnem = wxFindMnemonic (title);
-        wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
-
-        menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2);
-
-        wxString title2(wxStripMenuCodes(title));
-        wxXmString label_str(title2);
-        buttonWidget = XtVaCreateManagedWidget(title2,
-#if wxUSE_GADGETS
-            xmCascadeButtonGadgetClass, (Widget) parent,
-#else
-            xmCascadeButtonWidgetClass, (Widget) parent,
-#endif
-            XmNlabelString, label_str(),
-            XmNsubMenuId, menu,
-            NULL);
-
-        if (mnem != 0)
-            XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
-    }
-
-    m_menuWidget = (WXWidget) menu;
-
-    m_menuBar = menuBar;
-    m_topLevelMenu = topMenu;
-
-    for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxMenuItem *item = node->GetData();
-
-        item->CreateItem(menu, menuBar, topMenu);
-    }
-
-    SetBackgroundColour(m_backgroundColour);
-    SetForegroundColour(m_foregroundColour);
-    SetFont(m_font);
-
-    return buttonWidget;
-}
-
-// Destroys the Motif implementation of the menu,
-// but maintains the wxWindows data structures so we can
-// do a CreateMenu again.
-void wxMenu::DestroyMenu (bool full)
-{
-    for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxMenuItem *item = node->GetData();
-        item->SetMenuBar((wxMenuBar*) NULL);
-
-        item->DestroyItem(full);
-    }
-
-    if (m_buttonWidget)
-    {
-        if (full)
-        {
-            XtVaSetValues((Widget) m_buttonWidget, XmNsubMenuId, NULL, NULL);
-            XtDestroyWidget ((Widget) m_buttonWidget);
-            m_buttonWidget = (WXWidget) 0;
-        }
-    }
-    if (m_menuWidget && full)
-    {
-        XtDestroyWidget((Widget) m_menuWidget);
-        m_menuWidget = (WXWidget) NULL;
-    }
-}
-
-WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
-{
-    if (id == m_menuId)
-    {
-        if (it)
-            *it = (wxMenuItem*) NULL;
-        return m_buttonWidget;
-    }
-
-    for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxMenuItem *item = node->GetData ();
-        if (item->GetId() == id)
-        {
-            if (it)
-                *it = item;
-            return item->GetButtonWidget();
-        }
-
-        if (item->GetSubMenu())
-        {
-            WXWidget w = item->GetSubMenu()->FindMenuItem (id, it);
-            if (w)
-            {
-                return w;
-            }
-        }
-    }
-
-    if (it)
-        *it = (wxMenuItem*) NULL;
-    return (WXWidget) NULL;
-}
-
-void wxMenu::SetBackgroundColour(const wxColour& col)
-{
-    m_backgroundColour = col;
-    if (m_menuWidget)
-        wxDoChangeBackgroundColour(m_menuWidget, (wxColour&) col);
-    if (m_buttonWidget)
-        wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE);
-
-    for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxMenuItem* item = node->GetData();
-        if (item->GetButtonWidget())
-        {
-            // This crashes because it uses gadgets
-            //            wxDoChangeBackgroundColour(item->GetButtonWidget(), (wxColour&) col, TRUE);
-        }
-        if (item->GetSubMenu())
-            item->GetSubMenu()->SetBackgroundColour((wxColour&) col);
-    }
-}
-
-void wxMenu::SetForegroundColour(const wxColour& col)
-{
-    m_foregroundColour = col;
-    if (m_menuWidget)
-        wxDoChangeForegroundColour(m_menuWidget, (wxColour&) col);
-    if (m_buttonWidget)
-        wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
-
-    for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxMenuItem* item = node->GetData();
-        if (item->GetButtonWidget())
-        {
-            // This crashes because it uses gadgets
-            //            wxDoChangeForegroundColour(item->GetButtonWidget(), (wxColour&) col);
-        }
-        if (item->GetSubMenu())
-            item->GetSubMenu()->SetForegroundColour((wxColour&) col);
-    }
-}
-
-void wxMenu::ChangeFont(bool keepOriginalSize)
-{
-    // lesstif 0.87 hangs when setting XmNfontList
-#ifndef LESSTIF_VERSION
-    if (!m_font.Ok() || !m_menuWidget)
-        return;
-
-    XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_menuWidget));
-
-    XtVaSetValues ((Widget) m_menuWidget,
-        XmNfontList, fontList,
-        NULL);
-    if (m_buttonWidget)
-    {
-        XtVaSetValues ((Widget) m_buttonWidget,
-            XmNfontList, fontList,
-            NULL);
-    }
-
-    for ( wxMenuItemList::Node *node = GetMenuItems().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxMenuItem* item = node->GetData();
-        if (m_menuWidget && item->GetButtonWidget() && m_font.Ok())
-        {
-            XtVaSetValues ((Widget) item->GetButtonWidget(),
-                XmNfontList, fontList,
-                NULL);
-        }
-        if (item->GetSubMenu())
-            item->GetSubMenu()->ChangeFont(keepOriginalSize);
-    }
-#endif
-}
-
-void wxMenu::SetFont(const wxFont& font)
-{
-    m_font = font;
-    ChangeFont();
-}
-
-bool wxMenuBar::SetBackgroundColour(const wxColour& col)
-{
-    m_backgroundColour = col;
-    if (m_mainWidget)
-        wxDoChangeBackgroundColour(m_mainWidget, (wxColour&) col);
-
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-        m_menus[i]->SetBackgroundColour((wxColour&) col);
-
-    return TRUE;
-}
-
-bool wxMenuBar::SetForegroundColour(const wxColour& col)
-{
-    m_foregroundColour = col;
-    if (m_mainWidget)
-        wxDoChangeForegroundColour(m_mainWidget, (wxColour&) col);
-
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-        m_menus[i]->SetForegroundColour((wxColour&) col);
-
-    return TRUE;
-}
-
-void wxMenuBar::ChangeFont(bool WXUNUSED(keepOriginalSize))
-{
-    // Nothing to do for menubar, fonts are kept in wxMenus
-}
-
-bool wxMenuBar::SetFont(const wxFont& font)
-{
-    m_font = font;
-    ChangeFont();
-
-    size_t menuCount = GetMenuCount();
-    for (size_t i = 0; i < menuCount; i++)
-        m_menus[i]->SetFont(font);
-
-    return TRUE;
-}
-
diff --git a/src/x11/toolbar.cpp b/src/x11/toolbar.cpp
deleted file mode 100644 (file)
index c9b5a7f..0000000
+++ /dev/null
@@ -1,664 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        x11/toolbar.cpp
-// Purpose:     wxToolBar
-// Author:      Julian Smart
-// Modified by: 13.12.99 by VZ during toolbar classes reorganization
-// Created:     04/01/98
-// RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-#ifdef __GNUG__
-    #pragma implementation "toolbar.h"
-#endif
-
-#ifdef __VMS
-#define XtDisplay XTDISPLAY
-#endif
-
-#include "wx/wx.h"
-#include "wx/app.h"
-#include "wx/timer.h"
-#include "wx/toolbar.h"
-
-#ifdef __VMS__
-#pragma message disable nosimpint
-#endif
-#ifdef __VMS__
-#pragma message enable nosimpint
-#endif
-
-
-
-#include "wx/x11/private.h"
-
-// ----------------------------------------------------------------------------
-// wxWin macros
-// ----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
-
-// TODO: a decent generic toolbar implementation that
-// we can put in src/generic
-#if 0
-
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
-
-static void wxToolButtonCallback (Widget w, XtPointer clientData,
-                    XtPointer ptr);
-static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
-                     XEvent *event, Boolean *continue_to_dispatch);
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-class wxToolBarTimer : public wxTimer
-{
-public:
-    virtual void Notify();
-
-    static Widget help_popup;
-    static Widget buttonWidget;
-    static wxString helpString;
-};
-
-class wxToolBarTool : public wxToolBarToolBase
-{
-public:
-    wxToolBarTool(wxToolBar *tbar,
-                  int id,
-                  const wxBitmap& bitmap1,
-                  const wxBitmap& bitmap2,
-                  bool toggle,
-                  wxObject *clientData,
-                  const wxString& shortHelpString,
-                  const wxString& longHelpString)
-        : wxToolBarToolBase(tbar, id, bitmap1, bitmap2, toggle,
-                            clientData, shortHelpString, longHelpString)
-    {
-        Init();
-    }
-
-    wxToolBarTool(wxToolBar *tbar, wxControl *control)
-        : wxToolBarToolBase(tbar, control)
-    {
-        Init();
-    }
-
-    virtual ~wxToolBarTool();
-
-    // accessors
-    void SetWidget(Widget widget) { m_widget = widget; }
-    Widget GetButtonWidget() const { return m_widget; }
-
-    void SetPixmap(Pixmap pixmap) { m_pixmap = pixmap; }
-    Pixmap GetPixmap() const { return m_pixmap; }
-
-protected:
-    void Init();
-
-    Widget m_widget;
-    Pixmap m_pixmap;
-};
-
-// ----------------------------------------------------------------------------
-// globals
-// ----------------------------------------------------------------------------
-
-static wxToolBarTimer* wxTheToolBarTimer = (wxToolBarTimer*) NULL;
-
-Widget wxToolBarTimer::help_popup = (Widget) 0;
-Widget wxToolBarTimer::buttonWidget = (Widget) 0;
-wxString wxToolBarTimer::helpString;
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// wxToolBarTool
-// ----------------------------------------------------------------------------
-
-wxToolBarToolBase *wxToolBar::CreateTool(int id,
-                                         const wxBitmap& bitmap1,
-                                         const wxBitmap& bitmap2,
-                                         bool toggle,
-                                         wxObject *clientData,
-                                         const wxString& shortHelpString,
-                                         const wxString& longHelpString)
-{
-    return new wxToolBarTool(this, id, bitmap1, bitmap2, toggle,
-                             clientData, shortHelpString, longHelpString);
-}
-
-wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
-{
-    return new wxToolBarTool(this, control);
-}
-
-void wxToolBarTool::Init()
-{
-    m_widget = (Widget)0;
-    m_pixmap = (Pixmap)0;
-}
-
-wxToolBarTool::~wxToolBarTool()
-{
-    if ( m_widget )
-        XtDestroyWidget(m_widget);
-    if ( m_pixmap )
-        XmDestroyPixmap(DefaultScreenOfDisplay((Display*)wxGetDisplay()),
-                        m_pixmap);
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar construction
-// ----------------------------------------------------------------------------
-
-void wxToolBar::Init()
-{
-    m_maxWidth = -1;
-    m_maxHeight = -1;
-    m_defaultWidth = 24;
-    m_defaultHeight = 22;
-    m_toolPacking = 2;
-    m_toolSeparation = 8;
-    m_xMargin = 2;
-    m_yMargin = 2;
-    m_maxRows = 100;
-    m_maxCols = 100;
-}
-
-bool wxToolBar::Create(wxWindow *parent,
-                       wxWindowID id,
-                       const wxPoint& pos,
-                       const wxSize& size,
-                       long style,
-                       const wxString& name)
-{
-    Init();
-
-    m_windowId = id;
-
-    SetName(name);
-    m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
-    m_foregroundColour = parent->GetForegroundColour();
-    m_windowStyle = style;
-
-    SetParent(parent);
-
-    if (parent) parent->AddChild(this);
-
-    Widget parentWidget = (Widget) parent->GetClientWidget();
-
-    Widget toolbar = XtVaCreateManagedWidget("toolbar",
-                    xmBulletinBoardWidgetClass, (Widget) parentWidget,
-                    XmNmarginWidth, 0,
-                    XmNmarginHeight, 0,
-                    XmNresizePolicy, XmRESIZE_NONE,
-                    NULL);
-/*
-    Widget toolbar = XtVaCreateManagedWidget("toolbar",
-                xmFormWidgetClass, (Widget) m_clientWidget,
-                XmNtraversalOn, False,
-                XmNhorizontalSpacing, 0,
-                XmNverticalSpacing, 0,
-                XmNleftOffset, 0,
-                XmNrightOffset, 0,
-                XmNmarginWidth, 0,
-                XmNmarginHeight, 0,
-                NULL);
-*/
-
-    m_mainWidget = (WXWidget) toolbar;
-
-    m_font = parent->GetFont();
-    ChangeFont(FALSE);
-
-    SetCanAddEventHandler(TRUE);
-    AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
-
-    ChangeBackgroundColour();
-
-    return TRUE;
-}
-
-wxToolBar::~wxToolBar()
-{
-    delete wxTheToolBarTimer;
-    wxTheToolBarTimer = NULL;
-}
-
-bool wxToolBar::Realize()
-{
-    if ( m_tools.GetCount() == 0 )
-    {
-        // nothing to do
-        return TRUE;
-    }
-
-    // Separator spacing
-    const int separatorSize = GetToolSeparation(); // 8;
-    wxSize margins = GetToolMargins();
-    int packing = GetToolPacking();
-    int marginX = margins.x;
-    int marginY = margins.y;
-
-    int currentX = marginX;
-    int currentY = marginY;
-
-    int buttonHeight = 0;
-
-    int currentSpacing = 0;
-
-    Widget button;
-    Pixmap pixmap, insensPixmap;
-    wxBitmap bmp;
-
-    wxToolBarToolsList::Node *node = m_tools.GetFirst();
-    while ( node )
-    {
-        wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-
-        switch ( tool->GetStyle() )
-        {
-            case wxTOOL_STYLE_CONTROL:
-            {
-                wxControl* control = tool->GetControl();
-                wxSize sz = control->GetSize();
-                wxPoint pos = control->GetPosition();
-                control->Move(currentX, pos.y);
-                currentX += sz.x + packing;
-
-                break;
-            }
-            case wxTOOL_STYLE_SEPARATOR:
-                currentX += separatorSize;
-                break;
-
-            case wxTOOL_STYLE_BUTTON:
-                button = (Widget) 0;
-
-                if ( tool->CanBeToggled() )
-                {
-                    button = XtVaCreateWidget("toggleButton",
-                            xmToggleButtonWidgetClass, (Widget) m_mainWidget,
-                            XmNx, currentX, XmNy, currentY,
-                            XmNindicatorOn, False,
-                            XmNshadowThickness, 2,
-                            XmNborderWidth, 0,
-                            XmNspacing, 0,
-                            XmNmarginWidth, 0,
-                            XmNmarginHeight, 0,
-                            XmNmultiClick, XmMULTICLICK_KEEP,
-                            XmNlabelType, XmPIXMAP,
-                            NULL);
-                    XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
-                            (XtPointer) this);
-
-                    XtVaSetValues ((Widget) button,
-                            XmNselectColor, m_backgroundColour.AllocColour(XtDisplay((Widget) button)),
-                            NULL);
-                }
-                else
-                {
-                    button = XtVaCreateWidget("button",
-                            xmPushButtonWidgetClass, (Widget) m_mainWidget,
-                            XmNx, currentX, XmNy, currentY,
-                            XmNpushButtonEnabled, True,
-                            XmNmultiClick, XmMULTICLICK_KEEP,
-                            XmNlabelType, XmPIXMAP,
-                            NULL);
-                    XtAddCallback (button,
-                            XmNactivateCallback, (XtCallbackProc) wxToolButtonCallback,
-                            (XtPointer) this);
-                }
-
-                DoChangeBackgroundColour((WXWidget) button, m_backgroundColour, TRUE);
-
-                tool->SetWidget(button);
-
-                // For each button, if there is a mask, we must create
-                // a new wxBitmap that has the correct background colour
-                // for the button. Otherwise the background will just be
-                // e.g. black if a transparent XPM has been loaded.
-                bmp = tool->GetBitmap1();
-                if ( bmp.GetMask() )
-                {
-                    int backgroundPixel;
-                    XtVaGetValues(button, XmNbackground, &backgroundPixel,
-                            NULL);
-
-                    wxColour col;
-                    col.SetPixel(backgroundPixel);
-
-                    bmp = wxCreateMaskedBitmap(bmp, col);
-
-                    tool->SetBitmap1(bmp);
-                }
-
-                // Create a selected/toggled bitmap. If there isn't a 2nd
-                // bitmap, we need to create it (with a darker, selected
-                // background)
-                int backgroundPixel;
-                if ( tool->CanBeToggled() )
-                    XtVaGetValues(button, XmNselectColor, &backgroundPixel,
-                            NULL);
-                else
-                    XtVaGetValues(button, XmNarmColor, &backgroundPixel,
-                            NULL);
-
-                wxColour col;
-                col.SetPixel(backgroundPixel);
-
-                if (tool->GetBitmap2().Ok() && tool->GetBitmap2().GetMask())
-                {
-                    // Use what's there
-                    wxBitmap newBitmap = wxCreateMaskedBitmap(tool->GetBitmap2(), col);
-                    tool->SetBitmap2(newBitmap);
-                }
-                else
-                {
-                    // Use unselected bitmap
-                    if ( bmp.GetMask() )
-                    {
-                        wxBitmap newBitmap = wxCreateMaskedBitmap(bmp, col);
-                        tool->SetBitmap2(newBitmap);
-                    }
-                    else
-                        tool->SetBitmap2(bmp);
-                }
-
-                pixmap = (Pixmap) bmp.GetPixmap();
-                insensPixmap = (Pixmap) bmp.GetInsensPixmap();
-
-                if (tool->CanBeToggled())
-                {
-                    // Toggle button
-                    Pixmap pixmap2 = (Pixmap) 0;
-                    Pixmap insensPixmap2 = (Pixmap) 0;
-
-                    // If there's a bitmap for the toggled state, use it,
-                    // otherwise generate one.
-                    if (tool->GetBitmap2().Ok())
-                    {
-                        wxBitmap bmp2 = tool->GetBitmap2();
-                        pixmap2 = (Pixmap) bmp2.GetPixmap();
-                        insensPixmap2 = (Pixmap) bmp2.GetInsensPixmap();
-                    }
-                    else
-                    {
-                        pixmap2 = (Pixmap) bmp.GetArmPixmap(button);
-                        insensPixmap2 = XCreateInsensitivePixmap((Display*) wxGetDisplay(), pixmap2);
-                    }
-
-                    tool->SetPixmap(pixmap2);
-
-                    XtVaSetValues (button,
-                            XmNfillOnSelect, True,
-                            XmNlabelPixmap, pixmap,
-                            XmNselectPixmap, pixmap2,
-                            XmNlabelInsensitivePixmap, insensPixmap,
-                            XmNselectInsensitivePixmap, insensPixmap2,
-                            XmNlabelType, XmPIXMAP,
-                            NULL);
-                }
-                else
-                {
-                    Pixmap pixmap2 = (Pixmap) 0;
-
-                    // If there's a bitmap for the armed state, use it,
-                    // otherwise generate one.
-                    if (tool->GetBitmap2().Ok())
-                    {
-                        pixmap2 = (Pixmap) tool->GetBitmap2().GetPixmap();
-                    }
-                    else
-                    {
-                        pixmap2 = (Pixmap) bmp.GetArmPixmap(button);
-
-                    }
-
-                    tool->SetPixmap(pixmap2);
-
-                    // Normal button
-                    XtVaSetValues(button,
-                            XmNlabelPixmap, pixmap,
-                            XmNlabelInsensitivePixmap, insensPixmap,
-                            XmNarmPixmap, pixmap2,
-                            NULL);
-                }
-
-                XtManageChild(button);
-
-                {
-                    Dimension width, height;
-                    XtVaGetValues(button,
-                                  XmNwidth, &width,
-                                  XmNheight, & height,
-                                  NULL);
-                    currentX += width + packing;
-                    buttonHeight = wxMax(buttonHeight, height);
-                }
-
-                XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
-                        False, wxToolButtonPopupCallback, (XtPointer) this);
-
-                currentSpacing = 0;
-                break;
-        }
-
-        node = node->GetNext();
-    }
-
-    SetSize(-1, -1, currentX, buttonHeight + 2*marginY);
-
-    return TRUE;
-}
-
-wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
-                                                  wxCoord WXUNUSED(y)) const
-{
-    wxFAIL_MSG( _T("TODO") );
-
-    return (wxToolBarToolBase *)NULL;
-}
-
-bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
-{
-    tool->Attach(this);
-
-    return TRUE;
-}
-
-bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool)
-{
-    tool->Detach();
-
-    return TRUE;
-}
-
-void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
-{
-    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
-    XtSetSensitive(tool->GetButtonWidget(), (Boolean) enable);
-}
-
-void wxToolBar::DoToggleTool(wxToolBarToolBase *toolBase, bool toggle)
-{
-    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
-    XmToggleButtonSetState(tool->GetButtonWidget(), (Boolean) toggle, False);
-}
-
-void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
-                            bool WXUNUSED(toggle))
-{
-    // nothing to do
-}
-
-// ----------------------------------------------------------------------------
-// Motif callbacks
-// ----------------------------------------------------------------------------
-
-wxToolBarToolBase *wxToolBar::FindToolByWidget(WXWidget w) const
-{
-    wxToolBarToolsList::Node* node = m_tools.GetFirst();
-    while ( node )
-    {
-        wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-        if ( tool->GetButtonWidget() == w)
-        {
-            return tool;
-        }
-
-        node = node->GetNext();
-    }
-
-    return (wxToolBarToolBase *)NULL;
-}
-
-static void wxToolButtonCallback(Widget w,
-                                 XtPointer clientData,
-                                 XtPointer WXUNUSED(ptr))
-{
-    wxToolBar *toolBar = (wxToolBar *) clientData;
-    wxToolBarToolBase *tool = toolBar->FindToolByWidget((WXWidget) w);
-    if ( !tool )
-        return;
-
-    if ( tool->CanBeToggled() )
-        tool->Toggle();
-
-    if ( !toolBar->OnLeftClick(tool->GetId(), tool->IsToggled()) )
-    {
-        // revert
-        tool->Toggle();
-    }
-}
-
-
-static void wxToolButtonPopupCallback(Widget w,
-                                      XtPointer client_data,
-                                      XEvent *event,
-                                      Boolean *WXUNUSED(continue_to_dispatch))
-{
-    // TODO: retrieve delay before popping up tooltip from wxSystemSettings.
-    static const int delayMilli = 800;
-
-    wxToolBar* toolBar = (wxToolBar*) client_data;
-    wxToolBarToolBase *tool = toolBar->FindToolByWidget((WXWidget) w);
-
-    if ( !tool )
-        return;
-
-    wxString tooltip = tool->GetShortHelp();
-    if ( !tooltip )
-        return;
-
-    if (!wxTheToolBarTimer)
-        wxTheToolBarTimer = new wxToolBarTimer;
-
-    wxToolBarTimer::buttonWidget = w;
-    wxToolBarTimer::helpString = tooltip;
-
-    /************************************************************/
-    /* Popup help label                                         */
-    /************************************************************/
-    if (event->type == EnterNotify)
-    {
-        if (wxToolBarTimer::help_popup != (Widget) 0)
-        {
-            XtDestroyWidget (wxToolBarTimer::help_popup);
-            XtPopdown (wxToolBarTimer::help_popup);
-        }
-        wxToolBarTimer::help_popup = (Widget) 0;
-
-        // One shot
-        wxTheToolBarTimer->Start(delayMilli, TRUE);
-
-    }
-    /************************************************************/
-    /* Popdown help label                                       */
-    /************************************************************/
-    else if (event->type == LeaveNotify)
-    {
-        if (wxTheToolBarTimer)
-            wxTheToolBarTimer->Stop();
-        if (wxToolBarTimer::help_popup != (Widget) 0)
-        {
-            XtDestroyWidget (wxToolBarTimer::help_popup);
-            XtPopdown (wxToolBarTimer::help_popup);
-        }
-        wxToolBarTimer::help_popup = (Widget) 0;
-    }
-}
-
-void wxToolBarTimer::Notify()
-{
-    Position x, y;
-
-        /************************************************************/
-        /* Create shell without window decorations                  */
-        /************************************************************/
-        help_popup = XtVaCreatePopupShell ("shell",
-                                           overrideShellWidgetClass, (Widget) wxTheApp->GetTopLevelWidget(),
-                                           NULL);
-
-        /************************************************************/
-        /* Get absolute position on display of toolbar button       */
-        /************************************************************/
-        XtTranslateCoords (buttonWidget,
-                           (Position) 0,
-                           (Position) 0,
-                           &x, &y);
-
-        // Move the tooltip more or less above the button
-        int yOffset = 20; // TODO: What should be really?
-        y -= yOffset;
-        if (y < yOffset) y = 0;
-
-        /************************************************************/
-        /* Set the position of the help popup                       */
-        /************************************************************/
-        XtVaSetValues (help_popup,
-                       XmNx, (Position) x,
-                       XmNy, (Position) y,
-                       NULL);
-
-        /************************************************************/
-        /* Create help label                                        */
-        /************************************************************/
-        XmString text = XmStringCreateSimple ((char*) (const char*) helpString);
-        XtVaCreateManagedWidget ("help_label",
-                                 xmLabelWidgetClass, help_popup,
-                                 XmNlabelString, text,
-                                 XtVaTypedArg,
-                                 XmNforeground, XtRString, "black",
-                                                strlen("black")+1,
-                                 XtVaTypedArg,
-                                 XmNbackground, XtRString, "LightGoldenrod",
-                                                strlen("LightGoldenrod")+1,
-                                 NULL);
-        XmStringFree (text);
-
-        /************************************************************/
-        /* Popup help label                                         */
-        /************************************************************/
-        XtPopup (help_popup, XtGrabNone);
-}
-
-#endif