Added wxWakeUpIdle() to wxGTK,
Changed wxFindFile to detect hidden files (but not "." and ".." as before), Added "show hidden files" to file dialog, Added controls to wxToolBar, doc view now uses pretty file dialogs as per MSW. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -310,6 +310,11 @@ extern void WXDLLEXPORT wxExit();
|
|||||||
// Yield to other apps/messages
|
// Yield to other apps/messages
|
||||||
extern bool WXDLLEXPORT wxYield();
|
extern bool WXDLLEXPORT wxYield();
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
// Yield to other apps/messages
|
||||||
|
extern void WXDLLEXPORT wxWakeUpIdle();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Post a message to the given eventhandler which will be processed during the
|
// Post a message to the given eventhandler which will be processed during the
|
||||||
// next event loop iteration
|
// next event loop iteration
|
||||||
inline void WXDLLEXPORT wxPostEvent(wxEvtHandler *dest, wxEvent& event)
|
inline void WXDLLEXPORT wxPostEvent(wxEvtHandler *dest, wxEvent& event)
|
||||||
|
@@ -166,6 +166,7 @@ public:
|
|||||||
void OnNew( wxCommandEvent &event );
|
void OnNew( wxCommandEvent &event );
|
||||||
void OnChoice( wxCommandEvent &event );
|
void OnChoice( wxCommandEvent &event );
|
||||||
void OnTextEnter( wxCommandEvent &event );
|
void OnTextEnter( wxCommandEvent &event );
|
||||||
|
void OnCheck( wxCommandEvent &event );
|
||||||
|
|
||||||
void HandleAction( const wxString &fn );
|
void HandleAction( const wxString &fn );
|
||||||
|
|
||||||
|
@@ -49,11 +49,11 @@ extern const wxChar *wxToolBarNameStr;
|
|||||||
class wxToolBar: public wxControl
|
class wxToolBar: public wxControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxToolBar(void);
|
wxToolBar();
|
||||||
wxToolBar( wxWindow *parent, wxWindowID id,
|
wxToolBar( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
long style = 0, const wxString& name = wxToolBarNameStr );
|
long style = 0, const wxString& name = wxToolBarNameStr );
|
||||||
~wxToolBar(void);
|
~wxToolBar();
|
||||||
|
|
||||||
bool Create( wxWindow *parent, wxWindowID id,
|
bool Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
@@ -76,10 +76,16 @@ public:
|
|||||||
const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
|
const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
|
||||||
wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL,
|
wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL,
|
||||||
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
||||||
virtual void AddSeparator(void);
|
|
||||||
virtual void ClearTools(void);
|
|
||||||
|
|
||||||
virtual bool Realize(void);
|
// Add arbitrary control
|
||||||
|
virtual bool AddControl(wxControl *control);
|
||||||
|
|
||||||
|
// Add space
|
||||||
|
virtual void AddSeparator();
|
||||||
|
|
||||||
|
virtual void ClearTools();
|
||||||
|
|
||||||
|
virtual bool Realize();
|
||||||
|
|
||||||
virtual void EnableTool(int toolIndex, bool enable);
|
virtual void EnableTool(int toolIndex, bool enable);
|
||||||
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
|
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
|
||||||
|
@@ -49,11 +49,11 @@ extern const wxChar *wxToolBarNameStr;
|
|||||||
class wxToolBar: public wxControl
|
class wxToolBar: public wxControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxToolBar(void);
|
wxToolBar();
|
||||||
wxToolBar( wxWindow *parent, wxWindowID id,
|
wxToolBar( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
long style = 0, const wxString& name = wxToolBarNameStr );
|
long style = 0, const wxString& name = wxToolBarNameStr );
|
||||||
~wxToolBar(void);
|
~wxToolBar();
|
||||||
|
|
||||||
bool Create( wxWindow *parent, wxWindowID id,
|
bool Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
@@ -76,10 +76,16 @@ public:
|
|||||||
const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
|
const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
|
||||||
wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL,
|
wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL,
|
||||||
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
||||||
virtual void AddSeparator(void);
|
|
||||||
virtual void ClearTools(void);
|
|
||||||
|
|
||||||
virtual bool Realize(void);
|
// Add arbitrary control
|
||||||
|
virtual bool AddControl(wxControl *control);
|
||||||
|
|
||||||
|
// Add space
|
||||||
|
virtual void AddSeparator();
|
||||||
|
|
||||||
|
virtual void ClearTools();
|
||||||
|
|
||||||
|
virtual bool Realize();
|
||||||
|
|
||||||
virtual void EnableTool(int toolIndex, bool enable);
|
virtual void EnableTool(int toolIndex, bool enable);
|
||||||
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
|
virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
|
||||||
|
@@ -224,6 +224,8 @@ bool MyApp::InitToolbar(wxToolBar* toolBar, bool smallicons)
|
|||||||
combo->Append("toolbar");
|
combo->Append("toolbar");
|
||||||
toolBar->AddControl(combo);
|
toolBar->AddControl(combo);
|
||||||
|
|
||||||
|
toolBar->AddSeparator();
|
||||||
|
|
||||||
if ( !smallicons )
|
if ( !smallicons )
|
||||||
{
|
{
|
||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
@@ -238,11 +240,6 @@ bool MyApp::InitToolbar(wxToolBar* toolBar, bool smallicons)
|
|||||||
currentX += width + 5;
|
currentX += width + 5;
|
||||||
toolBar->AddSeparator();
|
toolBar->AddSeparator();
|
||||||
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help button");
|
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help button");
|
||||||
|
|
||||||
toolBar->ToggleTool( wxID_SAVE, TRUE );
|
|
||||||
toolBar->ToggleTool( wxID_COPY, TRUE );
|
|
||||||
toolBar->ToggleTool( wxID_COPY, FALSE );
|
|
||||||
toolBar->EnableTool( wxID_PRINT, FALSE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolBar->Realize();
|
toolBar->Realize();
|
||||||
@@ -303,7 +300,7 @@ MyFrame::MyFrame(wxFrame* parent,
|
|||||||
wxTB_FLAT | wxTB_DOCKABLE,
|
wxTB_FLAT | wxTB_DOCKABLE,
|
||||||
ID_TOOLBAR);
|
ID_TOOLBAR);
|
||||||
|
|
||||||
tbar->SetMargins( 2, 2 );
|
tbar->SetMargins( 4, 4 );
|
||||||
|
|
||||||
wxGetApp().InitToolbar(tbar);
|
wxGetApp().InitToolbar(tbar);
|
||||||
}
|
}
|
||||||
|
@@ -1191,7 +1191,7 @@ wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path)
|
|||||||
// template extension.
|
// template extension.
|
||||||
|
|
||||||
wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
||||||
#ifdef __WXMSW__
|
#if defined(__WXMSW__) || defined(__WXGTK__)
|
||||||
int noTemplates,
|
int noTemplates,
|
||||||
#else
|
#else
|
||||||
int WXUNUSED(noTemplates),
|
int WXUNUSED(noTemplates),
|
||||||
@@ -1200,8 +1200,8 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
|
|||||||
long WXUNUSED(flags),
|
long WXUNUSED(flags),
|
||||||
bool WXUNUSED(save))
|
bool WXUNUSED(save))
|
||||||
{
|
{
|
||||||
// We can only have multiple filters in Windows
|
// We can only have multiple filters in Windows and GTK
|
||||||
#ifdef __WXMSW__
|
#if defined(__WXMSW__) || defined(__WXGTK__)
|
||||||
wxString descrBuf;
|
wxString descrBuf;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@@ -611,10 +611,7 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
|||||||
|
|
||||||
// TODO: Wake up idle handler for the other platforms.
|
// TODO: Wake up idle handler for the other platforms.
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
extern bool g_isIdle;
|
wxWakeUpIdle();
|
||||||
extern void wxapp_install_idle_handler();
|
|
||||||
if ( g_isIdle )
|
|
||||||
wxapp_install_idle_handler();
|
|
||||||
#elif wxUSE_GUI // this works for wxMSW, but may be for others too?
|
#elif wxUSE_GUI // this works for wxMSW, but may be for others too?
|
||||||
// might also send a dummy message to the top level window, this would
|
// might also send a dummy message to the top level window, this would
|
||||||
// probably be cleaner?
|
// probably be cleaner?
|
||||||
|
@@ -1304,7 +1304,9 @@ wxString wxFindNextFile()
|
|||||||
nextDir != NULL;
|
nextDir != NULL;
|
||||||
nextDir = readdir(gs_dirStream) )
|
nextDir = readdir(gs_dirStream) )
|
||||||
{
|
{
|
||||||
if (wxMatchWild(name, nextDir->d_name))
|
if (wxMatchWild(name, nextDir->d_name, FALSE) && // RR: added FALSE to find hidden files
|
||||||
|
strcmp(nextDir->d_name, ".") &&
|
||||||
|
strcmp(nextDir->d_name, "..") )
|
||||||
{
|
{
|
||||||
result.Empty();
|
result.Empty();
|
||||||
if ( !path.IsEmpty() )
|
if ( !path.IsEmpty() )
|
||||||
|
@@ -543,6 +543,7 @@ void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event )
|
|||||||
#define ID_TEXT wxID_FILEDLGG + 9
|
#define ID_TEXT wxID_FILEDLGG + 9
|
||||||
#define ID_LIST_CTRL wxID_FILEDLGG + 10
|
#define ID_LIST_CTRL wxID_FILEDLGG + 10
|
||||||
#define ID_ACTIVATED wxID_FILEDLGG + 11
|
#define ID_ACTIVATED wxID_FILEDLGG + 11
|
||||||
|
#define ID_CHECK wxID_FILEDLGG + 12
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
|
||||||
|
|
||||||
@@ -557,6 +558,7 @@ BEGIN_EVENT_TABLE(wxFileDialog,wxDialog)
|
|||||||
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
|
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
|
||||||
EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoice)
|
EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoice)
|
||||||
EVT_TEXT_ENTER(ID_TEXT,wxFileDialog::OnTextEnter)
|
EVT_TEXT_ENTER(ID_TEXT,wxFileDialog::OnTextEnter)
|
||||||
|
EVT_CHECKBOX(ID_CHECK,wxFileDialog::OnCheck)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxFileDialog::wxFileDialog(wxWindow *parent,
|
wxFileDialog::wxFileDialog(wxWindow *parent,
|
||||||
@@ -668,6 +670,9 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
|||||||
wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
m_choice = new wxChoice( this, ID_CHOICE );
|
m_choice = new wxChoice( this, ID_CHOICE );
|
||||||
choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 10 );
|
choicesizer->Add( m_choice, 1, wxCENTER|wxALL, 10 );
|
||||||
|
m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden files") );
|
||||||
|
m_check->SetValue( FALSE );
|
||||||
|
choicesizer->Add( m_check, 0, wxCENTER|wxALL, 10 );
|
||||||
choicesizer->Add( new wxButton( this, wxID_CANCEL, _("Cancel") ), 0, wxCENTER | wxALL, 10 );
|
choicesizer->Add( new wxButton( this, wxID_CANCEL, _("Cancel") ), 0, wxCENTER | wxALL, 10 );
|
||||||
mainsizer->Add( choicesizer, 0, wxEXPAND );
|
mainsizer->Add( choicesizer, 0, wxEXPAND );
|
||||||
|
|
||||||
@@ -706,6 +711,11 @@ void wxFileDialog::OnChoice( wxCommandEvent &event )
|
|||||||
m_list->SetWild( *str );
|
m_list->SetWild( *str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFileDialog::OnCheck( wxCommandEvent &event )
|
||||||
|
{
|
||||||
|
m_list->ShowHidden( event.GetInt() );
|
||||||
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnActivated( wxListEvent &event )
|
void wxFileDialog::OnActivated( wxListEvent &event )
|
||||||
{
|
{
|
||||||
HandleAction( event.m_item.m_text );
|
HandleAction( event.m_item.m_text );
|
||||||
|
@@ -124,8 +124,13 @@ unsigned char g_palette[64*3] =
|
|||||||
|
|
||||||
extern void wxFlushResources();
|
extern void wxFlushResources();
|
||||||
|
|
||||||
|
/* forward declaration */
|
||||||
|
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
|
||||||
|
void wxapp_install_idle_handler();
|
||||||
|
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// global functions
|
// wxExit
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxExit()
|
void wxExit()
|
||||||
@@ -133,8 +138,9 @@ void wxExit()
|
|||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* forward declaration */
|
//-----------------------------------------------------------------------------
|
||||||
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
|
// wxYield
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxYield()
|
bool wxYield()
|
||||||
{
|
{
|
||||||
@@ -165,6 +171,20 @@ bool wxYield()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxWakeUpIdle
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// local functions
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
||||||
{
|
{
|
||||||
if (!wxTheApp) return TRUE;
|
if (!wxTheApp) return TRUE;
|
||||||
@@ -213,9 +233,6 @@ void wxapp_install_idle_handler()
|
|||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
|
|
||||||
/* forward declaration */
|
|
||||||
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
|
|
||||||
|
|
||||||
void wxapp_install_thread_wakeup()
|
void wxapp_install_thread_wakeup()
|
||||||
{
|
{
|
||||||
if (wxTheApp->m_wakeUpTimerTag) return;
|
if (wxTheApp->m_wakeUpTimerTag) return;
|
||||||
|
@@ -43,7 +43,8 @@ extern bool g_blockEventsOnDrag;
|
|||||||
|
|
||||||
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!button->m_hasVMT) return;
|
if (!button->m_hasVMT) return;
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
@@ -122,6 +122,15 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// InsertChild callback for wxToolBar
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent), wxWindow* WXUNUSED(child) )
|
||||||
|
{
|
||||||
|
/* we don't do anything here but pray */
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolBar
|
// wxToolBar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -155,6 +164,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
m_blockNextEvent = FALSE;
|
m_blockNextEvent = FALSE;
|
||||||
|
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
@@ -304,7 +314,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
|
|
||||||
GtkWidget *item = gtk_toolbar_append_element
|
GtkWidget *item = gtk_toolbar_append_element
|
||||||
(
|
(
|
||||||
GTK_TOOLBAR(m_toolbar),
|
m_toolbar,
|
||||||
ctype,
|
ctype,
|
||||||
(GtkWidget *)NULL,
|
(GtkWidget *)NULL,
|
||||||
(const char *)NULL,
|
(const char *)NULL,
|
||||||
@@ -332,6 +342,29 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxToolBar::AddControl(wxControl *control)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( control, FALSE, wxT("toolbar: can't insert NULL control") );
|
||||||
|
|
||||||
|
wxCHECK_MSG( control->GetParent() == this, FALSE,
|
||||||
|
wxT("control must have toolbar as parent") );
|
||||||
|
|
||||||
|
m_hasToolAlready = TRUE;
|
||||||
|
|
||||||
|
wxToolBarTool *tool = new wxToolBarTool(control);
|
||||||
|
|
||||||
|
gtk_toolbar_append_widget( m_toolbar, control->m_widget, (const char *) NULL, (const char *) NULL );
|
||||||
|
|
||||||
|
GtkRequisition req;
|
||||||
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
||||||
|
m_width = req.width;
|
||||||
|
m_height = req.height;
|
||||||
|
|
||||||
|
m_tools.Append( tool );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void wxToolBar::AddSeparator()
|
void wxToolBar::AddSeparator()
|
||||||
{
|
{
|
||||||
gtk_toolbar_append_space( m_toolbar );
|
gtk_toolbar_append_space( m_toolbar );
|
||||||
@@ -635,12 +668,12 @@ void wxToolBar::OnInternalIdle()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (!tool->m_item->window)
|
node = node->Next();
|
||||||
break;
|
|
||||||
|
if (!tool->m_item || !tool->m_item->window)
|
||||||
|
continue;
|
||||||
else
|
else
|
||||||
gdk_window_set_cursor( tool->m_item->window, cursor.GetCursor() );
|
gdk_window_set_cursor( tool->m_item->window, cursor.GetCursor() );
|
||||||
|
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,8 +124,13 @@ unsigned char g_palette[64*3] =
|
|||||||
|
|
||||||
extern void wxFlushResources();
|
extern void wxFlushResources();
|
||||||
|
|
||||||
|
/* forward declaration */
|
||||||
|
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
|
||||||
|
void wxapp_install_idle_handler();
|
||||||
|
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// global functions
|
// wxExit
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxExit()
|
void wxExit()
|
||||||
@@ -133,8 +138,9 @@ void wxExit()
|
|||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* forward declaration */
|
//-----------------------------------------------------------------------------
|
||||||
gint wxapp_idle_callback( gpointer WXUNUSED(data) );
|
// wxYield
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxYield()
|
bool wxYield()
|
||||||
{
|
{
|
||||||
@@ -165,6 +171,20 @@ bool wxYield()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxWakeUpIdle
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// local functions
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
|
||||||
{
|
{
|
||||||
if (!wxTheApp) return TRUE;
|
if (!wxTheApp) return TRUE;
|
||||||
@@ -213,9 +233,6 @@ void wxapp_install_idle_handler()
|
|||||||
|
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
|
|
||||||
/* forward declaration */
|
|
||||||
static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
|
|
||||||
|
|
||||||
void wxapp_install_thread_wakeup()
|
void wxapp_install_thread_wakeup()
|
||||||
{
|
{
|
||||||
if (wxTheApp->m_wakeUpTimerTag) return;
|
if (wxTheApp->m_wakeUpTimerTag) return;
|
||||||
|
@@ -43,7 +43,8 @@ extern bool g_blockEventsOnDrag;
|
|||||||
|
|
||||||
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
|
||||||
{
|
{
|
||||||
if (g_isIdle) wxapp_install_idle_handler();
|
if (g_isIdle)
|
||||||
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
if (!button->m_hasVMT) return;
|
if (!button->m_hasVMT) return;
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
@@ -122,6 +122,15 @@ static gint gtk_toolbar_enter_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// InsertChild callback for wxToolBar
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent), wxWindow* WXUNUSED(child) )
|
||||||
|
{
|
||||||
|
/* we don't do anything here but pray */
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxToolBar
|
// wxToolBar
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -155,6 +164,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
m_needParent = TRUE;
|
m_needParent = TRUE;
|
||||||
m_blockNextEvent = FALSE;
|
m_blockNextEvent = FALSE;
|
||||||
|
m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
|
||||||
@@ -304,7 +314,7 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
|
|
||||||
GtkWidget *item = gtk_toolbar_append_element
|
GtkWidget *item = gtk_toolbar_append_element
|
||||||
(
|
(
|
||||||
GTK_TOOLBAR(m_toolbar),
|
m_toolbar,
|
||||||
ctype,
|
ctype,
|
||||||
(GtkWidget *)NULL,
|
(GtkWidget *)NULL,
|
||||||
(const char *)NULL,
|
(const char *)NULL,
|
||||||
@@ -332,6 +342,29 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
|||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxToolBar::AddControl(wxControl *control)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( control, FALSE, wxT("toolbar: can't insert NULL control") );
|
||||||
|
|
||||||
|
wxCHECK_MSG( control->GetParent() == this, FALSE,
|
||||||
|
wxT("control must have toolbar as parent") );
|
||||||
|
|
||||||
|
m_hasToolAlready = TRUE;
|
||||||
|
|
||||||
|
wxToolBarTool *tool = new wxToolBarTool(control);
|
||||||
|
|
||||||
|
gtk_toolbar_append_widget( m_toolbar, control->m_widget, (const char *) NULL, (const char *) NULL );
|
||||||
|
|
||||||
|
GtkRequisition req;
|
||||||
|
(* GTK_WIDGET_CLASS( GTK_OBJECT(m_widget)->klass )->size_request ) (m_widget, &req );
|
||||||
|
m_width = req.width;
|
||||||
|
m_height = req.height;
|
||||||
|
|
||||||
|
m_tools.Append( tool );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void wxToolBar::AddSeparator()
|
void wxToolBar::AddSeparator()
|
||||||
{
|
{
|
||||||
gtk_toolbar_append_space( m_toolbar );
|
gtk_toolbar_append_space( m_toolbar );
|
||||||
@@ -635,12 +668,12 @@ void wxToolBar::OnInternalIdle()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||||
if (!tool->m_item->window)
|
node = node->Next();
|
||||||
break;
|
|
||||||
|
if (!tool->m_item || !tool->m_item->window)
|
||||||
|
continue;
|
||||||
else
|
else
|
||||||
gdk_window_set_cursor( tool->m_item->window, cursor.GetCursor() );
|
gdk_window_set_cursor( tool->m_item->window, cursor.GetCursor() );
|
||||||
|
|
||||||
node = node->Next();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user