Lots of wxMotif fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1304 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-01-01 19:13:35 +00:00
parent 17dff81c71
commit b412f9be50
34 changed files with 207 additions and 103 deletions

View File

@@ -9,6 +9,7 @@ docs/upgrade.txt
docs/todo.txt
docs/licence.txt
docs/symbols.txt
docs/bugs.txt
docs/*.html
src/*.inc

View File

@@ -10,6 +10,29 @@ wxMSW:
wxMotif:
--------
- wxNotebook and property list frame do not appear properly when
first shown.
Workaround: resize the window (manually or programmatically) to
make the window appear.
This also happens with other windows, e.g. the sizer
dialog in the layout sample.
- wxSashWindow borders aren't repainted properly if the sashtest
sample is exposed (after being under another window).
- If a popup wxMenu is destroyed after its parent window has been
destroyed, we get the message "Object XXX does not have windowed
ancestor".
Workaround: delete the menu before deleting the window on which it
was popped up.
Possible fix: call menu->DestroyMenu() before deleting the window,
if the window knows about the menu that was last popped up (hard
to know this with confidence).
- In wxGrid, cell highlight is not drawn/erased properly.
- Setting the size of a hidden window may show that window.
General:
--------

View File

@@ -1,6 +1,44 @@
wxWindows 2.0 Change Log
------------------------
Beta 2, ??? 1998
--------------------------
wxGTK:
wxMSW:
- 16-bit BC++ compilation/linking works albeit without the resource system.
wxMotif:
- Cured wxScreenDC origin problem so e.g. sash window sash is drawn at
the right place.
- Cured some widget table clashes.
- Added thread support (Robert).
- wxPoem sample now works.
General:
- Rearranged documentation a bit.
- Sash window uses area of first frame/dialog to paint over when drawing
the dragged sash, not just the sash window itself (it clipped to the right
or below).
- Made resource sample use the correct Cancel button id.
- Moved wxProp to main library (generic directory), created proplist
sample.
- Added bombs and fractal samples.
Beta 1, December 24th 1998
--------------------------
wxGTK:
- Various
wxMSW, wxMotif: not in sync with this release.
Alpha 18, December 29th 1998
----------------------------

View File

@@ -53,6 +53,13 @@ Constructs a wxMenu object.
Destructor, destroying the menu.
Note: under Motif, a popup menu must have a valid parent (the window
it was last popped up on) when being destroyed. Therefore, make sure
you delete or re-use the popup menu {\it before} destroying the
parent window. Re-use in this context means popping up the menu on
a different window from last time, which causes an implicit destruction
and recreation of internal data structures.
\membersection{wxMenu::Append}\label{wxmenuappend}
\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp

View File

@@ -81,6 +81,12 @@ Notes:
I'd prefer you to fix the problem and send the fix to me :-) or at
least let me know about it.
- Thread support is switched off by default in setup.h (wxUSE_THREADS)
because standard Unices often do not have the necessary thread library
installed. Please see ../docs/gtk/install.txt for more details on this.
For Linux, the problem is expected to go away with future
distributions of the operating system.
- If you have trouble compiling the file y_tab.c, or have strange
linking errors, check whether you're using a C or C++ compiler for this file.
You should specify a C compiler in the CCLEX variable in src/make.env.

View File

@@ -123,6 +123,10 @@
#define wxUSE_TIMEDATE 1
// Use time and date
#define wxUSE_THREADS 0
// Use threads
/*
* Finer detail
*

View File

@@ -36,6 +36,7 @@ class WXDLLEXPORT wxStaticBox: public wxControl
{
Create(parent, id, label, pos, size, style, name);
}
~wxStaticBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label,

View File

@@ -79,9 +79,9 @@ BombsFrameClass::BombsFrameClass(wxFrame *parent, const wxString& title, const w
wxMenu *menu2 = new wxMenu;
menu2->Append(IDM_RESTART, "&Restart"); // , "Clear the play field");
menu2->AppendSeparator();
menu2->Append(IDM_EASY, "&Easy", (char*)NULL, TRUE); // "10x10 play field", TRUE);
menu2->Append(IDM_MEDIUM, "&Medium", (char*)NULL, TRUE); // "15x15 play field", TRUE);
menu2->Append(IDM_DIFFICULT, "&Difficult", (char*)NULL, TRUE); // "25x20 play field", TRUE);
menu2->Append(IDM_EASY, "&Easy", wxEmptyString, TRUE); // "10x10 play field", TRUE);
menu2->Append(IDM_MEDIUM, "&Medium", wxEmptyString, TRUE); // "15x15 play field", TRUE);
menu2->Append(IDM_DIFFICULT, "&Difficult", wxEmptyString, TRUE); // "25x20 play field", TRUE);
menuBar1->Append(menu2, "&Game");
SetMenuBar(menuBar1);
menuBar=menuBar1;

View File

@@ -1,64 +1,16 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1993
# Created: 1998
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
# Copyright: (c) 1998 Julian Smart
#
# "%W% %G%"
#
# Makefile for docview example (UNIX).
# Makefile for docvwmdi example (UNIX).
WXDIR = ../..
PROGRAM=docview
# All common UNIX compiler flags and options are now in
# this central makefile.
include $(WXDIR)/src/make.env
OBJECTS=$(PROGRAM).o doc.o view.o
OBJECTS = $(OBJDIR)/docview.$(OBJSUFF) $(OBJDIR)/view.$(OBJSUFF) $(OBJDIR)/doc.$(OBJSUFF)
.SUFFIXES:
all: $(OBJDIR) wx$(GUISUFFIX) docview$(GUISUFFIX)
wx_motif:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
wx_ol:
cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
motif:
$(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
xview:
$(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
hp:
$(MAKE) -f makefile,unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
$(OBJDIR):
mkdir $(OBJDIR)
docview$(GUISUFFIX): $(OBJECTS) $(WXLIB)
$(CC) $(LDFLAGS) -o docview$(GUISUFFIX) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS)
$(OBJDIR)/docview.$(OBJSUFF): docview.$(SRCSUFF) docview.h doc.h view.h
$(CC) -c $(CPPFLAGS) -o $@ docview.$(SRCSUFF)
$(OBJDIR)/doc.$(OBJSUFF): doc.$(SRCSUFF) doc.h
$(CC) -c $(CPPFLAGS) -o $@ doc.$(SRCSUFF)
$(OBJDIR)/view.$(OBJSUFF): view.$(SRCSUFF) view.h
$(CC) -c $(CPPFLAGS) -o $@ view.$(SRCSUFF)
clean_motif:
$(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
clean_ol:
$(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
clean_hp:
$(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
cleanany:
rm -f $(OBJECTS) docview$(GUISUFFIX) core
include ../../src/makeprog.env

View File

@@ -54,7 +54,7 @@ bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
// X seems to require a forced resize
int x, y;
frame->GetSize(&x, &y);
frame->SetSize(x, y);
frame->SetSize(-1, -1, x, y);
#endif
frame->Show(TRUE);
@@ -146,7 +146,7 @@ bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
// X seems to require a forced resize
int x, y;
frame->GetSize(&x, &y);
frame->SetSize(x, y);
frame->SetSize(-1, -1, x, y);
#endif
frame->Show(TRUE);

View File

@@ -29,7 +29,7 @@
#include "wx/file.h"
#include "wx/log.h"
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm"
#endif
@@ -95,14 +95,10 @@ bool MyApp::OnInit(void)
m_locale.AddCatalog("fileutils"); // 3) and another just for testing
// Create the main frame window
MyFrame *frame = new MyFrame((wxFrame *) NULL, _("Minimal wxWindows App"), 50, 50, 150, 40);
MyFrame *frame = new MyFrame((wxFrame *) NULL, _("International wxWindows App"), 50, 50, 150, 40);
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
#else
frame->SetIcon(wxIcon(mondrian_xpm));
#endif
frame->SetIcon(wxICON(mondrian));
// Make a menubar
wxMenu *file_menu = new wxMenu;

View File

@@ -0,0 +1,17 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1998
# Updated:
# Copyright: (c) 1998 Julian Smart
#
# "%W% %G%"
#
# Makefile for proplist example (UNIX).
PROGRAM=test
OBJECTS=$(PROGRAM).o
include ../../src/makeprog.env

View File

@@ -179,19 +179,19 @@ bool MyFrame::OnClose(void)
}
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk)
EVT_BUTTON(RESOURCE_CANCEL, MyDialog::OnCancel)
// EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk)
EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel)
END_EVENT_TABLE()
void MyDialog::OnOk(wxCommandEvent& WXUNUSED(event) )
{
EndModal(RESOURCE_OK);
// EndModal(RESOURCE_OK);
}
void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event) )
{
EndModal(RESOURCE_CANCEL);
EndModal(ID_BUTTON109);
}

View File

@@ -55,5 +55,7 @@ class MyDialog : public wxDialog
#define RESOURCE_QUIT 4
#define RESOURCE_TEST1 2
/*
#define RESOURCE_OK 1
#define RESOURCE_CANCEL 2
*/

