Doc corrections

fixed listbox setbackground
  added spinbutton sample


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@997 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-11-14 20:17:32 +00:00
parent 4832f7c06c
commit e380f72b45
10 changed files with 702 additions and 673 deletions

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSLIDERH__
#define __GTKSLIDERH__

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKSLIDERH__
#define __GTKSLIDERH__

View File

@@ -21,6 +21,7 @@
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/spinbutt.h"
#endif
#include "wx/notebook.h"
@@ -65,6 +66,7 @@ class MyPanel: public wxPanel
void OnSetFont( wxCommandEvent &event );
void OnPageChanged( wxNotebookEvent &event );
void OnSliderUpdate( wxCommandEvent &event );
void OnSpinUpdate( wxSpinEvent &event );
wxListBox *m_listbox;
wxChoice *m_choice;
@@ -73,6 +75,8 @@ class MyPanel: public wxPanel
wxGauge *m_gauge;
wxSlider *m_slider;
wxButton *m_fontButton;
wxSpinButton *m_spinbutton;
wxTextCtrl *m_spintext;
wxTextCtrl *m_text;
wxNotebook *m_notebook;
@@ -182,6 +186,8 @@ const ID_SET_FONT = 170;
const ID_GAUGE = 180;
const ID_SLIDER = 181;
const ID_SPIN = 182;
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_SIZE ( MyPanel::OnSize)
@@ -217,6 +223,7 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_CHECKBOX (ID_RADIOBOX_ENABLE, MyPanel::OnRadioButtons)
EVT_BUTTON (ID_SET_FONT, MyPanel::OnSetFont)
EVT_SLIDER (ID_SLIDER, MyPanel::OnSliderUpdate)
EVT_SPIN (ID_SPIN, MyPanel::OnSpinUpdate)
END_EVENT_TABLE()
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
@@ -368,6 +375,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
"This is also supposed to demonstrate how\n"
"to use static controls.\n",
wxPoint(208,25) );
m_spintext = new wxTextCtrl( panel, -1, "0", wxPoint(20,160), wxSize(80,-1) );
m_spintext->SetBackgroundColour("wheat");
m_spinbutton = new wxSpinButton( panel, ID_SPIN, wxPoint(103,159), wxSize(-1,-1) );
m_spinbutton->SetBackgroundColour("wheat");
m_spinbutton->SetRange(0,100);
m_notebook->AddPage(panel, "wxGauge", FALSE, Image_Gauge);
}
@@ -581,6 +594,13 @@ void MyPanel::OnSliderUpdate( wxCommandEvent &WXUNUSED(event) )
m_gauge->SetValue( m_slider->GetValue() );
}
void MyPanel::OnSpinUpdate( wxSpinEvent &event )
{
wxString value;
value.sprintf( "%d", (int)event.GetPosition() );
m_spintext->SetValue( value );
}
MyPanel::~MyPanel()
{
delete m_notebook->GetImageList();

View File

@@ -104,6 +104,7 @@ LIB_CPP_SRC=\
gtk/scrolbar.cpp \
gtk/settings.cpp \
gtk/slider.cpp \
gtk/spinbutt.cpp \
gtk/statbox.cpp \
gtk/statbmp.cpp \
gtk/stattext.cpp \

View File

@@ -522,10 +522,13 @@ void wxListBox::ApplyWidgetStyle()
{
SetWidgetStyle();
if (m_backgroundColour.Ok())
{
GdkWindow *window = GTK_WIDGET(m_list)->window;
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
}
GList *child = m_list->children;
while (child)

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "slider.h"
#endif

View File

@@ -43,32 +43,32 @@
for all other window classes, does seems required as well.
What does wxWindow do? It contains the common interface for the following
jobs of its descentants:
jobs of its descendants:
1) Define the rudimentary behaviour common to all window classes, such as
resizing, intercepting user input so as to make it possible to use these
events for special purposes in a derived class, window names etc.
resizing, intercepting user input (so as to make it possible to use these
events for special purposes in a derived class), window names etc.
2) Provide the possibility to contain and manage children, if the derived
class is allowed to contain children, which holds true for those window
classes, which do not display a native GTK widget. To name them, these
classes which do not display a native GTK widget. To name them, these
classes are wxPanel, wxScrolledWindow, wxDialog, wxFrame. The MDI frame-
work classes are a special case and are handled a bit differently from
the rest.
the rest. The same holds true for the wxNotebook class.
3) Provide the possibility to draw into a client area of a window. This,
too, only holds true for classes that do not display a native GTK widget
as above.
4) Provide the entire mechanism for scrolling widgets. This actaul inter-
face for this is usually in wxScrolledWidget, but the GTK implementation
4) Provide the entire mechanism for scrolling widgets. This actual inter-
face for this is usually in wxScrolledWindow, but the GTK implementation
is in this class.
5) A multitude of helper or extra methods for special purposes, such as
Drag'n'Drop, managing validators etc.
Normally one might expect, that one wxWindows class would always contain
one GTK widget. Under GTK, there is no such allround widget that has all
Normally one might expect, that one wxWindows window would always correspond
to one GTK widget. Under GTK, there is no such allround widget that has all
the functionality. Moreover, the GTK defines a client area as a different
widget from the actual widget you are handling. Last but not least some
special classes (e.g. wxFrame) handle different categories of widgets and
@@ -79,18 +79,21 @@
this directory.
All windows must have a widget, with which they interact with other under-
lying GTK widget. It is this widget, e.g. that has to be resized etc and
lying GTK widgets. It is this widget, e.g. that has to be resized etc and
thw wxWindow class has a member variable called m_widget which holds a
pointer to this widget. When the window class displays a GTK native widget,
this is the only GTK widget the class manages. When the class has a client
area for drawing into and for containing children it must have at least
one more GTK widget to handle (of the type GtkMyFixed, defined in win_gtk.c),
but there can be any number of widgets, handled by a class (e.g. the frame
class handles three). The common rule for all windows is only, that the
widget that interacts with the rest of GTK must be referenced in m_widget
and all other widgets must be children of this widget on the GTK level.
The top-most widget, which also represents the client area, must be in
the m_wxwindow field and must be of the type GtkMyFixed.
pointer to this widget. When the window class represents a GTK native widget,
this is (in most cases) the only GTK widget the class manages. E.g. the
wxStatitText class handles only a GtkLabel widget a pointer to which you
can find in m_widget (defined in wxWindow)
When the class has a client area for drawing into and for containing children
it has to handle the client area widget (of the type GtkMyFixed, defined in
win_gtk.c), but there could be any number of widgets, handled by a class
The common rule for all windows is only, that the widget that interacts with
the rest of GTK must be referenced in m_widget and all other widgets must be
children of this widget on the GTK level. The top-most widget, which also
represents the client area, must be in the m_wxwindow field and must be of
the type GtkMyFixed.
As I said, the window classes that display a GTK native widget only have
one widget, so in the case of e.g. the wxButton class m_widget holds a

