class wxBitmapButton;
class wxStaticBitmap;
class wxFrame;
+class wxDialog;
class wxTreeCtrl;
class wxMask;
friend wxBitmapButton;
friend wxStaticBitmap;
friend wxFrame;
+ friend wxDialog;
friend wxTreeCtrl;
GdkBitmap *GetBitmap() const;
friend wxBitmapButton;
friend wxStaticBitmap;
friend wxFrame;
+ friend wxDialog;
friend wxTreeCtrl;
GdkPixmap *GetPixmap() const;
#include "wx/string.h"
#include "wx/event.h"
#include "wx/window.h"
+#include "wx/icon.h"
//-----------------------------------------------------------------------------
// forward decls
virtual int ShowModal(void);
virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
+ void SetModal( bool modal );
virtual void InitDialog(void);
virtual void Centre( int direction = wxHORIZONTAL );
+ virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
+
+ virtual void SetIcon( const wxIcon &icon );
+ virtual void Iconize( bool WXUNUSED(iconize)) { }
+ virtual bool IsIconized(void) const { return FALSE; }
+ bool Iconized(void) const { return IsIconized(); }
+ virtual void Maximize(void) { }
+ virtual void Restore(void) { }
+
private:
friend wxWindow;
bool m_modalShowing;
wxString m_title;
+ wxIcon m_icon;
virtual void ImplementSetPosition();
friend wxPaintDC;
friend wxWindow;
- GdkFont* GetInternalFont(float scale = 1.0);
+ GdkFont* GetInternalFont(float scale = 1.0) const;
// no data :-)
};
virtual wxString GetTitle() const { return m_title; }
virtual void SetIcon( const wxIcon &icon );
- void Iconize( bool WXUNUSED(iconize)) { }
- bool IsIconized(void) const { return FALSE; }
- bool Iconized(void) const { return FALSE; }
+ virtual void Iconize( bool WXUNUSED(iconize)) { }
+ virtual bool IsIconized(void) const { return FALSE; }
+ bool Iconized(void) const { return IsIconized(); }
+ virtual void Maximize(void) {}
+ virtual void Restore(void) {}
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
virtual void Maximize(void) {}
virtual void Restore(void) {}
- void OnActivate( wxActivateEvent &event );
+ void OnActivate( wxActivateEvent &event );
public:
// state
void Enable(bool enable = TRUE) { m_isEnabled = enable; }
bool IsEnabled() const { return m_isEnabled; }
- void Check(bool check = TRUE);
+ void Check( bool check = TRUE );
bool IsChecked() const;
// help string (displayed in the status bar by default)
- void SetHelpString(const wxString& str) { m_helpStr = str; }
+ void SetHelp(const wxString& str) { m_helpStr = str; }
+ const wxString& GetHelp() const { return m_helpStr; }
// implementation
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
// find item by name/id
int FindItem( const wxString itemString ) const;
- wxMenuItem *FindItem(int id) const;
+ wxMenuItem *FindItem( int id ) const;
+ wxMenuItem *FindItemForId( int id ) const { return FindItem( id ); }
// get/set item's state
void Enable( int id, bool enable );
bool IsChecked( int id ) const;
void SetLabel( int id, const wxString &label );
+ wxString GetLabel(int id) const;
+ // helpstring
+ virtual void SetHelpString(int id, const wxString& helpString);
+ virtual wxString GetHelpString(int id) const ;
+
// accessors
wxList& GetItems() { return m_items; }
virtual void GetPosition( int *x, int *y ) const;
virtual void Centre( int direction = wxHORIZONTAL );
virtual void Fit();
+ // set minimal/maxmimal size for the frame
+ virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW),
+ int WXUNUSED(maxH), int WXUNUSED(incW) ) { }
void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent& event );
virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode );
int GetReturnCode();
- wxWindow *GetParent();
+ wxWindow *GetParent() const
+ { return m_parent; }
+ wxWindow *GetGrandParent(void) const
+ { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
+ void wxWindow::SetParent( wxWindow *p )
+ { m_parent = p; }
wxEvtHandler *GetEventHandler();
void SetEventHandler( wxEvtHandler *handler );
virtual void SetBackgroundColour( const wxColour &colour );
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
+
+ virtual int GetCharHeight(void) const;
+ virtual int GetCharWidth(void) const;
+ virtual void GetTextExtent( const wxString& string, int *x, int *y,
+ int *descent = NULL,
+ int *externalLeading = NULL,
+ const wxFont *theFont = NULL, bool use16 = FALSE) const;
virtual void SetDefaultBackgroundColour( const wxColour& col )
- { m_defaultBackgroundColour = col; };
+ { m_defaultBackgroundColour = col; }
virtual wxColour GetDefaultBackgroundColour() const
- { return m_defaultBackgroundColour; };
+ { return m_defaultBackgroundColour; }
virtual void SetDefaultForegroundColour( const wxColour& col )
- { m_defaultForegroundColour = col; };
+ { m_defaultForegroundColour = col; }
virtual wxColour GetDefaultForegroundColour() const
- { return m_defaultForegroundColour; };
+ { return m_defaultForegroundColour; }
virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont();
class wxBitmapButton;
class wxStaticBitmap;
class wxFrame;
+class wxDialog;
class wxTreeCtrl;
class wxMask;
friend wxBitmapButton;
friend wxStaticBitmap;
friend wxFrame;
+ friend wxDialog;
friend wxTreeCtrl;
GdkBitmap *GetBitmap() const;
friend wxBitmapButton;
friend wxStaticBitmap;
friend wxFrame;
+ friend wxDialog;
friend wxTreeCtrl;
GdkPixmap *GetPixmap() const;
#include "wx/string.h"
#include "wx/event.h"
#include "wx/window.h"
+#include "wx/icon.h"
//-----------------------------------------------------------------------------
// forward decls
virtual int ShowModal(void);
virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
+ void SetModal( bool modal );
virtual void InitDialog(void);
virtual void Centre( int direction = wxHORIZONTAL );
+ virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 );
+
+ virtual void SetIcon( const wxIcon &icon );
+ virtual void Iconize( bool WXUNUSED(iconize)) { }
+ virtual bool IsIconized(void) const { return FALSE; }
+ bool Iconized(void) const { return IsIconized(); }
+ virtual void Maximize(void) { }
+ virtual void Restore(void) { }
+
private:
friend wxWindow;
bool m_modalShowing;
wxString m_title;
+ wxIcon m_icon;
virtual void ImplementSetPosition();
friend wxPaintDC;
friend wxWindow;
- GdkFont* GetInternalFont(float scale = 1.0);
+ GdkFont* GetInternalFont(float scale = 1.0) const;
// no data :-)
};
virtual wxString GetTitle() const { return m_title; }
virtual void SetIcon( const wxIcon &icon );
- void Iconize( bool WXUNUSED(iconize)) { }
- bool IsIconized(void) const { return FALSE; }
- bool Iconized(void) const { return FALSE; }
+ virtual void Iconize( bool WXUNUSED(iconize)) { }
+ virtual bool IsIconized(void) const { return FALSE; }
+ bool Iconized(void) const { return IsIconized(); }
+ virtual void Maximize(void) {}
+ virtual void Restore(void) {}
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
virtual void Maximize(void) {}
virtual void Restore(void) {}
- void OnActivate( wxActivateEvent &event );
+ void OnActivate( wxActivateEvent &event );
public:
// state
void Enable(bool enable = TRUE) { m_isEnabled = enable; }
bool IsEnabled() const { return m_isEnabled; }
- void Check(bool check = TRUE);
+ void Check( bool check = TRUE );
bool IsChecked() const;
// help string (displayed in the status bar by default)
- void SetHelpString(const wxString& str) { m_helpStr = str; }
+ void SetHelp(const wxString& str) { m_helpStr = str; }
+ const wxString& GetHelp() const { return m_helpStr; }
// implementation
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
// find item by name/id
int FindItem( const wxString itemString ) const;
- wxMenuItem *FindItem(int id) const;
+ wxMenuItem *FindItem( int id ) const;
+ wxMenuItem *FindItemForId( int id ) const { return FindItem( id ); }
// get/set item's state
void Enable( int id, bool enable );
bool IsChecked( int id ) const;
void SetLabel( int id, const wxString &label );
+ wxString GetLabel(int id) const;
+ // helpstring
+ virtual void SetHelpString(int id, const wxString& helpString);
+ virtual wxString GetHelpString(int id) const ;
+
// accessors
wxList& GetItems() { return m_items; }
virtual void GetPosition( int *x, int *y ) const;
virtual void Centre( int direction = wxHORIZONTAL );
virtual void Fit();
+ // set minimal/maxmimal size for the frame
+ virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH), int WXUNUSED(maxW),
+ int WXUNUSED(maxH), int WXUNUSED(incW) ) { }
void OnSize( wxSizeEvent &event );
void OnIdle( wxIdleEvent& event );
virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode );
int GetReturnCode();
- wxWindow *GetParent();
+ wxWindow *GetParent() const
+ { return m_parent; }
+ wxWindow *GetGrandParent(void) const
+ { return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
+ void wxWindow::SetParent( wxWindow *p )
+ { m_parent = p; }
wxEvtHandler *GetEventHandler();
void SetEventHandler( wxEvtHandler *handler );
virtual void SetBackgroundColour( const wxColour &colour );
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
+
+ virtual int GetCharHeight(void) const;
+ virtual int GetCharWidth(void) const;
+ virtual void GetTextExtent( const wxString& string, int *x, int *y,
+ int *descent = NULL,
+ int *externalLeading = NULL,
+ const wxFont *theFont = NULL, bool use16 = FALSE) const;
virtual void SetDefaultBackgroundColour( const wxColour& col )
- { m_defaultBackgroundColour = col; };
+ { m_defaultBackgroundColour = col; }
virtual wxColour GetDefaultBackgroundColour() const
- { return m_defaultBackgroundColour; };
+ { return m_defaultBackgroundColour; }
virtual void SetDefaultForegroundColour( const wxColour& col )
- { m_defaultForegroundColour = col; };
+ { m_defaultForegroundColour = col; }
virtual wxColour GetDefaultForegroundColour() const
- { return m_defaultForegroundColour; };
+ { return m_defaultForegroundColour; }
virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont();
#elif defined(__WXMOTIF__)
#include "wx/generic/treectrl.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/treectrl.h"
+#include "wx/generic/treectrl.h"
#elif defined(__WXQT__)
#include "wx/qt/treectrl.h"
#elif defined(__WXMAC__)
-0x00 0x00 0x00
+0x0 0x0 0x0
0xff 0xff 0xff
0xdd 0xdd 0xdd
0xbb 0xbb 0xbb
0x77 0x77 0x77
0x55 0x55 0x55
0x33 0x33 0x33
-0x88 0x00 0x00
-0xcc 0x00 0x00
-0xff 0x00 0x00
-0xff 0x44 0x00
-0xff 0x88 0x00
-0xff 0xcc 0x00
-0xff 0xff 0x00
-0xcc 0xcc 0x00
-0x88 0x88 0x00
-0x44 0x44 0x00
-0x00 0x44 0x00
-0x00 0x88 0x00
-0x00 0xcc 0x00
-0x00 0xff 0x00
-0x00 0x44 0x44
-0x00 0x88 0x88
-0x00 0xff 0xff
-0x00 0x00 0x44
-0x00 0x00 0x88
-0x00 0x00 0xff
-0x88 0x00 0x88
-0xff 0xcc 0x99
-0xcc 0xaa 0x77
-0xaa 0x88 0x55
-0x88 0x66 0x33
-0x66 0x44 0x11
-0x44 0x22 0x00
-0x22 0x00 0x00
-0x00 0x44 0x88
-0x44 0x88 0xcc
-0x88 0xcc 0xff
-0x00 0xcc 0x44
-0x44 0x88 0x44
-0x88 0xcc 0x00
-0x22 0x44 0x11
-0x33 0x66 0x22
-0x44 0x55 0x33
-0x66 0x88 0x44
-0x33 0x66 0x22
-0x22 0x44 0x11
+0x88 0x0 0x0
+0xcc 0x0 0x0
+0xff 0x0 0x0
+0xff 0x44 0x0
+0xff 0x88 0x0
+0xff 0xcc 0x0
+0xff 0xff 0x0
+0xcc 0xcc 0x0
+0x88 0x88 0x0
+0x60 0x60 0x0
+0x0 0x43 0x0
+0x0 0x7f 0x0
+0x0 0xcc 0x0
+0x0 0xff 0x0
+0x0 0x44 0x44
+0x0 0x88 0x88
+0x0 0xff 0xff
+0x0 0x0 0x44
+0x0 0x0 0x88
+0x0 0x0 0xff
+0xff 0xcc 0x97
+0xef 0xb1 0x7b
+0xdf 0x98 0x5f
+0xbf 0x87 0x56
+0x9f 0x6b 0x42
+0x7f 0x57 0x26
+0x5f 0x39 0xc
+0x3f 0x1c 0x0
+0x21 0x0 0x0
+0x0 0x43 0x87
+0x2d 0x70 0xaf
+0x5a 0x9e 0xd7
+0x87 0xcc 0xff
+0xff 0xe0 0xba
+0x21 0x43 0xf
+0x3d 0x5d 0x25
+0x59 0x78 0x3a
+0x75 0x93 0x4f
+0x91 0xae 0x64
+0xad 0xc8 0x7a
+0xf0 0xa8 0xef
+0xd0 0x88 0xd0
+0xaf 0x66 0xaf
+0x8e 0x44 0x8e
+0x6d 0x22 0x6d
+0x4b 0x0 0x4b
+0xff 0xc0 0xbc
+0xff 0x93 0x91
+0xff 0x66 0x67
+0xd8 0xf2 0xbf
+0xff 0xc9 0x68
+0xff 0x96 0x67
+0xa5 0x60 0xff
+0x51 0xff 0x99
+0x3f 0xa5 0x63
+0x98 0x90 0x67
}
}
-
-
bool wxPaintDC::CanGetTextExtent(void) const
{
return TRUE;
}
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
- long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
- wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
+ long *descent, long *externalLeading,
+ wxFont *theFont, bool WXUNUSED(use16) )
{
if (!Ok()) return;
- GdkFont *font = m_font.GetInternalFont( m_scaleY );
+ wxFont fontToUse = m_font;
+ if (theFont) fontToUse = *theFont;
+
+ GdkFont *font = fontToUse.GetInternalFont( m_scaleY );
if (width) (*width) = long(gdk_string_width( font, string ) / m_scaleX);
if (height) (*height) = long((font->ascent + font->descent) / m_scaleY);
+ if (descent) (*descent) = long(font->descent / m_scaleY);
+ if (externalLeading) (*externalLeading) = 0; // ??
}
long wxPaintDC::GetCharWidth(void)
if (!Ok()) return 0;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
- return gdk_string_width( font, "H" );
+ return long(gdk_string_width( font, "H" ) / m_scaleX);
}
long wxPaintDC::GetCharHeight(void)
if (!Ok()) return 0;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
- return font->ascent + font->descent;
+ return long((font->ascent + font->descent) / m_scaleY);
}
void wxPaintDC::Clear(void)
win->Close();
return TRUE;
-};
+}
//-----------------------------------------------------------------------------
// wxDialog
m_title = "";
m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
-};
+}
wxDialog::wxDialog( wxWindow *parent,
wxWindowID id, const wxString &title,
m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
-};
+}
bool wxDialog::Create( wxWindow *parent,
wxWindowID id, const wxString &title,
PostCreation();
return TRUE;
-};
+}
wxDialog::~wxDialog(void)
{
wxTopLevelWindows.DeleteObject( this );
if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
-};
+}
void wxDialog::SetTitle(const wxString& title )
{
m_title = title;
if (m_title.IsNull()) m_title = "";
gtk_window_set_title( GTK_WINDOW(m_widget), m_title );
-};
+}
wxString wxDialog::GetTitle(void) const
{
return (wxString&)m_title;
-};
+}
void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
{
if (Validate()) TransferDataFromWindow();
-};
+}
void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
{
{
SetReturnCode(wxID_CANCEL);
this->Show(FALSE);
- };
-};
+ }
+}
void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
{
{
SetReturnCode(wxID_OK);
this->Show(FALSE);
- };
- };
-};
+ }
+ }
+}
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// yes
-};
+}
bool wxDialog::OnClose(void)
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
- };
-};
+ }
+}
void wxDialog::ImplementSetPosition(void)
{
if (!show && IsModal() && m_modalShowing)
{
EndModal( wxID_CANCEL );
- };
+ }
wxWindow::Show( show );
if (show) InitDialog();
return TRUE;
-};
+}
+
+void wxDialog::SetModal(bool flag)
+{
+ if (flag)
+ m_windowStyle |= wxDIALOG_MODAL;
+ else
+ if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
+}
int wxDialog::ShowModal(void)
{
gtk_grab_remove( m_widget );
return GetReturnCode();
-};
+}
void wxDialog::EndModal( int retCode )
{
{
wxFAIL_MSG( "wxDialog: called EndModal twice" );
return;
- };
+ }
m_modalShowing = FALSE;
gtk_main_quit();
-};
+}
void wxDialog::InitDialog(void)
{
wxWindow::InitDialog();
-};
+}
+
+void wxDialog::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) )
+{
+ gdk_window_set_hints( m_widget->window, -1, -1,
+ minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
+}
+
+void wxDialog::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 );
+}
+
int style, int weight,
bool underlined);
-GdkFont *wxFont::GetInternalFont(float scale)
+GdkFont *wxFont::GetInternalFont(float scale) const
{
if (M_FONTDATA->m_byXFontName) return M_FONTDATA->m_font;
void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) )
{
- if (m_wxwindow)
- gdk_window_set_hints( m_wxwindow->window, -1, -1,
- minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
+ gdk_window_set_hints( m_widget->window, -1, -1,
+ minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
}
void wxFrame::SetIcon( const wxIcon &icon )
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(id);
mitem->SetText(item);
- mitem->SetHelpString(helpStr);
+ mitem->SetHelp(helpStr);
mitem->SetCheckable(checkable);
const char *text = mitem->GetText();
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
mitem->SetText(text);
GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText());
- mitem->SetHelpString(helpStr);
+ mitem->SetHelp(helpStr);
mitem->SetMenuItem(menuItem);
mitem->SetSubMenu(subMenu);
void wxMenu::SetLabel( int id, const wxString &label )
{
wxMenuItem *item = FindItem(id);
- if ( item )
+ if (item)
item->SetText(label);
}
+wxString wxMenu::GetLabel( int id ) const
+{
+ wxMenuItem *item = FindItem(id);
+ if (item) return item->GetText();
+ return "";
+}
+
+void wxMenu::SetHelpString( int id, const wxString& helpString )
+{
+ wxMenuItem *item = FindItem(id);
+ if (item) item->SetHelp( helpString );
+}
+
+wxString wxMenu::GetHelpString( int id ) const
+{
+ wxMenuItem *item = FindItem(id);
+ if (item) return item->GetHelp();
+ return "";
+}
+
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{
wxNode *node = m_items.First();
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
}
+int wxWindow::GetCharHeight(void) const
+{
+ GdkFont *font = m_font.GetInternalFont( 1.0 );
+ return font->ascent + font->descent;
+}
+
+int wxWindow::GetCharWidth(void) const
+{
+ GdkFont *font = m_font.GetInternalFont( 1.0 );
+ return gdk_string_width( font, "H" );
+}
+
+void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
+ int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const
+{
+ wxFont fontToUse = m_font;
+ if (theFont) fontToUse = *theFont;
+
+ GdkFont *font = fontToUse.GetInternalFont( 1.0 );
+ if (x) (*y) = gdk_string_width( font, string );
+ if (y) (*y) = font->ascent + font->descent;
+ if (descent) (*descent) = font->descent;
+ if (externalLeading) (*externalLeading) = 0; // ??
+}
+
void wxWindow::MakeModal( bool modal )
{
return;
return m_retCode;
}
-wxWindow *wxWindow::GetParent(void)
-{
- return m_parent;
-}
-
void wxWindow::Raise(void)
{
if (m_widget) gdk_window_raise( m_widget->window );
}
}
-
-
bool wxPaintDC::CanGetTextExtent(void) const
{
return TRUE;
}
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
- long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
- wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
+ long *descent, long *externalLeading,
+ wxFont *theFont, bool WXUNUSED(use16) )
{
if (!Ok()) return;
- GdkFont *font = m_font.GetInternalFont( m_scaleY );
+ wxFont fontToUse = m_font;
+ if (theFont) fontToUse = *theFont;
+
+ GdkFont *font = fontToUse.GetInternalFont( m_scaleY );
if (width) (*width) = long(gdk_string_width( font, string ) / m_scaleX);
if (height) (*height) = long((font->ascent + font->descent) / m_scaleY);
+ if (descent) (*descent) = long(font->descent / m_scaleY);
+ if (externalLeading) (*externalLeading) = 0; // ??
}
long wxPaintDC::GetCharWidth(void)
if (!Ok()) return 0;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
- return gdk_string_width( font, "H" );
+ return long(gdk_string_width( font, "H" ) / m_scaleX);
}
long wxPaintDC::GetCharHeight(void)
if (!Ok()) return 0;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
- return font->ascent + font->descent;
+ return long((font->ascent + font->descent) / m_scaleY);
}
void wxPaintDC::Clear(void)
win->Close();
return TRUE;
-};
+}
//-----------------------------------------------------------------------------
// wxDialog
m_title = "";
m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
-};
+}
wxDialog::wxDialog( wxWindow *parent,
wxWindowID id, const wxString &title,
m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
-};
+}
bool wxDialog::Create( wxWindow *parent,
wxWindowID id, const wxString &title,
PostCreation();
return TRUE;
-};
+}
wxDialog::~wxDialog(void)
{
wxTopLevelWindows.DeleteObject( this );
if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
-};
+}
void wxDialog::SetTitle(const wxString& title )
{
m_title = title;
if (m_title.IsNull()) m_title = "";
gtk_window_set_title( GTK_WINDOW(m_widget), m_title );
-};
+}
wxString wxDialog::GetTitle(void) const
{
return (wxString&)m_title;
-};
+}
void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
{
if (Validate()) TransferDataFromWindow();
-};
+}
void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
{
{
SetReturnCode(wxID_CANCEL);
this->Show(FALSE);
- };
-};
+ }
+}
void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
{
{
SetReturnCode(wxID_OK);
this->Show(FALSE);
- };
- };
-};
+ }
+ }
+}
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// yes
-};
+}
bool wxDialog::OnClose(void)
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
- };
-};
+ }
+}
void wxDialog::ImplementSetPosition(void)
{
if (!show && IsModal() && m_modalShowing)
{
EndModal( wxID_CANCEL );
- };
+ }
wxWindow::Show( show );
if (show) InitDialog();
return TRUE;
-};
+}
+
+void wxDialog::SetModal(bool flag)
+{
+ if (flag)
+ m_windowStyle |= wxDIALOG_MODAL;
+ else
+ if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
+}
int wxDialog::ShowModal(void)
{
gtk_grab_remove( m_widget );
return GetReturnCode();
-};
+}
void wxDialog::EndModal( int retCode )
{
{
wxFAIL_MSG( "wxDialog: called EndModal twice" );
return;
- };
+ }
m_modalShowing = FALSE;
gtk_main_quit();
-};
+}
void wxDialog::InitDialog(void)
{
wxWindow::InitDialog();
-};
+}
+
+void wxDialog::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) )
+{
+ gdk_window_set_hints( m_widget->window, -1, -1,
+ minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
+}
+
+void wxDialog::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 );
+}
+
int style, int weight,
bool underlined);
-GdkFont *wxFont::GetInternalFont(float scale)
+GdkFont *wxFont::GetInternalFont(float scale) const
{
if (M_FONTDATA->m_byXFontName) return M_FONTDATA->m_font;
void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) )
{
- if (m_wxwindow)
- gdk_window_set_hints( m_wxwindow->window, -1, -1,
- minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
+ gdk_window_set_hints( m_widget->window, -1, -1,
+ minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE );
}
void wxFrame::SetIcon( const wxIcon &icon )
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(id);
mitem->SetText(item);
- mitem->SetHelpString(helpStr);
+ mitem->SetHelp(helpStr);
mitem->SetCheckable(checkable);
const char *text = mitem->GetText();
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
mitem->SetText(text);
GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText());
- mitem->SetHelpString(helpStr);
+ mitem->SetHelp(helpStr);
mitem->SetMenuItem(menuItem);
mitem->SetSubMenu(subMenu);
void wxMenu::SetLabel( int id, const wxString &label )
{
wxMenuItem *item = FindItem(id);
- if ( item )
+ if (item)
item->SetText(label);
}
+wxString wxMenu::GetLabel( int id ) const
+{
+ wxMenuItem *item = FindItem(id);
+ if (item) return item->GetText();
+ return "";
+}
+
+void wxMenu::SetHelpString( int id, const wxString& helpString )
+{
+ wxMenuItem *item = FindItem(id);
+ if (item) item->SetHelp( helpString );
+}
+
+wxString wxMenu::GetHelpString( int id ) const
+{
+ wxMenuItem *item = FindItem(id);
+ if (item) return item->GetHelp();
+ return "";
+}
+
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{
wxNode *node = m_items.First();
if (m_wxwindow) gtk_widget_set_sensitive( m_wxwindow, enable );
}
+int wxWindow::GetCharHeight(void) const
+{
+ GdkFont *font = m_font.GetInternalFont( 1.0 );
+ return font->ascent + font->descent;
+}
+
+int wxWindow::GetCharWidth(void) const
+{
+ GdkFont *font = m_font.GetInternalFont( 1.0 );
+ return gdk_string_width( font, "H" );
+}
+
+void wxWindow::GetTextExtent( const wxString& string, int *x, int *y,
+ int *descent, int *externalLeading, const wxFont *theFont, bool WXUNUSED(use16) ) const
+{
+ wxFont fontToUse = m_font;
+ if (theFont) fontToUse = *theFont;
+
+ GdkFont *font = fontToUse.GetInternalFont( 1.0 );
+ if (x) (*y) = gdk_string_width( font, string );
+ if (y) (*y) = font->ascent + font->descent;
+ if (descent) (*descent) = font->descent;
+ if (externalLeading) (*externalLeading) = 0; // ??
+}
+
void wxWindow::MakeModal( bool modal )
{
return;
return m_retCode;
}
-wxWindow *wxWindow::GetParent(void)
-{
- return m_parent;
-}
-
void wxWindow::Raise(void)
{
if (m_widget) gdk_window_raise( m_widget->window );