1. wxGrid fixes contributed by Gerhard Gruber (client data for cells...)
2. Motif warnings removed 3. Using native msgbox under Motif (ok, it doesn't work, but generic doesn't work neither) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2930 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
// Name: gridg.h
|
// Name: gridg.h
|
||||||
// Purpose: wxGenericGrid
|
// Purpose: wxGenericGrid
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by: Michael Bedward
|
// Modified by: Michael Bedward
|
||||||
// Added edit in place facility, 20 April 1999
|
// Added edit in place facility, 20 April 1999
|
||||||
// Added cursor key control, 29 Jun 1999
|
// Added cursor key control, 29 Jun 1999
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -101,12 +101,16 @@ public:
|
|||||||
void SetCellTextFont(const wxFont& fnt, int row, int col);
|
void SetCellTextFont(const wxFont& fnt, int row, int col);
|
||||||
wxBitmap *GetCellBitmap(int row, int col) const;
|
wxBitmap *GetCellBitmap(int row, int col) const;
|
||||||
void SetCellBitmap(wxBitmap *bitmap, int row, int col);
|
void SetCellBitmap(wxBitmap *bitmap, int row, int col);
|
||||||
|
void *SetCellData(void *data, int row, int col);
|
||||||
|
void *GetCellData(int row, int col);
|
||||||
|
|
||||||
// Size accessors
|
// Size accessors
|
||||||
void SetColumnWidth(int col, int width);
|
void SetColumnWidth(int col, int width);
|
||||||
int GetColumnWidth(int col) const;
|
int GetColumnWidth(int col) const;
|
||||||
void SetRowHeight(int row, int height);
|
void SetRowHeight(int row, int height);
|
||||||
int GetRowHeight(int row) const;
|
int GetRowHeight(int row) const;
|
||||||
|
int GetViewHeight() const { return m_viewHeight; }
|
||||||
|
int GetViewWidth() const { return m_viewWidth; }
|
||||||
|
|
||||||
// Label accessors
|
// Label accessors
|
||||||
void SetLabelSize(int orientation, int sz);
|
void SetLabelSize(int orientation, int sz);
|
||||||
@@ -266,6 +270,8 @@ protected:
|
|||||||
int m_bottomOfSheet; // Calculated from m_rowHeights
|
int m_bottomOfSheet; // Calculated from m_rowHeights
|
||||||
int m_totalGridWidth; // Total 'virtual' size
|
int m_totalGridWidth; // Total 'virtual' size
|
||||||
int m_totalGridHeight;
|
int m_totalGridHeight;
|
||||||
|
int m_viewHeight; // Number of rows displayed
|
||||||
|
int m_viewWidth; // Number of columns displayed
|
||||||
int m_cellHeight; // For now, a default
|
int m_cellHeight; // For now, a default
|
||||||
int m_verticalLabelWidth;
|
int m_verticalLabelWidth;
|
||||||
int m_horizontalLabelHeight;
|
int m_horizontalLabelHeight;
|
||||||
@@ -318,7 +324,8 @@ public:
|
|||||||
wxColour backgroundColour;
|
wxColour backgroundColour;
|
||||||
wxBrush backgroundBrush;
|
wxBrush backgroundBrush;
|
||||||
wxBitmap* cellBitmap;
|
wxBitmap* cellBitmap;
|
||||||
int alignment;
|
void* cellData; // intended for additional data associated with a cell
|
||||||
|
int alignment;
|
||||||
|
|
||||||
wxGridCell(wxGenericGrid *window = (wxGenericGrid *) NULL);
|
wxGridCell(wxGenericGrid *window = (wxGenericGrid *) NULL);
|
||||||
~wxGridCell();
|
~wxGridCell();
|
||||||
@@ -337,6 +344,9 @@ public:
|
|||||||
void SetAlignment(int align) { alignment = align; }
|
void SetAlignment(int align) { alignment = align; }
|
||||||
wxBitmap *GetCellBitmap() const { return cellBitmap; }
|
wxBitmap *GetCellBitmap() const { return cellBitmap; }
|
||||||
void SetCellBitmap(wxBitmap *bitmap) { cellBitmap = bitmap; }
|
void SetCellBitmap(wxBitmap *bitmap) { cellBitmap = bitmap; }
|
||||||
|
|
||||||
|
void *SetCellData(void *data) { void *rc = cellData; cellData = data; return rc; }
|
||||||
|
void *GetCellData() const { return cellData; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxGrid : public wxGenericGrid
|
class WXDLLEXPORT wxGrid : public wxGenericGrid
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/msgdlg.h"
|
#include "wx/msw/msgdlg.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/generic/msgdlgg.h"
|
#include "wx/motif/msgdlg.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk/msgdlg.h"
|
#include "wx/gtk/msgdlg.h"
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
// Modified by: Michael Bedward
|
// Modified by: Michael Bedward
|
||||||
// Added edit in place facility, 20 Apr 1999
|
// Added edit in place facility, 20 Apr 1999
|
||||||
// Added cursor key control, 29 Jun 1999
|
// Added cursor key control, 29 Jun 1999
|
||||||
|
// Gerhard Gruber
|
||||||
|
// Added keyboard navigation, client data, other fixes
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
@@ -77,8 +79,10 @@ BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
wxGenericGrid::wxGenericGrid(void)
|
wxGenericGrid::wxGenericGrid()
|
||||||
{
|
{
|
||||||
|
m_viewWidth = 0;
|
||||||
|
m_viewHeight = 0;
|
||||||
m_batchCount = 0;
|
m_batchCount = 0;
|
||||||
m_hScrollBar = (wxScrollBar *) NULL;
|
m_hScrollBar = (wxScrollBar *) NULL;
|
||||||
m_vScrollBar = (wxScrollBar *) NULL;
|
m_vScrollBar = (wxScrollBar *) NULL;
|
||||||
@@ -137,9 +141,15 @@ wxGenericGrid::wxGenericGrid(void)
|
|||||||
m_textItem = (wxTextCtrl *) NULL;
|
m_textItem = (wxTextCtrl *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
bool wxGenericGrid::Create(wxWindow *parent,
|
||||||
long style, const wxString& name)
|
wxWindowID id,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
m_viewWidth = 0;
|
||||||
|
m_viewHeight = 0;
|
||||||
m_batchCount = 0;
|
m_batchCount = 0;
|
||||||
m_editingPanel = (wxPanel *) NULL;
|
m_editingPanel = (wxPanel *) NULL;
|
||||||
m_hScrollBar = (wxScrollBar *) NULL;
|
m_hScrollBar = (wxScrollBar *) NULL;
|
||||||
@@ -246,12 +256,12 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGenericGrid::~wxGenericGrid(void)
|
wxGenericGrid::~wxGenericGrid()
|
||||||
{
|
{
|
||||||
ClearGrid();
|
ClearGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericGrid::ClearGrid(void)
|
void wxGenericGrid::ClearGrid()
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
if (m_gridCells)
|
if (m_gridCells)
|
||||||
@@ -380,7 +390,7 @@ bool wxGenericGrid::CreateGrid(int nRows, int nCols, wxString **cellValues, shor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to determine various dimensions
|
// Need to determine various dimensions
|
||||||
void wxGenericGrid::UpdateDimensions(void)
|
void wxGenericGrid::UpdateDimensions()
|
||||||
{
|
{
|
||||||
int canvasWidth, canvasHeight;
|
int canvasWidth, canvasHeight;
|
||||||
GetSize(&canvasWidth, &canvasHeight);
|
GetSize(&canvasWidth, &canvasHeight);
|
||||||
@@ -941,7 +951,7 @@ void wxGenericGrid::DrawCellValue(wxDC *dc, wxRect *rect, int row, int col)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericGrid::AdjustScrollbars(void)
|
void wxGenericGrid::AdjustScrollbars()
|
||||||
{
|
{
|
||||||
int cw, ch;
|
int cw, ch;
|
||||||
GetClientSize(&cw, &ch);
|
GetClientSize(&cw, &ch);
|
||||||
@@ -966,56 +976,53 @@ void wxGenericGrid::AdjustScrollbars(void)
|
|||||||
int noHorizSteps = 0;
|
int noHorizSteps = 0;
|
||||||
int noVertSteps = 0;
|
int noVertSteps = 0;
|
||||||
|
|
||||||
if (m_totalGridWidth + vertScrollBarWidth <= cw)
|
if (m_totalGridWidth + vertScrollBarWidth > cw)
|
||||||
noHorizSteps = 0;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
noHorizSteps = 0;
|
|
||||||
int widthCount = 0;
|
int widthCount = 0;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int nx = 0;
|
int nx = 0;
|
||||||
for (i = m_scrollPosX ; i < m_totalCols; i++)
|
for (i = m_scrollPosX ; i < m_totalCols; i++)
|
||||||
{
|
{
|
||||||
widthCount += m_colWidths[i];
|
widthCount += m_colWidths[i];
|
||||||
// A partial bit doesn't count, we still have to scroll to see the
|
// A partial bit doesn't count, we still have to scroll to see the
|
||||||
// rest of it
|
// rest of it
|
||||||
if (widthCount + m_leftOfSheet + m_verticalLabelWidth > (cw-vertScrollBarWidth))
|
if (widthCount + m_leftOfSheet + m_verticalLabelWidth > (cw-vertScrollBarWidth))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
nx ++;
|
nx ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
noHorizSteps += nx;
|
noHorizSteps += nx;
|
||||||
}
|
}
|
||||||
if (m_totalGridHeight + horizScrollBarHeight <= ch)
|
m_viewWidth = noHorizSteps;
|
||||||
noVertSteps = 0;
|
|
||||||
else
|
if (m_totalGridHeight + horizScrollBarHeight > ch)
|
||||||
{
|
{
|
||||||
noVertSteps = 0;
|
|
||||||
int heightCount = 0;
|
int heightCount = 0;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int ny = 0;
|
int ny = 0;
|
||||||
for (i = m_scrollPosY ; i < m_totalRows; i++)
|
for (i = m_scrollPosY ; i < m_totalRows; i++)
|
||||||
{
|
{
|
||||||
heightCount += m_rowHeights[i];
|
heightCount += m_rowHeights[i];
|
||||||
// A partial bit doesn't count, we still have to scroll to see the
|
// A partial bit doesn't count, we still have to scroll to see the
|
||||||
// rest of it
|
// rest of it
|
||||||
if (heightCount + m_topOfSheet + m_horizontalLabelHeight > (ch-horizScrollBarHeight))
|
if (heightCount + m_topOfSheet + m_horizontalLabelHeight > (ch-horizScrollBarHeight))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
ny ++;
|
ny ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
noVertSteps += ny;
|
noVertSteps += ny;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_viewHeight = noVertSteps;
|
||||||
|
|
||||||
if (m_totalGridWidth + vertScrollBarWidth <= cw)
|
if (m_totalGridWidth + vertScrollBarWidth <= cw)
|
||||||
{
|
{
|
||||||
if ( m_hScrollBar )
|
if ( m_hScrollBar )
|
||||||
m_hScrollBar->Show(FALSE);
|
m_hScrollBar->Show(FALSE);
|
||||||
SetScrollPosX(0);
|
SetScrollPosX(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1479,12 +1486,12 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
|
|||||||
GetEventHandler()->ProcessEvent(g_evt2);
|
GetEventHandler()->ProcessEvent(g_evt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCell *wxGenericGrid::OnCreateCell(void)
|
wxGridCell *wxGenericGrid::OnCreateCell()
|
||||||
{
|
{
|
||||||
return new wxGridCell(this);
|
return new wxGridCell(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericGrid::OnChangeLabels(void)
|
void wxGenericGrid::OnChangeLabels()
|
||||||
{
|
{
|
||||||
char buf[100];
|
char buf[100];
|
||||||
int i;
|
int i;
|
||||||
@@ -1510,7 +1517,7 @@ void wxGenericGrid::OnChangeLabels(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericGrid::OnChangeSelectionLabel(void)
|
void wxGenericGrid::OnChangeSelectionLabel()
|
||||||
{
|
{
|
||||||
if (!GetEditable())
|
if (!GetEditable())
|
||||||
return;
|
return;
|
||||||
@@ -1553,7 +1560,7 @@ void wxGenericGrid::HighlightCell(wxDC *dc)
|
|||||||
dc->SetLogicalFunction(wxCOPY);
|
dc->SetLogicalFunction(wxCOPY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericGrid::DrawCellText(void)
|
void wxGenericGrid::DrawCellText()
|
||||||
{
|
{
|
||||||
if (!m_currentRectVisible)
|
if (!m_currentRectVisible)
|
||||||
return;
|
return;
|
||||||
@@ -2510,9 +2517,9 @@ void wxGenericGrid::SetGridCursor(int row, int col)
|
|||||||
dc.EndDrawing();
|
dc.EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// ----------------------------------------------------------------------------
|
||||||
* Grid cell
|
// Grid cell
|
||||||
*/
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxGridCell::wxGridCell(wxGenericGrid *window)
|
wxGridCell::wxGridCell(wxGenericGrid *window)
|
||||||
{
|
{
|
||||||
@@ -2539,9 +2546,11 @@ wxGridCell::wxGridCell(wxGenericGrid *window)
|
|||||||
alignment = window->GetCellAlignment();
|
alignment = window->GetCellAlignment();
|
||||||
else
|
else
|
||||||
alignment = wxLEFT;
|
alignment = wxLEFT;
|
||||||
|
|
||||||
|
cellData = (void *)NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGridCell::~wxGridCell(void)
|
wxGridCell::~wxGridCell()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2741,4 +2750,25 @@ void wxGenericGrid::_OnLabelRightClick(wxGridEvent& ev)
|
|||||||
OnLabelRightClick(ev.m_row, ev.m_col, ev.m_x, ev.m_y, ev.m_control, ev.m_shift);
|
OnLabelRightClick(ev.m_row, ev.m_col, ev.m_x, ev.m_y, ev.m_control, ev.m_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *wxGenericGrid::SetCellData(void *data, int row, int col)
|
||||||
|
{
|
||||||
|
void *rc = NULL;
|
||||||
|
|
||||||
|
wxGridCell *cell = GetCell(row, col);
|
||||||
|
if ( cell )
|
||||||
|
rc = cell->SetCellData(data);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *wxGenericGrid::GetCellData(int row, int col)
|
||||||
|
{
|
||||||
|
void *rc = NULL;
|
||||||
|
|
||||||
|
wxGridCell *cell = GetCell(row, col);
|
||||||
|
if ( cell )
|
||||||
|
rc = cell->GetCellData();
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -118,7 +118,6 @@ libwx_motif_la_SOURCES = \
|
|||||||
imaglist.cpp \
|
imaglist.cpp \
|
||||||
laywin.cpp \
|
laywin.cpp \
|
||||||
listctrl.cpp \
|
listctrl.cpp \
|
||||||
msgdlgg.cpp \
|
|
||||||
panelg.cpp \
|
panelg.cpp \
|
||||||
printps.cpp \
|
printps.cpp \
|
||||||
prntdlgg.cpp \
|
prntdlgg.cpp \
|
||||||
@@ -170,6 +169,7 @@ libwx_motif_la_SOURCES = \
|
|||||||
menu.cpp \
|
menu.cpp \
|
||||||
menuitem.cpp \
|
menuitem.cpp \
|
||||||
minifram.cpp \
|
minifram.cpp \
|
||||||
|
msgdlg.cpp \
|
||||||
notebook.cpp \
|
notebook.cpp \
|
||||||
palette.cpp \
|
palette.cpp \
|
||||||
pen.cpp \
|
pen.cpp \
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ wxMenu::wxMenu(const wxString& title, const wxFunction func)
|
|||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
m_menuBar = NULL;
|
m_menuBar = NULL;
|
||||||
m_pInvokingWindow = NULL;
|
m_pInvokingWindow = NULL;
|
||||||
|
|
||||||
//// Motif-specific members
|
//// Motif-specific members
|
||||||
m_numColumns = 1;
|
m_numColumns = 1;
|
||||||
m_menuWidget = (WXWidget) NULL;
|
m_menuWidget = (WXWidget) NULL;
|
||||||
@@ -77,7 +77,7 @@ wxMenu::wxMenu(const wxString& title, const wxFunction func)
|
|||||||
m_ownedByMenuBar = FALSE;
|
m_ownedByMenuBar = FALSE;
|
||||||
m_menuParent = (wxMenu*) NULL;
|
m_menuParent = (wxMenu*) NULL;
|
||||||
m_clientData = (void*) NULL;
|
m_clientData = (void*) NULL;
|
||||||
|
|
||||||
if (m_title != "")
|
if (m_title != "")
|
||||||
{
|
{
|
||||||
Append(ID_SEPARATOR, m_title) ;
|
Append(ID_SEPARATOR, m_title) ;
|
||||||
@@ -86,7 +86,7 @@ wxMenu::wxMenu(const wxString& title, const wxFunction func)
|
|||||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
|
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
|
||||||
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
|
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
|
||||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
|
||||||
Callback(func);
|
Callback(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,24 +100,24 @@ wxMenu::~wxMenu()
|
|||||||
else
|
else
|
||||||
DestroyMenu(FALSE);
|
DestroyMenu(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not sure if this is right
|
// Not sure if this is right
|
||||||
if (m_menuParent && m_menuBar)
|
if (m_menuParent && m_menuBar)
|
||||||
{
|
{
|
||||||
m_menuParent = NULL;
|
m_menuParent = NULL;
|
||||||
// m_menuBar = NULL;
|
// m_menuBar = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *node = m_menuItems.First();
|
wxNode *node = m_menuItems.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *)node->Data();
|
wxMenuItem *item = (wxMenuItem *)node->Data();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (item->GetSubMenu())
|
if (item->GetSubMenu())
|
||||||
item->DeleteSubMenu();
|
item->DeleteSubMenu();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxNode *next = node->Next();
|
wxNode *next = node->Next();
|
||||||
delete item;
|
delete item;
|
||||||
delete node;
|
delete node;
|
||||||
@@ -134,12 +134,12 @@ void wxMenu::Break()
|
|||||||
void wxMenu::Append(wxMenuItem *pItem)
|
void wxMenu::Append(wxMenuItem *pItem)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
|
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
|
||||||
|
|
||||||
m_menuItems.Append(pItem);
|
m_menuItems.Append(pItem);
|
||||||
|
|
||||||
if (m_menuWidget)
|
if (m_menuWidget)
|
||||||
pItem->CreateItem (m_menuWidget, m_menuBar, m_topLevelMenu); // this is a dynamic Append
|
pItem->CreateItem (m_menuWidget, m_menuBar, m_topLevelMenu); // this is a dynamic Append
|
||||||
|
|
||||||
m_noItems++;
|
m_noItems++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,16 +154,16 @@ void wxMenu::AppendSeparator()
|
|||||||
// as well as in m_menuItems, whereas we only store it in
|
// as well as in m_menuItems, whereas we only store it in
|
||||||
// m_menuItems here. What implications does this have?
|
// m_menuItems here. What implications does this have?
|
||||||
|
|
||||||
void wxMenu::Append(int id, const wxString& label, wxMenu *subMenu,
|
void wxMenu::Append(int id, const wxString& label, wxMenu *subMenu,
|
||||||
const wxString& helpString)
|
const wxString& helpString)
|
||||||
{
|
{
|
||||||
Append(new wxMenuItem(this, id, label, helpString, FALSE, subMenu));
|
Append(new wxMenuItem(this, id, label, helpString, FALSE, subMenu));
|
||||||
|
|
||||||
subMenu->m_topLevelMenu = m_topLevelMenu;
|
subMenu->m_topLevelMenu = m_topLevelMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ordinary menu item
|
// Ordinary menu item
|
||||||
void wxMenu::Append(int id, const wxString& label,
|
void wxMenu::Append(int id, const wxString& label,
|
||||||
const wxString& helpString, bool checkable)
|
const wxString& helpString, bool checkable)
|
||||||
{
|
{
|
||||||
// 'checkable' parameter is useless for Windows.
|
// 'checkable' parameter is useless for Windows.
|
||||||
@@ -175,19 +175,19 @@ void wxMenu::Delete(int id)
|
|||||||
wxNode *node;
|
wxNode *node;
|
||||||
wxMenuItem *item;
|
wxMenuItem *item;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
|
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
|
||||||
{
|
{
|
||||||
item = (wxMenuItem *)node->Data();
|
item = (wxMenuItem *)node->Data();
|
||||||
if (item->GetId() == id)
|
if (item->GetId() == id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
item->DestroyItem(TRUE);
|
item->DestroyItem(TRUE);
|
||||||
|
|
||||||
// See also old code - don't know if this is needed (seems redundant).
|
// See also old code - don't know if this is needed (seems redundant).
|
||||||
/*
|
/*
|
||||||
if (item->GetSubMenu()) {
|
if (item->GetSubMenu()) {
|
||||||
@@ -196,7 +196,7 @@ void wxMenu::Delete(int id)
|
|||||||
children->DeleteObject(item->GetSubMenu());
|
children->DeleteObject(item->GetSubMenu());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
m_menuItems.DeleteNode(node);
|
m_menuItems.DeleteNode(node);
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ void wxMenu::Enable(int id, bool flag)
|
|||||||
{
|
{
|
||||||
wxMenuItem *item = FindItemForId(id);
|
wxMenuItem *item = FindItemForId(id);
|
||||||
wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
|
wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
|
||||||
|
|
||||||
item->Enable(flag);
|
item->Enable(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ bool wxMenu::Enabled(int Id) const
|
|||||||
{
|
{
|
||||||
wxMenuItem *item = FindItemForId(Id);
|
wxMenuItem *item = FindItemForId(Id);
|
||||||
wxCHECK( item != NULL, FALSE );
|
wxCHECK( item != NULL, FALSE );
|
||||||
|
|
||||||
return item->IsEnabled();
|
return item->IsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ void wxMenu::Check(int Id, bool Flag)
|
|||||||
{
|
{
|
||||||
wxMenuItem *item = FindItemForId(Id);
|
wxMenuItem *item = FindItemForId(Id);
|
||||||
wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
|
wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
|
||||||
|
|
||||||
item->Check(Flag);
|
item->Check(Flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,23 +229,23 @@ bool wxMenu::Checked(int id) const
|
|||||||
{
|
{
|
||||||
wxMenuItem *item = FindItemForId(id);
|
wxMenuItem *item = FindItemForId(id);
|
||||||
wxCHECK( item != NULL, FALSE );
|
wxCHECK( item != NULL, FALSE );
|
||||||
|
|
||||||
return item->IsChecked();
|
return item->IsChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenu::SetTitle(const wxString& label)
|
void wxMenu::SetTitle(const wxString& label)
|
||||||
{
|
{
|
||||||
m_title = label ;
|
m_title = label ;
|
||||||
|
|
||||||
wxNode *node = m_menuItems.First ();
|
wxNode *node = m_menuItems.First ();
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||||
Widget widget = (Widget) item->GetButtonWidget();
|
Widget widget = (Widget) item->GetButtonWidget();
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XmString title_str = XmStringCreateSimple ((char*) (const char*) label);
|
XmString title_str = XmStringCreateSimple ((char*) (const char*) label);
|
||||||
XtVaSetValues (widget,
|
XtVaSetValues (widget,
|
||||||
XmNlabelString, title_str,
|
XmNlabelString, title_str,
|
||||||
@@ -263,7 +263,7 @@ void wxMenu::SetLabel(int id, const wxString& label)
|
|||||||
wxMenuItem *item = FindItemForId(id);
|
wxMenuItem *item = FindItemForId(id);
|
||||||
if (item == (wxMenuItem*) NULL)
|
if (item == (wxMenuItem*) NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
item->SetLabel(label);
|
item->SetLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ wxString wxMenu::GetLabel(int id) const
|
|||||||
XtVaGetValues ((Widget) w,
|
XtVaGetValues ((Widget) w,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
||||||
{
|
{
|
||||||
wxString str(s);
|
wxString str(s);
|
||||||
@@ -301,7 +301,7 @@ int wxMenu::FindItem (const wxString& itemString) const
|
|||||||
char buf1[200];
|
char buf1[200];
|
||||||
char buf2[200];
|
char buf2[200];
|
||||||
wxStripMenuCodes ((char *)(const char *)itemString, buf1);
|
wxStripMenuCodes ((char *)(const char *)itemString, buf1);
|
||||||
|
|
||||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||||
@@ -318,7 +318,7 @@ int wxMenu::FindItem (const wxString& itemString) const
|
|||||||
return item->GetId();
|
return item->GetId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,14 +329,14 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
|
|||||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||||
|
|
||||||
if (item->GetId() == itemId)
|
if (item->GetId() == itemId)
|
||||||
{
|
{
|
||||||
if (itemMenu)
|
if (itemMenu)
|
||||||
*itemMenu = (wxMenu *) this;
|
*itemMenu = (wxMenu *) this;
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetSubMenu())
|
if (item->GetSubMenu())
|
||||||
{
|
{
|
||||||
wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
|
wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
|
||||||
@@ -344,7 +344,7 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
|
|||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemMenu)
|
if (itemMenu)
|
||||||
*itemMenu = NULL;
|
*itemMenu = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -367,14 +367,14 @@ wxString wxMenu::GetHelpString (int itemId) const
|
|||||||
void wxMenu::ProcessCommand(wxCommandEvent & event)
|
void wxMenu::ProcessCommand(wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
bool processed = FALSE;
|
bool processed = FALSE;
|
||||||
|
|
||||||
// Try a callback
|
// Try a callback
|
||||||
if (m_callback)
|
if (m_callback)
|
||||||
{
|
{
|
||||||
(void) (*(m_callback)) (*this, event);
|
(void) (*(m_callback)) (*this, event);
|
||||||
processed = TRUE;
|
processed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the menu's event handler
|
// Try the menu's event handler
|
||||||
if ( !processed && GetEventHandler())
|
if ( !processed && GetEventHandler())
|
||||||
{
|
{
|
||||||
@@ -429,23 +429,21 @@ void wxMenu::UpdateUI(wxEvtHandler* source)
|
|||||||
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
|
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
|
||||||
{
|
{
|
||||||
Widget widget = (Widget) GetMainWidget();
|
Widget widget = (Widget) GetMainWidget();
|
||||||
|
|
||||||
/* The menuId field seems to be usused, so we'll use it to
|
/* The menuId field seems to be usused, so we'll use it to
|
||||||
indicate whether a menu is popped up or not:
|
indicate whether a menu is popped up or not:
|
||||||
0: Not currently created as a popup
|
0: Not currently created as a popup
|
||||||
-1: Created as a popup, but not active
|
-1: Created as a popup, but not active
|
||||||
1: Active popup.
|
1: Active popup.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (menu->GetParent() && (menu->GetId() != -1))
|
if (menu->GetParent() && (menu->GetId() != -1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (menu->GetMainWidget()) {
|
if (menu->GetMainWidget()) {
|
||||||
menu->DestroyMenu(TRUE);
|
menu->DestroyMenu(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow *parent = this;
|
|
||||||
|
|
||||||
menu->SetId(1); /* Mark as popped-up */
|
menu->SetId(1); /* Mark as popped-up */
|
||||||
menu->CreateMenu(NULL, widget, menu);
|
menu->CreateMenu(NULL, widget, menu);
|
||||||
menu->SetInvokingWindow(this);
|
menu->SetInvokingWindow(this);
|
||||||
@@ -454,12 +452,12 @@ bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
|
|||||||
|
|
||||||
// menu->SetParent(parent);
|
// menu->SetParent(parent);
|
||||||
// parent->children->Append(menu); // Store menu for later deletion
|
// parent->children->Append(menu); // Store menu for later deletion
|
||||||
|
|
||||||
Widget menuWidget = (Widget) menu->GetMainWidget();
|
Widget menuWidget = (Widget) menu->GetMainWidget();
|
||||||
|
|
||||||
int rootX = 0;
|
int rootX = 0;
|
||||||
int rootY = 0;
|
int rootY = 0;
|
||||||
|
|
||||||
int deviceX = x;
|
int deviceX = x;
|
||||||
int deviceY = y;
|
int deviceY = y;
|
||||||
/*
|
/*
|
||||||
@@ -470,27 +468,27 @@ bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
|
|||||||
deviceY = canvas->GetDC ()->LogicalToDeviceY (y);
|
deviceY = canvas->GetDC ()->LogicalToDeviceY (y);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Display *display = XtDisplay (widget);
|
Display *display = XtDisplay (widget);
|
||||||
Window rootWindow = RootWindowOfScreen (XtScreen((Widget)widget));
|
Window rootWindow = RootWindowOfScreen (XtScreen((Widget)widget));
|
||||||
Window thisWindow = XtWindow (widget);
|
Window thisWindow = XtWindow (widget);
|
||||||
Window childWindow;
|
Window childWindow;
|
||||||
XTranslateCoordinates (display, thisWindow, rootWindow, (int) deviceX, (int) deviceY,
|
XTranslateCoordinates (display, thisWindow, rootWindow, (int) deviceX, (int) deviceY,
|
||||||
&rootX, &rootY, &childWindow);
|
&rootX, &rootY, &childWindow);
|
||||||
|
|
||||||
XButtonPressedEvent event;
|
XButtonPressedEvent event;
|
||||||
event.type = ButtonPress;
|
event.type = ButtonPress;
|
||||||
event.button = 1;
|
event.button = 1;
|
||||||
|
|
||||||
event.x = deviceX;
|
event.x = deviceX;
|
||||||
event.y = deviceY;
|
event.y = deviceY;
|
||||||
|
|
||||||
event.x_root = rootX;
|
event.x_root = rootX;
|
||||||
event.y_root = rootY;
|
event.y_root = rootY;
|
||||||
|
|
||||||
XmMenuPosition (menuWidget, &event);
|
XmMenuPosition (menuWidget, &event);
|
||||||
XtManageChild (menuWidget);
|
XtManageChild (menuWidget);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,10 +569,10 @@ void wxMenuBar::Check(int id, bool flag)
|
|||||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!item->IsCheckable())
|
if (!item->IsCheckable())
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
item->Check(flag);
|
item->Check(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +582,7 @@ bool wxMenuBar::Checked(int id) const
|
|||||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||||
if (!item)
|
if (!item)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return item->IsChecked();
|
return item->IsChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +592,7 @@ bool wxMenuBar::Enabled(int id) const
|
|||||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||||
if (!item)
|
if (!item)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return item->IsEnabled();
|
return item->IsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,10 +600,10 @@ void wxMenuBar::SetLabel(int id, const wxString& label)
|
|||||||
{
|
{
|
||||||
wxMenu *itemMenu = NULL;
|
wxMenu *itemMenu = NULL;
|
||||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
item->SetLabel(label);
|
item->SetLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,17 +611,17 @@ wxString wxMenuBar::GetLabel(int id) const
|
|||||||
{
|
{
|
||||||
wxMenu *itemMenu = NULL;
|
wxMenu *itemMenu = NULL;
|
||||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
return wxString("");
|
return wxString("");
|
||||||
|
|
||||||
return item->GetLabel();
|
return item->GetLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuBar::SetLabelTop(int pos, const wxString& label)
|
void wxMenuBar::SetLabelTop(int pos, const wxString& label)
|
||||||
{
|
{
|
||||||
wxASSERT( (pos < m_menuCount) );
|
wxASSERT( (pos < m_menuCount) );
|
||||||
|
|
||||||
Widget w = (Widget) m_menus[pos]->GetButtonWidget();
|
Widget w = (Widget) m_menus[pos]->GetButtonWidget();
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
@@ -638,7 +636,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label)
|
|||||||
wxString wxMenuBar::GetLabelTop(int pos) const
|
wxString wxMenuBar::GetLabelTop(int pos) const
|
||||||
{
|
{
|
||||||
wxASSERT( (pos < m_menuCount) );
|
wxASSERT( (pos < m_menuCount) );
|
||||||
|
|
||||||
Widget w = (Widget) m_menus[pos]->GetButtonWidget();
|
Widget w = (Widget) m_menus[pos]->GetButtonWidget();
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
@@ -647,7 +645,7 @@ wxString wxMenuBar::GetLabelTop(int pos) const
|
|||||||
XtVaGetValues (w,
|
XtVaGetValues (w,
|
||||||
XmNlabelString, &text,
|
XmNlabelString, &text,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
|
||||||
{
|
{
|
||||||
wxString str(s);
|
wxString str(s);
|
||||||
@@ -661,7 +659,7 @@ wxString wxMenuBar::GetLabelTop(int pos) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMenuBar::OnDelete(wxMenu *menu, int pos)
|
bool wxMenuBar::OnDelete(wxMenu *menu, int pos)
|
||||||
@@ -669,7 +667,7 @@ bool wxMenuBar::OnDelete(wxMenu *menu, int pos)
|
|||||||
// Only applies to dynamic deletion (when set in frame)
|
// Only applies to dynamic deletion (when set in frame)
|
||||||
if (!m_menuBarFrame)
|
if (!m_menuBarFrame)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
menu->DestroyMenu(TRUE);
|
menu->DestroyMenu(TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -679,18 +677,18 @@ bool wxMenuBar::OnAppend(wxMenu *menu, const char *title)
|
|||||||
// Only applies to dynamic append (when set in frame)
|
// Only applies to dynamic append (when set in frame)
|
||||||
if (!m_menuBarFrame)
|
if (!m_menuBarFrame)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
// Probably should be an assert here
|
// Probably should be an assert here
|
||||||
if (menu->GetParent())
|
if (menu->GetParent())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Has already been appended
|
// Has already been appended
|
||||||
if (menu->GetButtonWidget())
|
if (menu->GetButtonWidget())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
WXWidget w = menu->CreateMenu(this, GetMainWidget(), menu, title, TRUE);
|
WXWidget w = menu->CreateMenu(this, GetMainWidget(), menu, title, TRUE);
|
||||||
menu->SetButtonWidget(w);
|
menu->SetButtonWidget(w);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,12 +696,12 @@ void wxMenuBar::Append (wxMenu * menu, const wxString& title)
|
|||||||
{
|
{
|
||||||
if (!OnAppend(menu, title))
|
if (!OnAppend(menu, title))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_menuCount ++;
|
m_menuCount ++;
|
||||||
wxMenu **new_menus = new wxMenu *[m_menuCount];
|
wxMenu **new_menus = new wxMenu *[m_menuCount];
|
||||||
wxString *new_titles = new wxString[m_menuCount];
|
wxString *new_titles = new wxString[m_menuCount];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < m_menuCount - 1; i++)
|
for (i = 0; i < m_menuCount - 1; i++)
|
||||||
{
|
{
|
||||||
new_menus[i] = m_menus[i];
|
new_menus[i] = m_menus[i];
|
||||||
@@ -718,10 +716,10 @@ void wxMenuBar::Append (wxMenu * menu, const wxString& title)
|
|||||||
}
|
}
|
||||||
m_menus = new_menus;
|
m_menus = new_menus;
|
||||||
m_titles = new_titles;
|
m_titles = new_titles;
|
||||||
|
|
||||||
m_menus[m_menuCount - 1] = (wxMenu *)menu;
|
m_menus[m_menuCount - 1] = (wxMenu *)menu;
|
||||||
m_titles[m_menuCount - 1] = title;
|
m_titles[m_menuCount - 1] = title;
|
||||||
|
|
||||||
menu->SetMenuBar(this);
|
menu->SetMenuBar(this);
|
||||||
menu->SetParent(this);
|
menu->SetParent(this);
|
||||||
}
|
}
|
||||||
@@ -730,7 +728,7 @@ void wxMenuBar::Delete(wxMenu * menu, int i)
|
|||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
int ii = (int) i;
|
int ii = (int) i;
|
||||||
|
|
||||||
if (menu != 0)
|
if (menu != 0)
|
||||||
{
|
{
|
||||||
for (ii = 0; ii < m_menuCount; ii++)
|
for (ii = 0; ii < m_menuCount; ii++)
|
||||||
@@ -746,12 +744,12 @@ void wxMenuBar::Delete(wxMenu * menu, int i)
|
|||||||
return;
|
return;
|
||||||
menu = m_menus[ii];
|
menu = m_menus[ii];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OnDelete(menu, ii))
|
if (!OnDelete(menu, ii))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu->SetParent((wxEvtHandler*) NULL);
|
menu->SetParent((wxEvtHandler*) NULL);
|
||||||
|
|
||||||
-- m_menuCount;
|
-- m_menuCount;
|
||||||
for (j = ii; j < m_menuCount; j++)
|
for (j = ii; j < m_menuCount; j++)
|
||||||
{
|
{
|
||||||
@@ -781,7 +779,7 @@ wxMenuItem *wxMenuBar::FindItemForId (int id, wxMenu ** itemMenu) const
|
|||||||
{
|
{
|
||||||
if (itemMenu)
|
if (itemMenu)
|
||||||
*itemMenu = NULL;
|
*itemMenu = NULL;
|
||||||
|
|
||||||
wxMenuItem *item = NULL;
|
wxMenuItem *item = NULL;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_menuCount; i++)
|
for (i = 0; i < m_menuCount; i++)
|
||||||
@@ -827,35 +825,35 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent)
|
|||||||
XtMapWidget((Widget) m_mainWidget);
|
XtMapWidget((Widget) m_mainWidget);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWindowWidget(), "MenuBar", NULL, 0);
|
Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWindowWidget(), "MenuBar", NULL, 0);
|
||||||
m_mainWidget = (WXWidget) menuBarW;
|
m_mainWidget = (WXWidget) menuBarW;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < GetMenuCount(); i++)
|
for (i = 0; i < GetMenuCount(); i++)
|
||||||
{
|
{
|
||||||
wxMenu *menu = GetMenu(i);
|
wxMenu *menu = GetMenu(i);
|
||||||
wxString title(m_titles[i]);
|
wxString title(m_titles[i]);
|
||||||
menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, title, TRUE));
|
menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, title, TRUE));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* COMMENT THIS OUT IF YOU DON'T LIKE A RIGHT-JUSTIFIED HELP MENU
|
* COMMENT THIS OUT IF YOU DON'T LIKE A RIGHT-JUSTIFIED HELP MENU
|
||||||
*/
|
*/
|
||||||
wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
|
wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
|
||||||
|
|
||||||
if (strcmp (wxBuffer, "Help") == 0)
|
if (strcmp (wxBuffer, "Help") == 0)
|
||||||
XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
|
XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetBackgroundColour(m_backgroundColour);
|
SetBackgroundColour(m_backgroundColour);
|
||||||
SetForegroundColour(m_foregroundColour);
|
SetForegroundColour(m_foregroundColour);
|
||||||
SetFont(m_font);
|
SetFont(m_font);
|
||||||
|
|
||||||
XtVaSetValues((Widget) parent->GetMainWindowWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL);
|
XtVaSetValues((Widget) parent->GetMainWindowWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL);
|
||||||
XtRealizeWidget ((Widget) menuBarW);
|
XtRealizeWidget ((Widget) menuBarW);
|
||||||
XtManageChild ((Widget) menuBarW);
|
XtManageChild ((Widget) menuBarW);
|
||||||
SetMenuBarFrame(parent);
|
SetMenuBarFrame(parent);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -867,22 +865,22 @@ bool wxMenuBar::DestroyMenuBar()
|
|||||||
SetMenuBarFrame((wxFrame*) NULL);
|
SetMenuBarFrame((wxFrame*) NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
XtUnmanageChild ((Widget) m_mainWidget);
|
XtUnmanageChild ((Widget) m_mainWidget);
|
||||||
XtUnrealizeWidget ((Widget) m_mainWidget);
|
XtUnrealizeWidget ((Widget) m_mainWidget);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < GetMenuCount(); i++)
|
for (i = 0; i < GetMenuCount(); i++)
|
||||||
{
|
{
|
||||||
wxMenu *menu = GetMenu(i);
|
wxMenu *menu = GetMenu(i);
|
||||||
menu->DestroyMenu(TRUE);
|
menu->DestroyMenu(TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
XtDestroyWidget((Widget) m_mainWidget);
|
XtDestroyWidget((Widget) m_mainWidget);
|
||||||
m_mainWidget = (WXWidget) 0;
|
m_mainWidget = (WXWidget) 0;
|
||||||
|
|
||||||
SetMenuBarFrame((wxFrame*) NULL);
|
SetMenuBarFrame((wxFrame*) NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +898,7 @@ int PostDeletionOfMenu( XtPointer* clientData )
|
|||||||
{
|
{
|
||||||
XtRemoveWorkProc(WorkProcMenuId);
|
XtRemoveWorkProc(WorkProcMenuId);
|
||||||
wxMenu *menu = (wxMenu *)clientData;
|
wxMenu *menu = (wxMenu *)clientData;
|
||||||
|
|
||||||
if (menu->GetMainWidget()) {
|
if (menu->GetMainWidget()) {
|
||||||
if (menu->GetParent())
|
if (menu->GetParent())
|
||||||
{
|
{
|
||||||
@@ -914,20 +912,20 @@ int PostDeletionOfMenu( XtPointer* clientData )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxMenuPopdownCallback(Widget w, XtPointer clientData,
|
wxMenuPopdownCallback(Widget w, XtPointer clientData,
|
||||||
XtPointer ptr)
|
XtPointer ptr)
|
||||||
{
|
{
|
||||||
wxMenu *menu = (wxMenu *)clientData;
|
wxMenu *menu = (wxMenu *)clientData;
|
||||||
|
|
||||||
// Added by JOREL Jean-Charles <jjorel@silr.ireste.fr>
|
// Added by JOREL Jean-Charles <jjorel@silr.ireste.fr>
|
||||||
/* Since Callbacks of MenuItems are not yet processed, we put a
|
/* Since Callbacks of MenuItems are not yet processed, we put a
|
||||||
* background job which will be done when system will be idle.
|
* background job which will be done when system will be idle.
|
||||||
* What awful hack!! :(
|
* What awful hack!! :(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WorkProcMenuId = XtAppAddWorkProc(
|
WorkProcMenuId = XtAppAddWorkProc(
|
||||||
(XtAppContext) wxTheApp->GetAppContext(),
|
(XtAppContext) wxTheApp->GetAppContext(),
|
||||||
(XtWorkProc) PostDeletionOfMenu,
|
(XtWorkProc) PostDeletionOfMenu,
|
||||||
(XtPointer) menu );
|
(XtPointer) menu );
|
||||||
// Apparently not found in Motif headers
|
// Apparently not found in Motif headers
|
||||||
@@ -947,12 +945,12 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
|||||||
Arg args[5];
|
Arg args[5];
|
||||||
XtSetArg (args[0], XmNnumColumns, m_numColumns);
|
XtSetArg (args[0], XmNnumColumns, m_numColumns);
|
||||||
XtSetArg (args[1], XmNpacking, XmPACK_COLUMN);
|
XtSetArg (args[1], XmNpacking, XmPACK_COLUMN);
|
||||||
|
|
||||||
if (!pullDown)
|
if (!pullDown)
|
||||||
{
|
{
|
||||||
menu = XmCreatePopupMenu ((Widget) parent, "popup", args, 2);
|
menu = XmCreatePopupMenu ((Widget) parent, "popup", args, 2);
|
||||||
XtAddCallback(menu,
|
XtAddCallback(menu,
|
||||||
XmNunmapCallback,
|
XmNunmapCallback,
|
||||||
(XtCallbackProc)wxMenuPopdownCallback,
|
(XtCallbackProc)wxMenuPopdownCallback,
|
||||||
(XtPointer)this);
|
(XtPointer)this);
|
||||||
}
|
}
|
||||||
@@ -960,9 +958,9 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
|||||||
{
|
{
|
||||||
char mnem = wxFindMnemonic (title);
|
char mnem = wxFindMnemonic (title);
|
||||||
wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
|
wxStripMenuCodes ((char*) (const char*) title, wxBuffer);
|
||||||
|
|
||||||
menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2);
|
menu = XmCreatePulldownMenu ((Widget) parent, "pulldown", args, 2);
|
||||||
|
|
||||||
XmString label_str = XmStringCreateSimple (wxBuffer);
|
XmString label_str = XmStringCreateSimple (wxBuffer);
|
||||||
buttonWidget = XtVaCreateManagedWidget (wxBuffer,
|
buttonWidget = XtVaCreateManagedWidget (wxBuffer,
|
||||||
#if wxUSE_GADGETS
|
#if wxUSE_GADGETS
|
||||||
@@ -973,44 +971,44 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
|||||||
XmNlabelString, label_str,
|
XmNlabelString, label_str,
|
||||||
XmNsubMenuId, menu,
|
XmNsubMenuId, menu,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (mnem != 0)
|
if (mnem != 0)
|
||||||
XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
|
XtVaSetValues (buttonWidget, XmNmnemonic, mnem, NULL);
|
||||||
|
|
||||||
XmStringFree (label_str);
|
XmStringFree (label_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_menuWidget = (WXWidget) menu;
|
m_menuWidget = (WXWidget) menu;
|
||||||
|
|
||||||
m_menuBar = menuBar;
|
m_menuBar = menuBar;
|
||||||
m_topLevelMenu = topMenu;
|
m_topLevelMenu = topMenu;
|
||||||
|
|
||||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||||
item->CreateItem (menu, menuBar, topMenu);
|
item->CreateItem (menu, menuBar, topMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetBackgroundColour(m_backgroundColour);
|
SetBackgroundColour(m_backgroundColour);
|
||||||
SetForegroundColour(m_foregroundColour);
|
SetForegroundColour(m_foregroundColour);
|
||||||
SetFont(m_font);
|
SetFont(m_font);
|
||||||
|
|
||||||
return buttonWidget;
|
return buttonWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroys the Motif implementation of the menu,
|
// Destroys the Motif implementation of the menu,
|
||||||
// but maintains the wxWindows data structures so we can
|
// but maintains the wxWindows data structures so we can
|
||||||
// do a CreateMenu again.
|
// do a CreateMenu again.
|
||||||
void wxMenu::DestroyMenu (bool full)
|
void wxMenu::DestroyMenu (bool full)
|
||||||
{
|
{
|
||||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||||
item->SetMenuBar((wxMenuBar*) NULL);
|
item->SetMenuBar((wxMenuBar*) NULL);
|
||||||
|
|
||||||
item->DestroyItem(full);
|
item->DestroyItem(full);
|
||||||
} // for()
|
}// for()
|
||||||
|
|
||||||
if (m_buttonWidget)
|
if (m_buttonWidget)
|
||||||
{
|
{
|
||||||
if (full)
|
if (full)
|
||||||
@@ -1035,7 +1033,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
|
|||||||
*it = (wxMenuItem*) NULL;
|
*it = (wxMenuItem*) NULL;
|
||||||
return m_buttonWidget;
|
return m_buttonWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||||
{
|
{
|
||||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||||
@@ -1045,7 +1043,7 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
|
|||||||
*it = item;
|
*it = item;
|
||||||
return item->GetButtonWidget();
|
return item->GetButtonWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetSubMenu())
|
if (item->GetSubMenu())
|
||||||
{
|
{
|
||||||
WXWidget w = item->GetSubMenu()->FindMenuItem (id, it);
|
WXWidget w = item->GetSubMenu()->FindMenuItem (id, it);
|
||||||
@@ -1054,8 +1052,8 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // for()
|
}// for()
|
||||||
|
|
||||||
if (it)
|
if (it)
|
||||||
*it = (wxMenuItem*) NULL;
|
*it = (wxMenuItem*) NULL;
|
||||||
return (WXWidget) NULL;
|
return (WXWidget) NULL;
|
||||||
@@ -1068,7 +1066,7 @@ void wxMenu::SetBackgroundColour(const wxColour& col)
|
|||||||
wxDoChangeBackgroundColour(m_menuWidget, (wxColour&) col);
|
wxDoChangeBackgroundColour(m_menuWidget, (wxColour&) col);
|
||||||
if (m_buttonWidget)
|
if (m_buttonWidget)
|
||||||
wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE);
|
wxDoChangeBackgroundColour(m_buttonWidget, (wxColour&) col, TRUE);
|
||||||
|
|
||||||
wxNode* node = m_menuItems.First();
|
wxNode* node = m_menuItems.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -1091,7 +1089,7 @@ void wxMenu::SetForegroundColour(const wxColour& col)
|
|||||||
wxDoChangeForegroundColour(m_menuWidget, (wxColour&) col);
|
wxDoChangeForegroundColour(m_menuWidget, (wxColour&) col);
|
||||||
if (m_buttonWidget)
|
if (m_buttonWidget)
|
||||||
wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
|
wxDoChangeForegroundColour(m_buttonWidget, (wxColour&) col);
|
||||||
|
|
||||||
wxNode* node = m_menuItems.First();
|
wxNode* node = m_menuItems.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -1110,12 +1108,12 @@ void wxMenu::SetForegroundColour(const wxColour& col)
|
|||||||
void wxMenu::ChangeFont(bool keepOriginalSize)
|
void wxMenu::ChangeFont(bool keepOriginalSize)
|
||||||
{
|
{
|
||||||
// lesstif 0.87 hangs when setting XmNfontList
|
// lesstif 0.87 hangs when setting XmNfontList
|
||||||
#ifndef LESSTIF_VERSION
|
#ifndef LESSTIF_VERSION
|
||||||
if (!m_font.Ok() || !m_menuWidget)
|
if (!m_font.Ok() || !m_menuWidget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_menuWidget));
|
XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_menuWidget));
|
||||||
|
|
||||||
XtVaSetValues ((Widget) m_menuWidget,
|
XtVaSetValues ((Widget) m_menuWidget,
|
||||||
XmNfontList, fontList,
|
XmNfontList, fontList,
|
||||||
NULL);
|
NULL);
|
||||||
@@ -1150,7 +1148,7 @@ void wxMenu::SetFont(const wxFont& font)
|
|||||||
|
|
||||||
void wxMenuBar::SetBackgroundColour(const wxColour& col)
|
void wxMenuBar::SetBackgroundColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_backgroundColour = col;
|
m_backgroundColour = col;
|
||||||
if (m_mainWidget)
|
if (m_mainWidget)
|
||||||
wxDoChangeBackgroundColour(m_mainWidget, (wxColour&) col);
|
wxDoChangeBackgroundColour(m_mainWidget, (wxColour&) col);
|
||||||
@@ -1164,7 +1162,7 @@ void wxMenuBar::SetForegroundColour(const wxColour& col)
|
|||||||
m_foregroundColour = col;
|
m_foregroundColour = col;
|
||||||
if (m_mainWidget)
|
if (m_mainWidget)
|
||||||
wxDoChangeForegroundColour(m_mainWidget, (wxColour&) col);
|
wxDoChangeForegroundColour(m_mainWidget, (wxColour&) col);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_menuCount; i++)
|
for (i = 0; i < m_menuCount; i++)
|
||||||
m_menus[i]->SetForegroundColour((wxColour&) col);
|
m_menus[i]->SetForegroundColour((wxColour&) col);
|
||||||
@@ -1179,7 +1177,7 @@ void wxMenuBar::SetFont(const wxFont& font)
|
|||||||
{
|
{
|
||||||
m_font = font;
|
m_font = font;
|
||||||
ChangeFont();
|
ChangeFont();
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_menuCount; i++)
|
for (i = 0; i < m_menuCount; i++)
|
||||||
m_menus[i]->SetFont(font);
|
m_menus[i]->SetFont(font);
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* in Create(). The cells are freed on the next call to Create()
|
* in Create(). The cells are freed on the next call to Create()
|
||||||
* or when the destructor is called.
|
* or when the destructor is called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Wolfram Gloger <u7y22ab@sunmail.lrz-muenchen.de>
|
/* Wolfram Gloger <u7y22ab@sunmail.lrz-muenchen.de>
|
||||||
I have implemented basic colormap support for the X11 versions of
|
I have implemented basic colormap support for the X11 versions of
|
||||||
wxWindows, notably wxPalette::Create(). The way I did it is to
|
wxWindows, notably wxPalette::Create(). The way I did it is to
|
||||||
@@ -71,11 +71,10 @@ wxPaletteRefData::wxPaletteRefData()
|
|||||||
|
|
||||||
wxPaletteRefData::~wxPaletteRefData()
|
wxPaletteRefData::~wxPaletteRefData()
|
||||||
{
|
{
|
||||||
XColor xcol;
|
|
||||||
Display *display = (Display*) NULL;
|
Display *display = (Display*) NULL;
|
||||||
|
|
||||||
wxNode *node, *next;
|
wxNode *node, *next;
|
||||||
|
|
||||||
for (node = m_palettes.First(); node; node = next) {
|
for (node = m_palettes.First(); node; node = next) {
|
||||||
wxXPalette *c = (wxXPalette *)node->Data();
|
wxXPalette *c = (wxXPalette *)node->Data();
|
||||||
unsigned long *pix_array = c->m_pix_array;
|
unsigned long *pix_array = c->m_pix_array;
|
||||||
@@ -83,7 +82,7 @@ wxPaletteRefData::~wxPaletteRefData()
|
|||||||
bool destroyable = c->m_destroyable;
|
bool destroyable = c->m_destroyable;
|
||||||
int pix_array_n = c->m_pix_array_n;
|
int pix_array_n = c->m_pix_array_n;
|
||||||
display = (Display*) c->m_display;
|
display = (Display*) c->m_display;
|
||||||
|
|
||||||
if (pix_array_n > 0)
|
if (pix_array_n > 0)
|
||||||
{
|
{
|
||||||
// XFreeColors(display, cmap, pix_array, pix_array_n, 0);
|
// XFreeColors(display, cmap, pix_array, pix_array_n, 0);
|
||||||
@@ -96,10 +95,10 @@ wxPaletteRefData::~wxPaletteRefData()
|
|||||||
}
|
}
|
||||||
delete [] pix_array;
|
delete [] pix_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destroyable)
|
if (destroyable)
|
||||||
XFreeColormap(display, cmap);
|
XFreeColormap(display, cmap);
|
||||||
|
|
||||||
next = node->Next();
|
next = node->Next();
|
||||||
m_palettes.DeleteNode(node);
|
m_palettes.DeleteNode(node);
|
||||||
delete c;
|
delete c;
|
||||||
@@ -122,26 +121,26 @@ wxPalette::~wxPalette()
|
|||||||
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
|
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
if (!n) {
|
if (!n) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_refData = new wxPaletteRefData;
|
m_refData = new wxPaletteRefData;
|
||||||
|
|
||||||
XColor xcol;
|
XColor xcol;
|
||||||
Display* display = (Display*) wxGetDisplay();
|
Display* display = (Display*) wxGetDisplay();
|
||||||
|
|
||||||
unsigned long *pix_array;
|
unsigned long *pix_array;
|
||||||
Colormap cmap;
|
Colormap cmap;
|
||||||
int pix_array_n;
|
int pix_array_n;
|
||||||
|
|
||||||
cmap = (Colormap) wxTheApp->GetMainColormap(display);
|
cmap = (Colormap) wxTheApp->GetMainColormap(display);
|
||||||
|
|
||||||
pix_array = new unsigned long[n];
|
pix_array = new unsigned long[n];
|
||||||
if (!pix_array)
|
if (!pix_array)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pix_array_n = n;
|
pix_array_n = n;
|
||||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||||
for(int i = 0; i < n; i++) {
|
for(int i = 0; i < n; i++) {
|
||||||
@@ -150,16 +149,16 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
|
|||||||
xcol.blue = (unsigned short)blue[i] << 8;
|
xcol.blue = (unsigned short)blue[i] << 8;
|
||||||
pix_array[i] = (XAllocColor(display, cmap, &xcol) == 0) ? 0 : xcol.pixel;
|
pix_array[i] = (XAllocColor(display, cmap, &xcol) == 0) ? 0 : xcol.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxXPalette *c = new wxXPalette;
|
wxXPalette *c = new wxXPalette;
|
||||||
|
|
||||||
c->m_pix_array_n = pix_array_n;
|
c->m_pix_array_n = pix_array_n;
|
||||||
c->m_pix_array = pix_array;
|
c->m_pix_array = pix_array;
|
||||||
c->m_cmap = (WXColormap) cmap;
|
c->m_cmap = (WXColormap) cmap;
|
||||||
c->m_display = (WXDisplay*) display;
|
c->m_display = (WXDisplay*) display;
|
||||||
c->m_destroyable = FALSE;
|
c->m_destroyable = FALSE;
|
||||||
M_PALETTEDATA->m_palettes.Append(c);
|
M_PALETTEDATA->m_palettes.Append(c);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +166,7 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
|
|||||||
{
|
{
|
||||||
if ( !m_refData )
|
if ( !m_refData )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -176,10 +175,10 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi
|
|||||||
{
|
{
|
||||||
if ( !m_refData )
|
if ( !m_refData )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (index < 0 || index > 255)
|
if (index < 0 || index > 255)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -188,7 +187,7 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
|||||||
{
|
{
|
||||||
if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.Number() == 0))
|
if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.Number() == 0))
|
||||||
return wxTheApp->GetMainColormap(display);
|
return wxTheApp->GetMainColormap(display);
|
||||||
|
|
||||||
wxNode* node = M_PALETTEDATA->m_palettes.First();
|
wxNode* node = M_PALETTEDATA->m_palettes.First();
|
||||||
if (!display && node)
|
if (!display && node)
|
||||||
{
|
{
|
||||||
@@ -200,22 +199,22 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
|||||||
wxXPalette* p = (wxXPalette*) node->Data();
|
wxXPalette* p = (wxXPalette*) node->Data();
|
||||||
if (p->m_display == display)
|
if (p->m_display == display)
|
||||||
return p->m_cmap;
|
return p->m_cmap;
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a new one: */
|
/* Make a new one: */
|
||||||
wxXPalette *c = new wxXPalette;
|
wxXPalette *c = new wxXPalette;
|
||||||
wxXPalette *first = (wxXPalette *)M_PALETTEDATA->m_palettes.First()->Data();
|
wxXPalette *first = (wxXPalette *)M_PALETTEDATA->m_palettes.First()->Data();
|
||||||
XColor xcol;
|
XColor xcol;
|
||||||
int pix_array_n = first->m_pix_array_n;
|
int pix_array_n = first->m_pix_array_n;
|
||||||
|
|
||||||
c->m_pix_array_n = pix_array_n;
|
c->m_pix_array_n = pix_array_n;
|
||||||
c->m_pix_array = new unsigned long[pix_array_n];
|
c->m_pix_array = new unsigned long[pix_array_n];
|
||||||
c->m_display = display;
|
c->m_display = display;
|
||||||
c->m_cmap = wxTheApp->GetMainColormap(display);
|
c->m_cmap = wxTheApp->GetMainColormap(display);
|
||||||
c->m_destroyable = FALSE;
|
c->m_destroyable = FALSE;
|
||||||
|
|
||||||
xcol.flags = DoRed | DoGreen | DoBlue;
|
xcol.flags = DoRed | DoGreen | DoBlue;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < pix_array_n; i++)
|
for (i = 0; i < pix_array_n; i++)
|
||||||
@@ -225,11 +224,11 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
|
|||||||
c->m_pix_array[i] =
|
c->m_pix_array[i] =
|
||||||
(XAllocColor((Display*) display, (Colormap) c->m_cmap, &xcol) == 0) ? 0 : xcol.pixel;
|
(XAllocColor((Display*) display, (Colormap) c->m_cmap, &xcol) == 0) ? 0 : xcol.pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wxPalette* nonConstThis = (wxPalette*) this;
|
// wxPalette* nonConstThis = (wxPalette*) this;
|
||||||
|
|
||||||
M_PALETTEDATA->m_palettes.Append(c);
|
M_PALETTEDATA->m_palettes.Append(c);
|
||||||
|
|
||||||
return c->m_cmap;
|
return c->m_cmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,7 +246,7 @@ bool wxPalette::TransferBitmap(void *data, int depth, int size)
|
|||||||
*uptr = (unsigned char)pix_array[*uptr];
|
*uptr = (unsigned char)pix_array[*uptr];
|
||||||
uptr++;
|
uptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -315,7 +314,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
|
|||||||
if (!M_PALETTEDATA)
|
if (!M_PALETTEDATA)
|
||||||
return (unsigned long*) 0;
|
return (unsigned long*) 0;
|
||||||
wxNode *node;
|
wxNode *node;
|
||||||
|
|
||||||
for (node = M_PALETTEDATA->m_palettes.First(); node; node = node->Next())
|
for (node = M_PALETTEDATA->m_palettes.First(); node; node = node->Next())
|
||||||
{
|
{
|
||||||
wxXPalette *c = (wxXPalette *)node->Data();
|
wxXPalette *c = (wxXPalette *)node->Data();
|
||||||
@@ -326,7 +325,7 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
|
|||||||
return c->m_pix_array;
|
return c->m_pix_array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not found; call GetXColormap, which will create it, then this again */
|
/* Not found; call GetXColormap, which will create it, then this again */
|
||||||
if (GetXColormap(display))
|
if (GetXColormap(display))
|
||||||
return GetXPixArray(display, n);
|
return GetXPixArray(display, n);
|
||||||
@@ -337,17 +336,17 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
|
|||||||
void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp)
|
void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxPaletteRefData;
|
m_refData = new wxPaletteRefData;
|
||||||
|
|
||||||
wxXPalette *c = new wxXPalette;
|
wxXPalette *c = new wxXPalette;
|
||||||
|
|
||||||
c->m_pix_array_n = 0;
|
c->m_pix_array_n = 0;
|
||||||
c->m_pix_array = (unsigned long*) NULL;
|
c->m_pix_array = (unsigned long*) NULL;
|
||||||
c->m_display = display;
|
c->m_display = display;
|
||||||
c->m_cmap = cm;
|
c->m_cmap = cm;
|
||||||
c->m_destroyable = dp;
|
c->m_destroyable = dp;
|
||||||
|
|
||||||
M_PALETTEDATA->m_palettes.Append(c);
|
M_PALETTEDATA->m_palettes.Append(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -36,7 +36,7 @@ END_EVENT_TABLE()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void wxToolButtonCallback (Widget w, XtPointer clientData,
|
static void wxToolButtonCallback (Widget w, XtPointer clientData,
|
||||||
XtPointer ptr);
|
XtPointer ptr);
|
||||||
static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
|
static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
|
||||||
XEvent *event, Boolean *continue_to_dispatch);
|
XEvent *event, Boolean *continue_to_dispatch);
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
|||||||
{
|
{
|
||||||
m_maxWidth = -1;
|
m_maxWidth = -1;
|
||||||
m_maxHeight = -1;
|
m_maxHeight = -1;
|
||||||
|
|
||||||
m_defaultWidth = 24;
|
m_defaultWidth = 24;
|
||||||
m_defaultHeight = 22;
|
m_defaultHeight = 22;
|
||||||
SetName(name);
|
SetName(name);
|
||||||
@@ -113,7 +113,7 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
|
|||||||
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
|
||||||
|
|
||||||
ChangeBackgroundColour();
|
ChangeBackgroundColour();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,15 +158,15 @@ bool wxToolBar::CreateTools()
|
|||||||
|
|
||||||
if (tool->m_isToggle)
|
if (tool->m_isToggle)
|
||||||
{
|
{
|
||||||
button = XtVaCreateWidget("toggleButton",
|
button = XtVaCreateWidget("toggleButton",
|
||||||
xmToggleButtonWidgetClass, (Widget) m_mainWidget,
|
xmToggleButtonWidgetClass, (Widget) m_mainWidget,
|
||||||
XmNx, currentX, XmNy, currentY,
|
XmNx, currentX, XmNy, currentY,
|
||||||
// XmNpushButtonEnabled, True,
|
// XmNpushButtonEnabled, True,
|
||||||
XmNmultiClick, XmMULTICLICK_KEEP,
|
XmNmultiClick, XmMULTICLICK_KEEP,
|
||||||
XmNlabelType, XmPIXMAP,
|
XmNlabelType, XmPIXMAP,
|
||||||
NULL);
|
NULL);
|
||||||
XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
|
XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
|
||||||
(XtPointer) this);
|
(XtPointer) this);
|
||||||
|
|
||||||
XtVaSetValues ((Widget) button,
|
XtVaSetValues ((Widget) button,
|
||||||
XmNselectColor, m_backgroundColour.AllocColour(XtDisplay((Widget) button)),
|
XmNselectColor, m_backgroundColour.AllocColour(XtDisplay((Widget) button)),
|
||||||
@@ -174,7 +174,7 @@ bool wxToolBar::CreateTools()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
button = XtVaCreateWidget("button",
|
button = XtVaCreateWidget("button",
|
||||||
xmPushButtonWidgetClass, (Widget) m_mainWidget,
|
xmPushButtonWidgetClass, (Widget) m_mainWidget,
|
||||||
XmNx, currentX, XmNy, currentY,
|
XmNx, currentX, XmNy, currentY,
|
||||||
XmNpushButtonEnabled, True,
|
XmNpushButtonEnabled, True,
|
||||||
@@ -198,12 +198,12 @@ bool wxToolBar::CreateTools()
|
|||||||
{
|
{
|
||||||
int backgroundPixel;
|
int backgroundPixel;
|
||||||
XtVaGetValues(button, XmNbackground, &backgroundPixel,
|
XtVaGetValues(button, XmNbackground, &backgroundPixel,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
|
||||||
wxColour col;
|
wxColour col;
|
||||||
col.SetPixel(backgroundPixel);
|
col.SetPixel(backgroundPixel);
|
||||||
|
|
||||||
wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap1, col);
|
wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap1, col);
|
||||||
|
|
||||||
tool->m_bitmap1 = newBitmap;
|
tool->m_bitmap1 = newBitmap;
|
||||||
@@ -214,10 +214,10 @@ bool wxToolBar::CreateTools()
|
|||||||
int backgroundPixel;
|
int backgroundPixel;
|
||||||
if (tool->m_isToggle)
|
if (tool->m_isToggle)
|
||||||
XtVaGetValues(button, XmNselectColor, &backgroundPixel,
|
XtVaGetValues(button, XmNselectColor, &backgroundPixel,
|
||||||
NULL);
|
NULL);
|
||||||
else
|
else
|
||||||
XtVaGetValues(button, XmNarmColor, &backgroundPixel,
|
XtVaGetValues(button, XmNarmColor, &backgroundPixel,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
wxColour col;
|
wxColour col;
|
||||||
col.SetPixel(backgroundPixel);
|
col.SetPixel(backgroundPixel);
|
||||||
@@ -235,7 +235,7 @@ bool wxToolBar::CreateTools()
|
|||||||
{
|
{
|
||||||
wxBitmap newBitmap = wxCreateMaskedBitmap(originalBitmap, col);
|
wxBitmap newBitmap = wxCreateMaskedBitmap(originalBitmap, col);
|
||||||
tool->m_bitmap2 = newBitmap;
|
tool->m_bitmap2 = newBitmap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tool->m_bitmap2 = tool->m_bitmap1;
|
tool->m_bitmap2 = tool->m_bitmap1;
|
||||||
}
|
}
|
||||||
@@ -264,11 +264,11 @@ bool wxToolBar::CreateTools()
|
|||||||
}
|
}
|
||||||
XtVaSetValues (button,
|
XtVaSetValues (button,
|
||||||
XmNindicatorOn, False,
|
XmNindicatorOn, False,
|
||||||
XmNshadowThickness, 2,
|
XmNshadowThickness, 2,
|
||||||
// XmNborderWidth, 0,
|
// XmNborderWidth, 0,
|
||||||
// XmNspacing, 0,
|
// XmNspacing, 0,
|
||||||
XmNmarginWidth, 0,
|
XmNmarginWidth, 0,
|
||||||
XmNmarginHeight, 0,
|
XmNmarginHeight, 0,
|
||||||
XmNfillOnSelect, True,
|
XmNfillOnSelect, True,
|
||||||
XmNlabelPixmap, pixmap,
|
XmNlabelPixmap, pixmap,
|
||||||
XmNselectPixmap, pixmap2,
|
XmNselectPixmap, pixmap2,
|
||||||
@@ -303,11 +303,11 @@ bool wxToolBar::CreateTools()
|
|||||||
|
|
||||||
Dimension width, height;
|
Dimension width, height;
|
||||||
XtVaGetValues(button, XmNwidth, & width, XmNheight, & height,
|
XtVaGetValues(button, XmNwidth, & width, XmNheight, & height,
|
||||||
NULL);
|
NULL);
|
||||||
currentX += width + marginX;
|
currentX += width + marginX;
|
||||||
buttonHeight = wxMax(buttonHeight, height);
|
buttonHeight = wxMax(buttonHeight, height);
|
||||||
|
|
||||||
XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
|
XtAddEventHandler (button, EnterWindowMask | LeaveWindowMask,
|
||||||
False, wxToolButtonPopupCallback, (XtPointer) this);
|
False, wxToolButtonPopupCallback, (XtPointer) this);
|
||||||
m_widgets.Append(tool->m_index, (wxObject*) button);
|
m_widgets.Append(tool->m_index, (wxObject*) button);
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ WXWidget wxToolBar::GetMainWidget() const
|
|||||||
|
|
||||||
|
|
||||||
void wxToolButtonCallback (Widget w, XtPointer clientData,
|
void wxToolButtonCallback (Widget w, XtPointer clientData,
|
||||||
XtPointer ptr)
|
XtPointer ptr)
|
||||||
{
|
{
|
||||||
wxToolBar *toolBar = (wxToolBar *) clientData;
|
wxToolBar *toolBar = (wxToolBar *) clientData;
|
||||||
int index = toolBar->FindIndexForWidget((WXWidget) w);
|
int index = toolBar->FindIndexForWidget((WXWidget) w);
|
||||||
@@ -505,7 +505,6 @@ static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
|
|||||||
wxNode *node = toolBar->GetTools().Find((long)index);
|
wxNode *node = toolBar->GetTools().Find((long)index);
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
|
||||||
wxString str(toolBar->GetToolShortHelp(index));
|
wxString str(toolBar->GetToolShortHelp(index));
|
||||||
if (str.IsNull() || str == "")
|
if (str.IsNull() || str == "")
|
||||||
return;
|
return;
|
||||||
@@ -513,8 +512,8 @@ static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
|
|||||||
if (!wxTheToolBarTimer)
|
if (!wxTheToolBarTimer)
|
||||||
wxTheToolBarTimer = new wxToolBarTimer;
|
wxTheToolBarTimer = new wxToolBarTimer;
|
||||||
|
|
||||||
wxToolBarTimer::buttonWidget = w;
|
wxToolBarTimer::buttonWidget = w;
|
||||||
wxToolBarTimer::helpString = str;
|
wxToolBarTimer::helpString = str;
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
@@ -526,7 +525,7 @@ static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
|
|||||||
{
|
{
|
||||||
XtDestroyWidget (wxToolBarTimer::help_popup);
|
XtDestroyWidget (wxToolBarTimer::help_popup);
|
||||||
XtPopdown (wxToolBarTimer::help_popup);
|
XtPopdown (wxToolBarTimer::help_popup);
|
||||||
}
|
}
|
||||||
wxToolBarTimer::help_popup = (Widget) 0;
|
wxToolBarTimer::help_popup = (Widget) 0;
|
||||||
|
|
||||||
// One shot
|
// One shot
|
||||||
@@ -544,7 +543,7 @@ static void wxToolButtonPopupCallback (Widget w, XtPointer client_data,
|
|||||||
{
|
{
|
||||||
XtDestroyWidget (wxToolBarTimer::help_popup);
|
XtDestroyWidget (wxToolBarTimer::help_popup);
|
||||||
XtPopdown (wxToolBarTimer::help_popup);
|
XtPopdown (wxToolBarTimer::help_popup);
|
||||||
}
|
}
|
||||||
wxToolBarTimer::help_popup = (Widget) 0;
|
wxToolBarTimer::help_popup = (Widget) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,16 +556,16 @@ void wxToolBarTimer::Notify()
|
|||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Create shell without window decorations */
|
/* Create shell without window decorations */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
help_popup = XtVaCreatePopupShell ("shell",
|
help_popup = XtVaCreatePopupShell ("shell",
|
||||||
overrideShellWidgetClass, (Widget) wxTheApp->GetTopLevelWidget(),
|
overrideShellWidgetClass, (Widget) wxTheApp->GetTopLevelWidget(),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Get absolute position on display of toolbar button */
|
/* Get absolute position on display of toolbar button */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
XtTranslateCoords (buttonWidget,
|
XtTranslateCoords (buttonWidget,
|
||||||
(Position) 0,
|
(Position) 0,
|
||||||
(Position) 0,
|
(Position) 0,
|
||||||
&x, &y);
|
&x, &y);
|
||||||
|
|
||||||
// Move the tooltip more or less above the button
|
// Move the tooltip more or less above the button
|
||||||
@@ -577,24 +576,24 @@ void wxToolBarTimer::Notify()
|
|||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Set the position of the help popup */
|
/* Set the position of the help popup */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
XtVaSetValues (help_popup,
|
XtVaSetValues (help_popup,
|
||||||
XmNx, (Position) x,
|
XmNx, (Position) x,
|
||||||
XmNy, (Position) y,
|
XmNy, (Position) y,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Create help label */
|
/* Create help label */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
XmString text = XmStringCreateSimple ((char*) (const char*) helpString);
|
XmString text = XmStringCreateSimple ((char*) (const char*) helpString);
|
||||||
XtVaCreateManagedWidget ("help_label",
|
XtVaCreateManagedWidget ("help_label",
|
||||||
xmLabelWidgetClass, help_popup,
|
xmLabelWidgetClass, help_popup,
|
||||||
XmNlabelString, text,
|
XmNlabelString, text,
|
||||||
XtVaTypedArg,
|
XtVaTypedArg,
|
||||||
XmNforeground, XtRString, "black",
|
XmNforeground, XtRString, "black",
|
||||||
strlen("black")+1,
|
strlen("black")+1,
|
||||||
XtVaTypedArg,
|
XtVaTypedArg,
|
||||||
XmNbackground, XtRString, "LightGoldenrod",
|
XmNbackground, XtRString, "LightGoldenrod",
|
||||||
strlen("LightGoldenrod")+1,
|
strlen("LightGoldenrod")+1,
|
||||||
NULL);
|
NULL);
|
||||||
XmStringFree (text);
|
XmStringFree (text);
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ void wxFlushEvents()
|
|||||||
Display *display = (Display*) wxGetDisplay();
|
Display *display = (Display*) wxGetDisplay();
|
||||||
|
|
||||||
XSync (display, FALSE);
|
XSync (display, FALSE);
|
||||||
XEvent event;
|
|
||||||
// XtAppPending returns availability of events AND timers/inputs, which
|
// XtAppPending returns availability of events AND timers/inputs, which
|
||||||
// are processed via callbacks, so XtAppNextEvent will not return if
|
// are processed via callbacks, so XtAppNextEvent will not return if
|
||||||
// there are no events. So added '& XtIMXEvent' - Sergey.
|
// there are no events. So added '& XtIMXEvent' - Sergey.
|
||||||
|
Reference in New Issue
Block a user