wxToolTip part II
small change in tab traversal makefile corrections wxGLCanvas moved git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1498 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
56b9c74101
commit
b11708106f
@ -369,9 +369,9 @@ Depending on how wxWindows has been configured, not all formats may be available
|
||||
|
||||
Returns a scaled version of the image. This is also useful for
|
||||
scaling bitmaps in general as the only other way to scale bitmaps
|
||||
is do blit a wxMemoryDC into another wxMemoryDC. Windows can such scaling
|
||||
itself, but on GTK scaling bitmaps is done using this routine
|
||||
internally.
|
||||
is to blit a wxMemoryDC into another wxMemoryDC. Windows can do such
|
||||
scaling itself but in the GTK port, scaling bitmaps is done using
|
||||
this routine internally.
|
||||
|
||||
\membersection{wxImage::SetData}\label{wximagesetdata}
|
||||
|
||||
@ -391,7 +391,7 @@ Specifies whether there is a mask or not. The area of the mask is determined by
|
||||
|
||||
\func{void}{SetMaskColour}{\param{unsigned char }{red}, \param{unsigned char }{blue}, \param{unsigned char }{green}}
|
||||
|
||||
Sets the mask colour for this image.
|
||||
Sets the mask colour for this image (and tells the image to use the mask).
|
||||
|
||||
\membersection{wxImage::SetRGB}\label{wximagesetrgb}
|
||||
|
||||
|
@ -1030,6 +1030,7 @@ typedef struct _GtkStyle GtkStyle;
|
||||
typedef struct _GtkAdjustment GtkAdjustment;
|
||||
typedef struct _GtkList GtkList;
|
||||
typedef struct _GtkToolbar GtkToolbar;
|
||||
typedef struct _GtkTooltips GtkTooltips;
|
||||
typedef struct _GtkNotebook GtkNotebook;
|
||||
typedef struct _GtkNotebookPage GtkNotebookPage;
|
||||
|
||||
|
@ -94,6 +94,9 @@ public:
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif
|
||||
void SetToolTip( wxToolTip *tip );
|
||||
void SetToolTip( const wxString &tip );
|
||||
|
||||
|
||||
// implementation
|
||||
|
||||
|
@ -32,13 +32,24 @@ class wxToolTip: public wxObject
|
||||
{
|
||||
public:
|
||||
|
||||
wxToolTip() {}
|
||||
wxToolTip( const wxString &tip );
|
||||
~wxToolTip();
|
||||
|
||||
static void Add( wxWindow *tool, const wxString &tip );
|
||||
static void Enable( bool flag );
|
||||
static void SetDelay( long msecs );
|
||||
wxString GetTip();
|
||||
|
||||
void Enable( bool flag );
|
||||
void SetDelay( long msecs );
|
||||
bool Ok();
|
||||
|
||||
// implementation
|
||||
|
||||
wxString m_text;
|
||||
|
||||
GtkTooltips *m_tooltips;
|
||||
GdkColor *m_bg;
|
||||
GdkColor *m_fg;
|
||||
|
||||
void Create( GtkWidget *tool );
|
||||
};
|
||||
|
||||
#endif // __GTKTOOLTIPH__
|
||||
|
@ -55,6 +55,7 @@ class wxItemResource;
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
class wxDropTarget;
|
||||
#endif
|
||||
class wxToolTip;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
@ -207,8 +208,8 @@ public:
|
||||
void PushEventHandler( wxEvtHandler *handler );
|
||||
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
|
||||
|
||||
virtual wxValidator *GetValidator();
|
||||
virtual void SetValidator( const wxValidator &validator );
|
||||
virtual wxValidator *GetValidator();
|
||||
|
||||
virtual void SetClientObject( wxClientData *data );
|
||||
virtual wxClientData *GetClientObject();
|
||||
@ -225,9 +226,13 @@ public:
|
||||
wxWindowID GetId() const;
|
||||
|
||||
void SetCursor( const wxCursor &cursor );
|
||||
|
||||
|
||||
void WarpPointer(int x, int y);
|
||||
|
||||
virtual void SetToolTip( const wxString &tip );
|
||||
virtual void SetToolTip( wxToolTip *tip );
|
||||
virtual wxToolTip& GetToolTip();
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Clear();
|
||||
|
||||
@ -359,6 +364,7 @@ public:
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
wxToolTip *m_toolTip;
|
||||
|
||||
GtkWidget *m_widget;
|
||||
GtkWidget *m_wxwindow;
|
||||
|
@ -94,6 +94,9 @@ public:
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif
|
||||
void SetToolTip( wxToolTip *tip );
|
||||
void SetToolTip( const wxString &tip );
|
||||
|
||||
|
||||
// implementation
|
||||
|
||||
|
@ -32,13 +32,24 @@ class wxToolTip: public wxObject
|
||||
{
|
||||
public:
|
||||
|
||||
wxToolTip() {}
|
||||
wxToolTip( const wxString &tip );
|
||||
~wxToolTip();
|
||||
|
||||
static void Add( wxWindow *tool, const wxString &tip );
|
||||
static void Enable( bool flag );
|
||||
static void SetDelay( long msecs );
|
||||
wxString GetTip();
|
||||
|
||||
void Enable( bool flag );
|
||||
void SetDelay( long msecs );
|
||||
bool Ok();
|
||||
|
||||
// implementation
|
||||
|
||||
wxString m_text;
|
||||
|
||||
GtkTooltips *m_tooltips;
|
||||
GdkColor *m_bg;
|
||||
GdkColor *m_fg;
|
||||
|
||||
void Create( GtkWidget *tool );
|
||||
};
|
||||
|
||||
#endif // __GTKTOOLTIPH__
|
||||
|
@ -55,6 +55,7 @@ class wxItemResource;
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
class wxDropTarget;
|
||||
#endif
|
||||
class wxToolTip;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
@ -207,8 +208,8 @@ public:
|
||||
void PushEventHandler( wxEvtHandler *handler );
|
||||
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
|
||||
|
||||
virtual wxValidator *GetValidator();
|
||||
virtual void SetValidator( const wxValidator &validator );
|
||||
virtual wxValidator *GetValidator();
|
||||
|
||||
virtual void SetClientObject( wxClientData *data );
|
||||
virtual wxClientData *GetClientObject();
|
||||
@ -225,9 +226,13 @@ public:
|
||||
wxWindowID GetId() const;
|
||||
|
||||
void SetCursor( const wxCursor &cursor );
|
||||
|
||||
|
||||
void WarpPointer(int x, int y);
|
||||
|
||||
virtual void SetToolTip( const wxString &tip );
|
||||
virtual void SetToolTip( wxToolTip *tip );
|
||||
virtual wxToolTip& GetToolTip();
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Clear();
|
||||
|
||||
@ -359,6 +364,7 @@ public:
|
||||
wxAcceleratorTable m_acceleratorTable;
|
||||
wxClientData *m_clientObject;
|
||||
void *m_clientData;
|
||||
wxToolTip *m_toolTip;
|
||||
|
||||
GtkWidget *m_widget;
|
||||
GtkWidget *m_wxwindow;
|
||||
|
@ -230,7 +230,7 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
||||
EVT_BUTTON (ID_CHOICE_DELETE, MyPanel::OnChoiceButtons)
|
||||
EVT_BUTTON (ID_CHOICE_FONT, MyPanel::OnChoiceButtons)
|
||||
EVT_CHECKBOX (ID_CHOICE_ENABLE, MyPanel::OnChoiceButtons)
|
||||
EVT_CHOICE (ID_COMBO, MyPanel::OnCombo)
|
||||
EVT_COMBOBOX (ID_COMBO, MyPanel::OnCombo)
|
||||
EVT_BUTTON (ID_COMBO_SEL_NUM, MyPanel::OnComboButtons)
|
||||
EVT_BUTTON (ID_COMBO_SEL_STR, MyPanel::OnComboButtons)
|
||||
EVT_BUTTON (ID_COMBO_CLEAR, MyPanel::OnComboButtons)
|
||||
@ -333,6 +333,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
// panel->SetBackgroundColour("cadet blue");
|
||||
// panel->SetForegroundColour("blue");
|
||||
m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 5, choices );
|
||||
#ifdef __WXGTK__
|
||||
m_listbox->SetToolTip( "This is a list box" );
|
||||
#endif
|
||||
// m_listbox->SetBackgroundColour("wheat");
|
||||
(void)new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_LISTBOX_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
||||
@ -340,13 +343,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
(void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
|
||||
button = new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
|
||||
|
||||
#ifdef __WXGTK__
|
||||
wxToolTip::Add( button, "Press here to set italic font" );
|
||||
button->SetToolTip( "Press here to set italic font" );
|
||||
#endif
|
||||
|
||||
// button->SetForegroundColour( "red" );
|
||||
m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
|
||||
m_checkbox->SetValue(FALSE);
|
||||
#ifdef __WXGTK__
|
||||
m_checkbox->SetToolTip( "Click here to disable the listbox" );
|
||||
#endif
|
||||
m_notebook->AddPage(panel, "wxList", TRUE, Image_List);
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
@ -385,7 +391,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
// tc->SetBackgroundColour("wheat");
|
||||
m_multitext = new wxTextCtrl( panel, ID_TEXT, "And here.", wxPoint(10,50), wxSize(320,160), wxTE_MULTILINE );
|
||||
(*m_multitext) << " More text.";
|
||||
m_multitext->SetBackgroundColour("wheat");
|
||||
// m_multitext->SetBackgroundColour("wheat");
|
||||
(void)new wxStaticBox( panel, -1, "wxClipboard", wxPoint(345,50), wxSize(160,145) );
|
||||
(void)new wxButton( panel, ID_COPY_TEXT, "Copy line 1", wxPoint(370,80), wxSize(110,30) );
|
||||
(void)new wxButton( panel, ID_PASTE_TEXT, "Paste text", wxPoint(370,140), wxSize(110,30) );
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
// If 1, use real DDE. If 0, use TCP/IP
|
||||
#define wxUSE_DDE_FOR_SAMPLE 1
|
||||
#define wxUSE_DDE_FOR_SAMPLE 0
|
||||
|
||||
#if wxUSE_DDE_FOR_SAMPLE
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "wx/utils.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/checklst.h"
|
||||
#include "wx/tooltip.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
#include "wx/dnd.h"
|
||||
@ -345,6 +346,8 @@ void wxListBox::AppendCommon( const wxString &item )
|
||||
if (m_dropTarget) m_dropTarget->RegisterWidget( list_item );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (m_toolTip) m_toolTip->Create( list_item );
|
||||
}
|
||||
|
||||
void wxListBox::Append( const wxString &item )
|
||||
@ -673,6 +676,29 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxListBox::SetToolTip( const wxString &tip )
|
||||
{
|
||||
SetToolTip( new wxToolTip( tip ) );
|
||||
}
|
||||
|
||||
void wxListBox::SetToolTip( wxToolTip *tip )
|
||||
{
|
||||
if (m_toolTip) delete m_toolTip;
|
||||
|
||||
m_toolTip = tip;
|
||||
|
||||
if (!tip) return;
|
||||
|
||||
m_toolTip->Create( GTK_WIDGET(m_list) ); /* this has no effect */
|
||||
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
m_toolTip->Create( GTK_WIDGET( child->data ) );
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
||||
{
|
||||
@ -750,3 +776,4 @@ void wxListBox::ApplyWidgetStyle()
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,54 +16,69 @@
|
||||
#include "gtk/gtk.h"
|
||||
#include "gdk/gdk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
GtkTooltips *gs_tooltips = (GtkTooltips*) NULL;
|
||||
GdkColor gs_tooltip_bg;
|
||||
GdkColor gs_tooltip_fg;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolTip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void wxToolTip::Add( wxWindow *tool, const wxString &tip )
|
||||
wxToolTip::wxToolTip( const wxString &tip )
|
||||
{
|
||||
if (!gs_tooltips)
|
||||
m_text = tip;
|
||||
|
||||
m_tooltips = (GtkTooltips*) NULL;
|
||||
|
||||
m_fg = new GdkColor;
|
||||
m_fg->red = 0;
|
||||
m_fg->green = 0;
|
||||
m_fg->blue = 0;
|
||||
|
||||
m_bg = new GdkColor;
|
||||
m_bg->red = 65535;
|
||||
m_bg->green = 65535;
|
||||
m_bg->blue = 50000;
|
||||
}
|
||||
|
||||
wxToolTip::~wxToolTip()
|
||||
{
|
||||
gtk_object_unref( GTK_OBJECT(m_tooltips) );
|
||||
|
||||
delete m_fg;
|
||||
delete m_bg;
|
||||
}
|
||||
|
||||
bool wxToolTip::Ok()
|
||||
{
|
||||
return (m_tooltips);
|
||||
}
|
||||
|
||||
void wxToolTip::Create( GtkWidget *tool )
|
||||
{
|
||||
if (!m_tooltips)
|
||||
{
|
||||
gs_tooltips = gtk_tooltips_new();
|
||||
m_tooltips = gtk_tooltips_new();
|
||||
|
||||
gs_tooltip_fg.red = 0;
|
||||
gs_tooltip_fg.green = 0;
|
||||
gs_tooltip_fg.blue = 0;
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_fg );
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool ), m_fg );
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool ), m_bg );
|
||||
|
||||
gs_tooltip_bg.red = 65535;
|
||||
gs_tooltip_bg.green = 65535;
|
||||
gs_tooltip_bg.blue = 50000;
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_bg );
|
||||
|
||||
gtk_tooltips_set_colors( gs_tooltips, &gs_tooltip_bg, &gs_tooltip_fg );
|
||||
gtk_tooltips_set_colors( m_tooltips, m_bg, m_fg );
|
||||
}
|
||||
|
||||
gtk_tooltips_set_tip( gs_tooltips, tool->GetConnectWidget(), tip, (gchar*) NULL );
|
||||
gtk_tooltips_set_tip( m_tooltips, tool, m_text, (gchar*) NULL );
|
||||
}
|
||||
|
||||
void wxToolTip::Enable( bool flag )
|
||||
{
|
||||
if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
|
||||
if (!Ok()) return;
|
||||
|
||||
if (flag)
|
||||
gtk_tooltips_enable( gs_tooltips );
|
||||
gtk_tooltips_enable( m_tooltips );
|
||||
else
|
||||
gtk_tooltips_disable( gs_tooltips );
|
||||
gtk_tooltips_disable( m_tooltips );
|
||||
}
|
||||
|
||||
void wxToolTip::SetDelay( long msecs )
|
||||
{
|
||||
if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
|
||||
if (!Ok()) return;
|
||||
|
||||
gtk_tooltips_set_delay( gs_tooltips, msecs );
|
||||
gtk_tooltips_set_delay( m_tooltips, msecs );
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
#include "wx/dnd.h"
|
||||
#endif
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/menu.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/intl.h"
|
||||
@ -1234,12 +1235,12 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
||||
// InsertChild for wxWindow.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Callback for wxWindow. This very strange beast has to be used because
|
||||
// C++ has no virtual methods in a constructor. We have to emulate a
|
||||
// virtual function here as wxNotebook requires a different way to insert
|
||||
// a child in it. I had opted for creating a wxNotebookPage window class
|
||||
// which would have made this superfluous (such in the MDI window system),
|
||||
// but no-one was listening to me...
|
||||
/* Callback for wxWindow. This very strange beast has to be used because
|
||||
* C++ has no virtual methods in a constructor. We have to emulate a
|
||||
* virtual function here as wxNotebook requires a different way to insert
|
||||
* a child in it. I had opted for creating a wxNotebookPage window class
|
||||
* which would have made this superfluous (such in the MDI window system),
|
||||
* but no-one was listening to me... */
|
||||
|
||||
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
|
||||
{
|
||||
@ -1342,6 +1343,8 @@ wxWindow::wxWindow()
|
||||
|
||||
m_isStaticBox = FALSE;
|
||||
m_acceptsFocus = FALSE;
|
||||
|
||||
m_toolTip = (wxToolTip*) NULL;
|
||||
}
|
||||
|
||||
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
|
||||
@ -1420,7 +1423,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ((m_windowStyle & wxTAB_TRAVERSAL) != 0)
|
||||
{
|
||||
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); /* changed from UNSET */
|
||||
m_acceptsFocus = FALSE;
|
||||
}
|
||||
else
|
||||
@ -1500,6 +1503,8 @@ wxWindow::~wxWindow()
|
||||
if (m_dropTarget) delete m_dropTarget;
|
||||
#endif
|
||||
|
||||
if (m_toolTip) delete m_toolTip;
|
||||
|
||||
if (m_parent) m_parent->RemoveChild( this );
|
||||
if (m_widget) Show( FALSE );
|
||||
|
||||
@ -1629,6 +1634,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
m_clientData = NULL;
|
||||
|
||||
m_isStaticBox = FALSE;
|
||||
m_toolTip = (wxToolTip*) NULL;
|
||||
}
|
||||
|
||||
void wxWindow::PostCreation()
|
||||
@ -2458,6 +2464,28 @@ void wxWindow::Clear()
|
||||
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
|
||||
}
|
||||
|
||||
void wxWindow::SetToolTip( const wxString &tip )
|
||||
{
|
||||
SetToolTip( new wxToolTip( tip ) );
|
||||
}
|
||||
|
||||
void wxWindow::SetToolTip( wxToolTip *tip )
|
||||
{
|
||||
if (m_toolTip) delete m_toolTip;
|
||||
|
||||
m_toolTip = tip;
|
||||
|
||||
if (m_toolTip) m_toolTip->Create( GetConnectWidget() );
|
||||
}
|
||||
|
||||
wxToolTip& wxWindow::GetToolTip()
|
||||
{
|
||||
if (!m_toolTip)
|
||||
wxLogError( "No tooltip set." );
|
||||
|
||||
return *m_toolTip;
|
||||
}
|
||||
|
||||
wxColour wxWindow::GetBackgroundColour() const
|
||||
{
|
||||
return m_backgroundColour;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "wx/utils.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/checklst.h"
|
||||
#include "wx/tooltip.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
#include "wx/dnd.h"
|
||||
@ -345,6 +346,8 @@ void wxListBox::AppendCommon( const wxString &item )
|
||||
if (m_dropTarget) m_dropTarget->RegisterWidget( list_item );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (m_toolTip) m_toolTip->Create( list_item );
|
||||
}
|
||||
|
||||
void wxListBox::Append( const wxString &item )
|
||||
@ -673,6 +676,29 @@ int wxListBox::GetIndex( GtkWidget *item ) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxListBox::SetToolTip( const wxString &tip )
|
||||
{
|
||||
SetToolTip( new wxToolTip( tip ) );
|
||||
}
|
||||
|
||||
void wxListBox::SetToolTip( wxToolTip *tip )
|
||||
{
|
||||
if (m_toolTip) delete m_toolTip;
|
||||
|
||||
m_toolTip = tip;
|
||||
|
||||
if (!tip) return;
|
||||
|
||||
m_toolTip->Create( GTK_WIDGET(m_list) ); /* this has no effect */
|
||||
|
||||
GList *child = m_list->children;
|
||||
while (child)
|
||||
{
|
||||
m_toolTip->Create( GTK_WIDGET( child->data ) );
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
void wxListBox::SetDropTarget( wxDropTarget *dropTarget )
|
||||
{
|
||||
@ -750,3 +776,4 @@ void wxListBox::ApplyWidgetStyle()
|
||||
child = child->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,54 +16,69 @@
|
||||
#include "gtk/gtk.h"
|
||||
#include "gdk/gdk.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
GtkTooltips *gs_tooltips = (GtkTooltips*) NULL;
|
||||
GdkColor gs_tooltip_bg;
|
||||
GdkColor gs_tooltip_fg;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolTip
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void wxToolTip::Add( wxWindow *tool, const wxString &tip )
|
||||
wxToolTip::wxToolTip( const wxString &tip )
|
||||
{
|
||||
if (!gs_tooltips)
|
||||
m_text = tip;
|
||||
|
||||
m_tooltips = (GtkTooltips*) NULL;
|
||||
|
||||
m_fg = new GdkColor;
|
||||
m_fg->red = 0;
|
||||
m_fg->green = 0;
|
||||
m_fg->blue = 0;
|
||||
|
||||
m_bg = new GdkColor;
|
||||
m_bg->red = 65535;
|
||||
m_bg->green = 65535;
|
||||
m_bg->blue = 50000;
|
||||
}
|
||||
|
||||
wxToolTip::~wxToolTip()
|
||||
{
|
||||
gtk_object_unref( GTK_OBJECT(m_tooltips) );
|
||||
|
||||
delete m_fg;
|
||||
delete m_bg;
|
||||
}
|
||||
|
||||
bool wxToolTip::Ok()
|
||||
{
|
||||
return (m_tooltips);
|
||||
}
|
||||
|
||||
void wxToolTip::Create( GtkWidget *tool )
|
||||
{
|
||||
if (!m_tooltips)
|
||||
{
|
||||
gs_tooltips = gtk_tooltips_new();
|
||||
m_tooltips = gtk_tooltips_new();
|
||||
|
||||
gs_tooltip_fg.red = 0;
|
||||
gs_tooltip_fg.green = 0;
|
||||
gs_tooltip_fg.blue = 0;
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_fg );
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool ), m_fg );
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool ), m_bg );
|
||||
|
||||
gs_tooltip_bg.red = 65535;
|
||||
gs_tooltip_bg.green = 65535;
|
||||
gs_tooltip_bg.blue = 50000;
|
||||
gdk_color_alloc( gtk_widget_get_colormap( tool->GetConnectWidget() ), &gs_tooltip_bg );
|
||||
|
||||
gtk_tooltips_set_colors( gs_tooltips, &gs_tooltip_bg, &gs_tooltip_fg );
|
||||
gtk_tooltips_set_colors( m_tooltips, m_bg, m_fg );
|
||||
}
|
||||
|
||||
gtk_tooltips_set_tip( gs_tooltips, tool->GetConnectWidget(), tip, (gchar*) NULL );
|
||||
gtk_tooltips_set_tip( m_tooltips, tool, m_text, (gchar*) NULL );
|
||||
}
|
||||
|
||||
void wxToolTip::Enable( bool flag )
|
||||
{
|
||||
if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
|
||||
if (!Ok()) return;
|
||||
|
||||
if (flag)
|
||||
gtk_tooltips_enable( gs_tooltips );
|
||||
gtk_tooltips_enable( m_tooltips );
|
||||
else
|
||||
gtk_tooltips_disable( gs_tooltips );
|
||||
gtk_tooltips_disable( m_tooltips );
|
||||
}
|
||||
|
||||
void wxToolTip::SetDelay( long msecs )
|
||||
{
|
||||
if (!gs_tooltips) gs_tooltips = gtk_tooltips_new();
|
||||
if (!Ok()) return;
|
||||
|
||||
gtk_tooltips_set_delay( gs_tooltips, msecs );
|
||||
gtk_tooltips_set_delay( m_tooltips, msecs );
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
#include "wx/dnd.h"
|
||||
#endif
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/menu.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/intl.h"
|
||||
@ -1234,12 +1235,12 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
||||
// InsertChild for wxWindow.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Callback for wxWindow. This very strange beast has to be used because
|
||||
// C++ has no virtual methods in a constructor. We have to emulate a
|
||||
// virtual function here as wxNotebook requires a different way to insert
|
||||
// a child in it. I had opted for creating a wxNotebookPage window class
|
||||
// which would have made this superfluous (such in the MDI window system),
|
||||
// but no-one was listening to me...
|
||||
/* Callback for wxWindow. This very strange beast has to be used because
|
||||
* C++ has no virtual methods in a constructor. We have to emulate a
|
||||
* virtual function here as wxNotebook requires a different way to insert
|
||||
* a child in it. I had opted for creating a wxNotebookPage window class
|
||||
* which would have made this superfluous (such in the MDI window system),
|
||||
* but no-one was listening to me... */
|
||||
|
||||
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
|
||||
{
|
||||
@ -1342,6 +1343,8 @@ wxWindow::wxWindow()
|
||||
|
||||
m_isStaticBox = FALSE;
|
||||
m_acceptsFocus = FALSE;
|
||||
|
||||
m_toolTip = (wxToolTip*) NULL;
|
||||
}
|
||||
|
||||
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
|
||||
@ -1420,7 +1423,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
if ((m_windowStyle & wxTAB_TRAVERSAL) != 0)
|
||||
{
|
||||
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||
GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); /* changed from UNSET */
|
||||
m_acceptsFocus = FALSE;
|
||||
}
|
||||
else
|
||||
@ -1500,6 +1503,8 @@ wxWindow::~wxWindow()
|
||||
if (m_dropTarget) delete m_dropTarget;
|
||||
#endif
|
||||
|
||||
if (m_toolTip) delete m_toolTip;
|
||||
|
||||
if (m_parent) m_parent->RemoveChild( this );
|
||||
if (m_widget) Show( FALSE );
|
||||
|
||||
@ -1629,6 +1634,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
m_clientData = NULL;
|
||||
|
||||
m_isStaticBox = FALSE;
|
||||
m_toolTip = (wxToolTip*) NULL;
|
||||
}
|
||||
|
||||
void wxWindow::PostCreation()
|
||||
@ -2458,6 +2464,28 @@ void wxWindow::Clear()
|
||||
if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
|
||||
}
|
||||
|
||||
void wxWindow::SetToolTip( const wxString &tip )
|
||||
{
|
||||
SetToolTip( new wxToolTip( tip ) );
|
||||
}
|
||||
|
||||
void wxWindow::SetToolTip( wxToolTip *tip )
|
||||
{
|
||||
if (m_toolTip) delete m_toolTip;
|
||||
|
||||
m_toolTip = tip;
|
||||
|
||||
if (m_toolTip) m_toolTip->Create( GetConnectWidget() );
|
||||
}
|
||||
|
||||
wxToolTip& wxWindow::GetToolTip()
|
||||
{
|
||||
if (!m_toolTip)
|
||||
wxLogError( "No tooltip set." );
|
||||
|
||||
return *m_toolTip;
|
||||
}
|
||||
|
||||
wxColour wxWindow::GetBackgroundColour() const
|
||||
{
|
||||
return m_backgroundColour;
|
||||
|
@ -1,3 +1,16 @@
|
||||
#
|
||||
# File: Makefile
|
||||
# Author: Robert Roebling
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Robert Roebling
|
||||
#
|
||||
# Makefile for Dialog Editor (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
|
||||
CC = g++
|
||||
|
||||
|
@ -2,15 +2,20 @@ docs/*.*
|
||||
win/*.cpp
|
||||
win/*.h
|
||||
win/make*.*
|
||||
src/*.cpp
|
||||
src/*.h
|
||||
src/make*.*
|
||||
gtk/*.cpp
|
||||
gtk/*.h
|
||||
gtk/make*.*
|
||||
motif/*.cpp
|
||||
motif/*.h
|
||||
motif/*.txt
|
||||
motif/make*.*
|
||||
samples/cube/*.cpp
|
||||
samples/cube/*.h
|
||||
samples/cube/*.rc
|
||||
samples/cube/*.ico
|
||||
samples/cube/*.xbm
|
||||
samples/cube/make*.*
|
||||
samples/cube/Makefile
|
||||
samples/isosurf/*.cpp
|
||||
samples/isosurf/*.h
|
||||
samples/isosurf/*.rc
|
||||
@ -19,6 +24,7 @@ samples/isosurf/*.xbm
|
||||
samples/isosurf/*.dat
|
||||
samples/isosurf/*.dat.gz
|
||||
samples/isosurf/make*.*
|
||||
samples/isosurf/Makefile
|
||||
samples/penguin/*.cpp
|
||||
samples/penguin/*.c
|
||||
samples/penguin/*.h
|
||||
@ -28,6 +34,7 @@ samples/penguin/*.xbm
|
||||
samples/penguin/*.xpm
|
||||
samples/penguin/make*.*
|
||||
samples/penguin/penguin.lwo
|
||||
samples/penguin/Makefile
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
#
|
||||
# File: Makefile
|
||||
# Author: Robert Roebling
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Robert Roebling
|
||||
#
|
||||
# Makefile for OpenGl demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
|
||||
CC = g++
|
||||
|
||||
@ -7,10 +20,10 @@ cube: cube.o glcanvas.o
|
||||
`wx-config --libs` -lMesaGL -lMesaGLU
|
||||
|
||||
cube.o: cube.cpp
|
||||
$(CC) `wx-config --cflags` -I../../src -c cube.cpp
|
||||
$(CC) `wx-config --cflags` -I../../gtk -c cube.cpp
|
||||
|
||||
glcanvas.o: ../../src/glcanvas.cpp
|
||||
$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../src -c ../../src/glcanvas.cpp
|
||||
glcanvas.o: ../../gtk/glcanvas.cpp
|
||||
$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../gtk -c ../../gtk/glcanvas.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o cube
|
||||
|
@ -1,3 +1,16 @@
|
||||
#
|
||||
# File: Makefile
|
||||
# Author: Robert Roebling
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Robert Roebling
|
||||
#
|
||||
# Makefile for OpenGl demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
|
||||
CC = g++
|
||||
|
||||
@ -7,10 +20,10 @@ isosurf: isosurf.o glcanvas.o
|
||||
`wx-config --libs` -lMesaGL -lMesaGLU
|
||||
|
||||
isosurf.o: isosurf.cpp
|
||||
$(CC) `wx-config --cflags` -I../../src -c isosurf.cpp
|
||||
$(CC) `wx-config --cflags` -I../../gtk -c isosurf.cpp
|
||||
|
||||
glcanvas.o: ../../src/glcanvas.cpp
|
||||
$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../src -c ../../src/glcanvas.cpp
|
||||
glcanvas.o: ../..gtk/glcanvas.cpp
|
||||
$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../gtk -c ../../gtk/glcanvas.cpp
|
||||
|
||||
clean:
|
||||
rm -f *.o cube
|
||||
|
@ -1,3 +1,16 @@
|
||||
#
|
||||
# File: Makefile
|
||||
# Author: Robert Roebling
|
||||
# Created: 1999
|
||||
# Updated:
|
||||
# Copyright: (c) 1998 Robert Roebling
|
||||
#
|
||||
# Makefile for OpenGL demo (GTK version)
|
||||
#
|
||||
# This makefile requires wxWindows/GTK to be
|
||||
# installed (possibly using "make install")
|
||||
# on your system.
|
||||
#
|
||||
|
||||
CPP = g++
|
||||
CC = gcc
|
||||
|
Loading…
Reference in New Issue
Block a user