Fixed two small things in wxListCtrl

Removed SetSizeHint from wxDialog (recompile)
  Removed dialog modal flag
  Code clean up here and there


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-09-05 18:26:06 +00:00
parent 42871d3819
commit e1e955e14c
17 changed files with 408 additions and 380 deletions

View File

@@ -32,6 +32,7 @@ More controls with bitmaps
Speed up bitmap saving Speed up bitmap saving
wxBitmapHandler wxBitmapHandler
Fix printing of bitmaps Fix printing of bitmaps
wxRadioBox layout and setsize
TrueType support (just kidding) TrueType support (just kidding)
wxTreeCtrl not yet finshed wxTreeCtrl not yet finshed

View File

@@ -74,13 +74,11 @@ class wxDialog: public wxWindow
virtual bool Show( bool show ); virtual bool Show( bool show );
virtual int ShowModal(void); virtual int ShowModal(void);
virtual void EndModal(int retCode); virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } virtual bool IsModal(void) const;
void SetModal( bool modal ); void SetModal( bool modal );
virtual void InitDialog(void); virtual void InitDialog(void);
virtual void Centre( int direction = wxHORIZONTAL ); 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 SetIcon( const wxIcon &icon );
virtual void Iconize( bool WXUNUSED(iconize)) { } virtual void Iconize( bool WXUNUSED(iconize)) { }
virtual bool IsIconized(void) const { return FALSE; } virtual bool IsIconized(void) const { return FALSE; }

View File

@@ -74,13 +74,11 @@ class wxDialog: public wxWindow
virtual bool Show( bool show ); virtual bool Show( bool show );
virtual int ShowModal(void); virtual int ShowModal(void);
virtual void EndModal(int retCode); virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); } virtual bool IsModal(void) const;
void SetModal( bool modal ); void SetModal( bool modal );
virtual void InitDialog(void); virtual void InitDialog(void);
virtual void Centre( int direction = wxHORIZONTAL ); 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 SetIcon( const wxIcon &icon );
virtual void Iconize( bool WXUNUSED(iconize)) { } virtual void Iconize( bool WXUNUSED(iconize)) { }
virtual bool IsIconized(void) const { return FALSE; } virtual bool IsIconized(void) const { return FALSE; }

View File

@@ -25,28 +25,28 @@ wxImageList::wxImageList( int width, int height, bool WXUNUSED(mask), int WXUNUS
m_width = width; m_width = width;
m_height = height; m_height = height;
Create(); Create();
}; }
wxImageList::~wxImageList() wxImageList::~wxImageList()
{ {
}; }
int wxImageList::GetImageCount() const int wxImageList::GetImageCount() const
{ {
return m_images.Number(); return m_images.Number();
}; }
bool wxImageList::Create() bool wxImageList::Create()
{ {
m_images.DeleteContents( TRUE ); m_images.DeleteContents( TRUE );
return TRUE; return TRUE;
}; }
int wxImageList::Add( const wxBitmap &bitmap ) int wxImageList::Add( const wxBitmap &bitmap )
{ {
m_images.Append( new wxBitmap(bitmap) ); m_images.Append( new wxBitmap(bitmap) );
return m_images.Number(); return m_images.Number();
}; }
wxBitmap *wxImageList::GetBitmap(int index) { wxBitmap *wxImageList::GetBitmap(int index) {
wxNode *node = m_images.Nth(index); wxNode *node = m_images.Nth(index);
@@ -71,23 +71,23 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap )
wxNode *next = node->Next(); wxNode *next = node->Next();
m_images.DeleteNode( node ); m_images.DeleteNode( node );
m_images.Insert( next, new wxBitmap(bitmap) ); m_images.Insert( next, new wxBitmap(bitmap) );
}; }
return TRUE; return TRUE;
}; }
bool wxImageList::Remove( int index ) bool wxImageList::Remove( int index )
{ {
wxNode *node = m_images.Nth( index ); wxNode *node = m_images.Nth( index );
if (node) m_images.DeleteNode( node ); if (node) m_images.DeleteNode( node );
return (node != NULL); return (node != NULL);
}; }
bool wxImageList::RemoveAll() bool wxImageList::RemoveAll()
{ {
m_images.Clear(); m_images.Clear();
return TRUE; return TRUE;
}; }
bool wxImageList::GetSize( int index, int &width, int &height ) const bool wxImageList::GetSize( int index, int &width, int &height ) const
{ {
@@ -113,10 +113,10 @@ bool wxImageList::GetSize( int index, int &width, int &height ) const
width = 0; width = 0;
height = 0; height = 0;
return FALSE; return FALSE;
}; }
#endif #endif
}; }
bool wxImageList::Draw( int index, wxDC &dc, int x, int y, bool wxImageList::Draw( int index, wxDC &dc, int x, int y,
int flags, bool WXUNUSED(solidBackground) ) int flags, bool WXUNUSED(solidBackground) )
@@ -134,7 +134,7 @@ bool wxImageList::Draw( int index, wxDC &dc, int x, int y,
(m_height != bm->GetHeight())) (m_height != bm->GetHeight()))
{ {
bm->Resize( m_width, m_height ); bm->Resize( m_width, m_height );
}; }
#endif #endif
@@ -142,6 +142,6 @@ bool wxImageList::Draw( int index, wxDC &dc, int x, int y,
dc.DrawIcon( *icon, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 ); dc.DrawIcon( *icon, x, y, (flags & wxIMAGELIST_DRAW_TRANSPARENT) > 0 );
return TRUE; return TRUE;
}; }

