#include "wx/generic/fontdlgg.h"
#elif defined(__WXGTK__)
#include "wx/generic/fontdlgg.h"
+# define wxFontDialog wxGenericFontDialog
+# define classwxFontDialog classwxGenericFontDialog
#endif
#endif
class wxToolBar;
class wxBitmapButton;
class wxStaticBitmap;
+class wxFrame;
class wxMask;
class wxBitmap;
friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
+ friend wxFrame;
GdkBitmap *GetBitmap() const;
friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
+ friend wxFrame;
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;
void SetTitle( const wxString &title );
wxString GetTitle() const { return m_title; }
+
+ void SetIcon( const wxIcon &icon );
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
bool m_doingOnSize;
bool m_addPrivateChild; // for toolbar (and maybe menubar)
wxString m_title;
+ wxIcon m_icon;
DECLARE_EVENT_TABLE()
};
class wxToolBar;
class wxBitmapButton;
class wxStaticBitmap;
+class wxFrame;
class wxMask;
class wxBitmap;
friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
+ friend wxFrame;
GdkBitmap *GetBitmap() const;
friend wxToolBar;
friend wxBitmapButton;
friend wxStaticBitmap;
+ friend wxFrame;
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;
void SetTitle( const wxString &title );
wxString GetTitle() const { return m_title; }
+
+ void SetIcon( const wxIcon &icon );
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
bool m_doingOnSize;
bool m_addPrivateChild; // for toolbar (and maybe menubar)
wxString m_title;
+ wxIcon m_icon;
DECLARE_EVENT_TABLE()
};
wxString& Remove(size_t nStart, size_t nLen)
{ return erase( nStart, nLen ); }
- size_t First( const char ch ) const { return find(ch); }
- size_t First( const char* psz ) const { return find(psz); }
- size_t First( const wxString &str ) const { return find(str); }
+ int First( const char ch ) const { size_t res = find(ch); return res == wxString::npos ? -1 : res; }
+ int First( const char* psz ) const { size_t res = find(psz); return res == wxString::npos ? -1 : res; }
+ int First( const wxString &str ) const { size_t res = find(str); return res == wxString::npos ? -1 : res; }
- size_t Last( const char ch ) const { return rfind(ch,0); }
- size_t Last( const char* psz ) const { return rfind(psz,0); }
- size_t Last( const wxString &str ) const { return rfind(str,0); }
+ int Last( const char ch ) const { size_t res = rfind(ch,0); return res == wxString::npos ? -1 : res; }
+ int Last( const char* psz ) const { size_t res = rfind(psz,0); return res == wxString::npos ? -1 : res; }
+ int Last( const wxString &str ) const { size_t res = rfind(str,0); return res == wxString::npos ? -1 : res; }
/// same as IsEmpty
bool IsNull() const { return IsEmpty(); }
* Compiling
-------------
-This must be done in ~/wxGTK
+The following must be done in ~/wxGTK
First you have to create all makefiles in all subdirectories:
- make makefiles
+ make Makefiles
Dependencies are generated automatically using
make depend
+
+for some reason, this doesn't seem to work.
Now the makefiles are created you can compile everything is as simple
as typing:
--------------------------
I propose to put all contributed programs in the directory
-"~/wcGTK/user", with a directory of its own.
+"~/wxGTK/user", with a directory of its own.
This directory then should include the following files:
the only case where you might want to add another line is the following:
this version of configure also supports creation of source archives of the
-application for easy distribution and updates to newer version of wxxt.
+application for easy distribution and updates to newer version of wxGTK.
For this purpose all files in the application-directory will be put into
a gziped tar-file in the full notation user/<your application>/*
if you want to include some other files that you want "more visible", like
make distrib
-NOTE: If you are in the base directory of wxxt it will create
+NOTE: If you are in the base directory of wxGTK it will create
distribution packages for wxxt as well as for all packages in the
user directory.
So if you want to create only packages for the files in user,
--- /dev/null
+include ../../src/gtk/setup/general/makeapp
--- /dev/null
+# WXXT base directory
+WXBASEDIR=@WXBASEDIR@
+
+# set the OS type for compilation
+OS=@OS@
+# compile a library only
+RULE=bin
+
+# define library name
+BIN_TARGET=test
+# define library sources
+BIN_SRC=\
+dialogs.cpp
+
+#define library objects
+BIN_OBJ=\
+dialogs.o
+
+# additional things needed to link
+BIN_LINK=
+
+# additional things needed to compile
+ADD_COMPILE=
+
+# include the definitions now
+include ../../../template.mak
wxFrame(parent, -1, title, pos, size)
{}
-void MyFrame::ChooseColour(wxCommandEvent& event)
+void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
{
wxColourData data;
data.SetChooseFull(TRUE);
dialog->Close();
}
-void MyFrame::ChooseFont(wxCommandEvent& event)
+void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
{
wxFontData data;
data.SetInitialFont(wxGetApp().m_canvasFont);
}
#if !defined(__WXMSW__) || USE_GENERIC_DIALOGS_IN_MSW
-void MyFrame::ChooseColourGeneric(wxCommandEvent& event)
+void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
{
wxColourData data;
data.SetChooseFull(TRUE);
dialog->Close();
}
-void MyFrame::ChooseFontGeneric(wxCommandEvent& event)
+void MyFrame::ChooseFontGeneric(wxCommandEvent& WXUNUSED(event) )
{
wxFontData data;
data.SetInitialFont(wxGetApp().m_canvasFont);
}
#endif
-void MyFrame::MessageBox(wxCommandEvent& event)
+void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
{
wxMessageDialog dialog(this, "This is a message box\nA long, long string to test out the message box properly",
"Message box text", wxYES_NO|wxCANCEL);
dialog.ShowModal();
}
-void MyFrame::TextEntry(wxCommandEvent& event)
+void MyFrame::TextEntry(wxCommandEvent& WXUNUSED(event) )
{
wxTextEntryDialog dialog(this, "This is a small sample\nA long, long string to test out the text entrybox",
"Please enter a string", "Default value", wxOK|wxCANCEL);
}
}
-void MyFrame::SingleChoice(wxCommandEvent& event)
+void MyFrame::SingleChoice(wxCommandEvent& WXUNUSED(event) )
{
const wxString choices[] = { "One", "Two", "Three", "Four", "Five" } ;
int n = 5;
}
}
-void MyFrame::FileOpen(wxCommandEvent& event)
+void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
{
wxFileDialog dialog(this, "Testing open file dialog", "", "", "*.txt", 0);
}
}
-void MyFrame::FileSave(wxCommandEvent& event)
+void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
{
wxFileDialog dialog(this, "Testing save file dialog", "", "",
"Text files (*.txt)|*.txt|Document files (*.doc)|*.doc",
}
}
-void MyFrame::DirChoose(wxCommandEvent& event)
+void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) )
{
+#ifndef __WXGTK__
wxDirDialog dialog(this, "Testing directory picker", "");
if (dialog.ShowModal() == wxID_OK)
wxMessageDialog dialog2(this, dialog.GetPath(), "Selected path");
dialog2.ShowModal();
}
+#endif
}
-void MyFrame::OnExit(wxCommandEvent& event)
+void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event) )
{
Close(TRUE);
}
-void MyCanvas::OnPaint(wxPaintEvent& event)
+void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc(this);
dc.SetFont(wxGetApp().m_canvasFont);
#include "wx/wx.h"
#endif
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
// Define a new application type
class MyApp: public wxApp
{ public:
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("aiai.xbm"));
+#ifdef __WXGTK__
+ frame->SetIcon(wxIcon( mondrian_xpm ));
#endif
// Make a menubar
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
// sort array elements using passed comparaison function
-void wxArrayString::Sort(bool bCase, bool bReverse)
+void wxArrayString::Sort(bool WXUNUSED(bCase), bool WXUNUSED(bReverse) )
{
//@@@@ TO DO
//qsort(m_pItems, m_nCount, sizeof(char *), fCmp);
wxDialog::wxDialog(void)
{
m_title = "";
- m_modalShowing = TRUE;
+ m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
};
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
};
PreCreation( parent, id, pos, size, style, name );
- m_modalShowing = ((m_windowStyle & wxDIALOG_MODAL) == wxDIALOG_MODAL);
-
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
bool wxDialog::Show( bool show )
{
- if (!show && m_modalShowing)
+ if (!show && IsModal() && m_modalShowing)
{
EndModal( wxID_CANCEL );
};
if (show) InitDialog();
- if (show && m_modalShowing)
- {
- gtk_grab_add( m_widget );
- gtk_main();
- gtk_grab_remove( m_widget );
- };
-
return TRUE;
};
int wxDialog::ShowModal(void)
{
+ if (m_modalShowing) return GetReturnCode();
+
Show( TRUE );
+
+ m_modalShowing = TRUE;
+
+ gtk_grab_add( m_widget );
+ gtk_main();
+ gtk_grab_remove( m_widget );
+
return GetReturnCode();
};
void wxDialog::EndModal( int retCode )
{
SetReturnCode( retCode );
+
+ if (!m_modalShowing) return;
+ m_modalShowing = FALSE;
+
gtk_main_quit();
};
gdk_window_set_hints( m_wxwindow->window, -1, -1,
minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
}
+
+void wxFrame::SetIcon( const wxIcon &icon )
+{
+ m_icon = icon;
+ if (!icon.Ok()) return;
+
+ wxMask *mask = icon.GetMask();
+ GdkBitmap *bm = NULL;
+ if (mask) bm = mask->GetBitmap();
+
+ gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm );
+}
+
m_menus.Append( menu );
menu->m_title = title; // ??????
- size_t pos;
+ int pos;
do {
pos = menu->m_title.First( '&' );
- if (pos != wxString::npos) menu->m_title.Remove( pos, 1 );
- } while (pos != wxString::npos);
+ if (pos != -1) menu->m_title.Remove( pos, 1 );
+ } while (pos != -1);
GtkWidget *root_menu;
root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) );
{
wxString s( itemString );
- size_t pos;
+ int pos;
do {
pos = s.First( '&' );
- if (pos != wxString::npos) s.Remove( pos, 1 );
- } while (pos != wxString::npos);
+ if (pos != -1) s.Remove( pos, 1 );
+ } while (pos != -1);
wxNode *node = m_items.First();
while (node)
wxDialog::wxDialog(void)
{
m_title = "";
- m_modalShowing = TRUE;
+ m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
};
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
+ m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
};
PreCreation( parent, id, pos, size, style, name );
- m_modalShowing = ((m_windowStyle & wxDIALOG_MODAL) == wxDIALOG_MODAL);
-
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
bool wxDialog::Show( bool show )
{
- if (!show && m_modalShowing)
+ if (!show && IsModal() && m_modalShowing)
{
EndModal( wxID_CANCEL );
};
if (show) InitDialog();
- if (show && m_modalShowing)
- {
- gtk_grab_add( m_widget );
- gtk_main();
- gtk_grab_remove( m_widget );
- };
-
return TRUE;
};
int wxDialog::ShowModal(void)
{
+ if (m_modalShowing) return GetReturnCode();
+
Show( TRUE );
+
+ m_modalShowing = TRUE;
+
+ gtk_grab_add( m_widget );
+ gtk_main();
+ gtk_grab_remove( m_widget );
+
return GetReturnCode();
};
void wxDialog::EndModal( int retCode )
{
SetReturnCode( retCode );
+
+ if (!m_modalShowing) return;
+ m_modalShowing = FALSE;
+
gtk_main_quit();
};
gdk_window_set_hints( m_wxwindow->window, -1, -1,
minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
}
+
+void wxFrame::SetIcon( const wxIcon &icon )
+{
+ m_icon = icon;
+ if (!icon.Ok()) return;
+
+ wxMask *mask = icon.GetMask();
+ GdkBitmap *bm = NULL;
+ if (mask) bm = mask->GetBitmap();
+
+ gdk_window_set_icon( m_widget->window, NULL, icon.GetPixmap(), bm );
+}
+
m_menus.Append( menu );
menu->m_title = title; // ??????
- size_t pos;
+ int pos;
do {
pos = menu->m_title.First( '&' );
- if (pos != wxString::npos) menu->m_title.Remove( pos, 1 );
- } while (pos != wxString::npos);
+ if (pos != -1) menu->m_title.Remove( pos, 1 );
+ } while (pos != -1);
GtkWidget *root_menu;
root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) );
{
wxString s( itemString );
- size_t pos;
+ int pos;
do {
pos = s.First( '&' );
- if (pos != wxString::npos) s.Remove( pos, 1 );
- } while (pos != wxString::npos);
+ if (pos != -1) s.Remove( pos, 1 );
+ } while (pos != -1);
wxNode *node = m_items.First();
while (node)