Color cubes now get created on 8-bit true-color
visual as well. (This exists). Added MakeModal() to wxFrame. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
00a395425c
commit
ca26177c30
@ -83,6 +83,9 @@ public:
|
|||||||
virtual void SetTitle( const wxString &title );
|
virtual void SetTitle( const wxString &title );
|
||||||
virtual wxString GetTitle() const { return m_title; }
|
virtual wxString GetTitle() const { return m_title; }
|
||||||
|
|
||||||
|
// make the window modal (all other windows unresponsive)
|
||||||
|
virtual void MakeModal(bool modal = TRUE);
|
||||||
|
|
||||||
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() const { return FALSE; }
|
virtual bool IsIconized() const { return FALSE; }
|
||||||
|
@ -83,6 +83,9 @@ public:
|
|||||||
virtual void SetTitle( const wxString &title );
|
virtual void SetTitle( const wxString &title );
|
||||||
virtual wxString GetTitle() const { return m_title; }
|
virtual wxString GetTitle() const { return m_title; }
|
||||||
|
|
||||||
|
// make the window modal (all other windows unresponsive)
|
||||||
|
virtual void MakeModal(bool modal = TRUE);
|
||||||
|
|
||||||
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() const { return FALSE; }
|
virtual bool IsIconized() const { return FALSE; }
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
wxBitmap *my_horse_png;
|
wxBitmap *my_horse_png;
|
||||||
wxBitmap *my_horse_jpeg;
|
wxBitmap *my_horse_jpeg;
|
||||||
wxBitmap *my_horse_gif;
|
wxBitmap *my_horse_gif;
|
||||||
|
wxBitmap *my_horse_bmp;
|
||||||
wxBitmap *my_square;
|
wxBitmap *my_square;
|
||||||
wxBitmap *my_anti;
|
wxBitmap *my_anti;
|
||||||
|
|
||||||
@ -91,6 +92,7 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
my_horse_png = (wxBitmap*) NULL;
|
my_horse_png = (wxBitmap*) NULL;
|
||||||
my_horse_jpeg = (wxBitmap*) NULL;
|
my_horse_jpeg = (wxBitmap*) NULL;
|
||||||
my_horse_gif = (wxBitmap*) NULL;
|
my_horse_gif = (wxBitmap*) NULL;
|
||||||
|
my_horse_bmp = (wxBitmap*) NULL;
|
||||||
my_square = (wxBitmap*) NULL;
|
my_square = (wxBitmap*) NULL;
|
||||||
my_anti = (wxBitmap*) NULL;
|
my_anti = (wxBitmap*) NULL;
|
||||||
|
|
||||||
@ -133,6 +135,11 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
else
|
else
|
||||||
my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
|
my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
|
||||||
|
|
||||||
|
if ( !image.LoadFile( dir + wxString("horse.bmp"), wxBITMAP_TYPE_BMP ) )
|
||||||
|
wxLogError("Can't load BMP image");
|
||||||
|
else
|
||||||
|
my_horse_bmp = new wxBitmap( image.ConvertToBitmap() );
|
||||||
|
|
||||||
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
||||||
my_square = new wxBitmap( image.ConvertToBitmap() );
|
my_square = new wxBitmap( image.ConvertToBitmap() );
|
||||||
|
|
||||||
@ -144,6 +151,7 @@ MyCanvas::~MyCanvas()
|
|||||||
delete my_horse_png;
|
delete my_horse_png;
|
||||||
delete my_horse_jpeg;
|
delete my_horse_jpeg;
|
||||||
delete my_horse_gif;
|
delete my_horse_gif;
|
||||||
|
delete my_horse_bmp;
|
||||||
delete my_square;
|
delete my_square;
|
||||||
delete my_anti;
|
delete my_anti;
|
||||||
}
|
}
|
||||||
@ -171,6 +179,9 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
|
|
||||||
dc.DrawText( "GIF handler", 30, 595 );
|
dc.DrawText( "GIF handler", 30, 595 );
|
||||||
if (my_horse_gif && my_horse_gif->Ok()) dc.DrawBitmap( *my_horse_gif, 30, 610 );
|
if (my_horse_gif && my_horse_gif->Ok()) dc.DrawBitmap( *my_horse_gif, 30, 610 );
|
||||||
|
|
||||||
|
dc.DrawText( "BMP handler", 30, 815 );
|
||||||
|
if (my_horse_bmp && my_horse_bmp->Ok()) dc.DrawBitmap( *my_horse_bmp, 30, 830 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyCanvas::CreateAntiAliasedBitmap()
|
void MyCanvas::CreateAntiAliasedBitmap()
|
||||||
|
@ -343,7 +343,7 @@ bool wxApp::OnInitGui()
|
|||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
GdkColor *colors = cmap->colors;
|
GdkColor *colors = cmap->colors;
|
||||||
if(colors)
|
if (colors)
|
||||||
{
|
{
|
||||||
int max = 3 * 65536;
|
int max = 3 * 65536;
|
||||||
|
|
||||||
@ -359,6 +359,15 @@ bool wxApp::OnInitGui()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* assume 8-bit true or static colors. this really
|
||||||
|
exists. */
|
||||||
|
GdkVisual* vis = gdk_colormap_get_visual( cmap );
|
||||||
|
index = (r >> (5 - vis->red_prec)) << vis->red_shift;
|
||||||
|
index |= (g >> (5 - vis->green_prec)) << vis->green_shift;
|
||||||
|
index |= (b >> (5 - vis->blue_prec)) << vis->blue_shift;
|
||||||
|
}
|
||||||
|
|
||||||
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
||||||
}
|
}
|
||||||
|
@ -742,6 +742,20 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
m_resizing = FALSE;
|
m_resizing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFrame::MakeModal( bool modal )
|
||||||
|
{
|
||||||
|
if (modal)
|
||||||
|
{
|
||||||
|
gtk_grab_add( m_widget );
|
||||||
|
gtk_main();
|
||||||
|
gtk_grab_remove( m_widget );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxFrame::OnInternalIdle()
|
void wxFrame::OnInternalIdle()
|
||||||
{
|
{
|
||||||
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
|
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
|
||||||
|
@ -343,7 +343,7 @@ bool wxApp::OnInitGui()
|
|||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
GdkColor *colors = cmap->colors;
|
GdkColor *colors = cmap->colors;
|
||||||
if(colors)
|
if (colors)
|
||||||
{
|
{
|
||||||
int max = 3 * 65536;
|
int max = 3 * 65536;
|
||||||
|
|
||||||
@ -359,6 +359,15 @@ bool wxApp::OnInitGui()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* assume 8-bit true or static colors. this really
|
||||||
|
exists. */
|
||||||
|
GdkVisual* vis = gdk_colormap_get_visual( cmap );
|
||||||
|
index = (r >> (5 - vis->red_prec)) << vis->red_shift;
|
||||||
|
index |= (g >> (5 - vis->green_prec)) << vis->green_shift;
|
||||||
|
index |= (b >> (5 - vis->blue_prec)) << vis->blue_shift;
|
||||||
|
}
|
||||||
|
|
||||||
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
m_colorCube[ (r*1024) + (g*32) + b ] = index;
|
||||||
}
|
}
|
||||||
|
@ -742,6 +742,20 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
m_resizing = FALSE;
|
m_resizing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFrame::MakeModal( bool modal )
|
||||||
|
{
|
||||||
|
if (modal)
|
||||||
|
{
|
||||||
|
gtk_grab_add( m_widget );
|
||||||
|
gtk_main();
|
||||||
|
gtk_grab_remove( m_widget );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxFrame::OnInternalIdle()
|
void wxFrame::OnInternalIdle()
|
||||||
{
|
{
|
||||||
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
|
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
|
||||||
|
Loading…
Reference in New Issue
Block a user