In DialogEd, changed Close to Destroy to make it shut down properly.
Various Motif fixes incl. fixing window colours, menu fonts/colours, dialog box git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1235 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1036,7 +1036,8 @@ void * wxDebugAlloc(size_t size, char * fileName, int lineNum, bool isObject, bo
|
||||
return (void *)malloc(size);
|
||||
}
|
||||
|
||||
char * buf = (char *) malloc(wxDebugContext::TotSize (size));
|
||||
int totSize = wxDebugContext::TotSize (size);
|
||||
char * buf = (char *) malloc(totSize);
|
||||
if (!buf) {
|
||||
wxLogDebug("Call to malloc (%ld) failed.", (long)size);
|
||||
return 0;
|
||||
|
@@ -1770,6 +1770,8 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
|
||||
|
||||
/* wxRadioBox/wxRadioButton */
|
||||
{ "wxRB_GROUP", wxRB_GROUP },
|
||||
{ "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS },
|
||||
{ "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS },
|
||||
{ "wxRA_HORIZONTAL", wxRA_HORIZONTAL },
|
||||
{ "wxRA_VERTICAL", wxRA_VERTICAL },
|
||||
|
||||
|
@@ -40,7 +40,7 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
|
||||
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
|
||||
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
|
||||
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
|
||||
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
|
||||
|
@@ -1369,10 +1369,10 @@ void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
|
||||
|
||||
void wxListMainWindow::OnChar( wxKeyEvent &event )
|
||||
{
|
||||
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, m_parent->GetId() );
|
||||
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
|
||||
le.m_code = event.KeyCode();
|
||||
le.SetEventObject( m_parent );
|
||||
m_parent->GetEventHandler()->ProcessEvent( le );
|
||||
le.SetEventObject( GetParent() );
|
||||
GetParent()->GetEventHandler()->ProcessEvent( le );
|
||||
|
||||
/*
|
||||
if (event.KeyCode() == WXK_TAB)
|
||||
|
@@ -40,7 +40,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
SetValidator(validator);
|
||||
m_noStrings = n;
|
||||
m_windowStyle = style;
|
||||
m_backgroundColour = parent->GetBackgroundColour();
|
||||
// m_backgroundColour = parent->GetBackgroundColour();
|
||||
m_backgroundColour = * wxWHITE;
|
||||
m_foregroundColour = parent->GetForegroundColour();
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
@@ -117,9 +117,10 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
wxASSERT_MSG( (parentWidget != (Widget) 0), "Could not find a suitable parent shell for dialog." );
|
||||
|
||||
Arg args[1];
|
||||
Arg args[2];
|
||||
XtSetArg (args[0], XmNdefaultPosition, False);
|
||||
Widget dialogShell = XmCreateBulletinBoardDialog(parentWidget, (char*) (const char*) name, args, 1);
|
||||
XtSetArg (args[1], XmNautoUnmanage, False);
|
||||
Widget dialogShell = XmCreateBulletinBoardDialog(parentWidget, (char*) (const char*) name, args, 2);
|
||||
m_mainWidget = (WXWidget) dialogShell;
|
||||
|
||||
// We don't want margins, since there is enough elsewhere.
|
||||
@@ -474,7 +475,8 @@ int wxDialog::ShowModal()
|
||||
wxModalShowingStack.Insert((wxObject *)TRUE);
|
||||
|
||||
m_modalShowing = TRUE;
|
||||
XtAddGrab((Widget) m_mainWidget, TRUE, FALSE);
|
||||
// XtAddGrab((Widget) m_mainWidget, TRUE, FALSE);
|
||||
|
||||
XEvent event;
|
||||
|
||||
// Loop until we signal that the dialog should be closed
|
||||
@@ -710,18 +712,20 @@ static void wxUnmapBulletinBoard(Widget WXUNUSED(dialog), wxDialog *WXUNUSED(cli
|
||||
*/
|
||||
}
|
||||
|
||||
void wxDialog::ChangeFont(bool WXUNUSED(keepOriginalSize))
|
||||
void wxDialog::ChangeFont(bool keepOriginalSize)
|
||||
{
|
||||
// TODO
|
||||
wxWindow::ChangeFont(keepOriginalSize);
|
||||
}
|
||||
|
||||
void wxDialog::ChangeBackgroundColour()
|
||||
{
|
||||
// TODO
|
||||
if (GetMainWidget())
|
||||
DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
|
||||
}
|
||||
|
||||
void wxDialog::ChangeForegroundColour()
|
||||
{
|
||||
// TODO
|
||||
if (GetMainWidget())
|
||||
DoChangeForegroundColour(GetMainWidget(), m_foregroundColour);
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,8 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
m_windowStyle = style;
|
||||
m_noItems = n;
|
||||
m_selected = 0;
|
||||
m_backgroundColour = parent->GetBackgroundColour();
|
||||
// m_backgroundColour = parent->GetBackgroundColour();
|
||||
m_backgroundColour = * wxWHITE;
|
||||
m_foregroundColour = parent->GetForegroundColour();
|
||||
|
||||
SetName(name);
|
||||
@@ -760,9 +761,10 @@ void wxListBox::ChangeBackgroundColour()
|
||||
|
||||
/* TODO: should scrollbars be affected? Should probably have separate
|
||||
* function to change them (by default, taken from wxSystemSettings)
|
||||
DoChangeBackgroundColour((WXWidget) hsb, m_backgroundColour, TRUE);
|
||||
DoChangeBackgroundColour((WXWidget) vsb, m_backgroundColour, TRUE);
|
||||
*/
|
||||
*/
|
||||
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
||||
DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
||||
|
||||
DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
|
||||
}
|
||||
|
@@ -91,7 +91,6 @@ LIB_CPP_SRC=\
|
||||
dcmemory.cpp \
|
||||
dcscreen.cpp \
|
||||
dialog.cpp \
|
||||
dirdlg.cpp \
|
||||
dnd.cpp \
|
||||
filedlg.cpp \
|
||||
font.cpp \
|
||||
@@ -136,6 +135,7 @@ LIB_CPP_SRC=\
|
||||
\
|
||||
../generic/choicdgg.cpp \
|
||||
../generic/colrdlgg.cpp \
|
||||
../generic/dirdlgg.cpp \
|
||||
../generic/fontdlgg.cpp \
|
||||
../generic/gridg.cpp \
|
||||
../generic/helpext.cpp \
|
||||
@@ -156,6 +156,7 @@ LIB_CPP_SRC=\
|
||||
|
||||
# If you're not using the generic ones, you
|
||||
# may wish to define platform-specific ones
|
||||
# dirdlg.cpp \
|
||||
# treectrl.cpp \
|
||||
# listctrl.cpp \
|
||||
# imaglist.cpp \
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "wx/utils.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/settings.h"
|
||||
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/LabelG.h>
|
||||
@@ -81,6 +82,9 @@ wxMenu::wxMenu(const wxString& title, const wxFunction func)
|
||||
Append(ID_SEPARATOR, m_title) ;
|
||||
AppendSeparator() ;
|
||||
}
|
||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
|
||||
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
|
||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
|
||||
Callback(func);
|
||||
}
|
||||
@@ -456,6 +460,9 @@ wxMenuBar::wxMenuBar()
|
||||
m_titles = NULL;
|
||||
m_menuBarFrame = NULL;
|
||||
m_mainWidget = (WXWidget) NULL;
|
||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
|
||||
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
|
||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
|
||||
@@ -468,6 +475,9 @@ wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
|
||||
for ( i = 0; i < n; i++ )
|
||||
m_titles[i] = titles[i];
|
||||
m_menuBarFrame = NULL;
|
||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENU);
|
||||
m_foregroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_MENUTEXT);
|
||||
m_font = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
}
|
||||
|
||||
wxMenuBar::~wxMenuBar()
|
||||
@@ -781,6 +791,10 @@ bool wxMenuBar::CreateMenuBar(wxFrame* parent)
|
||||
XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL);
|
||||
}
|
||||
|
||||
SetBackgroundColour(m_backgroundColour);
|
||||
SetForegroundColour(m_foregroundColour);
|
||||
SetFont(m_font);
|
||||
|
||||
XtVaSetValues((Widget) parent->GetMainWindowWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL);
|
||||
XtRealizeWidget ((Widget) menuBarW);
|
||||
XtManageChild ((Widget) menuBarW);
|
||||
@@ -921,6 +935,10 @@ WXWidget wxMenu::CreateMenu (wxMenuBar * menuBar, WXWidget parent, wxMenu * topM
|
||||
item->CreateItem (menu, menuBar, topMenu);
|
||||
}
|
||||
|
||||
SetBackgroundColour(m_backgroundColour);
|
||||
SetForegroundColour(m_foregroundColour);
|
||||
SetFont(m_font);
|
||||
|
||||
return buttonWidget;
|
||||
}
|
||||
|
||||
@@ -986,3 +1004,128 @@ WXWidget wxMenu::FindMenuItem (int id, wxMenuItem ** it) const
|
||||
*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);
|
||||
|
||||
wxNode* node = m_menuItems.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem* item = (wxMenuItem*) node->Data();
|
||||
if (item->GetButtonWidget())
|
||||
{
|
||||
// This crashes because it uses gadgets
|
||||
// wxDoChangeBackgroundColour(item->GetButtonWidget(), (wxColour&) col, TRUE);
|
||||
}
|
||||
if (item->GetSubMenu())
|
||||
item->GetSubMenu()->SetBackgroundColour((wxColour&) col);
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
wxNode* node = m_menuItems.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem* item = (wxMenuItem*) node->Data();
|
||||
if (item->GetButtonWidget())
|
||||
{
|
||||
// This crashes because it uses gadgets
|
||||
// wxDoChangeForegroundColour(item->GetButtonWidget(), (wxColour&) col);
|
||||
}
|
||||
if (item->GetSubMenu())
|
||||
item->GetSubMenu()->SetForegroundColour((wxColour&) col);
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
wxNode* node = m_menuItems.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem* item = (wxMenuItem*) node->Data();
|
||||
if (m_menuWidget && item->GetButtonWidget() && m_font.Ok())
|
||||
{
|
||||
XtVaSetValues ((Widget) item->GetButtonWidget(),
|
||||
XmNfontList, fontList,
|
||||
NULL);
|
||||
}
|
||||
if (item->GetSubMenu())
|
||||
item->GetSubMenu()->ChangeFont(keepOriginalSize);
|
||||
node = node->Next();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxMenu::SetFont(const wxFont& font)
|
||||
{
|
||||
m_font = font;
|
||||
ChangeFont();
|
||||
}
|
||||
|
||||
void wxMenuBar::SetBackgroundColour(const wxColour& col)
|
||||
{
|
||||
|
||||
m_backgroundColour = col;
|
||||
if (m_mainWidget)
|
||||
wxDoChangeBackgroundColour(m_mainWidget, (wxColour&) col);
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
m_menus[i]->SetBackgroundColour((wxColour&) col);
|
||||
}
|
||||
|
||||
void wxMenuBar::SetForegroundColour(const wxColour& col)
|
||||
{
|
||||
m_foregroundColour = col;
|
||||
if (m_mainWidget)
|
||||
wxDoChangeForegroundColour(m_mainWidget, (wxColour&) col);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
m_menus[i]->SetForegroundColour((wxColour&) col);
|
||||
}
|
||||
|
||||
void wxMenuBar::ChangeFont(bool keepOriginalSize)
|
||||
{
|
||||
// Nothing to do for menubar, fonts are kept in wxMenus
|
||||
}
|
||||
|
||||
void wxMenuBar::SetFont(const wxFont& font)
|
||||
{
|
||||
m_font = font;
|
||||
ChangeFont();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
m_menus[i]->SetFont(font);
|
||||
}
|
||||
|
||||
|
@@ -386,17 +386,46 @@ void wxRadioBox::Command (wxCommandEvent & event)
|
||||
|
||||
void wxRadioBox::ChangeFont(bool keepOriginalSize)
|
||||
{
|
||||
// TODO
|
||||
wxWindow::ChangeFont(keepOriginalSize);
|
||||
|
||||
XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) GetTopWidget()));
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
{
|
||||
WXWidget radioButton = m_radioButtons[i];
|
||||
|
||||
XtVaSetValues ((Widget) radioButton,
|
||||
XmNfontList, fontList,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::ChangeBackgroundColour()
|
||||
{
|
||||
// TODO
|
||||
wxWindow::ChangeBackgroundColour();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
{
|
||||
WXWidget radioButton = m_radioButtons[i];
|
||||
|
||||
DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBox::ChangeForegroundColour()
|
||||
{
|
||||
// TODO
|
||||
wxWindow::ChangeForegroundColour();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
{
|
||||
WXWidget radioButton = m_radioButtons[i];
|
||||
|
||||
DoChangeForegroundColour(radioButton, m_foregroundColour);
|
||||
}
|
||||
}
|
||||
|
||||
void wxRadioBoxCallback (Widget w, XtPointer clientData,
|
||||
|
@@ -114,10 +114,11 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL);
|
||||
|
||||
m_mainWidget = (Widget) formWidget;
|
||||
m_mainWidget = (WXWidget) frameWidget;
|
||||
m_formWidget = (WXWidget) formWidget;
|
||||
|
||||
SetCanAddEventHandler(TRUE);
|
||||
AttachWidget (parent, m_mainWidget, (WXWidget) frameWidget, pos.x, pos.y, size.x, size.y);
|
||||
AttachWidget (parent, (WXWidget) frameWidget, (WXWidget) formWidget, pos.x, pos.y, size.x, size.y);
|
||||
ChangeBackgroundColour();
|
||||
|
||||
return TRUE;
|
||||
|
@@ -80,7 +80,8 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
m_modified = FALSE;
|
||||
m_processedDefault = FALSE;
|
||||
m_fileName = "";
|
||||
m_backgroundColour = parent->GetBackgroundColour();
|
||||
// m_backgroundColour = parent->GetBackgroundColour();
|
||||
m_backgroundColour = * wxWHITE;
|
||||
m_foregroundColour = parent->GetForegroundColour();
|
||||
|
||||
SetName(name);
|
||||
@@ -649,46 +650,51 @@ void wxTextCtrl::ChangeBackgroundColour()
|
||||
{
|
||||
wxWindow::ChangeBackgroundColour();
|
||||
|
||||
Widget parent = XtParent ((Widget) m_mainWidget);
|
||||
Widget hsb, vsb;
|
||||
/* TODO: should scrollbars be affected? Should probably have separate
|
||||
* function to change them (by default, taken from wxSystemSettings)
|
||||
*/
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
Widget parent = XtParent ((Widget) m_mainWidget);
|
||||
Widget hsb, vsb;
|
||||
|
||||
XtVaGetValues (parent,
|
||||
XtVaGetValues (parent,
|
||||
XmNhorizontalScrollBar, &hsb,
|
||||
XmNverticalScrollBar, &vsb,
|
||||
NULL);
|
||||
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
if (hsb)
|
||||
DoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
|
||||
if (vsb)
|
||||
DoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
|
||||
|
||||
/* TODO: should scrollbars be affected? Should probably have separate
|
||||
* function to change them (by default, taken from wxSystemSettings)
|
||||
if (hsb)
|
||||
DoChangeBackgroundColour((WXWidget) hsb, m_backgroundColour, TRUE);
|
||||
if (vsb)
|
||||
DoChangeBackgroundColour((WXWidget) vsb, m_backgroundColour, TRUE);
|
||||
*/
|
||||
|
||||
DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
|
||||
DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void wxTextCtrl::ChangeForegroundColour()
|
||||
{
|
||||
wxWindow::ChangeForegroundColour();
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
Widget parent = XtParent ((Widget) m_mainWidget);
|
||||
Widget hsb, vsb;
|
||||
|
||||
Widget parent = XtParent ((Widget) m_mainWidget);
|
||||
Widget hsb, vsb;
|
||||
|
||||
XtVaGetValues (parent,
|
||||
XtVaGetValues (parent,
|
||||
XmNhorizontalScrollBar, &hsb,
|
||||
XmNverticalScrollBar, &vsb,
|
||||
NULL);
|
||||
|
||||
/* TODO: should scrollbars be affected? Should probably have separate
|
||||
* function to change them (by default, taken from wxSystemSettings)
|
||||
if (hsb)
|
||||
DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
|
||||
if (vsb)
|
||||
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
|
||||
*/
|
||||
DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
|
||||
/* TODO: should scrollbars be affected? Should probably have separate
|
||||
* function to change them (by default, taken from wxSystemSettings)
|
||||
if (hsb)
|
||||
DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
|
||||
if (vsb)
|
||||
DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
|
||||
*/
|
||||
DoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
|
||||
}
|
||||
}
|
||||
|
||||
static void wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer ptr)
|
||||
|
@@ -182,6 +182,8 @@ bool wxToolBar::CreateTools()
|
||||
(XtPointer) this);
|
||||
}
|
||||
|
||||
DoChangeBackgroundColour((WXWidget) button, m_backgroundColour, TRUE);
|
||||
|
||||
// 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
|
||||
|
@@ -1240,3 +1240,43 @@ void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
|
||||
}
|
||||
|
||||
|
||||
// These functions duplicate those in wxWindow, but are needed
|
||||
// for use outside of wxWindow (e.g. wxMenu, wxMenuBar).
|
||||
|
||||
// Change a widget's foreground and background colours.
|
||||
|
||||
void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
|
||||
{
|
||||
// When should we specify the foreground, if it's calculated
|
||||
// by wxComputeColours?
|
||||
// Solution: say we start with the default (computed) foreground colour.
|
||||
// If we call SetForegroundColour explicitly for a control or window,
|
||||
// then the foreground is changed.
|
||||
// Therefore SetBackgroundColour computes the foreground colour, and
|
||||
// SetForegroundColour changes the foreground colour. The ordering is
|
||||
// important.
|
||||
|
||||
XtVaSetValues ((Widget) widget,
|
||||
XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
|
||||
NULL);
|
||||
}
|
||||
|
||||
void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour)
|
||||
{
|
||||
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
|
||||
(wxColour*) NULL);
|
||||
|
||||
XtVaSetValues ((Widget) widget,
|
||||
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
|
||||
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
|
||||
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
|
||||
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
|
||||
NULL);
|
||||
|
||||
if (changeArmColour)
|
||||
XtVaSetValues ((Widget) widget,
|
||||
XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -441,6 +441,10 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
NULL);
|
||||
|
||||
m_hScrollBar = (WXWidget) hScrollBar;
|
||||
|
||||
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
DoChangeBackgroundColour(m_hScrollBar, backgroundColour, TRUE);
|
||||
|
||||
m_hScroll = TRUE;
|
||||
}
|
||||
if (m_windowStyle & wxVSCROLL)
|
||||
@@ -464,9 +468,17 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
NULL);
|
||||
|
||||
m_vScrollBar = (WXWidget) vScrollBar;
|
||||
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
DoChangeBackgroundColour(m_vScrollBar, backgroundColour, TRUE);
|
||||
|
||||
m_vScroll = TRUE;
|
||||
}
|
||||
|
||||
// Scrolled widget needs to have its colour changed or we get
|
||||
// a little blue square where the scrollbars abutt
|
||||
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
|
||||
DoChangeBackgroundColour(m_scrolledWindow, backgroundColour, TRUE);
|
||||
|
||||
if (m_hScrollBar || m_vScrollBar)
|
||||
XmScrolledWindowSetAreas ((Widget) m_scrolledWindow, (Widget) m_hScrollBar, (Widget) m_vScrollBar, (Widget) m_drawingArea);
|
||||
|
||||
|
@@ -47,6 +47,7 @@ extern wxList wxPendingDelete;
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
|
||||
EVT_SIZE(wxDialog::OnSize)
|
||||
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
|
||||
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
|
||||
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
|
||||
@@ -568,6 +569,16 @@ bool wxDialog::OnClose(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||
{
|
||||
// if we're using constraints - do use them
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if ( GetAutoLayout() ) {
|
||||
Layout();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
// Compatibility
|
||||
|
@@ -90,7 +90,6 @@ LIB_CPP_SRC=\
|
||||
dcmemory.cpp \
|
||||
dcscreen.cpp \
|
||||
dialog.cpp \
|
||||
dirdlg.cpp \
|
||||
dnd.cpp \
|
||||
filedlg.cpp \
|
||||
font.cpp \
|
||||
@@ -135,6 +134,7 @@ LIB_CPP_SRC=\
|
||||
\
|
||||
../generic/choicdgg.cpp \
|
||||
../generic/colrdlgg.cpp \
|
||||
../generic/dirdlgg.cpp \
|
||||
../generic/fontdlgg.cpp \
|
||||
../generic/gridg.cpp \
|
||||
../generic/imaglist.cpp \
|
||||
@@ -154,6 +154,7 @@ LIB_CPP_SRC=\
|
||||
|
||||
# If you're not using the generic ones, you
|
||||
# may wish to define platform-specific ones
|
||||
# dirdlg.cpp \
|
||||
# treectrl.cpp \
|
||||
# listctrl.cpp \
|
||||
# imaglist.cpp \
|
||||
|
Reference in New Issue
Block a user