if test "$wxUSE_DEBUG_INFO" = 1 ; then
WXDEBUG="-g"
wxUSE_OPTIMISE=0
+ else
+ WX_LINK="-s $WX_LINK"
fi
fi
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:6863: checking for main in -ldl" >&5
+echo "configure:6865: checking for main in -ldl" >&5
ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6871 "configure"
+#line 6873 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:6878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking "for threads"""... $ac_c" 1>&6
-echo "configure:6908: checking "for threads"" >&5
+echo "configure:6910: checking "for threads"" >&5
# Check whether --with-threads or --without-threads was given.
if test "${with_threads+set}" = set; then
withval="$with_threads"
solaris*)
echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
-echo "configure:6942: checking for thr_create in -lthread" >&5
+echo "configure:6944: checking for thr_create in -lthread" >&5
ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 6950 "configure"
+#line 6952 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
thr_create()
; return 0; }
EOF
-if { (eval echo configure:6961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6
-echo "configure:6992: checking for pthread_create in -lpthread-0.7" >&5
+echo "configure:6994: checking for pthread_create in -lpthread-0.7" >&5
ac_lib_var=`echo pthread-0.7'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread-0.7 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7000 "configure"
+#line 7002 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:7011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
-echo "configure:7035: checking for sys/prctl.h" >&5
+echo "configure:7037: checking for sys/prctl.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 7040 "configure"
+#line 7042 "configure"
#include "confdefs.h"
#include <sys/prctl.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6
-echo "configure:7071: checking for pthread_setcanceltype in -lpthread" >&5
+echo "configure:7073: checking for pthread_setcanceltype in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7079 "configure"
+#line 7081 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
pthread_setcanceltype()
; return 0; }
EOF
-if { (eval echo configure:7090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for printf in -lposix4""... $ac_c" 1>&6
-echo "configure:7119: checking for printf in -lposix4" >&5
+echo "configure:7121: checking for printf in -lposix4" >&5
ac_lib_var=`echo posix4'_'printf | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lposix4 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 7127 "configure"
+#line 7129 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
printf()
; return 0; }
EOF
-if { (eval echo configure:7138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
if test "$wxUSE_OPENGL" = 1; then
echo $ac_n "checking for OpenGL includes""... $ac_c" 1>&6
-echo "configure:7187: checking for OpenGL includes" >&5
+echo "configure:7189: checking for OpenGL includes" >&5
ac_find_includes=
for ac_dir in $SEARCH_INCLUDE;
OPENGL_INCLUDE="-I$ac_find_includes"
echo "$ac_t""found $ac_find_includes" 1>&6
echo $ac_n "checking for OpenGL library""... $ac_c" 1>&6
-echo "configure:7202: checking for OpenGL library" >&5
+echo "configure:7204: checking for OpenGL library" >&5
ac_find_libraries=
for ac_dir in $SEARCH_LIB;
if test "$wxUSE_DEBUG_INFO" = 1 ; then
WXDEBUG="-g"
wxUSE_OPTIMISE=0
+ else
+ WX_LINK="-s $WX_LINK"
fi
fi
AC_SUBST(WXDEBUG)
const wxString& GetHelp() const { return m_helpStr; }
// implementation
+
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
GtkWidget *GetMenuItem() const { return m_menuItem; }
-private:
int m_id;
wxString m_text;
bool m_isCheckMenu;
const wxString& GetHelp() const { return m_helpStr; }
// implementation
+
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
GtkWidget *GetMenuItem() const { return m_menuItem; }
-private:
int m_id;
wxString m_text;
bool m_isCheckMenu;
wxCursorRefData::wxCursorRefData()
{
- m_cursor = (GdkCursor *) NULL;
+ m_cursor = (GdkCursor *) NULL;
}
wxCursorRefData::~wxCursorRefData()
{
- if (m_cursor) gdk_cursor_destroy( m_cursor );
+ if (m_cursor) gdk_cursor_destroy( m_cursor );
}
//-----------------------------------------------------------------------------
wxCursor::wxCursor( int cursorId )
{
- m_refData = new wxCursorRefData();
-
- GdkCursorType gdk_cur = GDK_LEFT_PTR;
- switch (cursorId)
- {
- case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
- case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
- case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
- case wxCURSOR_SIZENS: gdk_cur = GDK_SB_V_DOUBLE_ARROW; break;
- case wxCURSOR_WAIT: gdk_cur = GDK_WATCH; break;
- case wxCURSOR_WATCH: gdk_cur = GDK_WATCH; break;
- case wxCURSOR_SIZING: gdk_cur = GDK_SIZING; break;
- case wxCURSOR_SPRAYCAN: gdk_cur = GDK_SPRAYCAN; break;
- case wxCURSOR_IBEAM: gdk_cur = GDK_XTERM; break;
- case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
- case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
- }
-
- M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
-
+ m_refData = new wxCursorRefData();
+
+ GdkCursorType gdk_cur = GDK_LEFT_PTR;
+ switch (cursorId)
+ {
+ case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
+ case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
+ case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
+ case wxCURSOR_SIZENS: gdk_cur = GDK_SB_V_DOUBLE_ARROW; break;
+ case wxCURSOR_WAIT:
+ case wxCURSOR_WATCH: gdk_cur = GDK_WATCH; break;
+ case wxCURSOR_SIZING: gdk_cur = GDK_SIZING; break;
+ case wxCURSOR_SPRAYCAN: gdk_cur = GDK_SPRAYCAN; break;
+ case wxCURSOR_IBEAM: gdk_cur = GDK_XTERM; break;
+ case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
+ case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
+ case wxCURSOR_SIZENWSE:
+ case wxCURSOR_SIZENESW: gdk_cur = GDK_FLEUR; break;
+ case wxCURSOR_QUESTION_ARROW: gdk_cur = GDK_QUESTION_ARROW; break;
+ case wxCURSOR_PAINT_BRUSH: gdk_cur = GDK_SPRAYCAN; break;
+ case wxCURSOR_MAGNIFIER: gdk_cur = GDK_PLUS; break;
+ case wxCURSOR_CHAR: gdk_cur = GDK_XTERM; break;
+ case wxCURSOR_LEFT_BUTTON: gdk_cur = GDK_LEFTBUTTON; break;
+ case wxCURSOR_MIDDLE_BUTTON: gdk_cur = GDK_MIDDLEBUTTON; break;
+ case wxCURSOR_RIGHT_BUTTON: gdk_cur = GDK_RIGHTBUTTON; break;
/*
- do that yourself
-
- wxCURSOR_BULLSEYE,
- wxCURSOR_CHAR,
- wxCURSOR_LEFT_BUTTON,
- wxCURSOR_MAGNIFIER,
- wxCURSOR_MIDDLE_BUTTON,
- wxCURSOR_NO_ENTRY,
- wxCURSOR_PAINT_BRUSH,
- wxCURSOR_POINT_LEFT,
- wxCURSOR_POINT_RIGHT,
- wxCURSOR_QUESTION_ARROW,
- wxCURSOR_RIGHT_BUTTON,
- wxCURSOR_SIZENESW,
- wxCURSOR_SIZENS,
- wxCURSOR_SIZENWSE,
- wxCURSOR_SIZEWE,
- wxCURSOR_BLANK
-,
- wxCURSOR_CROSS_REVERSE,
- wxCURSOR_DOUBLE_ARROW,
- wxCURSOR_BASED_ARROW_UP,
- wxCURSOR_BASED_ARROW_DOWN
+ case wxCURSOR_DOUBLE_ARROW: gdk_cur = GDK_DOUBLE_ARROW; break;
+ case wxCURSOR_CROSS_REVERSE: gdk_cur = GDK_CROSS_REVERSE; break;
+ case wxCURSOR_BASED_ARROW_UP: gdk_cur = GDK_BASED_ARROW_UP; break;
+ case wxCURSOR_BASED_ARROW_DOWN: gdk_cur = GDK_BASED_ARROW_DOWN; break;
*/
+ }
+ M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
}
wxCursor::wxCursor( const wxCursor &cursor )
{
- Ref( cursor );
+ Ref( cursor );
}
wxCursor::~wxCursor()
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
- if (*this == cursor) return (*this);
- Ref( cursor );
- return *this;
+ if (*this == cursor) return (*this);
+ Ref( cursor );
+
+ return *this;
}
bool wxCursor::operator == ( const wxCursor& cursor ) const
{
- return m_refData == cursor.m_refData;
+ return m_refData == cursor.m_refData;
}
bool wxCursor::operator != ( const wxCursor& cursor ) const
{
- return m_refData != cursor.m_refData;
+ return m_refData != cursor.m_refData;
}
bool wxCursor::Ok() const
{
- return (m_refData != NULL);
+ return (m_refData != NULL);
}
GdkCursor *wxCursor::GetCursor() const
{
- return M_CURSORDATA->m_cursor;
+ return M_CURSORDATA->m_cursor;
}
//-----------------------------------------------------------------------------
void wxEndBusyCursor()
{
- g_isBusy = FALSE;
+ g_isBusy = FALSE;
}
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
{
- g_isBusy = TRUE;
+ g_isBusy = TRUE;
}
bool wxIsBusy()
{
- return g_isBusy;
+ return g_isBusy;
}
void wxSetCursor( const wxCursor& cursor )
{
- extern wxCursor *g_globalCursor;
- if (g_globalCursor) (*g_globalCursor) = cursor;
+ extern wxCursor *g_globalCursor;
+ if (g_globalCursor) (*g_globalCursor) = cursor;
- if (cursor.Ok()) {}
+ if (cursor.Ok()) {}
}
if (!menu->IsEnabled(id)) return;
+ wxMenuItem* item = menu->FindItem( id );
+ wxCHECK_RET( item, "error in menu item callback" );
+
+ if (item->m_isCheckMenu)
+ {
+ if (item->m_isChecked == item->IsChecked())
+ {
+ /* the menu item has been checked by calling wxMenuItem->Check() */
+ return;
+ }
+ else
+ {
+ /* the user pressed on the menu item -> report */
+ item->m_isChecked; /* make consistent again */
+ }
+ }
+
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
event.SetEventObject( menu );
event.SetInt(id );
wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" )
+ if (check == m_isChecked) return;
+
m_isChecked = check;
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
}
bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0;
- wxASSERT( bIsChecked == m_isChecked ); // consistency check
-
return bIsChecked;
}
static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
- if (!win->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
+ if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
- float diff = win->m_adjust->value - win->m_oldPos;
- if (fabs(diff) < 0.2) return;
+ float diff = win->m_adjust->value - win->m_oldPos;
+ if (fabs(diff) < 0.2) return;
- wxEventType command = wxEVT_NULL;
+ wxEventType command = wxEVT_NULL;
- float line_step = win->m_adjust->step_increment;
- float page_step = win->m_adjust->page_increment;
+ float line_step = win->m_adjust->step_increment;
+ float page_step = win->m_adjust->page_increment;
- if (win->m_isScrolling)
- {
- command = wxEVT_SCROLL_THUMBTRACK;
- }
- else
- {
- if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
- else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
- else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
- else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
- else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
- else command = wxEVT_SCROLL_THUMBTRACK;
- }
-
- int value = (int)(win->m_adjust->value+0.5);
+ if (win->m_isScrolling)
+ {
+ command = wxEVT_SCROLL_THUMBTRACK;
+ }
+ else
+ {
+ if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+ else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
+ else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
+ else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
+ else command = wxEVT_SCROLL_THUMBTRACK;
+ }
+
+ int value = (int)(win->m_adjust->value+0.5);
- int orient = wxHORIZONTAL;
- if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
+ int orient = wxHORIZONTAL;
+ if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
- wxScrollEvent event( command, win->GetId(), value, orient );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
+ wxScrollEvent event( command, win->GetId(), value, orient );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
/*
- wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
- cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+ wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
+ cevent.SetEventObject( win );
+ win->ProcessEvent( cevent );
*/
}
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
{
- win->m_isScrolling = FALSE;
+ win->m_isScrolling = FALSE;
// g_blockEventsOnScroll = FALSE;
- gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
- return FALSE;
+ return FALSE;
}
//-----------------------------------------------------------------------------
const wxPoint& pos, const wxSize& size,
long style, const wxValidator& validator, const wxString& name )
{
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_needParent = TRUE;
+ m_acceptsFocus = TRUE;
- PreCreation( parent, id, pos, size, style, name );
+ PreCreation( parent, id, pos, size, style, name );
- SetValidator( validator );
+ SetValidator( validator );
- m_oldPos = 0.0;
+ m_oldPos = 0.0;
- if (style & wxSB_VERTICAL == wxSB_VERTICAL)
- m_widget = gtk_hscrollbar_new( (GtkAdjustment *) NULL );
- else
- m_widget = gtk_vscrollbar_new( (GtkAdjustment *) NULL );
+ if (style & wxSB_VERTICAL == wxSB_VERTICAL)
+ m_widget = gtk_hscrollbar_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_vscrollbar_new( (GtkAdjustment *) NULL );
- m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
+ m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
- gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
- (GtkSignalFunc) gtk_scrollbar_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_adjust),
+ "value_changed",
+ (GtkSignalFunc) gtk_scrollbar_callback,
+ (gpointer) this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "button_press_event",
- (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_widget),
+ "button_press_event",
+ (GtkSignalFunc)gtk_scrollbar_button_press_callback,
+ (gpointer) this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "button_release_event",
- (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_widget),
+ "button_release_event",
+ (GtkSignalFunc)gtk_scrollbar_button_release_callback,
+ (gpointer) this );
- m_parent->AddChild( this );
+ m_parent->AddChild( this );
- (m_parent->m_insertCallback)( m_parent, this );
+ (m_parent->m_insertCallback)( m_parent, this );
- PostCreation();
+ PostCreation();
- SetBackgroundColour( parent->GetBackgroundColour() );
+ SetBackgroundColour( parent->GetBackgroundColour() );
- Show( TRUE );
+ Show( TRUE );
- return TRUE;
+ return TRUE;
}
int wxScrollBar::GetThumbPosition(void) const
{
- return (int)(m_adjust->value+0.5);
+ return (int)(m_adjust->value+0.5);
}
int wxScrollBar::GetThumbSize() const
{
- return (int)(m_adjust->page_size+0.5);
+ return (int)(m_adjust->page_size+0.5);
}
int wxScrollBar::GetPageSize() const
{
- return (int)(m_adjust->page_increment+0.5);
+ return (int)(m_adjust->page_increment+0.5);
}
int wxScrollBar::GetRange() const
{
- return (int)(m_adjust->upper+0.5);
+ return (int)(m_adjust->upper+0.5);
}
void wxScrollBar::SetThumbPosition( int viewStart )
{
- if (m_isScrolling) return;
+ if (m_isScrolling) return;
- float fpos = (float)viewStart;
- m_oldPos = fpos;
- if (fabs(fpos-m_adjust->value) < 0.2) return;
- m_adjust->value = fpos;
+ float fpos = (float)viewStart;
+ m_oldPos = fpos;
+ if (fabs(fpos-m_adjust->value) < 0.2) return;
+ m_adjust->value = fpos;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) )
{
- float fpos = (float)position;
- float frange = (float)range;
- float fthumb = (float)thumbSize;
- float fpage = (float)pageSize;
+ float fpos = (float)position;
+ float frange = (float)range;
+ float fthumb = (float)thumbSize;
+ float fpage = (float)pageSize;
- if ((fabs(frange-m_adjust->upper) < 0.2) &&
- (fabs(fthumb-m_adjust->page_size) < 0.2) &&
- (fabs(fpage-m_adjust->page_increment) < 0.2))
- {
- SetThumbPosition( position );
- return;
- }
+ if ((fabs(frange-m_adjust->upper) < 0.2) &&
+ (fabs(fthumb-m_adjust->page_size) < 0.2) &&
+ (fabs(fpage-m_adjust->page_increment) < 0.2))
+ {
+ SetThumbPosition( position );
+ return;
+ }
- m_oldPos = fpos;
+ m_oldPos = fpos;
- m_adjust->lower = 0.0;
- m_adjust->upper = frange;
- m_adjust->value = fpos;
- m_adjust->step_increment = 1.0;
- m_adjust->page_increment = (float)(wxMax(fpage,0));
- m_adjust->page_size = fthumb;
-
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ m_adjust->lower = 0.0;
+ m_adjust->upper = frange;
+ m_adjust->value = fpos;
+ m_adjust->step_increment = 1.0;
+ m_adjust->page_increment = (float)(wxMax(fpage,0));
+ m_adjust->page_size = fthumb;
+
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
-// Backward compatibility
+/* Backward compatibility */
int wxScrollBar::GetValue(void) const
{
- return GetThumbPosition();
+ return GetThumbPosition();
}
void wxScrollBar::SetValue( int viewStart )
{
- SetThumbPosition( viewStart );
+ SetThumbPosition( viewStart );
}
void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const
{
- int pos = (int)(m_adjust->value+0.5);
- int thumb = (int)(m_adjust->page_size+0.5);
- int page = (int)(m_adjust->page_increment+0.5);
- int range = (int)(m_adjust->upper+0.5);
+ int pos = (int)(m_adjust->value+0.5);
+ int thumb = (int)(m_adjust->page_size+0.5);
+ int page = (int)(m_adjust->page_increment+0.5);
+ int range = (int)(m_adjust->upper+0.5);
- *viewStart = pos;
- *viewLength = range;
- *objectLength = thumb;
- *pageLength = page;
+ *viewStart = pos;
+ *viewLength = range;
+ *objectLength = thumb;
+ *pageLength = page;
}
int wxScrollBar::GetViewLength() const
{
- return (int)(m_adjust->upper+0.5);
+ return (int)(m_adjust->upper+0.5);
}
int wxScrollBar::GetObjectLength() const
{
- return (int)(m_adjust->page_size+0.5);
+ return (int)(m_adjust->page_size+0.5);
}
void wxScrollBar::SetPageSize( int pageLength )
{
- int pos = (int)(m_adjust->value+0.5);
- int thumb = (int)(m_adjust->page_size+0.5);
- int range = (int)(m_adjust->upper+0.5);
- SetScrollbar( pos, thumb, range, pageLength );
+ int pos = (int)(m_adjust->value+0.5);
+ int thumb = (int)(m_adjust->page_size+0.5);
+ int range = (int)(m_adjust->upper+0.5);
+ SetScrollbar( pos, thumb, range, pageLength );
}
void wxScrollBar::SetObjectLength( int objectLength )
{
- int pos = (int)(m_adjust->value+0.5);
- int page = (int)(m_adjust->page_increment+0.5);
- int range = (int)(m_adjust->upper+0.5);
- SetScrollbar( pos, objectLength, range, page );
+ int pos = (int)(m_adjust->value+0.5);
+ int page = (int)(m_adjust->page_increment+0.5);
+ int range = (int)(m_adjust->upper+0.5);
+ SetScrollbar( pos, objectLength, range, page );
}
void wxScrollBar::SetViewLength( int viewLength )
{
- int pos = (int)(m_adjust->value+0.5);
- int thumb = (int)(m_adjust->page_size+0.5);
- int page = (int)(m_adjust->page_increment+0.5);
- SetScrollbar( pos, thumb, viewLength, page );
+ int pos = (int)(m_adjust->value+0.5);
+ int thumb = (int)(m_adjust->page_size+0.5);
+ int page = (int)(m_adjust->page_increment+0.5);
+ SetScrollbar( pos, thumb, viewLength, page );
}
bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
{
- GtkRange *range = GTK_RANGE(m_widget);
- return ( (window == GTK_WIDGET(range)->window) ||
- (window == range->trough) ||
- (window == range->slider) ||
- (window == range->step_forw) ||
- (window == range->step_back) );
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
}
void wxScrollBar::ApplyWidgetStyle()
{
- SetWidgetStyle();
- gtk_widget_set_style( m_widget, m_widgetStyle );
+ SetWidgetStyle();
+ gtk_widget_set_style( m_widget, m_widgetStyle );
}
wxFont wxSystemSettings::GetSystemFont( int index )
{
- switch (index)
- {
- case wxSYS_OEM_FIXED_FONT:
- case wxSYS_ANSI_FIXED_FONT:
- case wxSYS_SYSTEM_FIXED_FONT:
- {
- return *wxNORMAL_FONT;
- }
- case wxSYS_ANSI_VAR_FONT:
- case wxSYS_SYSTEM_FONT:
- case wxSYS_DEVICE_DEFAULT_FONT:
- case wxSYS_DEFAULT_GUI_FONT:
+ switch (index)
{
- if (!g_systemFont)
- g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
- return *g_systemFont;
+ case wxSYS_OEM_FIXED_FONT:
+ case wxSYS_ANSI_FIXED_FONT:
+ case wxSYS_SYSTEM_FIXED_FONT:
+ {
+ return *wxNORMAL_FONT;
+ }
+ case wxSYS_ANSI_VAR_FONT:
+ case wxSYS_SYSTEM_FONT:
+ case wxSYS_DEVICE_DEFAULT_FONT:
+ case wxSYS_DEFAULT_GUI_FONT:
+ {
+ if (!g_systemFont)
+ g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+ return *g_systemFont;
+ }
}
- }
- return wxNullFont;
+ return wxNullFont;
}
int wxSystemSettings::GetSystemMetric( int index )
static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
- if (!win->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
+ if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
- float diff = win->m_adjust->value - win->m_oldPos;
- if (fabs(diff) < 0.2) return;
+ float diff = win->m_adjust->value - win->m_oldPos;
+ if (fabs(diff) < 0.2) return;
- wxEventType command = wxEVT_NULL;
+ wxEventType command = wxEVT_NULL;
- float line_step = win->m_adjust->step_increment;
- float page_step = win->m_adjust->page_increment;
+ float line_step = win->m_adjust->step_increment;
+ float page_step = win->m_adjust->page_increment;
- if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
- else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
- else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
- else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
- else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
- else command = wxEVT_SCROLL_THUMBTRACK;
-
- int value = (int)(win->m_adjust->value+0.5);
+ if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+ else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
+ else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
+ else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
+ else command = wxEVT_SCROLL_THUMBTRACK;
+
+ int value = (int)(win->m_adjust->value+0.5);
- int orient = wxHORIZONTAL;
- if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
+ int orient = wxHORIZONTAL;
+ if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
- wxScrollEvent event( command, win->GetId(), value, orient );
- event.SetEventObject( win );
- win->ProcessEvent( event );
+ wxScrollEvent event( command, win->GetId(), value, orient );
+ event.SetEventObject( win );
+ win->ProcessEvent( event );
- wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
- cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
+ cevent.SetEventObject( win );
+ win->ProcessEvent( cevent );
}
//-----------------------------------------------------------------------------
long style, const wxValidator& validator, const wxString& name )
{
m_acceptsFocus = TRUE;
- m_needParent = TRUE;
+ m_needParent = TRUE;
- PreCreation( parent, id, pos, size, style, name );
+ PreCreation( parent, id, pos, size, style, name );
- SetValidator( validator );
+ SetValidator( validator );
- m_oldPos = 0.0;
+ m_oldPos = 0.0;
- if (style & wxSL_VERTICAL == wxSL_VERTICAL)
- m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
- else
- m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
+ if (style & wxSL_VERTICAL == wxSL_VERTICAL)
+ m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
- gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
+ gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
- m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
+ m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
- gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
- (GtkSignalFunc) gtk_slider_callback, (gpointer) this );
- SetRange( minValue, maxValue );
- SetValue( value );
+ gtk_signal_connect( GTK_OBJECT(m_adjust),
+ "value_changed",
+ (GtkSignalFunc) gtk_slider_callback,
+ (gpointer) this );
+
+ SetRange( minValue, maxValue );
+ SetValue( value );
- m_parent->AddChild( this );
+ m_parent->AddChild( this );
- (m_parent->m_insertCallback)( m_parent, this );
+ (m_parent->m_insertCallback)( m_parent, this );
- PostCreation();
+ PostCreation();
- SetBackgroundColour( parent->GetBackgroundColour() );
+ SetBackgroundColour( parent->GetBackgroundColour() );
- Show( TRUE );
+ Show( TRUE );
- return TRUE;
+ return TRUE;
}
int wxSlider::GetValue(void) const
{
- return (int)(m_adjust->value+0.5);
+ return (int)(m_adjust->value+0.5);
}
void wxSlider::SetValue( int value )
{
- float fpos = (float)value;
- m_oldPos = fpos;
- if (fabs(fpos-m_adjust->value) < 0.2) return;
- m_adjust->value = fpos;
+ float fpos = (float)value;
+ m_oldPos = fpos;
+ if (fabs(fpos-m_adjust->value) < 0.2) return;
+
+ m_adjust->value = fpos;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}
void wxSlider::SetRange( int minValue, int maxValue )
{
- float fmin = (float)minValue;
- float fmax = (float)maxValue;
+ float fmin = (float)minValue;
+ float fmax = (float)maxValue;
- if ((fabs(fmin-m_adjust->lower) < 0.2) &&
- (fabs(fmax-m_adjust->upper) < 0.2))
- return;
+ if ((fabs(fmin-m_adjust->lower) < 0.2) &&
+ (fabs(fmax-m_adjust->upper) < 0.2))
+ {
+ return;
+ }
- m_adjust->lower = fmin;
- m_adjust->upper = fmax;
+ m_adjust->lower = fmin;
+ m_adjust->upper = fmax;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
int wxSlider::GetMin(void) const
{
- return (int)(m_adjust->lower+0.5);
+ return (int)(m_adjust->lower+0.5);
}
int wxSlider::GetMax(void) const
{
- return (int)(m_adjust->upper+0.5);
+ return (int)(m_adjust->upper+0.5);
}
void wxSlider::SetPageSize( int pageSize )
{
- float fpage = (float)pageSize;
+ float fpage = (float)pageSize;
- if (fabs(fpage-m_adjust->page_increment) < 0.2) return;
+ if (fabs(fpage-m_adjust->page_increment) < 0.2) return;
- m_adjust->page_increment = fpage;
+ m_adjust->page_increment = fpage;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
int wxSlider::GetPageSize(void) const
{
- return (int)(m_adjust->page_increment+0.5);
+ return (int)(m_adjust->page_increment+0.5);
}
void wxSlider::SetThumbLength( int len )
{
- float flen = (float)len;
+ float flen = (float)len;
- if (fabs(flen-m_adjust->page_size) < 0.2) return;
+ if (fabs(flen-m_adjust->page_size) < 0.2) return;
- m_adjust->page_size = flen;
+ m_adjust->page_size = flen;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
int wxSlider::GetThumbLength(void) const
{
- return (int)(m_adjust->page_size+0.5);
+ return (int)(m_adjust->page_size+0.5);
}
void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
int wxSlider::GetLineSize(void) const
{
- return 0;
+ return 0;
}
void wxSlider::SetTick( int WXUNUSED(tickPos) )
int wxSlider::GetTickFreq(void) const
{
- return 0;
+ return 0;
}
void wxSlider::ClearTicks(void)
int wxSlider::GetSelEnd(void) const
{
- return 0;
+ return 0;
}
int wxSlider::GetSelStart(void) const
{
- return 0;
+ return 0;
}
void wxSlider::ClearSel(void)
bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
{
- GtkRange *range = GTK_RANGE(m_widget);
- return ( (window == GTK_WIDGET(range)->window) ||
- (window == range->trough) ||
- (window == range->slider) ||
- (window == range->step_forw) ||
- (window == range->step_back) );
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
}
void wxSlider::ApplyWidgetStyle()
{
- SetWidgetStyle();
- gtk_widget_set_style( m_widget, m_widgetStyle );
+ SetWidgetStyle();
+ gtk_widget_set_style( m_widget, m_widgetStyle );
}
int wxDisplayDepth(void)
{
- wxFAIL_MSG( "wxDisplayDepth always returns 8" );
- return 8;
+ return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
}
//------------------------------------------------------------------------
wxCursorRefData::wxCursorRefData()
{
- m_cursor = (GdkCursor *) NULL;
+ m_cursor = (GdkCursor *) NULL;
}
wxCursorRefData::~wxCursorRefData()
{
- if (m_cursor) gdk_cursor_destroy( m_cursor );
+ if (m_cursor) gdk_cursor_destroy( m_cursor );
}
//-----------------------------------------------------------------------------
wxCursor::wxCursor( int cursorId )
{
- m_refData = new wxCursorRefData();
-
- GdkCursorType gdk_cur = GDK_LEFT_PTR;
- switch (cursorId)
- {
- case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
- case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
- case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
- case wxCURSOR_SIZENS: gdk_cur = GDK_SB_V_DOUBLE_ARROW; break;
- case wxCURSOR_WAIT: gdk_cur = GDK_WATCH; break;
- case wxCURSOR_WATCH: gdk_cur = GDK_WATCH; break;
- case wxCURSOR_SIZING: gdk_cur = GDK_SIZING; break;
- case wxCURSOR_SPRAYCAN: gdk_cur = GDK_SPRAYCAN; break;
- case wxCURSOR_IBEAM: gdk_cur = GDK_XTERM; break;
- case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
- case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
- }
-
- M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
-
+ m_refData = new wxCursorRefData();
+
+ GdkCursorType gdk_cur = GDK_LEFT_PTR;
+ switch (cursorId)
+ {
+ case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
+ case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
+ case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
+ case wxCURSOR_SIZENS: gdk_cur = GDK_SB_V_DOUBLE_ARROW; break;
+ case wxCURSOR_WAIT:
+ case wxCURSOR_WATCH: gdk_cur = GDK_WATCH; break;
+ case wxCURSOR_SIZING: gdk_cur = GDK_SIZING; break;
+ case wxCURSOR_SPRAYCAN: gdk_cur = GDK_SPRAYCAN; break;
+ case wxCURSOR_IBEAM: gdk_cur = GDK_XTERM; break;
+ case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
+ case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
+ case wxCURSOR_SIZENWSE:
+ case wxCURSOR_SIZENESW: gdk_cur = GDK_FLEUR; break;
+ case wxCURSOR_QUESTION_ARROW: gdk_cur = GDK_QUESTION_ARROW; break;
+ case wxCURSOR_PAINT_BRUSH: gdk_cur = GDK_SPRAYCAN; break;
+ case wxCURSOR_MAGNIFIER: gdk_cur = GDK_PLUS; break;
+ case wxCURSOR_CHAR: gdk_cur = GDK_XTERM; break;
+ case wxCURSOR_LEFT_BUTTON: gdk_cur = GDK_LEFTBUTTON; break;
+ case wxCURSOR_MIDDLE_BUTTON: gdk_cur = GDK_MIDDLEBUTTON; break;
+ case wxCURSOR_RIGHT_BUTTON: gdk_cur = GDK_RIGHTBUTTON; break;
/*
- do that yourself
-
- wxCURSOR_BULLSEYE,
- wxCURSOR_CHAR,
- wxCURSOR_LEFT_BUTTON,
- wxCURSOR_MAGNIFIER,
- wxCURSOR_MIDDLE_BUTTON,
- wxCURSOR_NO_ENTRY,
- wxCURSOR_PAINT_BRUSH,
- wxCURSOR_POINT_LEFT,
- wxCURSOR_POINT_RIGHT,
- wxCURSOR_QUESTION_ARROW,
- wxCURSOR_RIGHT_BUTTON,
- wxCURSOR_SIZENESW,
- wxCURSOR_SIZENS,
- wxCURSOR_SIZENWSE,
- wxCURSOR_SIZEWE,
- wxCURSOR_BLANK
-,
- wxCURSOR_CROSS_REVERSE,
- wxCURSOR_DOUBLE_ARROW,
- wxCURSOR_BASED_ARROW_UP,
- wxCURSOR_BASED_ARROW_DOWN
+ case wxCURSOR_DOUBLE_ARROW: gdk_cur = GDK_DOUBLE_ARROW; break;
+ case wxCURSOR_CROSS_REVERSE: gdk_cur = GDK_CROSS_REVERSE; break;
+ case wxCURSOR_BASED_ARROW_UP: gdk_cur = GDK_BASED_ARROW_UP; break;
+ case wxCURSOR_BASED_ARROW_DOWN: gdk_cur = GDK_BASED_ARROW_DOWN; break;
*/
+ }
+ M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
}
wxCursor::wxCursor( const wxCursor &cursor )
{
- Ref( cursor );
+ Ref( cursor );
}
wxCursor::~wxCursor()
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
- if (*this == cursor) return (*this);
- Ref( cursor );
- return *this;
+ if (*this == cursor) return (*this);
+ Ref( cursor );
+
+ return *this;
}
bool wxCursor::operator == ( const wxCursor& cursor ) const
{
- return m_refData == cursor.m_refData;
+ return m_refData == cursor.m_refData;
}
bool wxCursor::operator != ( const wxCursor& cursor ) const
{
- return m_refData != cursor.m_refData;
+ return m_refData != cursor.m_refData;
}
bool wxCursor::Ok() const
{
- return (m_refData != NULL);
+ return (m_refData != NULL);
}
GdkCursor *wxCursor::GetCursor() const
{
- return M_CURSORDATA->m_cursor;
+ return M_CURSORDATA->m_cursor;
}
//-----------------------------------------------------------------------------
void wxEndBusyCursor()
{
- g_isBusy = FALSE;
+ g_isBusy = FALSE;
}
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
{
- g_isBusy = TRUE;
+ g_isBusy = TRUE;
}
bool wxIsBusy()
{
- return g_isBusy;
+ return g_isBusy;
}
void wxSetCursor( const wxCursor& cursor )
{
- extern wxCursor *g_globalCursor;
- if (g_globalCursor) (*g_globalCursor) = cursor;
+ extern wxCursor *g_globalCursor;
+ if (g_globalCursor) (*g_globalCursor) = cursor;
- if (cursor.Ok()) {}
+ if (cursor.Ok()) {}
}
if (!menu->IsEnabled(id)) return;
+ wxMenuItem* item = menu->FindItem( id );
+ wxCHECK_RET( item, "error in menu item callback" );
+
+ if (item->m_isCheckMenu)
+ {
+ if (item->m_isChecked == item->IsChecked())
+ {
+ /* the menu item has been checked by calling wxMenuItem->Check() */
+ return;
+ }
+ else
+ {
+ /* the user pressed on the menu item -> report */
+ item->m_isChecked; /* make consistent again */
+ }
+ }
+
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
event.SetEventObject( menu );
event.SetInt(id );
wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" )
+ if (check == m_isChecked) return;
+
m_isChecked = check;
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
}
bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0;
- wxASSERT( bIsChecked == m_isChecked ); // consistency check
-
return bIsChecked;
}
static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
- if (!win->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
+ if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
- float diff = win->m_adjust->value - win->m_oldPos;
- if (fabs(diff) < 0.2) return;
+ float diff = win->m_adjust->value - win->m_oldPos;
+ if (fabs(diff) < 0.2) return;
- wxEventType command = wxEVT_NULL;
+ wxEventType command = wxEVT_NULL;
- float line_step = win->m_adjust->step_increment;
- float page_step = win->m_adjust->page_increment;
+ float line_step = win->m_adjust->step_increment;
+ float page_step = win->m_adjust->page_increment;
- if (win->m_isScrolling)
- {
- command = wxEVT_SCROLL_THUMBTRACK;
- }
- else
- {
- if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
- else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
- else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
- else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
- else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
- else command = wxEVT_SCROLL_THUMBTRACK;
- }
-
- int value = (int)(win->m_adjust->value+0.5);
+ if (win->m_isScrolling)
+ {
+ command = wxEVT_SCROLL_THUMBTRACK;
+ }
+ else
+ {
+ if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+ else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
+ else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
+ else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
+ else command = wxEVT_SCROLL_THUMBTRACK;
+ }
+
+ int value = (int)(win->m_adjust->value+0.5);
- int orient = wxHORIZONTAL;
- if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
+ int orient = wxHORIZONTAL;
+ if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
- wxScrollEvent event( command, win->GetId(), value, orient );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
+ wxScrollEvent event( command, win->GetId(), value, orient );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
/*
- wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
- cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+ wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
+ cevent.SetEventObject( win );
+ win->ProcessEvent( cevent );
*/
}
GdkEventButton *WXUNUSED(gdk_event),
wxScrollBar *win )
{
- win->m_isScrolling = FALSE;
+ win->m_isScrolling = FALSE;
// g_blockEventsOnScroll = FALSE;
- gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_adjust), "value_changed" );
- return FALSE;
+ return FALSE;
}
//-----------------------------------------------------------------------------
const wxPoint& pos, const wxSize& size,
long style, const wxValidator& validator, const wxString& name )
{
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_needParent = TRUE;
+ m_acceptsFocus = TRUE;
- PreCreation( parent, id, pos, size, style, name );
+ PreCreation( parent, id, pos, size, style, name );
- SetValidator( validator );
+ SetValidator( validator );
- m_oldPos = 0.0;
+ m_oldPos = 0.0;
- if (style & wxSB_VERTICAL == wxSB_VERTICAL)
- m_widget = gtk_hscrollbar_new( (GtkAdjustment *) NULL );
- else
- m_widget = gtk_vscrollbar_new( (GtkAdjustment *) NULL );
+ if (style & wxSB_VERTICAL == wxSB_VERTICAL)
+ m_widget = gtk_hscrollbar_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_vscrollbar_new( (GtkAdjustment *) NULL );
- m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
+ m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
- gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
- (GtkSignalFunc) gtk_scrollbar_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_adjust),
+ "value_changed",
+ (GtkSignalFunc) gtk_scrollbar_callback,
+ (gpointer) this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "button_press_event",
- (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_widget),
+ "button_press_event",
+ (GtkSignalFunc)gtk_scrollbar_button_press_callback,
+ (gpointer) this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "button_release_event",
- (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_widget),
+ "button_release_event",
+ (GtkSignalFunc)gtk_scrollbar_button_release_callback,
+ (gpointer) this );
- m_parent->AddChild( this );
+ m_parent->AddChild( this );
- (m_parent->m_insertCallback)( m_parent, this );
+ (m_parent->m_insertCallback)( m_parent, this );
- PostCreation();
+ PostCreation();
- SetBackgroundColour( parent->GetBackgroundColour() );
+ SetBackgroundColour( parent->GetBackgroundColour() );
- Show( TRUE );
+ Show( TRUE );
- return TRUE;
+ return TRUE;
}
int wxScrollBar::GetThumbPosition(void) const
{
- return (int)(m_adjust->value+0.5);
+ return (int)(m_adjust->value+0.5);
}
int wxScrollBar::GetThumbSize() const
{
- return (int)(m_adjust->page_size+0.5);
+ return (int)(m_adjust->page_size+0.5);
}
int wxScrollBar::GetPageSize() const
{
- return (int)(m_adjust->page_increment+0.5);
+ return (int)(m_adjust->page_increment+0.5);
}
int wxScrollBar::GetRange() const
{
- return (int)(m_adjust->upper+0.5);
+ return (int)(m_adjust->upper+0.5);
}
void wxScrollBar::SetThumbPosition( int viewStart )
{
- if (m_isScrolling) return;
+ if (m_isScrolling) return;
- float fpos = (float)viewStart;
- m_oldPos = fpos;
- if (fabs(fpos-m_adjust->value) < 0.2) return;
- m_adjust->value = fpos;
+ float fpos = (float)viewStart;
+ m_oldPos = fpos;
+ if (fabs(fpos-m_adjust->value) < 0.2) return;
+ m_adjust->value = fpos;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) )
{
- float fpos = (float)position;
- float frange = (float)range;
- float fthumb = (float)thumbSize;
- float fpage = (float)pageSize;
+ float fpos = (float)position;
+ float frange = (float)range;
+ float fthumb = (float)thumbSize;
+ float fpage = (float)pageSize;
- if ((fabs(frange-m_adjust->upper) < 0.2) &&
- (fabs(fthumb-m_adjust->page_size) < 0.2) &&
- (fabs(fpage-m_adjust->page_increment) < 0.2))
- {
- SetThumbPosition( position );
- return;
- }
+ if ((fabs(frange-m_adjust->upper) < 0.2) &&
+ (fabs(fthumb-m_adjust->page_size) < 0.2) &&
+ (fabs(fpage-m_adjust->page_increment) < 0.2))
+ {
+ SetThumbPosition( position );
+ return;
+ }
- m_oldPos = fpos;
+ m_oldPos = fpos;
- m_adjust->lower = 0.0;
- m_adjust->upper = frange;
- m_adjust->value = fpos;
- m_adjust->step_increment = 1.0;
- m_adjust->page_increment = (float)(wxMax(fpage,0));
- m_adjust->page_size = fthumb;
-
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ m_adjust->lower = 0.0;
+ m_adjust->upper = frange;
+ m_adjust->value = fpos;
+ m_adjust->step_increment = 1.0;
+ m_adjust->page_increment = (float)(wxMax(fpage,0));
+ m_adjust->page_size = fthumb;
+
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
-// Backward compatibility
+/* Backward compatibility */
int wxScrollBar::GetValue(void) const
{
- return GetThumbPosition();
+ return GetThumbPosition();
}
void wxScrollBar::SetValue( int viewStart )
{
- SetThumbPosition( viewStart );
+ SetThumbPosition( viewStart );
}
void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const
{
- int pos = (int)(m_adjust->value+0.5);
- int thumb = (int)(m_adjust->page_size+0.5);
- int page = (int)(m_adjust->page_increment+0.5);
- int range = (int)(m_adjust->upper+0.5);
+ int pos = (int)(m_adjust->value+0.5);
+ int thumb = (int)(m_adjust->page_size+0.5);
+ int page = (int)(m_adjust->page_increment+0.5);
+ int range = (int)(m_adjust->upper+0.5);
- *viewStart = pos;
- *viewLength = range;
- *objectLength = thumb;
- *pageLength = page;
+ *viewStart = pos;
+ *viewLength = range;
+ *objectLength = thumb;
+ *pageLength = page;
}
int wxScrollBar::GetViewLength() const
{
- return (int)(m_adjust->upper+0.5);
+ return (int)(m_adjust->upper+0.5);
}
int wxScrollBar::GetObjectLength() const
{
- return (int)(m_adjust->page_size+0.5);
+ return (int)(m_adjust->page_size+0.5);
}
void wxScrollBar::SetPageSize( int pageLength )
{
- int pos = (int)(m_adjust->value+0.5);
- int thumb = (int)(m_adjust->page_size+0.5);
- int range = (int)(m_adjust->upper+0.5);
- SetScrollbar( pos, thumb, range, pageLength );
+ int pos = (int)(m_adjust->value+0.5);
+ int thumb = (int)(m_adjust->page_size+0.5);
+ int range = (int)(m_adjust->upper+0.5);
+ SetScrollbar( pos, thumb, range, pageLength );
}
void wxScrollBar::SetObjectLength( int objectLength )
{
- int pos = (int)(m_adjust->value+0.5);
- int page = (int)(m_adjust->page_increment+0.5);
- int range = (int)(m_adjust->upper+0.5);
- SetScrollbar( pos, objectLength, range, page );
+ int pos = (int)(m_adjust->value+0.5);
+ int page = (int)(m_adjust->page_increment+0.5);
+ int range = (int)(m_adjust->upper+0.5);
+ SetScrollbar( pos, objectLength, range, page );
}
void wxScrollBar::SetViewLength( int viewLength )
{
- int pos = (int)(m_adjust->value+0.5);
- int thumb = (int)(m_adjust->page_size+0.5);
- int page = (int)(m_adjust->page_increment+0.5);
- SetScrollbar( pos, thumb, viewLength, page );
+ int pos = (int)(m_adjust->value+0.5);
+ int thumb = (int)(m_adjust->page_size+0.5);
+ int page = (int)(m_adjust->page_increment+0.5);
+ SetScrollbar( pos, thumb, viewLength, page );
}
bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
{
- GtkRange *range = GTK_RANGE(m_widget);
- return ( (window == GTK_WIDGET(range)->window) ||
- (window == range->trough) ||
- (window == range->slider) ||
- (window == range->step_forw) ||
- (window == range->step_back) );
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
}
void wxScrollBar::ApplyWidgetStyle()
{
- SetWidgetStyle();
- gtk_widget_set_style( m_widget, m_widgetStyle );
+ SetWidgetStyle();
+ gtk_widget_set_style( m_widget, m_widgetStyle );
}
wxFont wxSystemSettings::GetSystemFont( int index )
{
- switch (index)
- {
- case wxSYS_OEM_FIXED_FONT:
- case wxSYS_ANSI_FIXED_FONT:
- case wxSYS_SYSTEM_FIXED_FONT:
- {
- return *wxNORMAL_FONT;
- }
- case wxSYS_ANSI_VAR_FONT:
- case wxSYS_SYSTEM_FONT:
- case wxSYS_DEVICE_DEFAULT_FONT:
- case wxSYS_DEFAULT_GUI_FONT:
+ switch (index)
{
- if (!g_systemFont)
- g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
- return *g_systemFont;
+ case wxSYS_OEM_FIXED_FONT:
+ case wxSYS_ANSI_FIXED_FONT:
+ case wxSYS_SYSTEM_FIXED_FONT:
+ {
+ return *wxNORMAL_FONT;
+ }
+ case wxSYS_ANSI_VAR_FONT:
+ case wxSYS_SYSTEM_FONT:
+ case wxSYS_DEVICE_DEFAULT_FONT:
+ case wxSYS_DEFAULT_GUI_FONT:
+ {
+ if (!g_systemFont)
+ g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
+ return *g_systemFont;
+ }
}
- }
- return wxNullFont;
+ return wxNullFont;
}
int wxSystemSettings::GetSystemMetric( int index )
static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
- if (!win->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
+ if (!win->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
- float diff = win->m_adjust->value - win->m_oldPos;
- if (fabs(diff) < 0.2) return;
+ float diff = win->m_adjust->value - win->m_oldPos;
+ if (fabs(diff) < 0.2) return;
- wxEventType command = wxEVT_NULL;
+ wxEventType command = wxEVT_NULL;
- float line_step = win->m_adjust->step_increment;
- float page_step = win->m_adjust->page_increment;
+ float line_step = win->m_adjust->step_increment;
+ float page_step = win->m_adjust->page_increment;
- if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
- else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
- else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
- else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
- else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
- else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
- else command = wxEVT_SCROLL_THUMBTRACK;
-
- int value = (int)(win->m_adjust->value+0.5);
+ if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+ else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+ else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+ else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
+ else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
+ else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
+ else command = wxEVT_SCROLL_THUMBTRACK;
+
+ int value = (int)(win->m_adjust->value+0.5);
- int orient = wxHORIZONTAL;
- if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
+ int orient = wxHORIZONTAL;
+ if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL;
- wxScrollEvent event( command, win->GetId(), value, orient );
- event.SetEventObject( win );
- win->ProcessEvent( event );
+ wxScrollEvent event( command, win->GetId(), value, orient );
+ event.SetEventObject( win );
+ win->ProcessEvent( event );
- wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
- cevent.SetEventObject( win );
- win->ProcessEvent( cevent );
+ wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
+ cevent.SetEventObject( win );
+ win->ProcessEvent( cevent );
}
//-----------------------------------------------------------------------------
long style, const wxValidator& validator, const wxString& name )
{
m_acceptsFocus = TRUE;
- m_needParent = TRUE;
+ m_needParent = TRUE;
- PreCreation( parent, id, pos, size, style, name );
+ PreCreation( parent, id, pos, size, style, name );
- SetValidator( validator );
+ SetValidator( validator );
- m_oldPos = 0.0;
+ m_oldPos = 0.0;
- if (style & wxSL_VERTICAL == wxSL_VERTICAL)
- m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
- else
- m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
+ if (style & wxSL_VERTICAL == wxSL_VERTICAL)
+ m_widget = gtk_hscale_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_vscale_new( (GtkAdjustment *) NULL );
- gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
+ gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE );
- m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
+ m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
- gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
- (GtkSignalFunc) gtk_slider_callback, (gpointer) this );
- SetRange( minValue, maxValue );
- SetValue( value );
+ gtk_signal_connect( GTK_OBJECT(m_adjust),
+ "value_changed",
+ (GtkSignalFunc) gtk_slider_callback,
+ (gpointer) this );
+
+ SetRange( minValue, maxValue );
+ SetValue( value );
- m_parent->AddChild( this );
+ m_parent->AddChild( this );
- (m_parent->m_insertCallback)( m_parent, this );
+ (m_parent->m_insertCallback)( m_parent, this );
- PostCreation();
+ PostCreation();
- SetBackgroundColour( parent->GetBackgroundColour() );
+ SetBackgroundColour( parent->GetBackgroundColour() );
- Show( TRUE );
+ Show( TRUE );
- return TRUE;
+ return TRUE;
}
int wxSlider::GetValue(void) const
{
- return (int)(m_adjust->value+0.5);
+ return (int)(m_adjust->value+0.5);
}
void wxSlider::SetValue( int value )
{
- float fpos = (float)value;
- m_oldPos = fpos;
- if (fabs(fpos-m_adjust->value) < 0.2) return;
- m_adjust->value = fpos;
+ float fpos = (float)value;
+ m_oldPos = fpos;
+ if (fabs(fpos-m_adjust->value) < 0.2) return;
+
+ m_adjust->value = fpos;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}
void wxSlider::SetRange( int minValue, int maxValue )
{
- float fmin = (float)minValue;
- float fmax = (float)maxValue;
+ float fmin = (float)minValue;
+ float fmax = (float)maxValue;
- if ((fabs(fmin-m_adjust->lower) < 0.2) &&
- (fabs(fmax-m_adjust->upper) < 0.2))
- return;
+ if ((fabs(fmin-m_adjust->lower) < 0.2) &&
+ (fabs(fmax-m_adjust->upper) < 0.2))
+ {
+ return;
+ }
- m_adjust->lower = fmin;
- m_adjust->upper = fmax;
+ m_adjust->lower = fmin;
+ m_adjust->upper = fmax;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
int wxSlider::GetMin(void) const
{
- return (int)(m_adjust->lower+0.5);
+ return (int)(m_adjust->lower+0.5);
}
int wxSlider::GetMax(void) const
{
- return (int)(m_adjust->upper+0.5);
+ return (int)(m_adjust->upper+0.5);
}
void wxSlider::SetPageSize( int pageSize )
{
- float fpage = (float)pageSize;
+ float fpage = (float)pageSize;
- if (fabs(fpage-m_adjust->page_increment) < 0.2) return;
+ if (fabs(fpage-m_adjust->page_increment) < 0.2) return;
- m_adjust->page_increment = fpage;
+ m_adjust->page_increment = fpage;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
int wxSlider::GetPageSize(void) const
{
- return (int)(m_adjust->page_increment+0.5);
+ return (int)(m_adjust->page_increment+0.5);
}
void wxSlider::SetThumbLength( int len )
{
- float flen = (float)len;
+ float flen = (float)len;
- if (fabs(flen-m_adjust->page_size) < 0.2) return;
+ if (fabs(flen-m_adjust->page_size) < 0.2) return;
- m_adjust->page_size = flen;
+ m_adjust->page_size = flen;
- gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
+ gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}
int wxSlider::GetThumbLength(void) const
{
- return (int)(m_adjust->page_size+0.5);
+ return (int)(m_adjust->page_size+0.5);
}
void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
int wxSlider::GetLineSize(void) const
{
- return 0;
+ return 0;
}
void wxSlider::SetTick( int WXUNUSED(tickPos) )
int wxSlider::GetTickFreq(void) const
{
- return 0;
+ return 0;
}
void wxSlider::ClearTicks(void)
int wxSlider::GetSelEnd(void) const
{
- return 0;
+ return 0;
}
int wxSlider::GetSelStart(void) const
{
- return 0;
+ return 0;
}
void wxSlider::ClearSel(void)
bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
{
- GtkRange *range = GTK_RANGE(m_widget);
- return ( (window == GTK_WIDGET(range)->window) ||
- (window == range->trough) ||
- (window == range->slider) ||
- (window == range->step_forw) ||
- (window == range->step_back) );
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
}
void wxSlider::ApplyWidgetStyle()
{
- SetWidgetStyle();
- gtk_widget_set_style( m_widget, m_widgetStyle );
+ SetWidgetStyle();
+ gtk_widget_set_style( m_widget, m_widgetStyle );
}
int wxDisplayDepth(void)
{
- wxFAIL_MSG( "wxDisplayDepth always returns 8" );
- return 8;
+ return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
}
//------------------------------------------------------------------------