tbarsmpl.cpp G
textdlgg.cpp G
tipdlg.cpp G
+tipwin.cpp G
treectlg.cpp G
treelay.cpp G
wizard.cpp G
time.h W B
timer.h W B
tipdlg.h W
+tipwin.h W
tokenzr.h W B
toolbar.h W
tooltip.h W
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/tipwin.h
+// Purpose: wxTipWindow is a window like the one typically used for
+// showing the tooltips
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_TIPWIN_H_
+#define _WX_TIPWIN_H_
+
+#ifdef __GNUG__
+ #pragma interface "tipwin.h"
+#endif
+
+#include "wx/frame.h"
+
+// ----------------------------------------------------------------------------
+// wxTipWindow
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxTipWindow : public wxFrame
+{
+public:
+ wxTipWindow(wxWindow *parent,
+ const wxString& text,
+ wxCoord maxLength = 100);
+
+protected:
+ // event handlers
+ void OnPaint(wxPaintEvent& event);
+ void OnMouseClick(wxMouseEvent& event);
+
+ // calculate the client rect we need to display the text
+ void Adjust(const wxString& text, wxCoord maxLength);
+
+private:
+ wxArrayString m_textLines;
+ wxCoord m_heightLine;
+
+ DECLARE_EVENT_TABLE()
+};
+
+#endif // _WX_TIPWIN_H_
wxDefaultPosition, wxSize(300, 100),
wxTE_MULTILINE);
text->SetHelpText(_("Type text here if you have got nothing more "
- "more interesting to do"));
+ "interesting to do"));
sizerTop->Add(text, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
sizerTop->Add(sizerRow, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
#if wxUSE_HELP
#ifndef WX_PRECOMP
- // FIXME: temporary needed for wxSimpleHelpProvider compilation, to be
- // removed later
- #include "wx/intl.h"
- #include "wx/msgdlg.h"
+ #include "wx/tipwin.h"
#endif
#include "wx/app.h"
wxString text = GetHelp(window);
if ( !text.empty() )
{
- wxMessageBox(text, _("Help"), wxICON_INFORMATION | wxOK,
- (wxWindow *)window);
+ new wxTipWindow((wxWindow *)window, text);
return TRUE;
}
-# This file was automatically generated by tmake at 20:17, 2000/03/31
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T!
ALL_SOURCES = \
common/init.cpp \
common/textfile.cpp \
common/timercmn.cpp \
common/tokenzr.cpp \
+ common/treebase.cpp \
common/txtstrm.cpp \
common/unzip.c \
common/url.cpp \
textfile.o \
timercmn.o \
tokenzr.o \
+ treebase.o \
txtstrm.o \
unzip.o \
url.o \
textfile.d \
timercmn.d \
tokenzr.d \
+ treebase.d \
txtstrm.d \
unzip.d \
url.d \
textfile.d \
timercmn.d \
tokenzr.d \
+ treebase.d \
txtstrm.d \
unzip.d \
url.d \
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/generic/tipwin.cpp
+// Purpose: implementation of wxTipWindow
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 10.09.00
+// RCS-ID: $Id$
+// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// Licence: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "tipwin.h"
+#endif
+
+// For compilers that support precompilatixon, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/dcclient.h"
+#endif // WX_PRECOMP
+
+#include "wx/tipwin.h"
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+static const wxCoord TEXT_MARGIN_X = 3;
+static const wxCoord TEXT_MARGIN_Y = 3;
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// event tables
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxTipWindow, wxFrame)
+ EVT_PAINT(wxTipWindow::OnPaint)
+
+ EVT_LEFT_DOWN(wxTipWindow::OnMouseClick)
+ EVT_RIGHT_DOWN(wxTipWindow::OnMouseClick)
+ EVT_MIDDLE_DOWN(wxTipWindow::OnMouseClick)
+END_EVENT_TABLE()
+
+// ----------------------------------------------------------------------------
+// wxTipWindow
+// ----------------------------------------------------------------------------
+
+wxTipWindow::wxTipWindow(wxWindow *parent,
+ const wxString& text,
+ wxCoord maxLength)
+ : wxFrame(parent, -1, _T(""),
+ wxDefaultPosition, wxDefaultSize,
+ wxNO_BORDER | wxFRAME_FLOAT_ON_PARENT)
+{
+ // set colours
+ SetForegroundColour(*wxBLACK);
+ SetBackgroundColour(wxColour(0xc3ffff));
+
+ // set position and size
+ int x, y;
+ wxGetMousePosition(&x, &y);
+ Move(x, y + 20);
+
+ Adjust(text, maxLength);
+
+ // capture mouse as we want to dismiss the window when it is clicked
+ CaptureMouse();
+
+ Show(TRUE);
+}
+
+void wxTipWindow::Adjust(const wxString& text, wxCoord maxLength)
+{
+ wxClientDC dc(this);
+ dc.SetFont(GetFont());
+
+ // calculate the length: we want each line be no longer than maxLength
+ // pixels and we only break lines at words boundary
+ wxString current;
+ wxCoord height, width,
+ widthMax = 0;
+ m_heightLine = 0;
+
+ bool breakLine = FALSE;
+ for ( const wxChar *p = text.c_str(); ; p++ )
+ {
+ if ( *p == _T('\n') || *p == _T('\0') )
+ {
+ dc.GetTextExtent(current, &width, &height);
+ if ( width > widthMax )
+ widthMax = width;
+
+ if ( height > m_heightLine )
+ m_heightLine = height;
+
+ m_textLines.Add(current);
+
+ if ( !*p )
+ {
+ // end of text
+ break;
+ }
+
+ current.clear();
+ breakLine = FALSE;
+ }
+ else if ( breakLine && (*p == _T(' ') || *p == _T('\t')) )
+ {
+ // word boundary - break the line here
+ m_textLines.Add(current);
+ current.clear();
+ breakLine = FALSE;
+ }
+ else // line goes on
+ {
+ current += *p;
+ dc.GetTextExtent(current, &width, &height);
+ if ( width > maxLength )
+ breakLine = TRUE;
+
+ if ( width > widthMax )
+ widthMax = width;
+
+ if ( height > m_heightLine )
+ m_heightLine = height;
+ }
+ }
+
+ // take into account the border size and the margins
+ SetClientSize(2*(TEXT_MARGIN_X + 1) + widthMax,
+ 2*(TEXT_MARGIN_Y + 1) + m_textLines.GetCount()*m_heightLine);
+}
+
+void wxTipWindow::OnPaint(wxPaintEvent& event)
+{
+ wxPaintDC dc(this);
+
+ wxRect rect;
+ wxSize size = GetClientSize();
+ rect.width = size.x;
+ rect.height = size.y;
+
+ // first filll the background
+ dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
+ dc.SetPen(*wxBLACK_PEN);
+ dc.DrawRectangle(rect);
+
+ // and then draw the text line by line
+ dc.SetFont(GetFont());
+
+ wxPoint pt;
+ pt.x = TEXT_MARGIN_X;
+ pt.y = TEXT_MARGIN_Y;
+ size_t count = m_textLines.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ dc.DrawText(m_textLines[n], pt);
+
+ pt.y += m_heightLine;
+ }
+}
+
+void wxTipWindow::OnMouseClick(wxMouseEvent& event)
+{
+ ReleaseMouse();
+
+ Close();
+}
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
generic/tbarsmpl.cpp \
generic/textdlgg.cpp \
generic/tipdlg.cpp \
+ generic/tipwin.cpp \
generic/treectlg.cpp \
generic/treelay.cpp \
generic/wizard.cpp \
time.h \
timer.h \
tipdlg.h \
+ tipwin.h \
tokenzr.h \
toolbar.h \
tooltip.h \
tbarsmpl.o \
textdlgg.o \
tipdlg.o \
+ tipwin.o \
treectlg.o \
treelay.o \
wizard.o
tbarsmpl.d \
textdlgg.d \
tipdlg.d \
+ tipwin.d \
treectlg.d \
treelay.d \
wizard.d
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/busyinfo.cpp \
generic/tbarsmpl.cpp \
generic/textdlgg.cpp \
generic/tipdlg.cpp \
+ generic/tipwin.cpp \
generic/treectlg.cpp \
generic/treelay.cpp \
generic/wizard.cpp \
time.h \
timer.h \
tipdlg.h \
+ tipwin.h \
tokenzr.h \
toolbar.h \
tooltip.h \
tbarsmpl.o \
textdlgg.o \
tipdlg.o \
+ tipwin.o \
treectlg.o \
treelay.o \
wizard.o
tbarsmpl.d \
textdlgg.d \
tipdlg.d \
+ tipwin.d \
treectlg.d \
treelay.d \
wizard.d
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
#
$(MSWDIR)\tbarsmpl.obj \
$(MSWDIR)\textdlgg.obj \
$(MSWDIR)\tipdlg.obj \
+ $(MSWDIR)\tipwin.obj \
$(MSWDIR)\treectlg.obj \
$(MSWDIR)\treelay.obj \
$(MSWDIR)\wizard.obj
$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF)
+$(MSWDIR)\tipwin.obj: $(GENDIR)\tipwin.$(SRCSUFF)
+
$(MSWDIR)\treectlg.obj: $(GENDIR)\treectlg.$(SRCSUFF)
$(MSWDIR)\treelay.obj: $(GENDIR)\treelay.$(SRCSUFF)
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
#
$(MSWDIR)\tbarsmpl.obj \
$(MSWDIR)\textdlgg.obj \
$(MSWDIR)\tipdlg.obj \
+ $(MSWDIR)\tipwin.obj \
$(MSWDIR)\treectlg.obj \
$(MSWDIR)\treelay.obj \
$(MSWDIR)\wizard.obj
$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF)
+$(MSWDIR)\tipwin.obj: $(GENDIR)\tipwin.$(SRCSUFF)
+
$(MSWDIR)\treectlg.obj: $(GENDIR)\treectlg.$(SRCSUFF)
$(MSWDIR)\treelay.obj: $(GENDIR)\treelay.$(SRCSUFF)
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
#
$(GENDIR)\tbarsmpl.obj \
$(GENDIR)\textdlgg.obj \
$(GENDIR)\tipdlg.obj \
+ $(GENDIR)\tipwin.obj \
$(GENDIR)\treectlg.obj \
$(GENDIR)\treelay.obj \
$(GENDIR)\wizard.obj
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
+$(GENDIR)/tipwin.obj: $*.$(SRCSUFF)
+ cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
$(GENDIR)/treectlg.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
#
$(GENDIR)/tbarsmpl.$(OBJSUFF) \
$(GENDIR)/textdlgg.$(OBJSUFF) \
$(GENDIR)/tipdlg.$(OBJSUFF) \
+ $(GENDIR)/tipwin.$(OBJSUFF) \
$(GENDIR)/treectlg.$(OBJSUFF) \
$(GENDIR)/treelay.$(OBJSUFF) \
$(GENDIR)/wizard.$(OBJSUFF)
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
# Symantec C++ makefile for the msw objects
$(GENDIR)\tbarsmpl.obj \
$(GENDIR)\textdlgg.obj \
$(GENDIR)\tipdlg.obj \
+ $(GENDIR)\tipwin.obj \
$(GENDIR)\treectlg.obj \
$(GENDIR)\treelay.obj \
$(GENDIR)\wizard.obj
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
# File: makefile.vc
..\generic\$D\tbarsmpl.obj \
..\generic\$D\textdlgg.obj \
..\generic\$D\tipdlg.obj \
+ ..\generic\$D\tipwin.obj \
..\generic\$D\treectlg.obj \
..\generic\$D\treelay.obj \
..\generic\$D\wizard.obj
#!/binb/wmake.exe
-# This file was automatically generated by tmake at 11:57, 2000/09/08
+# This file was automatically generated by tmake at 19:28, 2000/09/10
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
#
tbarsmpl.obj &
textdlgg.obj &
tipdlg.obj &
+ tipwin.obj &
treectlg.obj &
treelay.obj &
wizard.obj
tipdlg.obj: $(GENDIR)\tipdlg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+tipwin.obj: $(GENDIR)\tipwin.cpp
+ *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+
treectlg.obj: $(GENDIR)\treectlg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<