Fixes to fonts, static text, radiobox, frame
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5db1a502b4
commit
7bce6aec99
@ -5,7 +5,7 @@ wxTreeCtrl
|
||||
-> Make it compile. Keyboard handling, icon support.
|
||||
|
||||
wxListCtrl
|
||||
-> Icon support in list mode. Backgroundcolour, font?
|
||||
-> Icon support in list mode
|
||||
|
||||
wxClipboard
|
||||
-> Urgh.
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
wxTreeItemId(long itemId) { m_pItem = (wxGenericTreeItem *)itemId; }
|
||||
operator long() const { return (long)m_pItem; }
|
||||
|
||||
protected:
|
||||
//protected:
|
||||
// for wxTreeCtrl usage only
|
||||
wxTreeItemId(wxGenericTreeItem *pItem) { m_pItem = pItem; }
|
||||
|
||||
|
@ -64,6 +64,7 @@ class MyPanel: public wxPanel
|
||||
void OnRadioButtons( wxCommandEvent &event );
|
||||
void OnSetFont( wxCommandEvent &event );
|
||||
void OnPageChanged( wxNotebookEvent &event );
|
||||
void OnSliderUpdate( wxCommandEvent &event );
|
||||
|
||||
wxListBox *m_listbox;
|
||||
wxChoice *m_choice;
|
||||
@ -215,12 +216,13 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
||||
EVT_BUTTON (ID_RADIOBOX_FONT, MyPanel::OnRadioButtons)
|
||||
EVT_CHECKBOX (ID_RADIOBOX_ENABLE, MyPanel::OnRadioButtons)
|
||||
EVT_BUTTON (ID_SET_FONT, MyPanel::OnSetFont)
|
||||
EVT_SLIDER (ID_SLIDER, MyPanel::OnSliderUpdate)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
|
||||
{
|
||||
// SetBackgroundColour("cadet blue");
|
||||
SetBackgroundColour("cadet blue");
|
||||
|
||||
m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE );
|
||||
m_text->SetBackgroundColour("wheat");
|
||||
@ -291,8 +293,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
// panel->SetBackgroundColour("cadet blue");
|
||||
// panel->SetForegroundColour("blue");
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
panel->SetForegroundColour("blue");
|
||||
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices );
|
||||
m_choice->SetBackgroundColour("wheat");
|
||||
(void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||
@ -305,10 +307,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
// panel->SetBackgroundColour("cadet blue");
|
||||
// panel->SetForegroundColour("blue");
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
panel->SetForegroundColour("blue");
|
||||
m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 5, choices );
|
||||
// m_combo->SetBackgroundColour("wheat");
|
||||
m_combo->SetBackgroundColour("wheat");
|
||||
(void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) );
|
||||
(void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
|
||||
@ -319,12 +321,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo);
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
// panel->SetBackgroundColour("cadet blue");
|
||||
// panel->SetForegroundColour("blue");
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
panel->SetForegroundColour("blue");
|
||||
wxTextCtrl *tc = new wxTextCtrl( panel, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(350,28));
|
||||
// tc->SetBackgroundColour("wheat");
|
||||
tc->SetBackgroundColour("wheat");
|
||||
tc = new wxTextCtrl( panel, ID_TEXT, "And here.", wxPoint(10,50), wxSize(350,160), wxTE_MULTILINE );
|
||||
// tc->SetBackgroundColour("wheat");
|
||||
tc->SetBackgroundColour("wheat");
|
||||
m_notebook->AddPage(panel, "wxTextCtrl" , FALSE, Image_Text);
|
||||
|
||||
wxString choices2[] =
|
||||
@ -334,12 +336,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
};
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
// panel->SetBackgroundColour("cadet blue");
|
||||
// panel->SetForegroundColour("blue");
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
panel->SetForegroundColour("blue");
|
||||
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->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");
|
||||
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) );
|
||||
@ -348,13 +350,22 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
|
||||
m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio);
|
||||
|
||||
panel = new wxPanel(m_notebook);
|
||||
// panel->SetBackgroundColour("cadet blue");
|
||||
// panel->SetForegroundColour("blue");
|
||||
panel->SetBackgroundColour("cadet blue");
|
||||
panel->SetForegroundColour("blue");
|
||||
(void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(180,130) );
|
||||
m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155,-1) );
|
||||
// m_gauge->SetBackgroundColour("wheat");
|
||||
m_slider = new wxSlider( panel, -1, 0, 0, 200, wxPoint(18,90), wxSize(155,-1) );
|
||||
// m_slider->SetBackgroundColour("wheat");
|
||||
m_gauge->SetBackgroundColour("wheat");
|
||||
m_slider = new wxSlider( panel, ID_SLIDER, 0, 0, 200, wxPoint(18,90), wxSize(155,-1) );
|
||||
m_slider->SetBackgroundColour("wheat");
|
||||
(void)new wxStaticBox( panel, -1, "Explanation", wxPoint(200,10), wxSize(290,130) );
|
||||
(void)new wxStaticText( panel, -1,
|
||||
"In order see the gauge (aka progress bar)\n"
|
||||
"control do something you have to drag the\n"
|
||||
"handle of the slider to the right.\n"
|
||||
"\n"
|
||||
"This is also supposed to demonstrate how\n"
|
||||
"to use static controls.\n",
|
||||
wxPoint(208,25) );
|
||||
m_notebook->AddPage(panel, "wxGauge", FALSE, Image_Gauge);
|
||||
}
|
||||
|
||||
@ -563,6 +574,11 @@ void MyPanel::OnSetFont( wxCommandEvent &WXUNUSED(event) )
|
||||
m_text->SetFont( *wxITALIC_FONT );
|
||||
}
|
||||
|
||||
void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )
|
||||
{
|
||||
m_gauge->SetValue( m_slider->GetValue() );
|
||||
}
|
||||
|
||||
MyPanel::~MyPanel()
|
||||
{
|
||||
delete m_notebook->GetImageList();
|
||||
|
27
samples/controls/icons/gauge.xpm
Normal file
27
samples/controls/icons/gauge.xpm
Normal file
@ -0,0 +1,27 @@
|
||||
/* XPM */
|
||||
static char * gauge_xpm[] = {
|
||||
/* width height ncolors chars_per_pixel */
|
||||
"16 16 5 1",
|
||||
/* colors */
|
||||
" s None c None",
|
||||
". c #000000",
|
||||
"+ c #000080",
|
||||
"@ c #c0c0c0",
|
||||
"# c #808080",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"################",
|
||||
"#..............#",
|
||||
"#.++++++++@@@@@#",
|
||||
"#.++++++++@@@@@#",
|
||||
"#.++++++++@@@@@#",
|
||||
"#.++++++++@@@@@#",
|
||||
"#.++++++++@@@@@#",
|
||||
"#.++++++++@@@@@#",
|
||||
"#.++++++++@@@@@#",
|
||||
"################",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
@ -136,8 +136,6 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
@ -145,6 +143,8 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,9 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
|
||||
{
|
||||
m_refData = new wxFontRefData();
|
||||
|
||||
if (FontIdOrFamily == wxDEFAULT) FontIdOrFamily = wxSWISS;
|
||||
M_FONTDATA->m_family = FontIdOrFamily;
|
||||
|
||||
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
|
||||
{
|
||||
M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, FontIdOrFamily );
|
||||
@ -112,11 +115,12 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
|
||||
M_FONTDATA->m_fontId = FontIdOrFamily;
|
||||
M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
|
||||
}
|
||||
if (Style == wxDEFAULT) Style = wxSWISS;
|
||||
|
||||
if (Style == wxDEFAULT) Style = wxNORMAL;
|
||||
M_FONTDATA->m_style = Style;
|
||||
if (Weight == wxDEFAULT) Weight = wxNORMAL;
|
||||
M_FONTDATA->m_weight = Weight;
|
||||
if (PointSize == wxDEFAULT) PointSize = 10;
|
||||
if (PointSize == wxDEFAULT) PointSize = 12;
|
||||
M_FONTDATA->m_pointSize = PointSize;
|
||||
M_FONTDATA->m_underlined = Underlined;
|
||||
|
||||
@ -361,12 +365,19 @@ GdkFont *wxFont::GetInternalFont(float scale) const
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
if (int_scale == 100) printf( "int_scale.\n" );
|
||||
if (M_FONTDATA->m_style == wxSWISS) printf( "swiss.\n" );
|
||||
if (M_FONTDATA->m_pointSize == 12) printf( "12.\n" );
|
||||
if (M_FONTDATA->m_weight == wxNORMAL) printf( "normal.\n" );
|
||||
if (M_FONTDATA->m_underlined == FALSE) printf( "false.\n" );
|
||||
*/
|
||||
if ((int_scale == 100) &&
|
||||
(M_FONTDATA->m_style == wxSWISS) &&
|
||||
(M_FONTDATA->m_family == wxSWISS) &&
|
||||
(M_FONTDATA->m_style == wxNORMAL) &&
|
||||
(M_FONTDATA->m_pointSize == 12) &&
|
||||
(M_FONTDATA->m_weight == wxNORMAL) &&
|
||||
(M_FONTDATA->m_underlined == FALSE) &&
|
||||
(M_FONTDATA->m_style == wxNORMAL))
|
||||
(M_FONTDATA->m_underlined == FALSE))
|
||||
{
|
||||
font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
|
||||
}
|
||||
|
@ -337,7 +337,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
||||
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
|
||||
int y = 0;
|
||||
if (m_frameMenuBar) y = wxMENU_HEIGHT;
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, y );
|
||||
gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
|
||||
}
|
||||
|
||||
|
@ -144,8 +144,6 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
@ -159,6 +157,8 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
|
||||
ConnectWidget( list_item );
|
||||
|
@ -104,7 +104,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
int tmp = 22+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
int tmp = 25+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
|
||||
width = m_width-10;
|
||||
|
@ -54,37 +54,40 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
|
||||
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
|
||||
|
||||
int y = 1;
|
||||
if (newSize.x == -1) {
|
||||
if (newSize.x == -1)
|
||||
{
|
||||
char *s = WXSTRINGCAST m_label;
|
||||
char *nl = strchr(s, '\n');
|
||||
if (nl) {
|
||||
do {
|
||||
if (nl)
|
||||
{
|
||||
do
|
||||
{
|
||||
*nl = 0;
|
||||
int x = gdk_string_measure( m_widget->style->font, s );
|
||||
if (x > newSize.x) {
|
||||
newSize.x = x;
|
||||
}
|
||||
int x = gdk_string_measure( m_widget->style->font, s ) + 4;
|
||||
if (x > newSize.x) newSize.x = x;
|
||||
*nl++ = '\n';
|
||||
if ((nl = strchr(s = nl, '\n'))) {
|
||||
if ((nl = strchr(s = nl, '\n')))
|
||||
{
|
||||
++y;
|
||||
} else {
|
||||
int x = gdk_string_measure( m_widget->style->font, s );
|
||||
if (x > newSize.x) {
|
||||
newSize.x = x;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = gdk_string_measure( m_widget->style->font, s ) + 4;
|
||||
if (x > newSize.x) newSize.x = x;
|
||||
}
|
||||
} while (nl);
|
||||
} else {
|
||||
newSize.x = gdk_string_measure( m_widget->style->font, label );
|
||||
}
|
||||
else
|
||||
{
|
||||
newSize.x = gdk_string_measure( m_widget->style->font, label ) + 4;
|
||||
}
|
||||
}
|
||||
if (newSize.y == -1) {
|
||||
if (y == 1) {
|
||||
if (newSize.y == -1)
|
||||
{
|
||||
if (y == 1)
|
||||
newSize.y = 26;
|
||||
} else {
|
||||
newSize.y
|
||||
= y * (m_widget->style->font->ascent +m_widget->style->font->descent);
|
||||
}
|
||||
else
|
||||
newSize.y = 4 + y * (m_widget->style->font->ascent + 2*m_widget->style->font->descent);
|
||||
}
|
||||
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
@ -136,8 +136,6 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
|
||||
|
||||
@ -145,6 +143,8 @@ void wxComboBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(list), list_item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,9 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
|
||||
{
|
||||
m_refData = new wxFontRefData();
|
||||
|
||||
if (FontIdOrFamily == wxDEFAULT) FontIdOrFamily = wxSWISS;
|
||||
M_FONTDATA->m_family = FontIdOrFamily;
|
||||
|
||||
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
|
||||
{
|
||||
M_FONTDATA->m_fontId = wxTheFontNameDirectory->FindOrCreateFontId( Face, FontIdOrFamily );
|
||||
@ -112,11 +115,12 @@ wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
|
||||
M_FONTDATA->m_fontId = FontIdOrFamily;
|
||||
M_FONTDATA->m_family = wxTheFontNameDirectory->GetFamily( FontIdOrFamily );
|
||||
}
|
||||
if (Style == wxDEFAULT) Style = wxSWISS;
|
||||
|
||||
if (Style == wxDEFAULT) Style = wxNORMAL;
|
||||
M_FONTDATA->m_style = Style;
|
||||
if (Weight == wxDEFAULT) Weight = wxNORMAL;
|
||||
M_FONTDATA->m_weight = Weight;
|
||||
if (PointSize == wxDEFAULT) PointSize = 10;
|
||||
if (PointSize == wxDEFAULT) PointSize = 12;
|
||||
M_FONTDATA->m_pointSize = PointSize;
|
||||
M_FONTDATA->m_underlined = Underlined;
|
||||
|
||||
@ -361,12 +365,19 @@ GdkFont *wxFont::GetInternalFont(float scale) const
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
if (int_scale == 100) printf( "int_scale.\n" );
|
||||
if (M_FONTDATA->m_style == wxSWISS) printf( "swiss.\n" );
|
||||
if (M_FONTDATA->m_pointSize == 12) printf( "12.\n" );
|
||||
if (M_FONTDATA->m_weight == wxNORMAL) printf( "normal.\n" );
|
||||
if (M_FONTDATA->m_underlined == FALSE) printf( "false.\n" );
|
||||
*/
|
||||
if ((int_scale == 100) &&
|
||||
(M_FONTDATA->m_style == wxSWISS) &&
|
||||
(M_FONTDATA->m_family == wxSWISS) &&
|
||||
(M_FONTDATA->m_style == wxNORMAL) &&
|
||||
(M_FONTDATA->m_pointSize == 12) &&
|
||||
(M_FONTDATA->m_weight == wxNORMAL) &&
|
||||
(M_FONTDATA->m_underlined == FALSE) &&
|
||||
(M_FONTDATA->m_style == wxNORMAL))
|
||||
(M_FONTDATA->m_underlined == FALSE))
|
||||
{
|
||||
font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
|
||||
}
|
||||
|
@ -337,7 +337,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
||||
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, wxMENU_HEIGHT );
|
||||
int y = 0;
|
||||
if (m_frameMenuBar) y = wxMENU_HEIGHT;
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_mainWindow), m_frameToolBar->m_widget, 1, y );
|
||||
gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height );
|
||||
}
|
||||
|
||||
|
@ -144,8 +144,6 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
GtkWidget *list_item = gtk_list_item_new_with_label( item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(list_item), "select",
|
||||
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
|
||||
|
||||
@ -159,6 +157,8 @@ void wxListBox::Append( const wxString &item, char *clientData )
|
||||
|
||||
gtk_container_add( GTK_CONTAINER(m_list), list_item );
|
||||
|
||||
if (m_widgetStyle) ApplyWidgetStyle();
|
||||
|
||||
gtk_widget_show( list_item );
|
||||
|
||||
ConnectWidget( list_item );
|
||||
|
@ -104,7 +104,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
|
||||
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
|
||||
|
||||
int tmp = 22+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
int tmp = 25+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
|
||||
if (tmp > maxLen) maxLen = tmp;
|
||||
|
||||
width = m_width-10;
|
||||
|
@ -54,37 +54,40 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe
|
||||
gtk_label_set_justify(GTK_LABEL(m_widget), justify);
|
||||
|
||||
int y = 1;
|
||||
if (newSize.x == -1) {
|
||||
if (newSize.x == -1)
|
||||
{
|
||||
char *s = WXSTRINGCAST m_label;
|
||||
char *nl = strchr(s, '\n');
|
||||
if (nl) {
|
||||
do {
|
||||
if (nl)
|
||||
{
|
||||
do
|
||||
{
|
||||
*nl = 0;
|
||||
int x = gdk_string_measure( m_widget->style->font, s );
|
||||
if (x > newSize.x) {
|
||||
newSize.x = x;
|
||||
}
|
||||
int x = gdk_string_measure( m_widget->style->font, s ) + 4;
|
||||
if (x > newSize.x) newSize.x = x;
|
||||
*nl++ = '\n';
|
||||
if ((nl = strchr(s = nl, '\n'))) {
|
||||
if ((nl = strchr(s = nl, '\n')))
|
||||
{
|
||||
++y;
|
||||
} else {
|
||||
int x = gdk_string_measure( m_widget->style->font, s );
|
||||
if (x > newSize.x) {
|
||||
newSize.x = x;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x = gdk_string_measure( m_widget->style->font, s ) + 4;
|
||||
if (x > newSize.x) newSize.x = x;
|
||||
}
|
||||
} while (nl);
|
||||
} else {
|
||||
newSize.x = gdk_string_measure( m_widget->style->font, label );
|
||||
}
|
||||
else
|
||||
{
|
||||
newSize.x = gdk_string_measure( m_widget->style->font, label ) + 4;
|
||||
}
|
||||
}
|
||||
if (newSize.y == -1) {
|
||||
if (y == 1) {
|
||||
if (newSize.y == -1)
|
||||
{
|
||||
if (y == 1)
|
||||
newSize.y = 26;
|
||||
} else {
|
||||
newSize.y
|
||||
= y * (m_widget->style->font->ascent +m_widget->style->font->descent);
|
||||
}
|
||||
else
|
||||
newSize.y = 4 + y * (m_widget->style->font->ascent + 2*m_widget->style->font->descent);
|
||||
}
|
||||
|
||||
SetSize( newSize.x, newSize.y );
|
||||
|
@ -445,6 +445,7 @@ END_EVENT_TABLE()
|
||||
MyFrame::MyFrame(void) :
|
||||
wxFrame( (wxFrame *) NULL, -1, (char *) "Robert's Test application", wxPoint(20,20), wxSize(470,360) )
|
||||
{
|
||||
/*
|
||||
wxMenu *file_menu = new wxMenu( "Test" );
|
||||
file_menu->Append( ID_OPEN, "Open..");
|
||||
file_menu->Append( ID_MSG, "MessageBox..");
|
||||
@ -460,6 +461,7 @@ MyFrame::MyFrame(void) :
|
||||
menu_bar->Show( TRUE );
|
||||
|
||||
SetMenuBar( menu_bar );
|
||||
*/
|
||||
|
||||
CreateStatusBar( 2 );
|
||||
|
||||
@ -470,7 +472,6 @@ MyFrame::MyFrame(void) :
|
||||
m_canvas->SetScrollbars( 10, 10, 50, 50 );
|
||||
|
||||
m_tb = CreateToolBar();
|
||||
m_tb->SetMargins( 2, 2 );
|
||||
m_tb->AddTool( 0, wxBitmap( list_xpm ), wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "This is a button" );
|
||||
m_tb->AddTool( 0, wxBitmap( folder_xpm ), wxNullBitmap, TRUE, -1, -1, (wxObject *) NULL, "This is a toggle" );
|
||||
m_tb->Realize();
|
||||
|
Loading…
Reference in New Issue
Block a user