DnD
RadioBox layout git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,23 +2,17 @@
|
||||
-------------------- High priority ---------------------
|
||||
|
||||
wxTreeCtrl
|
||||
-> Keyboard handling, icon support.
|
||||
-> Make it compile. Keyboard handling, icon support.
|
||||
|
||||
wxListCtrl
|
||||
-> Icon support in list mode.
|
||||
-> Icon support in list mode. Backgroundcolour, font?
|
||||
|
||||
Finish DnD
|
||||
-> Only decoding filelist and visual feedback missing
|
||||
|
||||
wxClipboard
|
||||
-> Urg.
|
||||
-> Urgh.
|
||||
|
||||
wxHelpController
|
||||
-> Karsten ?
|
||||
|
||||
Implement wxRadioBox layout
|
||||
-> I'm so lazy.
|
||||
|
||||
Fix printing of bitmaps
|
||||
-> No idea.
|
||||
|
||||
@@ -27,7 +21,10 @@ Add support SetForegroundColour in GTK widgets
|
||||
|
||||
wxBitmapCheckBox
|
||||
-> Interface same as checkbox?
|
||||
|
||||
|
||||
wxImage
|
||||
-> 24-bit support
|
||||
|
||||
-------------------- Low priority ---------------------
|
||||
|
||||
wxDebugContext <-> wxLogXXX functions
|
||||
|
@@ -123,7 +123,7 @@ public:
|
||||
|
||||
wxFileDataObject(void) { }
|
||||
void AddFile( const wxString &file )
|
||||
{ m_files += file; m_files += ";"; }
|
||||
{ m_files += file; m_files += '\0'; }
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual wxDataFormat GetPreferredFormat() const
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
||||
{ return format == wxDF_FILENAME; }
|
||||
virtual size_t GetDataSize() const
|
||||
{ return m_files.Len() + 1; } // +1 for trailing '\0'of course
|
||||
{ return m_files.Len(); } // no trailing '\0'
|
||||
virtual void GetDataHere(void *pBuf) const
|
||||
{ memcpy(pBuf, m_files.c_str(), GetDataSize()); }
|
||||
|
||||
@@ -154,16 +154,16 @@ class wxDropTarget: public wxObject
|
||||
virtual void OnLeave() { }
|
||||
virtual bool OnDrop( long x, long y, const void *pData ) = 0;
|
||||
|
||||
// protected:
|
||||
// implementation
|
||||
|
||||
friend wxWindow;
|
||||
int m_size;
|
||||
|
||||
// Override these to indicate what kind of data you support:
|
||||
|
||||
virtual size_t GetFormatCount() const = 0;
|
||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||
|
||||
void Drop( GdkEvent *event, int x, int y );
|
||||
void Drop( GdkEventDropDataAvailable *event, int x, int y );
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
};
|
||||
|
@@ -123,7 +123,7 @@ public:
|
||||
|
||||
wxFileDataObject(void) { }
|
||||
void AddFile( const wxString &file )
|
||||
{ m_files += file; m_files += ";"; }
|
||||
{ m_files += file; m_files += '\0'; }
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual wxDataFormat GetPreferredFormat() const
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
||||
{ return format == wxDF_FILENAME; }
|
||||
virtual size_t GetDataSize() const
|
||||
{ return m_files.Len() + 1; } // +1 for trailing '\0'of course
|
||||
{ return m_files.Len(); } // no trailing '\0'
|
||||
virtual void GetDataHere(void *pBuf) const
|
||||
{ memcpy(pBuf, m_files.c_str(), GetDataSize()); }
|
||||
|
||||
@@ -154,16 +154,16 @@ class wxDropTarget: public wxObject
|
||||
virtual void OnLeave() { }
|
||||
virtual bool OnDrop( long x, long y, const void *pData ) = 0;
|
||||
|
||||
// protected:
|
||||
// implementation
|
||||
|
||||
friend wxWindow;
|
||||
int m_size;
|
||||
|
||||
// Override these to indicate what kind of data you support:
|
||||
|
||||
virtual size_t GetFormatCount() const = 0;
|
||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||
|
||||
void Drop( GdkEvent *event, int x, int y );
|
||||
void Drop( GdkEventDropDataAvailable *event, int x, int y );
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
};
|
||||
|
@@ -316,14 +316,22 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
tc->SetBackgroundColour("wheat");
|
||||
m_notebook->AddPage(panel, "wxTextCtrl" , FALSE, Image_Text);
|
||||
|
||||
wxString choices2[] =
|
||||
{
|
||||
"Wonderful",
|
||||
"examples.",
|
||||
};
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices );
|
||||
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), 2, choices2, 1, wxRA_HORIZONTAL );
|
||||
m_radio->SetBackgroundColour("wheat");
|
||||
m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices, 1, wxRA_VERTICAL );
|
||||
m_radio->SetBackgroundColour("wheat");
|
||||
(void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_RADIOBOX_FONT, "Set Italic font", wxPoint(180,130), wxSize(140,30) );
|
||||
(void)new wxCheckBox( panel, ID_RADIOBOX_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) );
|
||||
(void)new wxCheckBox( panel, ID_RADIOBOX_ENABLE, "Disable", wxPoint(340,130), wxSize(140,30) );
|
||||
m_fontButton = new wxButton( panel, ID_SET_FONT, "Set more Italic font", wxPoint(340,30), wxSize(160,30) );
|
||||
m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio);
|
||||
|
||||
|
@@ -33,17 +33,18 @@ extern bool g_blockEventsOnDrag;
|
||||
|
||||
wxDropTarget::wxDropTarget()
|
||||
{
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
wxDropTarget::~wxDropTarget()
|
||||
{
|
||||
}
|
||||
|
||||
void wxDropTarget::Drop( GdkEvent *event, int x, int y )
|
||||
void wxDropTarget::Drop( GdkEventDropDataAvailable *event, int x, int y )
|
||||
{
|
||||
printf( "Drop data is of type %s.\n", event->dropdataavailable.data_type );
|
||||
printf( "Drop data is of type %s.\n", event->data_type );
|
||||
|
||||
OnDrop( x, y, (char *)event->dropdataavailable.data);
|
||||
OnDrop( x, y, (char *)event->data);
|
||||
}
|
||||
|
||||
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
|
||||
@@ -114,18 +115,42 @@ wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
||||
// wxFileDropTarget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
|
||||
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const aszFiles[] )
|
||||
{
|
||||
printf( "Got %d dropped files.\n", (int)nFiles );
|
||||
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
|
||||
for (size_t i = 0; i < nFiles; i++)
|
||||
{
|
||||
printf( aszFiles[i] );
|
||||
printf( "\n" );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
|
||||
bool wxFileDropTarget::OnDrop(long x, long y, const void *pData )
|
||||
{
|
||||
char *str = "/this/is/a/path.txt";
|
||||
size_t number = 0;
|
||||
char *text = (char*) pData;
|
||||
for (int i = 0; i < m_size; i++)
|
||||
if (text[i] == 0) number++;
|
||||
|
||||
return OnDropFiles(x, y, 1, &str );
|
||||
if (number == 0) return TRUE;
|
||||
|
||||
char **files = new char*[number];
|
||||
|
||||
text = (char*) pData;
|
||||
for (size_t i = 0; i < number; i++)
|
||||
{
|
||||
files[i] = text;
|
||||
int len = strlen( text );
|
||||
text += len+1;
|
||||
}
|
||||
|
||||
bool ret = OnDropFiles(x, y, 1, files );
|
||||
|
||||
free( files );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t wxFileDropTarget::GetFormatCount() const
|
||||
|
@@ -80,11 +80,11 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int y = m_y+15;
|
||||
int maxLen = 0;
|
||||
int height = 20;
|
||||
int width = 0;
|
||||
|
||||
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
|
||||
|
||||
// if (((m_style & wxRA_VERTICAL) == wxRA_VERTICAL) && (n > 0))
|
||||
if (n > 0)
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
@@ -107,7 +107,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int tmp = 22+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
|
||||
int width = m_width-10;
|
||||
width = m_width-10;
|
||||
if (size.x == -1) width = tmp;
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
|
||||
|
||||
@@ -115,10 +115,47 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
height += 20;
|
||||
|
||||
}
|
||||
width = maxLen + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, choices[i] );
|
||||
if (len > max) max = len;
|
||||
}
|
||||
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), max, 20 );
|
||||
|
||||
x += max;
|
||||
}
|
||||
|
||||
width = max*n + 10;
|
||||
height = 40;
|
||||
}
|
||||
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = maxLen+10;
|
||||
if (newSize.x == -1) newSize.x = width;
|
||||
if (newSize.y == -1) newSize.y = height;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
@@ -151,19 +188,51 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||
int x = m_x+5;
|
||||
int y = m_y+15;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y );
|
||||
y += 20;
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y );
|
||||
y += 20;
|
||||
|
||||
int w = m_width-10;
|
||||
if (w < 15) w = 15;
|
||||
gtk_widget_set_usize( button, w, 20 );
|
||||
int w = m_width-10;
|
||||
if (w < 15) w = 15;
|
||||
gtk_widget_set_usize( button, w, 20 );
|
||||
|
||||
node = node->Next();
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, label->label );
|
||||
if (len > max) max = len;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y );
|
||||
x += max;
|
||||
gtk_widget_set_usize( button, max, 20 );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -841,7 +841,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventBut
|
||||
// "drop_data_available_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
|
||||
static void gtk_window_drop_callback( GtkWidget *widget, GdkEventDropDataAvailable *event, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
|
||||
@@ -850,6 +850,7 @@ static void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWind
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
|
||||
win->GetDropTarget()->m_size = event->data_numbytes;
|
||||
win->GetDropTarget()->Drop( event, x, y );
|
||||
}
|
||||
|
||||
|
@@ -33,17 +33,18 @@ extern bool g_blockEventsOnDrag;
|
||||
|
||||
wxDropTarget::wxDropTarget()
|
||||
{
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
wxDropTarget::~wxDropTarget()
|
||||
{
|
||||
}
|
||||
|
||||
void wxDropTarget::Drop( GdkEvent *event, int x, int y )
|
||||
void wxDropTarget::Drop( GdkEventDropDataAvailable *event, int x, int y )
|
||||
{
|
||||
printf( "Drop data is of type %s.\n", event->dropdataavailable.data_type );
|
||||
printf( "Drop data is of type %s.\n", event->data_type );
|
||||
|
||||
OnDrop( x, y, (char *)event->dropdataavailable.data);
|
||||
OnDrop( x, y, (char *)event->data);
|
||||
}
|
||||
|
||||
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
|
||||
@@ -114,18 +115,42 @@ wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
||||
// wxFileDropTarget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
|
||||
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const aszFiles[] )
|
||||
{
|
||||
printf( "Got %d dropped files.\n", (int)nFiles );
|
||||
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
|
||||
for (size_t i = 0; i < nFiles; i++)
|
||||
{
|
||||
printf( aszFiles[i] );
|
||||
printf( "\n" );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
|
||||
bool wxFileDropTarget::OnDrop(long x, long y, const void *pData )
|
||||
{
|
||||
char *str = "/this/is/a/path.txt";
|
||||
size_t number = 0;
|
||||
char *text = (char*) pData;
|
||||
for (int i = 0; i < m_size; i++)
|
||||
if (text[i] == 0) number++;
|
||||
|
||||
return OnDropFiles(x, y, 1, &str );
|
||||
if (number == 0) return TRUE;
|
||||
|
||||
char **files = new char*[number];
|
||||
|
||||
text = (char*) pData;
|
||||
for (size_t i = 0; i < number; i++)
|
||||
{
|
||||
files[i] = text;
|
||||
int len = strlen( text );
|
||||
text += len+1;
|
||||
}
|
||||
|
||||
bool ret = OnDropFiles(x, y, 1, files );
|
||||
|
||||
free( files );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t wxFileDropTarget::GetFormatCount() const
|
||||
|
@@ -80,11 +80,11 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int y = m_y+15;
|
||||
int maxLen = 0;
|
||||
int height = 20;
|
||||
int width = 0;
|
||||
|
||||
GtkRadioButton *m_radio = (GtkRadioButton*) NULL;
|
||||
|
||||
// if (((m_style & wxRA_VERTICAL) == wxRA_VERTICAL) && (n > 0))
|
||||
if (n > 0)
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
@@ -107,7 +107,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
int tmp = 22+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
|
||||
int width = m_width-10;
|
||||
width = m_width-10;
|
||||
if (size.x == -1) width = tmp;
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
|
||||
|
||||
@@ -115,10 +115,47 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
height += 20;
|
||||
|
||||
}
|
||||
width = maxLen + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, choices[i] );
|
||||
if (len > max) max = len;
|
||||
}
|
||||
|
||||
GSList *radio_button_group = (GSList *) NULL;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
|
||||
|
||||
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
|
||||
|
||||
m_boxes.Append( (wxObject*) m_radio );
|
||||
|
||||
ConnectWidget( GTK_WIDGET(m_radio) );
|
||||
|
||||
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(m_radio), max, 20 );
|
||||
|
||||
x += max;
|
||||
}
|
||||
|
||||
width = max*n + 10;
|
||||
height = 40;
|
||||
}
|
||||
|
||||
wxSize newSize = size;
|
||||
if (newSize.x == -1) newSize.x = maxLen+10;
|
||||
if (newSize.x == -1) newSize.x = width;
|
||||
if (newSize.y == -1) newSize.y = height;
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
||||
@@ -151,19 +188,51 @@ void wxRadioBox::OnSize( wxSizeEvent &event )
|
||||
int x = m_x+5;
|
||||
int y = m_y+15;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
if (m_windowStyle & wxRA_VERTICAL)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y );
|
||||
y += 20;
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y );
|
||||
y += 20;
|
||||
|
||||
int w = m_width-10;
|
||||
if (w < 15) w = 15;
|
||||
gtk_widget_set_usize( button, w, 20 );
|
||||
int w = m_width-10;
|
||||
if (w < 15) w = 15;
|
||||
gtk_widget_set_usize( button, w, 20 );
|
||||
|
||||
node = node->Next();
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0;
|
||||
|
||||
wxNode *node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON( node->Data() );
|
||||
GtkLabel *label = GTK_LABEL( button->child );
|
||||
|
||||
GdkFont *font = m_widget->style->font;
|
||||
int len = 27+gdk_string_measure( font, label->label );
|
||||
if (len > max) max = len;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
node = m_boxes.First();
|
||||
while (node)
|
||||
{
|
||||
GtkWidget *button = GTK_WIDGET( node->Data() );
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), button, x, y );
|
||||
x += max;
|
||||
gtk_widget_set_usize( button, max, 20 );
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -841,7 +841,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget, GdkEventBut
|
||||
// "drop_data_available_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win )
|
||||
static void gtk_window_drop_callback( GtkWidget *widget, GdkEventDropDataAvailable *event, wxWindow *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
|
||||
@@ -850,6 +850,7 @@ static void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWind
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
|
||||
win->GetDropTarget()->m_size = event->data_numbytes;
|
||||
win->GetDropTarget()->Drop( event, x, y );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user