View File

@@ -30,7 +30,7 @@
#include "typetest.h"
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "mondrian.xpm"
#endif

View File

@@ -35,7 +35,7 @@
#include "wxpoem.h"
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "corner1.xpm"
#include "corner2.xpm"
#include "corner3.xpm"
@@ -159,6 +159,14 @@ MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
{
}
MainWindow::~MainWindow()
{
// Note: this must be done before the main window/canvas are destroyed
// or we get an error (no parent window for menu item button)
delete popupMenu;
popupMenu = NULL;
}
// Read the poetry buffer, either for finding the size
// or for writing to a bitmap (not to the window directly,
// since that displays messily)
@@ -639,7 +647,7 @@ bool MyApp::OnInit()
Corner3 = new wxIcon("icon_3");
Corner4 = new wxIcon("icon_4");
#endif
#ifdef __WXGTK__
#if defined(__WXGTK__) || defined(__WXMOTIF__)
Corner1 = new wxIcon( corner1_xpm );
Corner2 = new wxIcon( corner2_xpm );
Corner3 = new wxIcon( corner3_xpm );
@@ -658,17 +666,14 @@ int MyApp::OnExit()
if (backingBitmap)
delete backingBitmap;
delete HelpController;
delete popupMenu;
delete GreyPen;
delete DarkGreyPen;
delete WhitePen;
//#ifdef __WXMSW__
delete Corner1;
delete Corner2;
delete Corner3;
delete Corner4;
//#endif
delete NormalFont;
delete BoldFont;
@@ -1070,7 +1075,7 @@ bool Compile(void)
void PopupFunction(wxMenu& /*menu*/, wxCommandEvent& event)
{
switch (event.m_commandInt)
switch (event.GetId())
{
case POEM_NEXT:
// Another poem/page

View File

@@ -47,6 +47,7 @@ class MainWindow: public wxFrame
public:
MyCanvas *canvas;
MainWindow(wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
~MainWindow();
void OnCloseWindow(wxCloseEvent& event);
void OnChar(wxKeyEvent& event);

View File

@@ -834,6 +834,7 @@ void wxSocketBase::SetupCallbacks()
m_internal->sock_inputid = XtAppAddInput (wxAPP_CONTEXT, m_fd,
(XtPointer *) XtInputReadMask,
(XtInputCallbackProc) wx_socket_read,
(XtPointer) this);
}
}
else

View File

@@ -1024,7 +1024,7 @@ void wxGenericGrid::AdjustScrollbars(void)
if (m_hScrollBar && !m_hScrollBar->IsShown())
horizScrollBarHeight = 0;
if (m_hScrollBar)
if (m_hScrollBar && m_hScrollBar->IsShown())
{
int nCols = GetCols();
m_hScrollBar->SetScrollbar(m_hScrollBar->GetThumbPosition(), wxMax(noHorizSteps, 1), (noHorizSteps == 0) ? 1 : nCols, wxMax(noHorizSteps, 1));
@@ -1038,7 +1038,7 @@ void wxGenericGrid::AdjustScrollbars(void)
}
if (m_vScrollBar)
if (m_vScrollBar && m_vScrollBar->IsShown())
{
int nRows = GetRows();

View File

@@ -115,13 +115,21 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
{
if ( sashHit != wxSASH_NONE )
{
CaptureMouse();
CaptureMouse();
// Required for X to specify that
// that we wish to draw on top of all windows
// - and we optimise by specifying the area
// for creating the overlap window.
wxScreenDC::StartDrawingOnTop(this);
// that we wish to draw on top of all windows
// - and we optimise by specifying the area
// for creating the overlap window.
// Find the first frame or dialog and use this to specify
// the area to draw on.
wxWindow* parent = this;
while (parent && !parent->IsKindOf(CLASSINFO(wxDialog)) &&
!parent->IsKindOf(CLASSINFO(wxFrame)))
parent = parent->GetParent();
wxScreenDC::StartDrawingOnTop(parent);
// We don't say we're dragging yet; we leave that
// decision for the Dragging() branch, to ensure

View File

@@ -29,7 +29,7 @@ RANLIB = ranlib
############################ Switches #################################
# Debug/trace mode. 1 or more for debugging.
DEBUG = 0
DEBUG = 1
GUI = -D__WXSTUBS__ -D__LINUX__ -D__UNIX__
GUISUFFIX = _stubs
@@ -38,7 +38,7 @@ GUISUFFIX = _stubs
# Misc options
OPTIONS = -D__WXDEBUG__
COPTIONS =
DEBUGFLAGS =
DEBUGFLAGS = -ggdb
INCLUDE =
WARN = -Wall -Wno-unused # -w
CWARN = -Wall -Wno-unused # -w

View File

@@ -28,7 +28,10 @@
#include "wx/log.h"
#include "wx/module.h"
#include "wx/memory.h"
#if wxUSE_THREADS
#include "wx/thread.h"
#endif
#if wxUSE_WX_RESOURCES
#include "wx/resource.h"
@@ -299,9 +302,12 @@ int wxApp::MainLoop()
{
if (!ProcessIdle())
{
// TODO: Robert, what's this for?
#if wxUSE_THREADS
wxMutexGuiLeave();
usleep(20);
wxMutexGuiEnter();
#endif
}
}

View File

@@ -148,6 +148,7 @@ wxChoice::~wxChoice()
if (GetMainWidget())
{
DetachWidget(GetMainWidget()); // Removes event handlers
DetachWidget(m_formWidget);
XtDestroyWidget((Widget) m_formWidget);
m_formWidget = (WXWidget) 0;

View File

@@ -66,7 +66,8 @@ bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
wxRect rect;
int x, y, width, height;
window->GetPosition(& x, & y);
window->ClientToScreen(& x, & y);
if (window->GetParent())
window->GetParent()->ClientToScreen(& x, & y);
window->GetSize(& width, & height);
rect.x = x; rect.y = y;
rect.width = width; rect.height = height;

View File

@@ -286,6 +286,9 @@ wxDialog::~wxDialog()
// Note that this might need to be done for wxFrame also.
DestroyChildren();
// This causes a crash in e.g. the resource sample when closing
// the example dialog. TODO: Probably not necessary (?)
#if 0
// Now process all events, because otherwise
// this might remain on the screen.
Display* display;
@@ -301,6 +304,7 @@ wxDialog::~wxDialog()
XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
XtDispatchEvent(&event);
}
#endif
}
// By default, pressing escape cancels the dialog

View File

@@ -688,7 +688,7 @@ void wxListBoxCallback (Widget w, XtPointer clientData,
if (item->InSetValue())
return;
wxCommandEvent event (wxEVT_COMMAND_LISTBOX_SELECTED);
wxCommandEvent event (wxEVT_COMMAND_LISTBOX_SELECTED, item->GetId());
switch (cbs->reason)
{
case XmCR_MULTIPLE_SELECT:

View File

@@ -98,7 +98,6 @@ LIB_CPP_SRC=\
frame.cpp \
gauge.cpp \
gdiobj.cpp \
helpxxxx.cpp \
icon.cpp \
listbox.cpp \
joystick.cpp \

View File

@@ -70,6 +70,7 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id,
m_pSubMenu = pSubMenu;
m_idItem = id;
m_bEnabled = TRUE;
m_bChecked = FALSE;
//// Motif-specific
m_menuBar = NULL;
@@ -310,6 +311,7 @@ void wxMenuItemCallback (Widget w, XtPointer clientData,
{
wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item->GetId());
commandEvent.SetEventObject(item->GetMenuBar()->GetMenuBarFrame());
commandEvent.SetInt( item->GetId() );
item->GetMenuBar()->GetMenuBarFrame()->GetEventHandler()->ProcessEvent(commandEvent);
}
@@ -317,6 +319,8 @@ void wxMenuItemCallback (Widget w, XtPointer clientData,
{
wxCommandEvent event (wxEVT_COMMAND_MENU_SELECTED, item->GetId());
event.SetEventObject(item->GetTopMenu());
event.SetInt( item->GetId() );
item->GetTopMenu()->ProcessCommand (event);
}
}

View File

@@ -181,6 +181,7 @@ wxRadioBox::~wxRadioBox()
{
delete[] m_radioButtonLabels;
delete[] m_radioButtons;
DetachWidget(m_formWidget);
}
wxString wxRadioBox::GetLabel(int item) const

View File

@@ -87,7 +87,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
XtManageChild (radioButtonWidget);
SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, NULL, pos.x, pos.y, size.x, size.y);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
ChangeBackgroundColour();

View File

@@ -155,16 +155,17 @@ void wxScrollBar::Command(wxCommandEvent& event)
void wxScrollBar::ChangeFont(bool keepOriginalSize)
{
// TODO
// Do anything for a scrollbar? A font will never be seen.
}
void wxScrollBar::ChangeBackgroundColour()
{
// TODO
wxWindow::ChangeBackgroundColour();
}
void wxScrollBar::ChangeForegroundColour()
{
// TODO
wxWindow::ChangeForegroundColour();
}
static void wxScrollBarCallback(Widget widget, XtPointer clientData,

View File

@@ -124,6 +124,11 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
return TRUE;
}
wxStaticBox::~wxStaticBox()
{
DetachWidget(m_formWidget);
}
void wxStaticBox::SetLabel(const wxString& label)
{
if (!m_labelWidget)
@@ -194,10 +199,14 @@ void wxStaticBox::ChangeFont(bool keepOriginalSize)
void wxStaticBox::ChangeBackgroundColour()
{
wxWindow::ChangeBackgroundColour();
if (m_labelWidget)
DoChangeBackgroundColour(m_labelWidget, m_backgroundColour);
}
void wxStaticBox::ChangeForegroundColour()
{
wxWindow::ChangeForegroundColour();
if (m_labelWidget)
DoChangeForegroundColour(m_labelWidget, m_foregroundColour);
}

View File

@@ -13,15 +13,20 @@
#pragma implementation "thread.h"
#endif
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include "wx/defs.h"
#if wxUSE_THREADS
#include "wx/module.h"
#include "wx/thread.h"
#include "wx/utils.h"
#include "wx/log.h"
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
@@ -434,4 +439,5 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
#endif
// wxUSE_THREADS

View File

@@ -2259,12 +2259,7 @@ bool wxAddWindowToTable(Widget w, wxWindow *win)
// printf("Adding widget %ld, name = %s\n", w, win->GetClassInfo()->GetClassName());
if ((oldItem = (wxWindow *)wxWidgetHashTable->Get ((long) w)))
{
char buf[300];
sprintf(buf, "Widget table clash: new widget is %ld, %s", (long)w, win->GetClassInfo()->GetClassName());
wxError (buf);
fflush(stderr);
sprintf(buf, "Old widget was %s", oldItem->GetClassInfo()->GetClassName());
wxError (buf);
wxLogError("Widget table clash: new widget is %ld, %s", (long)w, win->GetClassInfo()->GetClassName());
return FALSE;
}
@@ -3266,8 +3261,23 @@ void wxWindow::ChangeBackgroundColour()
{
if (GetMainWidget())
DoChangeBackgroundColour(GetMainWidget(), m_backgroundColour);
// This not necessary
#if 0
if (m_scrolledWindow && (GetMainWidget() != m_scrolledWindow))
{
DoChangeBackgroundColour(m_scrolledWindow, m_backgroundColour);
// Have to set the scrollbar colours back since
// the scrolled window seemed to change them
wxColour backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE) ;
if (m_hScrollBar)
DoChangeBackgroundColour(m_hScrollBar, backgroundColour);
if (m_vScrollBar)
DoChangeBackgroundColour(m_vScrollBar, backgroundColour);
}
#endif
}
void wxWindow::ChangeForegroundColour()