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:
Julian Smart
1998-12-18 14:40:38 +00:00
parent 358fc25cc3
commit 94b49b9303
31 changed files with 466 additions and 72 deletions

View File

@@ -7,7 +7,7 @@ config.sub
wx-config.in
mkinstalldirs
makeenvs/*.env
src/makeenvs/*.env
src/Makefile
src/Makefile.in

View File

@@ -4,6 +4,10 @@ docs/licence.txt
distrib/msw/*.rsp
distrib/msw/*.bat
tools/gettext/xgettext.exe
tools/gettext/msgfmt.exe
tools/gettext/msgunfmt.exe
src/makeb32.env
src/makebcc.env
src/makemsw.env

View File

@@ -33,3 +33,5 @@ docs/html/tex2rtf/*.gif
docs/html/odbc/*.htm
docs/html/gettext/*.htm

View File

@@ -258,10 +258,16 @@ Iconizes or restores the frame.
\membersection{wxFrame::IsIconized}\label{wxframeisiconized}
\func{bool}{IsIconized}{\void}
\constfunc{bool}{IsIconized}{\void}
Returns TRUE if the frame is iconized.
\membersection{wxFrame::IsMaximized}\label{wxframeismaximized}
\constfunc{bool}{IsMaximized}{\void}
Returns TRUE if the frame is maximized.
\membersection{wxFrame::LoadAccelerators}\label{wxframeloadaccelerators}
\func{void}{LoadAccelerators}{\param{const wxString\& }{table}}

View File

@@ -15,8 +15,10 @@ labelled buttons.
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxRA\_HORIZONTAL}}{Lays the radiobox out in rows.}
\twocolitem{\windowstyle{wxRA\_VERTICAL}}{Lays the radiobox out in columns.}
\twocolitem{\windowstyle{wxRA\_SPECIFY\_ROWS}}{The major dimension parameter refers to the
maximum number of rows.}
\twocolitem{\windowstyle{wxRA\_SPECIFY\_COLS}}{The major dimension parameter refers to the
maximum number of columns.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.
@@ -45,7 +47,7 @@ Default constructor.
\func{}{wxRadioBox}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp
\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp
\param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_HORIZONTAL},\rtfsp
\param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp
\param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
\param{const wxString\& }{name = ``radioBox"}}
@@ -67,7 +69,7 @@ Constructor, creating and showing a radiobox.
\docparam{choices}{An array of choices with which to initialize the radiobox.}
\docparam{majorDimension}{Specifies the number of rows (if style is wxRA\_VERTICAL) or columns (if style is wxRA\_HORIZONTAL) for a two-dimensional
\docparam{majorDimension}{Specifies the maximum number of rows (if style contains wxRA\_SPECIFY\_ROWS) or columns (if style contains wxRA\_SPECIFY\_COLS) for a two-dimensional
radiobox.}
\docparam{style}{Window style. See \helpref{wxRadioBox}{wxradiobox}.}
@@ -91,7 +93,7 @@ Destructor, destroying the radiobox item.
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{const wxString\& }{label},\rtfsp
\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{int}{ n = 0}, \param{const wxString}{ choices[] = NULL},\rtfsp
\param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_HORIZONTAL},\rtfsp
\param{int}{ majorDimension = 0}, \param{long}{ style = wxRA\_SPECIFY\_COLS},\rtfsp
\param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
\param{const wxString\& }{name = ``radioBox"}}

View File

@@ -74,4 +74,18 @@ More recently:
with gcc) and the sample is now partially working. Some work
on the scrollbars is required.
- wxListCtrl assumed that one of the args to GetClientSize can be NULL:
corrected.
corrected.
18/12/98
--------
- Removed major bug whereby dialogs were unmanaged automatically
when any button was pressed.
- Fixed colours of wxWindow scrollbars, made list and text controls
have a white background.
- Fixed dialog colour setting.
- Added settable fonts and colours for wxMenu/wxMenuBar. Now
they have sensible colours by default.
- Fixed a bug in wxStaticBox.
- Controls sample runs, though wxRadioBox doesn't appear and
the notebook flickers for a while.

View File

@@ -18,6 +18,8 @@
#include "wx/defs.h"
#include "wx/event.h"
#include "wx/font.h"
#include "wx/gdicmn.h"
class WXDLLEXPORT wxMenuItem;
class WXDLLEXPORT wxMenuBar;
@@ -115,6 +117,15 @@ public:
void DestroyMenu(bool full);
WXWidget FindMenuItem(int id, wxMenuItem **it = NULL) const;
const wxColour& GetBackgroundColour() const { return m_backgroundColour; }
const wxColour& GetForegroundColour() const { return m_foregroundColour; }
const wxFont& GetFont() const { return m_font; }
void SetBackgroundColour(const wxColour& colour);
void SetForegroundColour(const wxColour& colour);
void SetFont(const wxFont& colour);
void ChangeFont(bool keepOriginalSize = FALSE);
public:
wxFunction m_callback;
@@ -135,6 +146,9 @@ public:
wxMenu* m_topLevelMenu ;
wxMenu* m_menuParent;
bool m_ownedByMenuBar;
wxColour m_foregroundColour;
wxColour m_backgroundColour;
wxFont m_font;
};
// ----------------------------------------------------------------------------
@@ -194,6 +208,15 @@ class WXDLLEXPORT wxMenuBar: public wxEvtHandler
// Destroy menubar, but keep data structures intact so we can recreate it.
bool DestroyMenuBar();
const wxColour& GetBackgroundColour() const { return m_backgroundColour; }
const wxColour& GetForegroundColour() const { return m_foregroundColour; }
const wxFont& GetFont() const { return m_font; }
void SetBackgroundColour(const wxColour& colour);
void SetForegroundColour(const wxColour& colour);
void SetFont(const wxFont& colour);
void ChangeFont(bool keepOriginalSize = FALSE);
public:
wxEvtHandler * m_eventHandler;
int m_menuCount;
@@ -204,6 +227,9 @@ class WXDLLEXPORT wxMenuBar: public wxEvtHandler
//// Motif-specific
WXWidget m_mainWidget;
wxColour m_foregroundColour;
wxColour m_backgroundColour;
wxFont m_font;
};
#endif // _WX_MENU_H_

View File

@@ -38,6 +38,9 @@ Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
extern XColor g_itemColors[];
extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
#define wxNO_COLORS 0x00
#define wxBACK_COLORS 0x01
#define wxFORE_COLORS 0x02

View File

@@ -81,6 +81,7 @@ public:
void SetTitle(const wxString& title);
wxString GetTitle() const ;
void OnSize(wxSizeEvent& event);
bool OnClose();
void OnCharHook(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event);

View File

@@ -369,9 +369,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
panel = new wxPanel(m_notebook);
panel->SetBackgroundColour("cadet blue");
panel->SetForegroundColour("blue");
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), 2, choices2, 1, wxRA_VERTICAL );
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), 2, choices2, 1, wxRA_SPECIFY_ROWS );
m_radio->SetBackgroundColour("wheat");
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices, 1, wxRA_HORIZONTAL );
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices, 1, wxRA_SPECIFY_COLS );
m_radio->SetBackgroundColour("wheat");
(void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
(void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) );

78
samples/makefile.unx Normal file
View File

@@ -0,0 +1,78 @@
#
# Makefile : Builds wxWindows utils for Unix.
# Replace this with your own path if necessary
WXDIR = ..
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/make.env
TARGET=motif
# Change these if needed.
THISDIR = $(WXDIR)/samples
all:
cd config; $(MAKE) -f makefile.unx $(TARGET)
cd controls; $(MAKE) -f makefile.unx $(TARGET)
cd dialogs; $(MAKE) -f makefile.unx $(TARGET)
cd dnd; $(MAKE) -f makefile.unx $(TARGET)
cd docview; $(MAKE) -f makefile.unx $(TARGET)
cd docvwmdi; $(MAKE) -f makefile.unx $(TARGET)
cd dynamic; $(MAKE) -f makefile.unx $(TARGET)
cd grid; $(MAKE) -f makefile.unx $(TARGET)
cd help; $(MAKE) -f makefile.unx $(TARGET)
cd image; $(MAKE) -f makefile.unx $(TARGET)
cd internat; $(MAKE) -f makefile.unx $(TARGET)
cd layout; $(MAKE) -f makefile.unx $(TARGET)
cd memcheck; $(MAKE) -f makefile.unx $(TARGET)
cd minifram; $(MAKE) -f makefile.unx $(TARGET)
cd minimal; $(MAKE) -f makefile.unx $(TARGET)
cd nativdlg; $(MAKE) -f makefile.unx $(TARGET)
cd notebook; $(MAKE) -f makefile.unx $(TARGET)
cd printing; $(MAKE) -f makefile.unx $(TARGET)
cd resource; $(MAKE) -f makefile.unx $(TARGET)
cd sashtest; $(MAKE) -f makefile.unx $(TARGET)
cd splitter; $(MAKE) -f makefile.unx $(TARGET)
cd tab; $(MAKE) -f makefile.unx $(TARGET)
cd thread; $(MAKE) -f makefile.unx $(TARGET)
cd toolbar; $(MAKE) -f makefile.unx $(TARGET)
cd typetest; $(MAKE) -f makefile.unx $(TARGET)
cd validate; $(MAKE) -f makefile.unx $(TARGET)
cd treectrl; $(MAKE) -f makefile.unx $(TARGET)
cd wxpoem; $(MAKE) -f makefile.unx $(TARGET)
clean:
cd config; $(MAKE) -f makefile.unx clean$(TARGET)
cd controls; $(MAKE) -f makefile.unx clean$(TARGET)
cd dialogs; $(MAKE) -f makefile.unx clean$(TARGET)
cd dnd; $(MAKE) -f makefile.unx clean$(TARGET)
cd docview; $(MAKE) -f makefile.unx clean$(TARGET)
cd docvwmdi; $(MAKE) -f makefile.unx clean$(TARGET)
cd dynamic; $(MAKE) -f makefile.unx clean$(TARGET)
cd grid; $(MAKE) -f makefile.unx clean$(TARGET)
cd help; $(MAKE) -f makefile.unx clean$(TARGET)
cd image; $(MAKE) -f makefile.unx clean$(TARGET)
cd internat; $(MAKE) -f makefile.unx clean$(TARGET)
cd layout; $(MAKE) -f makefile.unx clean$(TARGET)
cd memcheck; $(MAKE) -f makefile.unx clean$(TARGET)
cd minifram; $(MAKE) -f makefile.unx clean$(TARGET)
cd minimal; $(MAKE) -f makefile.unx clean$(TARGET)
cd nativdlg; $(MAKE) -f makefile.unx clean$(TARGET)
cd notebook; $(MAKE) -f makefile.unx clean$(TARGET)
cd printing; $(MAKE) -f makefile.unx clean$(TARGET)
cd resource; $(MAKE) -f makefile.unx clean$(TARGET)
cd sashtest; $(MAKE) -f makefile.unx clean$(TARGET)
cd splitter; $(MAKE) -f makefile.unx clean$(TARGET)
cd tab; $(MAKE) -f makefile.unx clean$(TARGET)
cd thread; $(MAKE) -f makefile.unx clean$(TARGET)
cd toolbar; $(MAKE) -f makefile.unx clean$(TARGET)
cd typetest; $(MAKE) -f makefile.unx clean$(TARGET)
cd validate; $(MAKE) -f makefile.unx clean$(TARGET)
cd treectrl; $(MAKE) -f makefile.unx clean$(TARGET)
cd wxpoem; $(MAKE) -f makefile.unx clean$(TARGET)
cleanmotif: clean
motif: all

View File

@@ -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;

View File

@@ -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 },

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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 \

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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;

View File

@@ -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)

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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 \

View File

@@ -2117,8 +2117,8 @@ void wxResourceEditorFrame::OnSaveAs(wxCommandEvent& WXUNUSED(event))
void wxResourceEditorFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{
manager->Clear(TRUE, FALSE) ;
this->Close();
manager->Clear(TRUE, FALSE) ;
this->Destroy();
}
void wxResourceEditorFrame::OnAbout(wxCommandEvent& WXUNUSED(event))

View File

@@ -1371,13 +1371,13 @@ wxProperty *wxRadioBoxPropertyInfo::GetProperty(wxString& name)
if (name == "orientation")
{
wxString orient;
if (m_propertyWindow->GetWindowStyleFlag() & wxRA_HORIZONTAL)
orient = "wxRA_HORIZONTAL";
if (m_propertyWindow->GetWindowStyleFlag() & wxRA_SPECIFY_COLS)
orient = "wxRA_SPECIFY_COLS";
else
orient = "wxRA_VERTICAL";
orient = "wxRA_SPECIFY_ROWS";
return new wxProperty("orientation", orient, "string",
new wxStringListValidator(new wxStringList("wxRA_HORIZONTAL", "wxRA_VERTICAL",
new wxStringListValidator(new wxStringList("wxRA_SPECIFY_COLS", "wxRA_SPECIFY_ROWS",
NULL)));
}
else if (name == "values")
@@ -1405,17 +1405,17 @@ bool wxRadioBoxPropertyInfo::SetProperty(wxString& name, wxProperty *property)
{
long windowStyle = radioBox->GetWindowStyleFlag();
wxString val(property->GetValue().StringValue());
if (val == "wxRA_HORIZONTAL")
if (val == "wxRA_SPECIFY_COLS")
{
if (windowStyle & wxRA_VERTICAL)
windowStyle -= wxRA_VERTICAL;
windowStyle |= wxRA_HORIZONTAL;
if (windowStyle & wxRA_SPECIFY_ROWS)
windowStyle -= wxRA_SPECIFY_ROWS;
windowStyle |= wxRA_SPECIFY_COLS;
}
else
{
if (windowStyle & wxRA_HORIZONTAL)
windowStyle -= wxRA_HORIZONTAL;
windowStyle |= wxRA_VERTICAL;
if (windowStyle & wxRA_SPECIFY_COLS)
windowStyle -= wxRA_SPECIFY_COLS;
windowStyle |= wxRA_SPECIFY_ROWS;
}
radioBox->SetWindowStyleFlag(windowStyle);
wxItemResource *resource = wxResourceManager::GetCurrentResourceManager()->FindResourceForWindow(radioBox);

View File

@@ -97,6 +97,8 @@ int g_WindowStylesRadioButtonCount = sizeof(g_WindowStylesRadioButton)/sizeof(wx
/* wxRadioBox */
static wxWindowStylePair g_WindowStylesRadioBox[] = {
{ "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS },
{ "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS },
{ "wxRA_HORIZONTAL", wxRA_HORIZONTAL },
{ "wxRA_VERTICAL", wxRA_VERTICAL }
};