[COMPILER]
* BUG: Removed the ability to compile property access without having to use the ME keyword. This is too disturbing. [GB.FORM] * NEW: Uses the Draw.Style API for drawing SidePanel arrows. [GB.FORM.MDI] * NEW: Uses the Draw.Style API for drawing Toolbar handles. [GB.QT] * BUG: The style drawing methods really work. git-svn-id: svn://localhost/gambas/trunk@1192 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
e6b94a0a86
commit
2752a989ed
@ -130,11 +130,12 @@ PUBLIC SUB dwgHandle_Draw()
|
||||
|
||||
Draw.FillX = 0
|
||||
Draw.FillY = 0
|
||||
IF $bVertical THEN
|
||||
Draw.Tile(Picture["img/handle-v.png"], 2, 3, (dwgHandle.W - 4) AND NOT 3, 8)
|
||||
ELSE
|
||||
Draw.Tile(Picture["img/handle.png"], 3, 2, 8, (dwgHandle.H - 4) AND NOT 3)
|
||||
ENDIF
|
||||
Draw.Style.Handle(0, 0, dwgHandle.W, dwgHandle.H, $bVertical, NOT ME.Enabled)
|
||||
' IF $bVertical THEN
|
||||
' Draw.Tile(Picture["img/handle-v.png"], 2, 3, (dwgHandle.W - 4) AND NOT 3, 8)
|
||||
' ELSE
|
||||
' Draw.Tile(Picture["img/handle.png"], 3, 2, 8, (dwgHandle.H - 4) AND NOT 3)
|
||||
' ENDIF
|
||||
|
||||
END
|
||||
|
||||
@ -321,7 +322,7 @@ END
|
||||
|
||||
PUBLIC SUB dwgHandle_MouseUp()
|
||||
|
||||
SetHidden(NOT $bHidden)
|
||||
'SetHidden(NOT $bHidden)
|
||||
|
||||
END
|
||||
|
||||
|
@ -6,7 +6,7 @@ Library=gb.gui
|
||||
Library=gb.form
|
||||
Library=gb.settings
|
||||
Authors=Benoît Minisini
|
||||
Environment="GB_GUI=gb.gtk"
|
||||
Environment="GB_GUI=gb.qt"
|
||||
TabSize=2
|
||||
Translate=1
|
||||
Language=en
|
||||
|
@ -215,24 +215,44 @@ END
|
||||
PRIVATE SUB RefreshArrow()
|
||||
|
||||
DIM hPict AS Picture
|
||||
DIM hImage AS Image
|
||||
DIM sKey AS String
|
||||
DIM iType AS Integer
|
||||
|
||||
IF NOT $bOpened THEN RETURN
|
||||
|
||||
SELECT CASE $iOrientation
|
||||
CASE Align.Top, Align.Bottom
|
||||
IF $bVisible XOR ($iOrientation = Align.Bottom) THEN
|
||||
hPict = Picture["img/8/side-top.png"]
|
||||
sKey = "$side-top"
|
||||
iType = Align.Top
|
||||
'hPict = Picture["img/8/side-top.png"]
|
||||
ELSE
|
||||
hPict = Picture["img/8/side-bottom.png"]
|
||||
sKey = "$side-bottom"
|
||||
iType = Align.Bottom
|
||||
'hPict = Picture["img/8/side-bottom.png"]
|
||||
ENDIF
|
||||
CASE Align.Left, Align.Right
|
||||
IF $bVisible XOR ($iOrientation = Align.Right) THEN
|
||||
hPict = Picture["img/8/side-left.png"]
|
||||
sKey = "$side-left"
|
||||
iType = Align.Left
|
||||
'hPict = Picture["img/8/side-left.png"]
|
||||
ELSE
|
||||
hPict = Picture["img/8/side-right.png"]
|
||||
sKey = "$align-right"
|
||||
iType = Align.Right
|
||||
'hPict = Picture["img/8/side-right.png"]
|
||||
ENDIF
|
||||
END SELECT
|
||||
|
||||
hPict = Picture[sKey]
|
||||
IF NOT hPict THEN
|
||||
hPict = NEW Picture(8, 8, TRUE)
|
||||
Draw.Begin(hPict)
|
||||
Draw.Style.Arrow(0, 0, 8, 8, iType)
|
||||
Draw.End
|
||||
Picture[sKey] = hPict
|
||||
ENDIF
|
||||
|
||||
btnSide.Picture = hPict
|
||||
btnSide2.Picture = hPict
|
||||
|
||||
|
@ -9,14 +9,17 @@
|
||||
}
|
||||
{ panMove DrawingArea
|
||||
MoveScaled(2,1,46,3)
|
||||
Background = Color.Background
|
||||
{ btnSide ToolButton
|
||||
MoveScaled(0,0,12,3)
|
||||
Background = Color.Background
|
||||
Mouse = Mouse.Arrow
|
||||
Text = ("")
|
||||
}
|
||||
{ btnSide2 ToolButton btnSide
|
||||
Name = "btnSide2"
|
||||
MoveScaled(15,0,12,3)
|
||||
Background = Color.Background
|
||||
Mouse = Mouse.Arrow
|
||||
Text = ("")
|
||||
}
|
||||
|
@ -289,8 +289,6 @@ void gDraw::save()
|
||||
gdk_gc_copy(copy, gcm);
|
||||
g_array_append_val(_gc_stack, copy);
|
||||
}
|
||||
|
||||
fprintf(stderr, "save: %d\n", _gc_stack->len);
|
||||
}
|
||||
|
||||
void gDraw::restore()
|
||||
@ -300,8 +298,6 @@ void gDraw::restore()
|
||||
if (!_gc_stack || _gc_stack->len <= 0)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "restore: %d\n", _gc_stack->len);
|
||||
|
||||
copy = g_array_index(_gc_stack, GdkGC *, _gc_stack->len - 1);
|
||||
gdk_gc_copy(gc, copy);
|
||||
g_object_unref(G_OBJECT(copy));
|
||||
|
@ -792,10 +792,21 @@ static QColorGroup get_color_group(int state)
|
||||
}
|
||||
}
|
||||
|
||||
static QColorGroup get_color_group_mask(int state)
|
||||
{
|
||||
static QColorGroup mask_cg(Qt::color1, Qt::color1, Qt::color1, Qt::color1, Qt::color1, Qt::color1, Qt::color1, Qt::color0, Qt::color0);
|
||||
|
||||
return mask_cg;
|
||||
}
|
||||
|
||||
static void style_arrow(GB_DRAW *d, int x, int y, int w, int h, int type, int state)
|
||||
{
|
||||
QStyle::SFlags flags = QStyle::Style_Default;
|
||||
QStyle::PrimitiveElement pe;
|
||||
|
||||
if (!state)
|
||||
flags |= QStyle::Style_Enabled;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ALIGN_NORMAL: pe = GB.System.IsRightToLeft() ? QStyle::PE_ArrowLeft : QStyle::PE_ArrowRight; break;
|
||||
@ -808,8 +819,14 @@ static void style_arrow(GB_DRAW *d, int x, int y, int w, int h, int type, int st
|
||||
}
|
||||
|
||||
QRect r(x, y, w, h);
|
||||
QApplication::style().drawPrimitive(pe, DP(d), r, get_color_group(state));
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(pe, DPM(d), r, get_color_group(state));
|
||||
QApplication::style().drawPrimitive(pe, DP(d), r, get_color_group(state), flags);
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
//qDebug("arrow: %p %p %d", DPM(d), DPM(d)->device(), dynamic_cast<QBitmap *>(DPM(d)->device()) != NULL);
|
||||
QApplication::style().drawPrimitive(pe, DPM(d), r, get_color_group_mask(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_check(GB_DRAW *d, int x, int y, int w, int h, int value, int state)
|
||||
@ -828,7 +845,12 @@ static void style_check(GB_DRAW *d, int x, int y, int w, int h, int value, int s
|
||||
flags |= QStyle::Style_On;
|
||||
|
||||
QApplication::style().drawPrimitive(QStyle::PE_Indicator, DP(d), r, get_color_group(state), flags);
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(QStyle::PE_IndicatorMask, DPM(d), r, get_color_group(state), flags);
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_IndicatorMask, DPM(d), r, get_color_group_mask(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_option(GB_DRAW *d, int x, int y, int w, int h, int value, int state)
|
||||
@ -845,7 +867,12 @@ static void style_option(GB_DRAW *d, int x, int y, int w, int h, int value, int
|
||||
flags |= QStyle::Style_On;
|
||||
|
||||
QApplication::style().drawPrimitive(QStyle::PE_ExclusiveIndicator, DP(d), r, get_color_group(state), flags);
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(QStyle::PE_ExclusiveIndicatorMask, DPM(d), r, get_color_group(state), flags);
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_ExclusiveIndicatorMask, DPM(d), r, get_color_group_mask(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_separator(GB_DRAW *d, int x, int y, int w, int h, int vertical, int state)
|
||||
@ -860,14 +887,24 @@ static void style_separator(GB_DRAW *d, int x, int y, int w, int h, int vertical
|
||||
flags |= QStyle::Style_Horizontal;
|
||||
|
||||
QApplication::style().drawPrimitive(QStyle::PE_DockWindowSeparator, DP(d), r, get_color_group(0), flags);
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(QStyle::PE_DockWindowSeparator, DPM(d), r, get_color_group(0), flags);
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_DockWindowSeparator, DPM(d), r, get_color_group_mask(0), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_focus(GB_DRAW *d, int x, int y, int w, int h)
|
||||
{
|
||||
QRect r(x, y, w, h);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_FocusRect, DP(d), r, get_color_group(0));
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(QStyle::PE_FocusRect, DPM(d), r, get_color_group(0));
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_FocusRect, DPM(d), r, get_color_group_mask(0));
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_button(GB_DRAW *d, int x, int y, int w, int h, int value, int state)
|
||||
@ -884,7 +921,12 @@ static void style_button(GB_DRAW *d, int x, int y, int w, int h, int value, int
|
||||
flags |= QStyle::Style_On;
|
||||
|
||||
QApplication::style().drawPrimitive(QStyle::PE_ButtonCommand, DP(d), r, get_color_group(state), flags);
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(QStyle::PE_ButtonCommand, DPM(d), r, get_color_group(state), flags);
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_ButtonCommand, DPM(d), r, get_color_group_mask(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_panel(GB_DRAW *d, int x, int y, int w, int h, int border, int state)
|
||||
@ -902,7 +944,7 @@ static void style_panel(GB_DRAW *d, int x, int y, int w, int h, int border, int
|
||||
if (border == BORDER_PLAIN)
|
||||
{
|
||||
qDrawPlainRect(DP(d), r, get_color_group(state).foreground(), 1);
|
||||
if DPM(d) qDrawPlainRect(DPM(d), r, get_color_group(state).foreground(), 1);
|
||||
if DPM(d) qDrawPlainRect(DPM(d), r, get_color_group_mask(state).foreground(), 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -921,7 +963,12 @@ static void style_panel(GB_DRAW *d, int x, int y, int w, int h, int border, int
|
||||
}
|
||||
|
||||
QApplication::style().drawPrimitive(pe, DP(d), r, get_color_group(state), flags);
|
||||
if (DPM(d)) QApplication::style().drawPrimitive(pe, DPM(d), r, get_color_group(state), flags);
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(pe, DPM(d), r, get_color_group_mask(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
}
|
||||
}
|
||||
|
||||
static void style_handle(GB_DRAW *d, int x, int y, int w, int h, int vertical, int state)
|
||||
@ -942,7 +989,9 @@ static void style_handle(GB_DRAW *d, int x, int y, int w, int h, int vertical, i
|
||||
if (DPM(d))
|
||||
{
|
||||
DPM(d)->translate(x, y);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_Splitter, DPM(d), r, get_color_group(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::OrROP);
|
||||
QApplication::style().drawPrimitive(QStyle::PE_Splitter, DPM(d), r, get_color_group_mask(state), flags);
|
||||
DPM(d)->setRasterOp(Qt::CopyROP);
|
||||
DPM(d)->translate(-x, -y);
|
||||
}
|
||||
}
|
||||
|
@ -191,12 +191,13 @@ static void trans_identifier(int index, boolean first, boolean point, PATTERN ne
|
||||
|
||||
CODE_push_extern(sym->global.value);
|
||||
}
|
||||
/* That breaks some code if the property has the same name as a class!
|
||||
else if (type == TK_PROPERTY)
|
||||
{
|
||||
CODE_push_me(FALSE);
|
||||
CODE_push_unknown(CLASS_add_unknown(JOB->class, index));
|
||||
}
|
||||
else if (type == TK_EVENT || type == TK_LABEL)
|
||||
}*/
|
||||
else if (type == TK_EVENT || type == TK_LABEL || type == TK_PROPERTY)
|
||||
{
|
||||
goto __CLASS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user