File diff suppressed because it is too large Load Diff

View File

@@ -27,11 +27,9 @@ class wxBitmapButton;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmapButton // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{ {
if (!button->HasVMT()) return; if (!button->HasVMT()) return;
@@ -43,6 +41,10 @@ static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitma
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
wxBitmapButton::wxBitmapButton(void) wxBitmapButton::wxBitmapButton(void)
{ {

View File

@@ -27,11 +27,9 @@ class wxButton;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxButton // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button ) static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{ {
if (!button->HasVMT()) return; if (!button->HasVMT()) return;
@@ -43,6 +41,10 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
wxButton::wxButton(void) wxButton::wxButton(void)
{ {

View File

@@ -22,7 +22,7 @@
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxCheckBox // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
@@ -36,6 +36,8 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB
cb->GetEventHandler()->ProcessEvent(event); cb->GetEventHandler()->ProcessEvent(event);
} }
//-----------------------------------------------------------------------------
// wxCheckBox
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)

View File

@@ -22,7 +22,7 @@
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxChoice // "activate"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
@@ -38,6 +38,8 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
choice->GetEventHandler()->ProcessEvent(event); choice->GetEventHandler()->ProcessEvent(event);
} }
//-----------------------------------------------------------------------------
// wxChoice
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)

View File

@@ -22,12 +22,9 @@
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxComboBox // "select"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// clicked
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{ {
if (!combo->HasVMT()) return; if (!combo->HasVMT()) return;
@@ -66,6 +63,8 @@ static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxC
} }
*/ */
//-----------------------------------------------------------------------------
// wxComboBox
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)

View File

