const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name );
virtual wxToolBar *GetToolBar() const;
- void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
+ void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR
virtual void SetMenuBar( wxMenuBar *menuBar );
bool m_delayedFont:1;
bool m_delayedForegroundColour:1;
bool m_delayedBackgroundColour:1;
- bool m_delayedCursor:1;
- // the cursor is set in OnInternalIdle(). this fields holds
- // a reference to the cursor currently set in theGdk window
- // so that we don't have to set it more than once
- wxCursor m_currentGdkCursor;
-
// contains GTK's widgets internal information about non-default widget
// font and colours. we create one for each widget that gets any
// non-default attribute set via SetFont() or SetForegroundColour() /
const wxString& name = wxToolBarNameStr);
virtual wxToolBar *OnCreateToolBar( long style, wxWindowID id, const wxString& name );
virtual wxToolBar *GetToolBar() const;
- void SetToolBar(wxToolBar *toolbar) { m_frameToolBar = toolbar; }
+ void SetToolBar(wxToolBar *toolbar);
#endif // wxUSE_TOOLBAR
virtual void SetMenuBar( wxMenuBar *menuBar );
bool m_delayedFont:1;
bool m_delayedForegroundColour:1;
bool m_delayedBackgroundColour:1;
- bool m_delayedCursor:1;
- // the cursor is set in OnInternalIdle(). this fields holds
- // a reference to the cursor currently set in theGdk window
- // so that we don't have to set it more than once
- wxCursor m_currentGdkCursor;
-
// contains GTK's widgets internal information about non-default widget
// font and colours. we create one for each widget that gets any
// non-default attribute set via SetFont() or SetForegroundColour() /
MyCanvas( wxWindow *parent, wxWindowID, const wxPoint &pos, const wxSize &size );
~MyCanvas();
void OnPaint( wxPaintEvent &event );
+ void OnQueryPosition( wxCommandEvent &event );
void OnAddButton( wxCommandEvent &event );
void OnDeleteButton( wxCommandEvent &event );
void OnMoveButton( wxCommandEvent &event );
#define ID_DELBUTTON 2
#define ID_MOVEBUTTON 3
#define ID_SCROLLWIN 4
+#define ID_QUERYPOS 5
#define ID_NEWBUTTON 10
IMPLEMENT_DYNAMIC_CLASS(MyCanvas, wxScrolledWindow)
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
- EVT_PAINT( MyCanvas::OnPaint)
+ EVT_PAINT( MyCanvas::OnPaint)
+ EVT_BUTTON( ID_QUERYPOS, MyCanvas::OnQueryPosition)
EVT_BUTTON( ID_ADDBUTTON, MyCanvas::OnAddButton)
EVT_BUTTON( ID_DELBUTTON, MyCanvas::OnDeleteButton)
EVT_BUTTON( ID_MOVEBUTTON, MyCanvas::OnMoveButton)
"examples."
};
- m_button = new wxButton( this, -1, "wxButton", wxPoint(10,110) );
+ m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
(void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150) );
{
}
+void MyCanvas::OnQueryPosition( wxCommandEvent &WXUNUSED(event) )
+{
+ wxPoint pt( m_button->GetPosition() );
+ wxLogMessage( """wxButton"" position %d %d", pt.x, pt.y );
+ if ((pt.x == 10) && (pt.y == 110))
+ wxLogMessage( "-> Correct." );
+ else
+ wxLogMessage( "-> Incorrect." );
+}
+
void MyCanvas::OnAddButton( wxCommandEvent &WXUNUSED(event) )
{
- wxLogMessage( "Inserting button at position 50,50" );
- (void) new wxButton( this, ID_NEWBUTTON, "new button", wxPoint(50,50) );
+ wxLogMessage( "Inserting button at position 10,70..." );
+ (void) new wxButton( this, ID_NEWBUTTON, "new button", wxPoint(10,70), wxSize(80,25) );
}
void MyCanvas::OnDeleteButton( wxCommandEvent &event )
{
- wxLogMessage( "deleting button inserted with ""add button""" );
+ wxLogMessage( "Deleting button inserted with ""Add button""..." );
wxWindow *win = FindWindow( ID_NEWBUTTON );
if (win)
win->Destroy();
dc.DrawText( "Some text", 140, 140 );
+ dc.DrawRectangle( 10, 70, 80, 25 );
+
dc.DrawRectangle( 100, 160, 200, 200 );
}
return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
}
+void wxFrame::SetToolBar(wxToolBar *toolbar)
+{
+ m_frameToolBar = toolbar;
+ if (m_frameToolBar)
+ {
+ /* insert into toolbar area if not already there */
+ if (m_frameToolBar->m_widget->parent != m_mainWidget)
+ {
+ gtk_widget_ref( m_frameToolBar->m_widget );
+ gtk_widget_unparent( m_frameToolBar->m_widget );
+
+ m_insertInClientArea = TRUE;
+ wxInsertChildInFrame( this, m_frameToolBar );
+ m_insertInClientArea = FALSE;
+
+ gtk_widget_unref( m_frameToolBar->m_widget );
+ }
+ }
+}
+
wxToolBar *wxFrame::GetToolBar() const
{
return m_frameToolBar;
wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor;
- if (cursor.Ok() && m_currentGdkCursor != cursor)
+ if (cursor.Ok())
{
- m_currentGdkCursor = cursor;
-
GdkWindow *window = (GdkWindow*) NULL;
if (HasFlag(wxTE_MULTILINE))
window = GTK_TEXT(m_text)->text_area;
return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
}
+void wxFrame::SetToolBar(wxToolBar *toolbar)
+{
+ m_frameToolBar = toolbar;
+ if (m_frameToolBar)
+ {
+ /* insert into toolbar area if not already there */
+ if (m_frameToolBar->m_widget->parent != m_mainWidget)
+ {
+ gtk_widget_ref( m_frameToolBar->m_widget );
+ gtk_widget_unparent( m_frameToolBar->m_widget );
+
+ m_insertInClientArea = TRUE;
+ wxInsertChildInFrame( this, m_frameToolBar );
+ m_insertInClientArea = FALSE;
+
+ gtk_widget_unref( m_frameToolBar->m_widget );
+ }
+ }
+}
+
wxToolBar *wxFrame::GetToolBar() const
{
return m_frameToolBar;
wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor;
- if (cursor.Ok() && m_currentGdkCursor != cursor)
+ if (cursor.Ok())
{
- m_currentGdkCursor = cursor;
-
GdkWindow *window = (GdkWindow*) NULL;
if (HasFlag(wxTE_MULTILINE))
window = GTK_TEXT(m_text)->text_area;