From 94b49b9303a9fd119e24d1b07263f5bb0643afa5 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 18 Dec 1998 14:40:38 +0000 Subject: [PATCH] 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 --- distrib/msw/motif.rsp | 2 +- distrib/msw/msw.rsp | 4 + distrib/msw/wx_html.rsp | 2 + docs/latex/wx/frame.tex | 8 +- docs/latex/wx/radiobox.tex | 12 +-- docs/motif/changes.txt | 16 +++- include/wx/motif/menu.h | 26 ++++++ include/wx/motif/private.h | 3 + include/wx/msw/dialog.h | 1 + samples/controls/controls.cpp | 4 +- samples/makefile.unx | 78 +++++++++++++++++ src/common/memory.cpp | 3 +- src/common/resource.cpp | 2 + src/generic/colrdlgg.cpp | 2 +- src/generic/listctrl.cpp | 6 +- src/motif/combobox.cpp | 3 +- src/motif/dialog.cpp | 18 ++-- src/motif/listbox.cpp | 10 ++- src/motif/makefile.unx | 3 +- src/motif/menu.cpp | 143 ++++++++++++++++++++++++++++++++ src/motif/radiobox.cpp | 35 +++++++- src/motif/statbox.cpp | 5 +- src/motif/textctrl.cpp | 56 +++++++------ src/motif/toolbar.cpp | 2 + src/motif/utils.cpp | 40 +++++++++ src/motif/window.cpp | 12 +++ src/msw/dialog.cpp | 11 +++ src/stubs/makefile.unx | 3 +- utils/dialoged/src/reseditr.cpp | 4 +- utils/dialoged/src/winprop.cpp | 22 ++--- utils/dialoged/src/winstyle.cpp | 2 + 31 files changed, 466 insertions(+), 72 deletions(-) create mode 100644 samples/makefile.unx diff --git a/distrib/msw/motif.rsp b/distrib/msw/motif.rsp index 6c39512204..13158238af 100644 --- a/distrib/msw/motif.rsp +++ b/distrib/msw/motif.rsp @@ -7,7 +7,7 @@ config.sub wx-config.in mkinstalldirs -makeenvs/*.env +src/makeenvs/*.env src/Makefile src/Makefile.in diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp index 0856bf7ab5..93f221d7f2 100644 --- a/distrib/msw/msw.rsp +++ b/distrib/msw/msw.rsp @@ -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 diff --git a/distrib/msw/wx_html.rsp b/distrib/msw/wx_html.rsp index 0fd2444d4f..70992d3055 100644 --- a/distrib/msw/wx_html.rsp +++ b/distrib/msw/wx_html.rsp @@ -33,3 +33,5 @@ docs/html/tex2rtf/*.gif docs/html/odbc/*.htm +docs/html/gettext/*.htm + diff --git a/docs/latex/wx/frame.tex b/docs/latex/wx/frame.tex index 71f2df8904..6e03a81d2d 100644 --- a/docs/latex/wx/frame.tex +++ b/docs/latex/wx/frame.tex @@ -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}} diff --git a/docs/latex/wx/radiobox.tex b/docs/latex/wx/radiobox.tex index c679667354..a98a59a22e 100644 --- a/docs/latex/wx/radiobox.tex +++ b/docs/latex/wx/radiobox.tex @@ -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"}} diff --git a/docs/motif/changes.txt b/docs/motif/changes.txt index 3f351fe3a8..000fb7f9c0 100644 --- a/docs/motif/changes.txt +++ b/docs/motif/changes.txt @@ -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. \ No newline at end of file + 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. diff --git a/include/wx/motif/menu.h b/include/wx/motif/menu.h index f9ebc22090..d29ae23ac4 100644 --- a/include/wx/motif/menu.h +++ b/include/wx/motif/menu.h @@ -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_ diff --git a/include/wx/motif/private.h b/include/wx/motif/private.h index b5d91867a4..94d89bfbb7 100644 --- a/include/wx/motif/private.h +++ b/include/wx/motif/private.h @@ -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 diff --git a/include/wx/msw/dialog.h b/include/wx/msw/dialog.h index 8ec1b50995..b63c9875d0 100644 --- a/include/wx/msw/dialog.h +++ b/include/wx/msw/dialog.h @@ -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); diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index d8a9805a4f..5e3e17192e 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -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) ); diff --git a/samples/makefile.unx b/samples/makefile.unx new file mode 100644 index 0000000000..6eb6471224 --- /dev/null +++ b/samples/makefile.unx @@ -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 diff --git a/src/common/memory.cpp b/src/common/memory.cpp index ee71e7fd3a..85efd2cf3b 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -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; diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 63cfce31b3..059a8315b4 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -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 }, diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 2e3f8ce919..daec7a16fb 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -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) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 3411f58f1b..c395229e1c 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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) diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index 4537779eb6..b170657045 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -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); diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 90258bd2af..efbbb9a9a6 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -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); } diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp index 13fca3d66d..02cef45259 100644 --- a/src/motif/listbox.cpp +++ b/src/motif/listbox.cpp @@ -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); } diff --git a/src/motif/makefile.unx b/src/motif/makefile.unx index e43f53516e..682fd52b0d 100644 --- a/src/motif/makefile.unx +++ b/src/motif/makefile.unx @@ -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 \ diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp index 1eb8e5a3c9..f42b5d07d4 100644 --- a/src/motif/menu.cpp +++ b/src/motif/menu.cpp @@ -28,6 +28,7 @@ #include "wx/utils.h" #include "wx/app.h" #include "wx/frame.h" +#include "wx/settings.h" #include #include @@ -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); +} + diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index a5e78b7638..fd6c929cd3 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -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, diff --git a/src/motif/statbox.cpp b/src/motif/statbox.cpp index 487d56710b..8f16b556ef 100644 --- a/src/motif/statbox.cpp +++ b/src/motif/statbox.cpp @@ -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; diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp index 3c7dc810ea..b9f564264c 100644 --- a/src/motif/textctrl.cpp +++ b/src/motif/textctrl.cpp @@ -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) diff --git a/src/motif/toolbar.cpp b/src/motif/toolbar.cpp index 989b24331b..ee33bfeea4 100644 --- a/src/motif/toolbar.cpp +++ b/src/motif/toolbar.cpp @@ -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 diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index cf188f5c4f..8af9016cac 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -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); +} + + diff --git a/src/motif/window.cpp b/src/motif/window.cpp index 9be496a55a..3d78814a44 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -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); diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 57b7d1cfc2..44919fc74c 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -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 diff --git a/src/stubs/makefile.unx b/src/stubs/makefile.unx index 6d6c5c43ed..5bd62163fd 100644 --- a/src/stubs/makefile.unx +++ b/src/stubs/makefile.unx @@ -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 \ diff --git a/utils/dialoged/src/reseditr.cpp b/utils/dialoged/src/reseditr.cpp index 401428b1bc..755e83b153 100644 --- a/utils/dialoged/src/reseditr.cpp +++ b/utils/dialoged/src/reseditr.cpp @@ -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)) diff --git a/utils/dialoged/src/winprop.cpp b/utils/dialoged/src/winprop.cpp index 246ea5ab31..00b91eee7a 100644 --- a/utils/dialoged/src/winprop.cpp +++ b/utils/dialoged/src/winprop.cpp @@ -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); diff --git a/utils/dialoged/src/winstyle.cpp b/utils/dialoged/src/winstyle.cpp index efc4fad4a1..6fa29b4b18 100644 --- a/utils/dialoged/src/winstyle.cpp +++ b/utils/dialoged/src/winstyle.cpp @@ -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 } }; -- 2.47.2