@@ -22,7 +22,8 @@
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// delete // "delete_event"
//-----------------------------------------------------------------------------
bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win ) bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{ {
@@ -207,7 +208,7 @@ void wxDialog::Centre( int direction )
bool wxDialog::Show( bool show ) bool wxDialog::Show( bool show )
{ {
if (!show && IsModal() && m_modalShowing) if (!show && IsModal())
{ {
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
@@ -219,19 +220,25 @@ bool wxDialog::Show( bool show )
return TRUE; return TRUE;
} }
void wxDialog::SetModal(bool flag) bool wxDialog::IsModal(void) const
{ {
return m_modalShowing;
}
void wxDialog::SetModal( bool WXUNUSED(flag) )
{
/*
if (flag) if (flag)
m_windowStyle |= wxDIALOG_MODAL; m_windowStyle |= wxDIALOG_MODAL;
else else
if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
*/
wxFAIL_MSG( "wxDialog:SetModal obsolete now" );
} }
int wxDialog::ShowModal(void) int wxDialog::ShowModal(void)
{ {
SetModal(TRUE); if (IsModal())
if (m_modalShowing)
{ {
wxFAIL_MSG( "wxDialog:ShowModal called twice" ); wxFAIL_MSG( "wxDialog:ShowModal called twice" );
return GetReturnCode(); return GetReturnCode();
@@ -252,7 +259,7 @@ void wxDialog::EndModal( int retCode )
{ {
SetReturnCode( retCode ); SetReturnCode( retCode );
if (!m_modalShowing) if (!IsModal())
{ {
wxFAIL_MSG( "wxDialog:EndModal called twice" ); wxFAIL_MSG( "wxDialog:EndModal called twice" );
return; return;
@@ -270,12 +277,6 @@ void wxDialog::InitDialog(void)
wxWindow::InitDialog(); 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 ) void wxDialog::SetIcon( const wxIcon &icon )
{ {
m_icon = icon; m_icon = icon;

View File

@@ -27,11 +27,9 @@ class wxBitmapButton;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmapButton // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button ) static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{ {
if (!button->HasVMT()) return; if (!button->HasVMT()) return;
@@ -43,6 +41,10 @@ static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitma
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
wxBitmapButton::wxBitmapButton(void) wxBitmapButton::wxBitmapButton(void)
{ {

View File

@@ -27,11 +27,9 @@ class wxButton;
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxButton // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button ) static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{ {
if (!button->HasVMT()) return; if (!button->HasVMT()) return;
@@ -43,6 +41,10 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
wxButton::wxButton(void) wxButton::wxButton(void)
{ {

View File

@@ -22,7 +22,7 @@
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxCheckBox // "clicked"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
@@ -36,6 +36,8 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB
cb->GetEventHandler()->ProcessEvent(event); cb->GetEventHandler()->ProcessEvent(event);
} }
//-----------------------------------------------------------------------------
// wxCheckBox
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)

View File

@@ -22,7 +22,7 @@
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxChoice // "activate"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice ) static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
@@ -38,6 +38,8 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
choice->GetEventHandler()->ProcessEvent(event); choice->GetEventHandler()->ProcessEvent(event);
} }
//-----------------------------------------------------------------------------
// wxChoice
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)

View File

@@ -22,12 +22,9 @@
extern bool g_blockEventsOnDrag; extern bool g_blockEventsOnDrag;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxComboBox // "select"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// clicked
static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{ {
if (!combo->HasVMT()) return; if (!combo->HasVMT()) return;
@@ -66,6 +63,8 @@ static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxC
} }
*/ */
//-----------------------------------------------------------------------------
// wxComboBox
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)

View File

@@ -22,7 +22,8 @@
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// delete // "delete_event"
//-----------------------------------------------------------------------------
bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win ) bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{ {
@@ -207,7 +208,7 @@ void wxDialog::Centre( int direction )
bool wxDialog::Show( bool show ) bool wxDialog::Show( bool show )
{ {
if (!show && IsModal() && m_modalShowing) if (!show && IsModal())
{ {
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
@@ -219,19 +220,25 @@ bool wxDialog::Show( bool show )
return TRUE; return TRUE;
} }
void wxDialog::SetModal(bool flag) bool wxDialog::IsModal(void) const
{ {
return m_modalShowing;
}
void wxDialog::SetModal( bool WXUNUSED(flag) )
{
/*
if (flag) if (flag)
m_windowStyle |= wxDIALOG_MODAL; m_windowStyle |= wxDIALOG_MODAL;
else else
if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
*/
wxFAIL_MSG( "wxDialog:SetModal obsolete now" );
} }
int wxDialog::ShowModal(void) int wxDialog::ShowModal(void)
{ {
SetModal(TRUE); if (IsModal())
if (m_modalShowing)
{ {
wxFAIL_MSG( "wxDialog:ShowModal called twice" ); wxFAIL_MSG( "wxDialog:ShowModal called twice" );
return GetReturnCode(); return GetReturnCode();
@@ -252,7 +259,7 @@ void wxDialog::EndModal( int retCode )
{ {
SetReturnCode( retCode ); SetReturnCode( retCode );
if (!m_modalShowing) if (!IsModal())
{ {
wxFAIL_MSG( "wxDialog:EndModal called twice" ); wxFAIL_MSG( "wxDialog:EndModal called twice" );
return; return;
@@ -270,12 +277,6 @@ void wxDialog::InitDialog(void)
wxWindow::InitDialog(); 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 ) void wxDialog::SetIcon( const wxIcon &icon )
{ {
m_icon = icon; m_icon = icon;