// Yield to other apps/messages
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
// next event loop iteration
inline void WXDLLEXPORT wxPostEvent(wxEvtHandler *dest, wxEvent& event)
void OnNew( wxCommandEvent &event );
void OnChoice( wxCommandEvent &event );
void OnTextEnter( wxCommandEvent &event );
+ void OnCheck( wxCommandEvent &event );
void HandleAction( const wxString &fn );
class wxToolBar: public wxControl
{
public:
- wxToolBar(void);
+ wxToolBar();
wxToolBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxToolBarNameStr );
- ~wxToolBar(void);
+ ~wxToolBar();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL,
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 ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
class wxToolBar: public wxControl
{
public:
- wxToolBar(void);
+ wxToolBar();
wxToolBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxToolBarNameStr );
- ~wxToolBar(void);
+ ~wxToolBar();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
const wxBitmap& pushedBitmap = wxNullBitmap, bool toggle = FALSE,
wxCoord xPos = -1, wxCoord yPos = -1, wxObject *clientData = (wxObject *)NULL,
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 ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on
combo->Append("toolbar");
toolBar->AddControl(combo);
+ toolBar->AddSeparator();
+
if ( !smallicons )
{
currentX += width + 5;
currentX += width + 5;
toolBar->AddSeparator();
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();
wxTB_FLAT | wxTB_DOCKABLE,
ID_TOOLBAR);
- tbar->SetMargins( 2, 2 );
+ tbar->SetMargins( 4, 4 );
wxGetApp().InitToolbar(tbar);
}
// template extension.
wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXGTK__)
int noTemplates,
#else
int WXUNUSED(noTemplates),
long WXUNUSED(flags),
bool WXUNUSED(save))
{
- // We can only have multiple filters in Windows
-#ifdef __WXMSW__
+ // We can only have multiple filters in Windows and GTK
+#if defined(__WXMSW__) || defined(__WXGTK__)
wxString descrBuf;
int i;
// TODO: Wake up idle handler for the other platforms.
#ifdef __WXGTK__
- extern bool g_isIdle;
- extern void wxapp_install_idle_handler();
- if ( g_isIdle )
- wxapp_install_idle_handler();
+ wxWakeUpIdle();
#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
// probably be cleaner?
nextDir != NULL;
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();
if ( !path.IsEmpty() )
#define ID_TEXT wxID_FILEDLGG + 9
#define ID_LIST_CTRL wxID_FILEDLGG + 10
#define ID_ACTIVATED wxID_FILEDLGG + 11
+#define ID_CHECK wxID_FILEDLGG + 12
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
EVT_LIST_ITEM_ACTIVATED(ID_LIST_CTRL, wxFileDialog::OnActivated)
EVT_CHOICE(ID_CHOICE,wxFileDialog::OnChoice)
EVT_TEXT_ENTER(ID_TEXT,wxFileDialog::OnTextEnter)
+ EVT_CHECKBOX(ID_CHECK,wxFileDialog::OnCheck)
END_EVENT_TABLE()
wxFileDialog::wxFileDialog(wxWindow *parent,
wxBoxSizer *choicesizer = new wxBoxSizer( wxHORIZONTAL );
m_choice = new wxChoice( this, ID_CHOICE );
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 );
mainsizer->Add( choicesizer, 0, wxEXPAND );
m_list->SetWild( *str );
}
+void wxFileDialog::OnCheck( wxCommandEvent &event )
+{
+ m_list->ShowHidden( event.GetInt() );
+}
+
void wxFileDialog::OnActivated( wxListEvent &event )
{
HandleAction( event.m_item.m_text );
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()
gtk_main_quit();
}
-/* forward declaration */
-gint wxapp_idle_callback( gpointer WXUNUSED(data) );
+//-----------------------------------------------------------------------------
+// wxYield
+//-----------------------------------------------------------------------------
bool wxYield()
{
return TRUE;
}
+//-----------------------------------------------------------------------------
+// wxWakeUpIdle
+//-----------------------------------------------------------------------------
+
+void wxWakeUpIdle()
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+}
+
+//-----------------------------------------------------------------------------
+// local functions
+//-----------------------------------------------------------------------------
+
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (!wxTheApp) return TRUE;
#if wxUSE_THREADS
-/* forward declaration */
-static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
-
void wxapp_install_thread_wakeup()
{
if (wxTheApp->m_wakeUpTimerTag) return;
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 (g_blockEventsOnDrag) return;
return FALSE;
}
+//-----------------------------------------------------------------------------
+// InsertChild callback for wxToolBar
+//-----------------------------------------------------------------------------
+
+static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent), wxWindow* WXUNUSED(child) )
+{
+ /* we don't do anything here but pray */
+}
+
//-----------------------------------------------------------------------------
// wxToolBar
//-----------------------------------------------------------------------------
{
m_needParent = TRUE;
m_blockNextEvent = FALSE;
+ m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
GtkWidget *item = gtk_toolbar_append_element
(
- GTK_TOOLBAR(m_toolbar),
+ m_toolbar,
ctype,
(GtkWidget *)NULL,
(const char *)NULL,
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()
{
gtk_toolbar_append_space( m_toolbar );
while (node)
{
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
- if (!tool->m_item->window)
- break;
+ node = node->Next();
+
+ if (!tool->m_item || !tool->m_item->window)
+ continue;
else
gdk_window_set_cursor( tool->m_item->window, cursor.GetCursor() );
-
- node = node->Next();
}
}
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()
gtk_main_quit();
}
-/* forward declaration */
-gint wxapp_idle_callback( gpointer WXUNUSED(data) );
+//-----------------------------------------------------------------------------
+// wxYield
+//-----------------------------------------------------------------------------
bool wxYield()
{
return TRUE;
}
+//-----------------------------------------------------------------------------
+// wxWakeUpIdle
+//-----------------------------------------------------------------------------
+
+void wxWakeUpIdle()
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+}
+
+//-----------------------------------------------------------------------------
+// local functions
+//-----------------------------------------------------------------------------
+
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (!wxTheApp) return TRUE;
#if wxUSE_THREADS
-/* forward declaration */
-static gint wxapp_wakeup_timerout_callback( gpointer WXUNUSED(data) );
-
void wxapp_install_thread_wakeup()
{
if (wxTheApp->m_wakeUpTimerTag) return;
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 (g_blockEventsOnDrag) return;
return FALSE;
}
+//-----------------------------------------------------------------------------
+// InsertChild callback for wxToolBar
+//-----------------------------------------------------------------------------
+
+static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent), wxWindow* WXUNUSED(child) )
+{
+ /* we don't do anything here but pray */
+}
+
//-----------------------------------------------------------------------------
// wxToolBar
//-----------------------------------------------------------------------------
{
m_needParent = TRUE;
m_blockNextEvent = FALSE;
+ m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
GtkWidget *item = gtk_toolbar_append_element
(
- GTK_TOOLBAR(m_toolbar),
+ m_toolbar,
ctype,
(GtkWidget *)NULL,
(const char *)NULL,
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()
{
gtk_toolbar_append_space( m_toolbar );
while (node)
{
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
- if (!tool->m_item->window)
- break;
+ node = node->Next();
+
+ if (!tool->m_item || !tool->m_item->window)
+ continue;
else
gdk_window_set_cursor( tool->m_item->window, cursor.GetCursor() );
-
- node = node->Next();
}
}