View File

@@ -522,10 +522,13 @@ void wxListBox::ApplyWidgetStyle()
{
SetWidgetStyle();
if (m_backgroundColour.Ok())
{
GdkWindow *window = GTK_WIDGET(m_list)->window;
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
}
GList *child = m_list->children;
while (child)

View File

@@ -7,7 +7,6 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "slider.h"
#endif

View File

@@ -43,32 +43,32 @@
for all other window classes, does seems required as well.
What does wxWindow do? It contains the common interface for the following
jobs of its descentants:
jobs of its descendants:
1) Define the rudimentary behaviour common to all window classes, such as
resizing, intercepting user input so as to make it possible to use these
events for special purposes in a derived class, window names etc.
resizing, intercepting user input (so as to make it possible to use these
events for special purposes in a derived class), window names etc.
2) Provide the possibility to contain and manage children, if the derived
class is allowed to contain children, which holds true for those window
classes, which do not display a native GTK widget. To name them, these
classes which do not display a native GTK widget. To name them, these
classes are wxPanel, wxScrolledWindow, wxDialog, wxFrame. The MDI frame-
work classes are a special case and are handled a bit differently from
the rest.
the rest. The same holds true for the wxNotebook class.
3) Provide the possibility to draw into a client area of a window. This,
too, only holds true for classes that do not display a native GTK widget
as above.
4) Provide the entire mechanism for scrolling widgets. This actaul inter-
face for this is usually in wxScrolledWidget, but the GTK implementation
4) Provide the entire mechanism for scrolling widgets. This actual inter-
face for this is usually in wxScrolledWindow, but the GTK implementation
is in this class.
5) A multitude of helper or extra methods for special purposes, such as
Drag'n'Drop, managing validators etc.
Normally one might expect, that one wxWindows class would always contain
one GTK widget. Under GTK, there is no such allround widget that has all
Normally one might expect, that one wxWindows window would always correspond
to one GTK widget. Under GTK, there is no such allround widget that has all
the functionality. Moreover, the GTK defines a client area as a different
widget from the actual widget you are handling. Last but not least some
special classes (e.g. wxFrame) handle different categories of widgets and
@@ -79,18 +79,21 @@
this directory.
All windows must have a widget, with which they interact with other under-
lying GTK widget. It is this widget, e.g. that has to be resized etc and
lying GTK widgets. It is this widget, e.g. that has to be resized etc and
thw wxWindow class has a member variable called m_widget which holds a
pointer to this widget. When the window class displays a GTK native widget,
this is the only GTK widget the class manages. When the class has a client
area for drawing into and for containing children it must have at least
one more GTK widget to handle (of the type GtkMyFixed, defined in win_gtk.c),
but there can be any number of widgets, handled by a class (e.g. the frame
class handles three). The common rule for all windows is only, that the
widget that interacts with the rest of GTK must be referenced in m_widget
and all other widgets must be children of this widget on the GTK level.
The top-most widget, which also represents the client area, must be in
the m_wxwindow field and must be of the type GtkMyFixed.
pointer to this widget. When the window class represents a GTK native widget,
this is (in most cases) the only GTK widget the class manages. E.g. the
wxStatitText class handles only a GtkLabel widget a pointer to which you
can find in m_widget (defined in wxWindow)
When the class has a client area for drawing into and for containing children
it has to handle the client area widget (of the type GtkMyFixed, defined in
win_gtk.c), but there could be any number of widgets, handled by a class
The common rule for all windows is only, that the widget that interacts with
the rest of GTK must be referenced in m_widget and all other widgets must be
children of this widget on the GTK level. The top-most widget, which also
represents the client area, must be in the m_wxwindow field and must be of
the type GtkMyFixed.
As I said, the window classes that display a GTK native widget only have
one widget, so in the case of e.g. the wxButton class m_widget holds a