@ -60,6 +60,10 @@
p . setBrush ( TQt : : NoBrush ) ;
p . setBrush ( TQt : : NoBrush ) ;
extern int m_scrollBarSubLineWidth ;
extern int m_scrollBarSubLineWidth ;
extern bool m_scrollbarBack1 ;
extern bool m_scrollbarForward1 ;
extern bool m_scrollbarBack2 ;
extern bool m_scrollbarForward2 ;
WidgetLookup m_widgetLookup ;
WidgetLookup m_widgetLookup ;
Animations m_animations ;
Animations m_animations ;
@ -410,11 +414,18 @@ void gtkScrollbarToScrollbarCeData(GtkScrollbar* scrollbarWidget, TQStyleControl
ceData . pageStep = gtk_adjustment_get_page_increment ( adjustment ) ;
ceData . pageStep = gtk_adjustment_get_page_increment ( adjustment ) ;
// Convert the GTK slider length into a correct pagestep that TQt3 can use to obtain the same slider length value
// Convert the GTK slider length into a correct pagestep that TQt3 can use to obtain the same slider length value
bool threeButtonScrollBar = false ;
if ( m_scrollbarBack2 | m_scrollbarForward2 ) threeButtonScrollBar = true ;
TQStyle : : ControlElementFlags elementFlags = TQStyle : : CEF_None ;
TQStyle : : ControlElementFlags elementFlags = TQStyle : : CEF_None ;
int gtkSliderLength = slider_end_pos - slider_start_pos ;
int gtkSliderLength = slider_end_pos - slider_start_pos ;
uint range = ceData . maxSteps - ceData . minSteps ;
uint range = ceData . maxSteps - ceData . minSteps ;
// HACK
// GTK3 does not handle odd-sized steppers correctly
if ( ( m_scrollBarSubLineWidth % 2 ) ! = 0 ) {
gtkSliderLength = gtkSliderLength + 4 ;
}
int sbextent = tqApp - > style ( ) . pixelMetric ( TQStyle : : PM_ScrollBarExtent , ceData , elementFlags , NULL ) ;
int sbextent = tqApp - > style ( ) . pixelMetric ( TQStyle : : PM_ScrollBarExtent , ceData , elementFlags , NULL ) ;
int maxlen = ( ( ceData . orientation = = TQt : : Horizontal ) ? ceData . rect . width ( ) : ceData . rect . height ( ) ) - ( sbextent * 2 ) ;
int maxlen = ( ( ceData . orientation = = TQt : : Horizontal ) ? ceData . rect . width ( ) : ceData . rect . height ( ) ) - ( sbextent * ( threeButtonScrollBar ? 3.0 : 2.0 ) ) ;
int gtkPageStep = ceil ( ( - 1.0 ) * ( range * gtkSliderLength ) / ( gtkSliderLength - maxlen ) ) ;
int gtkPageStep = ceil ( ( - 1.0 ) * ( range * gtkSliderLength ) / ( gtkSliderLength - maxlen ) ) ;
ceData . pageStep = gtkPageStep ;
ceData . pageStep = gtkPageStep ;
}
}
@ -600,6 +611,8 @@ draw_slider_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, Gtk
cairo_restore ( cr ) ;
cairo_restore ( cr ) ;
}
}
TQStyle : : SubControl lastSliderActiveSubControl = TQStyle : : SC_None ;
static void
static void
draw_scrollbar_frame ( DRAW_ARGS , const GtkWidgetPath * path , GtkStateFlags state , GtkWidget * widget ) {
draw_scrollbar_frame ( DRAW_ARGS , const GtkWidgetPath * path , GtkStateFlags state , GtkWidget * widget ) {
cairo_save ( cr ) ;
cairo_save ( cr ) ;
@ -658,6 +671,10 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state,
state = ( GtkStateFlags ) ( state | GTK_STATE_FLAG_INSENSITIVE ) ;
state = ( GtkStateFlags ) ( state | GTK_STATE_FLAG_INSENSITIVE ) ;
}
}
sflags & = ~ TQStyle : : Style_On ;
sflags & = ~ TQStyle : : Style_Down ;
sflags & = ~ TQStyle : : Style_Active ;
// Determine active subcontrols
// Determine active subcontrols
gint cursor_x = - 1 ;
gint cursor_x = - 1 ;
gint cursor_y = - 1 ;
gint cursor_y = - 1 ;
@ -680,34 +697,64 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state,
last = tqApp - > style ( ) . querySubControlMetrics ( TQStyle : : CC_ScrollBar , ceData , elementFlags , TQStyle : : SC_ScrollBarLast ) ;
last = tqApp - > style ( ) . querySubControlMetrics ( TQStyle : : CC_ScrollBar , ceData , elementFlags , TQStyle : : SC_ScrollBarLast ) ;
// HACK
// HACK
// This may not be 100% reliable , and it has the side effect of triggering the page step activity effect when the slider is dragged quickly and the mouse cursor momentarily pops out of the slider rectangle.
// This may not be 100% reliable !
GdkModifierType mouseStateFlags ;
GdkModifierType mouseStateFlags ;
gdk_device_get_state ( device , gtk_widget_get_window ( widget ) , NULL , & mouseStateFlags ) ;
gdk_device_get_state ( device , gtk_widget_get_window ( widget ) , NULL , & mouseStateFlags ) ;
bool mousedown = ( mouseStateFlags & GDK_BUTTON1_MASK ) ;
bool mousedown = ( mouseStateFlags & GDK_BUTTON1_MASK ) ;
if ( mousedown ) {
if ( mousedown ) {
if ( subline . contains ( cursor_pos ) ) {
bool combine_addlineregion_drawing_areas = tqApp - > style ( ) . styleHint ( TQStyle : : SH_ScrollBar_CombineAddLineRegionDrawingAreas ) ;
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSubLine ) ;
if ( lastSliderActiveSubControl ! = TQStyle : : SC_None ) {
}
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | lastSliderActiveSubControl ) ;
if ( addline . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarAddLine ) ;
}
if ( subpage . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSubPage ) ;
}
}
if ( addpage . contains ( cursor_pos ) ) {
else {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarAddPage ) ;
if ( subline . contains ( cursor_pos ) ) {
}
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSubLine ) ;
if ( slider . contains ( cursor_pos ) ) {
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarSubLine ;
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSlider ) ;
}
}
else if ( addline . contains ( cursor_pos ) ) {
if ( first . contains ( cursor_pos ) ) {
// Not so fast...the addline region may contain a subline control!
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarFirst ) ;
TQRect internalSubLine ;
}
if ( ceData . orientation = = TQt : : Horizontal ) {
if ( last . contains ( cursor_pos ) ) {
internalSubLine = TQRect ( addline . x ( ) , addline . y ( ) , addline . width ( ) / 2 , addline . height ( ) ) ;
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarLast ) ;
}
else {
internalSubLine = TQRect ( addline . x ( ) , addline . y ( ) , addline . width ( ) , addline . height ( ) / 2 ) ;
}
if ( internalSubLine . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSubLine ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarSubLine ;
}
else {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarAddLine ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarAddLine ;
}
}
else if ( subpage . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSubPage ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarSubPage ;
}
else if ( addpage . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarAddPage ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarAddPage ;
}
else if ( slider . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarSlider ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarSlider ;
}
else if ( first . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarFirst ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarFirst ;
}
else if ( last . contains ( cursor_pos ) ) {
activeSubControl = ( TQStyle : : SubControl ) ( activeSubControl | TQStyle : : SC_ScrollBarLast ) ;
lastSliderActiveSubControl = TQStyle : : SC_ScrollBarLast ;
}
}
}
}
}
else {
lastSliderActiveSubControl = TQStyle : : SC_None ;
}
}
}
// Draw item
// Draw item