Tag: cws_src680_aquavcl01
User: ericb
Date: 2006/12/23 01:06:54
Modified:
gsl/vcl/aqua/source/gdi/salnativewidgets.cxx
Log:
cosmetic changes + fixed several little bugs in switch for pushbuttons
File Changes:
Directory: /gsl/vcl/aqua/source/gdi/
====================================
File [changed]: salnativewidgets.cxx
Url:
http://gsl.openoffice.org/source/browse/gsl/vcl/aqua/source/gdi/salnativewidgets.cxx?r1=1.1.2.11&r2=1.1.2.12
Delta lines: +268 -267
-----------------------
--- salnativewidgets.cxx 22 Dec 2006 23:29:11 -0000 1.1.2.11
+++ salnativewidgets.cxx 23 Dec 2006 09:06:51 -0000 1.1.2.12
@@ -4,9 +4,9 @@
*
* $RCSfile: salnativewidgets.cxx,v $
*
- * $Revision: 1.1.2.11 $
+ * $Revision: 1.1.2.12 $
*
- * last change: $Author: ericb $ $Date: 2006/12/22 23:29:11 $
+ * last change: $Author: ericb $ $Date: 2006/12/23 09:06:51 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -59,7 +59,6 @@
// just set the environment variable SAL_NO_NWF to something
// and vcl controls will be used as default again.
-
fprintf(stderr,"Control type is : %d\n", nType );
fprintf(stderr,"Control part is : %d\n", nPart );
@@ -73,6 +72,7 @@
return true;
}
break;
+
case CTRL_SCROLLBAR:
{
if( nPart == PART_DRAW_BACKGROUND_HORZ ||
@@ -82,6 +82,7 @@
return true;
}
break;
+
case CTRL_EDITBOX: // ** TO DO **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -89,6 +90,7 @@
return false;
}
break;
+
case CTRL_MULTILINE_EDITBOX: // ** TO DO **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -96,6 +98,7 @@
return false;
}
break;
+
case CTRL_SPINBOX: // ** TO DO **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -104,6 +107,7 @@
return false;
}
break;
+
case CTRL_SPINBUTTONS: // ** TO DO **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -111,6 +115,7 @@
return false;
}
break;
+
case CTRL_COMBOBOX: // ** TO DO **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -118,6 +123,7 @@
return false;
}
break;
+
case CTRL_LISTBOX: // ** TO DO **
{
if( nPart == PART_ENTIRE_CONTROL //||
@@ -127,6 +133,7 @@
return true;
}
break;
+
case CTRL_TAB_ITEM:
case CTRL_TAB_PANE:
case CTRL_TAB_BODY:
@@ -137,6 +144,7 @@
return false;
}
break;
+
case CTRL_TOOLBAR: // ** TO DO + CHECK IF NEEDED **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -148,18 +156,21 @@
return false;
}
break;
+
case CTRL_MENUBAR: // ** TO DO + CHECK IF NEEDED **
{
if( nPart == PART_ENTIRE_CONTROL )
return false;
}
break;
+
case CTRL_TOOLTIP: // ** TO DO + CHECK IF NEEDED **
{
if( nPart == PART_ENTIRE_CONTROL )
return false;
}
break;
+
case CTRL_MENU_POPUP: // ** TO DO + CHECK IF NEEDED **
{
if( nPart == PART_ENTIRE_CONTROL ||
@@ -187,13 +198,14 @@
if ( nType == CTRL_SCROLLBAR )
{
-
// outside by default
rIsInside = FALSE;
// make position relative to rControlRegion
- // [ericb] rControlRegion.GetBoundRect() returns the rectangle
where native control (the scrollbar is located
+ // [ericb] rControlRegion.GetBoundRect() returns the rectangle
where vcl control is located
+ // when a control is hit on the scrollbar (native control), the
coordinates of the click
+ // are translated to vcl control coordinates
// rPos : the structure containing the cursor position
// aPos = relative position of current cursor
@@ -210,7 +222,6 @@
float Width = static_cast<float>(ControlRect.Right()) -
static_cast<float>(ControlRect.Left());
float Height = static_cast<float>(ControlRect.Bottom()) -
static_cast<float>(ControlRect.Top());
-
fprintf(stderr, "Width = %f \n", Width);
fprintf(stderr, "Height = %f \n", Height);
@@ -219,7 +230,6 @@
switch ( nPart )
{
case PART_BUTTON_LEFT:
-
if ( aPos.getX() > (Width-35) &&
aPos.getX() < (Width-15) )
{
fprintf(stderr, "button left
\n");
@@ -285,19 +295,13 @@
if( (nState & CTRL_STATE_ENABLED) == 0 )
{
if( (nState & CTRL_STATE_HIDDEN) == 0 )
- {
return kThemeStateInactive;
- }
else
- {
return kThemeStateUnavailableInactive;
}
- }
if( (nState & CTRL_STATE_HIDDEN) != 0 )
- {
return kThemeStateUnavailable;
- }
if( (nState & CTRL_STATE_PRESSED) != 0 )
return kThemeStatePressed;
@@ -305,7 +309,7 @@
if( (nState & CTRL_STATE_ROLLOVER) != 0 )
return kThemeStatePressed;//kThemeStateRollover;
- return kThemeStateActive;
+ return kThemeStateInactive;
}
/*
@@ -318,7 +322,7 @@
* rControlHandle: Carries platform dependent data and is maintained by
the WinSalGraphics implementation.
* aCaption: A caption or title string (like button text etc)
*/
-BOOL AquaSalGraphics::drawNativeControl( ControlType nType,
+BOOL AquaSalGraphics::drawNativeControl(ControlType nType,
ControlPart nPart,
const Region& rControlRegion,
ControlState nState,
@@ -352,16 +356,15 @@
case CTRL_PUSHBUTTON:
{
- // [ FIXME] : instead of use value, vcl can retrieve corect values
on the fly (to be implemented)
-
+ // [ FIXME] : instead of use a value, vcl can retrieve corect
values on the fly (to be implemented)
int max_height = 20;
+
// [FIXME]: for width, better use (native)
text length to define width. How retrieve the text length ?
int max_width = 68;
// [FIXME] find a better criteria to
differentiate several buttons who are square, but are not Bewel buttons.
if((rc.size.width < 17) && (rc.size.width ==
rc.size.height ) )
{
-
HIThemeButtonDrawInfo aBevelInfo;
aBevelInfo.version = 0;
aBevelInfo.kind = kThemeBevelButton;
@@ -371,25 +374,24 @@
{
case BUTTONVALUE_ON:
aBevelInfo.value = kThemeButtonOn;
break;
+
case BUTTONVALUE_OFF:
aBevelInfo.value = kThemeButtonOff;
break;
+
case BUTTONVALUE_MIXED:
case BUTTONVALUE_DONTKNOW:
default:
aBevelInfo.value = kThemeButtonMixed;
break;
-
-
+ }
aBevelInfo.adornment = ((
nState & CTRL_STATE_DEFAULT ) != 0) ?
kThemeAdornmentDefault :
kThemeAdornmentNone;
if( (nState &
CTRL_STATE_FOCUSED) != 0 )
aBevelInfo.adornment |=
kThemeAdornmentFocus;
- }
if( BeginGraphics() )
{
- HIThemeDrawButton( &rc,
&aBevelInfo, mrContext,
-
kHIThemeOrientationNormal, NULL );
+ HIThemeDrawButton( &rc, &aBevelInfo, mrContext,
kHIThemeOrientationNormal, NULL );
EndGraphics();
return true;
}
@@ -403,11 +405,9 @@
{
HIThemeButtonDrawInfo aPushInfo;
aPushInfo.version = 0;
- if( (nType != CTRL_TAB_PANE) &&
(rc.size.width >= max_width ||
-
rc.size.height >= max_height ))
+ if( (nType != CTRL_TAB_PANE) && (rc.size.width >= max_width
|| rc.size.height >= max_height ))
{
aPushInfo.kind =
kThemePushButton;
-
// just in case people don't
like push button with iconn inside
if (rc.size.width > max_width )
{
@@ -421,24 +421,25 @@
}
aPushInfo.state = getState(
nState );
+
switch( aValue.getTristateVal()
)
{
case BUTTONVALUE_ON:
aPushInfo.value = kThemeButtonOn;
break;
+
case BUTTONVALUE_OFF:
aPushInfo.value = kThemeButtonOff;
break;
+
case BUTTONVALUE_MIXED:
case
BUTTONVALUE_DONTKNOW:
default:
aPushInfo.value = kThemeButtonMixed;
break;
-
-
+ }
aPushInfo.adornment =
(( nState & CTRL_STATE_DEFAULT ) != 0) ?
kThemeAdornmentDefault :
kThemeAdornmentNone;
if( (nState &
CTRL_STATE_FOCUSED) != 0 )
aPushInfo.adornment |= kThemeAdornmentFocus;
- }
if( BeginGraphics() )
{
@@ -593,7 +594,7 @@
SalControlHandle&
rControlHandle, const rtl::OUString& aCaption )
{
printf("In text\n");
- return( TRUE );
+ return( FALSE );
}
|