PictureBox now uses the new UserControl Draw pseudo-event and Frame container in now implemented in Gambas.

[GB.DRAW]
* NEW: Add PaintExtents W and H properties as synonymous of Width and Height.

[GB.GUI.BASE]
* NEW: PictureBox now uses the new UserControl Draw pseudo-event.
* NEW: Frame container in now implemented in Gambas.

[GB.GTK]
* NEW: Frame container in now implemented in Gambas.
* BUG: Style drawing routines now work correctly on UserControl.

[GB.GTK3]
* NEW: Frame container in now implemented in Gambas.

[GB.QT4]
* NEW: Frame container in now implemented in Gambas.

[GB.QT5]
* NEW: Frame container in now implemented in Gambas.
* BUG: Do not activate windows on Wayland, this is not supported.
This commit is contained in:
gambas 2021-01-23 23:30:36 +01:00
parent bc170a2317
commit f588c83fda
34 changed files with 279 additions and 293 deletions

View File

@ -1,6 +1,6 @@
# Gambas Project File 3.0
Title=Common controls and classes for GUI components
Startup=FMain
Startup=FTestFrame
Version=3.15.90
VersionFile=1
Component=gb.image

View File

@ -0,0 +1,157 @@
' Gambas class file
Export
Inherits UserContainer
Public Const _Properties As String = "*,Text,TextFont"
Public Const _Similar As String = "Panel"
Property Text As String
Property RichText As String
Property TextFont As Font
Private $hContainer As Panel
Private $hFrame As DrawingArea
Private $sText As String
Private $bRichText As Boolean
Private $hTextFont As Font
Public Sub _new()
$hFrame = New DrawingArea(Me) As "Frame"
$hFrame.Margin = True
$hContainer = New Panel($hFrame)
Me._Container = $hContainer
End
Public Sub Frame_Arrange()
Dim DS As Integer
Dim H As Integer
DS = Desktop.Scale
If $hTextFont Then
H = Max($hTextFont.H, DS)
Else
H = Max(Me.Font.H, DS)
Endif
H += DS \ 2
If $sText Then
$hContainer.Move(DS, H, $hFrame.W - DS * 2, $hFrame.H - DS - H)
Else
$hContainer.Move(DS, DS, $hFrame.W - DS * 2, $hFrame.H - DS * 2)
Endif
End
Public Sub Frame_Draw()
Dim DS As Integer
Dim W As Integer
Dim sText As String
Dim hRect As PaintExtents
Dim H As Integer
DS = Desktop.Scale
If $sText Then
If $hTextFont Then Paint.Font = $hTextFont
H = Max(Paint.Font.H, DS)
W = $hFrame.W - DS * 5
If $bRichText Then
sText = Paint.TrimRichText($sText, W)
hRect = Paint.RichTextExtents(sText)
Else
sText = Paint.TrimText($sText, W)
hRect = Paint.TextExtents(sText)
Endif
If Me.Background <> Color.Default Then Paint.FillRect(DS \ 2 + 2, H \ 2 + 2, $hFrame.W - DS - 4, $hFrame.H - (DS + H) \ 2 - 4, Me.Background)
Paint.Background = Color.LightForeground
Paint.MoveTo(CInt($hFrame.W - hRect.W) \ 2 - DS, H \ 2)
Paint.LineTo(DS \ 2, H \ 2)
Paint.LineTo(DS \ 2, $hFrame.H - DS \ 2)
Paint.LineTo($hFrame.W - DS \ 2, $hFrame.H - DS \ 2)
Paint.LineTo($hFrame.W - DS \ 2, H \ 2)
Paint.LineTo(CInt($hFrame.W - hRect.W) \ 2 + hRect.W + DS, H \ 2)
Paint.LineWidth = 1
Paint.Translate(0.5, 0.5)
Paint.Stroke()
Paint.Translate(-0.5, -0.5)
Paint.Background = Style.ForegroundOf(Me)
'Paint.Restore
'Paint.FillRect(CInt($hFrame.W - hRect.W) \ 2 - DS, H \ 2, hRect.Width + DS * 2, H - (H \ 2), Style.BackgroundOf(Me))
If $bRichText Then
Paint.DrawRichText(sText, 0, 0, $hFrame.W, H, Align.Center)
Else
Paint.DrawText(sText, 0, 0, $hFrame.W, H, Align.Center)
Endif
Else
If Me.Background <> Color.Default Then Paint.FillRect(DS \ 2, DS \ 2, $hFrame.W - DS, $hFrame.H - DS, Me.Background)
Paint.DrawRect(DS \ 2, DS \ 2, $hFrame.W - DS, $hFrame.H - DS, Color.LightForeground)
'Style.PaintPanel(DS \ 2, DS \ 2, $hFrame.W - DS, $hFrame.H - DS, Border.Etched)
Endif
End
Private Function Text_Read() As String
If Not $bRichText Then Return $sText
End
Private Sub Text_Write(Value As String)
$sText = Value
$bRichText = False
Frame_Arrange
$hFrame.Refresh
End
Private Function RichText_Read() As String
If $bRichText Then Return $sText
End
Private Sub RichText_Write(Value As String)
$sText = Value
$bRichText = True
Frame_Arrange
$hFrame.Refresh
End
Private Function TextFont_Read() As Font
Return $hTextFont
End
Private Sub TextFont_Write(Value As Font)
$hTextFont = Value
End
Public Sub Frame_Font()
Frame_Arrange
End

View File

@ -1,9 +1,9 @@
' Gambas class file
Export
Inherits DrawingArea
Inherits UserControl
Public Const _Properties As String = "*,-Arrangement,-Spacing,-Margin,-Indent,-Invert,-NoBackground,-Tablet,-Cached,-Focus,Padding{Range:0;64},Picture,Stretch,AutoResize,Alignment{Align.*}=TopLeft,Border{Border.None;Plain;Sunken;Raised;Etched},Mode{PictureBox.Normal;Fill;Cover;Contain;Repeat}"
Public Const _Properties As String = "*,Padding{Range:0;64},Picture,Stretch,AutoResize,Alignment{Align.*}=TopLeft,Border{Border.None;Plain;Sunken;Raised;Etched},Mode{PictureBox.Normal;Fill;Cover;Contain;Repeat}"
Public Const _DefaultEvent As String = "MouseDown"
Public Const _DefaultSize As String = "16,16"
Public Const _IsContainer As Boolean = False
@ -22,7 +22,6 @@ Public Enum Normal, Fill, Cover, Contain, {Repeat}
Static Private $hDefault As Image
Private $hObs As Observer
Private $iAlign As Integer = Align.TopLeft
Private $iPadding As Integer
Private $iBorder As Integer
@ -32,13 +31,6 @@ Private $hImage As Image
Private $bAutoResize As Boolean
Private $bStretch As Boolean
Public Sub _new()
$hObs = New Observer(Me) As "DrawingArea"
End
Private Function Alignment_Read() As Integer
Return $iAlign
@ -190,7 +182,7 @@ Private Sub Image_Write(Value As Image)
End
Public Sub DrawingArea_Draw()
Public Sub UserControl_Draw()
Dim W As Integer
Dim H As Integer

View File

@ -1,26 +1,9 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,78,60)
MoveScaled(0,0,79,65)
Arrangement = Arrange.Fill
Margin = True
{ ScrollArea1 ScrollArea
MoveScaled(4,3,35,30)
Visible = False
Mouse = Mouse.Pointing
AutoResize = True
{ Button1 Button
MoveScaled(10,8,11,5)
Text = ("Button")
}
{ Label1 Label
MoveScaled(7,28,19,6)
Border = Border.Plain
}
{ TextArea1 TextArea
MoveScaled(32,20,39,29)
}
}
{ MyScrollView1 ScrollView
MoveScaled(23,16,55,47)
{ Button2 Button Button
@ -216,4 +199,21 @@
MoveScaled(73,64,16,4)
}
}
{ ScrollArea1 ScrollArea
MoveScaled(4,3,35,30)
Visible = False
Mouse = Mouse.Pointing
AutoResize = True
{ Button1 Button
MoveScaled(10,8,11,5)
Text = ("Button")
}
{ Label1 Label
MoveScaled(7,28,19,6)
Border = Border.Plain
}
{ TextArea1 TextArea
MoveScaled(32,20,39,29)
}
}
}

View File

@ -0,0 +1,2 @@
' Gambas class file

View File

@ -0,0 +1,12 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,64,64)
{ MyFrame1 Frame
MoveScaled(4,10,41,32)
Text = ("Ceci est le titre de la frame et il peut être long mais très long en fait")
{ Button1 Button
MoveScaled(5,5,15,5)
}
}
}

View File

@ -25,7 +25,7 @@
#include "gambas.h"
#include "CContainer.h"
#include "gframe.h"
#include "gpanel.h"
#include "gmainwindow.h"
#include "cpaint_impl.h"
@ -71,11 +71,7 @@ void CUSERCONTROL_cb_draw(gContainer *sender, GdkRegion *region, int dx, int dy)
GB_ERROR_HANDLER handler;
#ifdef GTK3
cairo_t *save;
#endif
#ifdef GTK3
save = THIS_USERCONTROL->context;
cairo_t *save = THIS_USERCONTROL->context;
THIS_USERCONTROL->context = cr;
#endif

View File

@ -1,8 +1,9 @@
/***************************************************************************
CFrame.cpp
CPanel.cpp
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
(c) Benoît Minisini <g4mba5@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -21,16 +22,9 @@
***************************************************************************/
#define __CFRAME_CPP
#define __CPANEL_CPP
#include "CFrame.h"
BEGIN_METHOD(CFRAME_new, GB_OBJECT parent)
InitControl(new gFrame(CONTAINER(VARG(parent))), (CWIDGET*)THIS);
END_METHOD
#include "CPanel.h"
BEGIN_METHOD(CPANEL_new, GB_OBJECT parent)
@ -82,38 +76,11 @@ BEGIN_PROPERTY(CPANEL_border)
END_PROPERTY
BEGIN_PROPERTY(CFRAME_text)
if (READ_PROPERTY) { GB.ReturnNewZeroString( FRAME->text()); return; }
FRAME->setText(GB.ToZeroString(PROP(GB_STRING)));
END_PROPERTY
GB_DESC CFrameDesc[] =
{
GB_DECLARE("Frame", sizeof(CFRAME)), GB_INHERITS("Container"),
GB_METHOD("_new", 0, CFRAME_new, "(Parent)Container;"),
GB_PROPERTY("Caption", "s", CFRAME_text),
GB_PROPERTY("Text", "s", CFRAME_text),
GB_PROPERTY("Title", "s", CFRAME_text),
GB_PROPERTY("Arrangement", "i", Container_Arrangement),
GB_PROPERTY("AutoResize", "b", Container_AutoResize),
GB_PROPERTY("Padding", "i", Container_Padding),
GB_PROPERTY("Spacing", "b", Container_Spacing),
GB_PROPERTY("Margin", "b", Container_Margin),
GB_PROPERTY("Indent", "b", Container_Indent),
GB_PROPERTY("Invert", "b", Container_Invert),
FRAME_DESCRIPTION,
GB_END_DECLARE
};
//-------------------------------------------------------------------------
GB_DESC CPanelDesc[] =
{
GB_DECLARE("Panel", sizeof(CFRAME)), GB_INHERITS("Container"),
GB_DECLARE("Panel", sizeof(CPANEL)), GB_INHERITS("Container"),
GB_METHOD("_new", 0, CPANEL_new, "(Parent)Container;"),
@ -134,7 +101,7 @@ GB_DESC CPanelDesc[] =
GB_DESC CHBoxDesc[] =
{
GB_DECLARE("HBox", sizeof(CFRAME)), GB_INHERITS("Container"),
GB_DECLARE("HBox", sizeof(CPANEL)), GB_INHERITS("Container"),
GB_METHOD("_new", 0, CHBOX_new, "(Parent)Container;"),
@ -153,7 +120,7 @@ GB_DESC CHBoxDesc[] =
GB_DESC CVBoxDesc[] =
{
GB_DECLARE("VBox", sizeof(CFRAME)), GB_INHERITS("Container"),
GB_DECLARE("VBox", sizeof(CPANEL)), GB_INHERITS("Container"),
GB_METHOD("_new", 0, CVBOX_new, "(Parent)Container;"),
@ -172,7 +139,7 @@ GB_DESC CVBoxDesc[] =
GB_DESC CHPanelDesc[] =
{
GB_DECLARE("HPanel", sizeof(CFRAME)), GB_INHERITS("Container"),
GB_DECLARE("HPanel", sizeof(CPANEL)), GB_INHERITS("Container"),
GB_METHOD("_new", 0, CHPANEL_new, "(Parent)Container;"),
@ -191,7 +158,7 @@ GB_DESC CHPanelDesc[] =
GB_DESC CVPanelDesc[] =
{
GB_DECLARE("VPanel", sizeof(CFRAME)), GB_INHERITS("Container"),
GB_DECLARE("VPanel", sizeof(CPANEL)), GB_INHERITS("Container"),
GB_METHOD("_new", 0, CVPANEL_new, "(Parent)Container;"),

View File

@ -1,8 +1,9 @@
/***************************************************************************
CFrame.h
CPanel.h
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
(c) Benoît Minisini <g4mba5@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -21,16 +22,15 @@
***************************************************************************/
#ifndef __CFRAME_H
#define __CFRAME_H
#ifndef __CPANEL_H
#define __CPANEL_H
#include "main.h"
#include "gframe.h"
#include "gpanel.h"
#include "CWidget.h"
#include "CContainer.h"
#ifndef __CFRAME_CPP
extern GB_DESC CFrameDesc[];
#ifndef __CPANEL_CPP
extern GB_DESC CPanelDesc[];
extern GB_DESC CHBoxDesc[];
extern GB_DESC CVBoxDesc[];
@ -38,9 +38,8 @@ extern GB_DESC CHPanelDesc[];
extern GB_DESC CVPanelDesc[];
#else
#define THIS ((CFRAME *)_object)
#define THIS ((CPANEL *)_object)
#define FRAME ((gFrame *)(THIS->widget.widget))
#define PANEL ((gPanel *)(THIS->widget.widget))
#endif
@ -50,6 +49,6 @@ typedef
{
CWIDGET widget;
}
CFRAME;
CPANEL;
#endif

View File

@ -189,6 +189,28 @@ static bool begin_draw(int *x, int *y)
_widget = wid->widget;
}
else if (GB.Is(device, CLASS_UserControl))
{
gContainer *wid;
GtkAllocation *a;
if (PAINT_is_internal())
{
GB.Error("Cannot draw outside of 'Draw' event handler");
return TRUE;
}
wid = (gContainer *)((CDRAWINGAREA *)device)->ob.widget;
_dr = wid->widget->window;
a = &wid->widget->allocation;
_dr_x = a->x;
_dr_y = a->y;
*x += _dr_x;
*y += _dr_y;
_widget = wid->widget;
}
else if (GB.Is(device, CLASS_Picture))
{
gPicture *pic = ((CPICTURE *)device)->picture;
@ -625,9 +647,7 @@ static void style_panel(int x, int y, int w, int h, int border, int state)
GdkGCValues values;
uint col;
col = IMAGE.MergeColor(gDesktop::getColor(gDesktop::BACKGROUND), gDesktop::getColor(gDesktop::FOREGROUND), 0.5);
col = IMAGE.LighterColor(col);
col = gDesktop::getColor(gDesktop::LIGHT_FOREGROUND);
fill_gdk_color(&values.foreground, col, gdk_drawable_get_colormap(_dr));
gc = gtk_gc_get(gdk_drawable_get_depth(_dr), gdk_drawable_get_colormap(_dr), &values, GDK_GC_FOREGROUND);
gdk_draw_rectangle(_dr, gc, FALSE, x, y, w - 1, h - 1);

View File

@ -34,7 +34,7 @@
#include "CPicture.h"
#include "CContainer.h"
#include "CClipboard.h"
#include "CFrame.h"
#include "CPanel.h"
extern int MAIN_scale;

View File

@ -18,7 +18,7 @@ gb_gtk_la_SOURCES = \
gcontrol.cpp gcontainer.cpp \
gbutton.cpp gslider.cpp glabel.cpp gsignals.cpp \
gcombobox.cpp gtextbox.cpp gtextarea.cpp \
gframe.cpp gtabstrip.cpp \
gpanel.cpp gtabstrip.cpp \
gmenu.cpp gtrayicon.cpp gmainwindow.cpp \
gtree.h gtree.cpp \
watcher.h watcher.cpp \
@ -43,8 +43,8 @@ gb_gtk_la_SOURCES = \
CButton.h CButton.cpp \
CTextBox.h CTextBox.cpp \
CTextArea.h CTextArea.cpp \
CFrame.h CFrame.cpp \
CTabStrip.h CTabStrip.cpp \
CPanel.h CPanel.cpp \
CMenu.h CMenu.cpp CTrayIcon.h CTrayIcon.cpp CWindow.h CWindow.cpp \
cprinter.h cprinter.cpp \
csvgimage.h csvgimage.cpp \
@ -69,8 +69,7 @@ gb_gtk_la_SOURCES = \
gscrollbar.h \
gcontainer.h \
gdrawingarea.h gdrawingarea.cpp \
gtabstrip.h \
gframe.h \
gpanel.h gtabstrip.h \
gmenu.h \
gmainwindow.h \
gapplication.h gapplication.cpp \

View File

@ -1663,6 +1663,11 @@ void PAINT_begin(void *device)
_internal_paint = false;
}
bool PAINT_is_internal()
{
return _internal_paint;
}
void PAINT_end()
{
DRAW.Paint.End();

View File

@ -36,7 +36,8 @@ extern GB_PAINT_MATRIX_DESC PAINT_MATRIX_Interface;
#endif
void PAINT_begin(void *device);
void PAINT_end();
void PAINT_end(void);
bool PAINT_is_internal(void);
void PAINT_clip(int x, int y, int w, int h);
#ifndef GTK3
void PAINT_clip_region(GdkRegion *region);

View File

@ -1,6 +1,6 @@
/***************************************************************************
gframe.cpp
gpanel.cpp
(c) 2004-2006 - Daniel Campos Fernández <dcamposf@gmail.com>
@ -23,7 +23,7 @@
#include "widgets.h"
#include "gapplication.h"
#include "gframe.h"
#include "gpanel.h"
/****************************************************************************
@ -136,121 +136,3 @@ void gPanel::setBackground(gColor color)
}
#endif
/****************************************************************************
Frame
****************************************************************************/
gFrame::gFrame(gContainer *parent) : gContainer(parent)
{
border = widget = gtk_fixed_new();
fr = gtk_frame_new(NULL);
//label = gtk_frame_get_label_widget(GTK_FRAME(fr));
gtk_container_set_border_width(GTK_CONTAINER(fr),0);
gtk_frame_set_shadow_type(GTK_FRAME(fr), GTK_SHADOW_ETCHED_IN);
gtk_container_add(GTK_CONTAINER(widget), fr);
realize(false);
//g_signal_connect(G_OBJECT(border), "size-allocate", G_CALLBACK(cb_frame_resize), (gpointer)this);
}
const char *gFrame::text()
{
const char *label = gtk_frame_get_label(GTK_FRAME(fr));
if (!label)
label = "";
return label;
}
void gFrame::setText(const char *vl)
{
if (!vl)
vl = "";
gtk_frame_set_label(GTK_FRAME(fr), vl);
gtk_frame_set_label_align(GTK_FRAME(fr), 0.5, 0.0);
}
void gFrame::updateFont()
{
GtkWidget *label = gtk_frame_get_label_widget(GTK_FRAME(fr));
gContainer::updateFont();
if (label)
{
#ifdef GTK3
#else
gtk_widget_modify_font(label, font()->desc());
#endif
}
performArrange();
}
#ifdef GTK3
GtkWidget *gFrame::getStyleSheetWidget()
{
return fr;
}
#else
void gFrame::setRealForeground(gColor color)
{
gControl::setRealForeground(color);
//if (label) set_gdk_fg_color(label, color);
}
#endif
int gFrame::containerX()
{
return gApplication::getFrameWidth();
}
int gFrame::clientX()
{
return 0;
}
int gFrame::clientWidth()
{
return width(); // - gApplication::getFrameWidth() * 2;
}
int gFrame::containerWidth()
{
return clientWidth() - gApplication::getFrameWidth() * 2;
}
int gFrame::containerY()
{
int y = gApplication::getFrameWidth();
if (*text())
y = font()->height() * 3 / 2;
return y;
}
int gFrame::clientY()
{
return 0;
}
int gFrame::clientHeight()
{
return height(); // - clientY() - gApplication::getFrameWidth();
}
int gFrame::containerHeight()
{
return clientHeight() - containerY() - gApplication::getFrameWidth();
}
bool gFrame::resize(int w, int h)
{
if (gContainer::resize(w, h))
return true;
gtk_widget_set_size_request(fr, width(), height());
return false;
}

View File

@ -1,6 +1,6 @@
/***************************************************************************
gframe.h
gpanel.h
(c) 2000-2017 Benoît Minisini <g4mba5@gmail.com>
@ -21,8 +21,8 @@
***************************************************************************/
#ifndef __GFRAME_H
#define __GFRAME_H
#ifndef __GPANEL_H
#define __GPANEL_H
#include "gcontainer.h"
#include "gcolor.h"
@ -43,34 +43,4 @@ private:
void create();
};
class gFrame : public gContainer
{
public:
gFrame(gContainer *parent);
const char *text();
void setText(const char *vl);
virtual int clientX();
virtual int clientY();
virtual int clientWidth();
virtual int clientHeight();
virtual int containerX();
virtual int containerY();
virtual int containerWidth();
virtual int containerHeight();
virtual void updateFont();
#ifdef GTK3
virtual GtkWidget *getStyleSheetWidget();
#else
virtual void setRealForeground(gColor color);
#endif
virtual bool resize(int w, int h);
//"Private"
GtkWidget *fr;
};
#endif

View File

@ -50,7 +50,7 @@
#include "CWidget.h"
#include "CDrawingArea.h"
#include "CContainer.h"
#include "CFrame.h"
#include "CPanel.h"
#include "CMenu.h"
#include "CWindow.h"
#include "CLabel.h"
@ -205,7 +205,6 @@ GB_DESC *GB_CLASSES[] EXPORT =
ContainerChildrenDesc,
ContainerDesc,
CDrawingAreaDesc,
CFrameDesc,
UserControlDesc,
UserContainerDesc,
CPanelDesc,

View File

@ -1 +0,0 @@
../../gb.gtk/src/CFrame.cpp

View File

@ -1 +0,0 @@
../../gb.gtk/src/CFrame.h

1
gb.gtk3/src/CPanel.cpp Symbolic link
View File

@ -0,0 +1 @@
../../gb.gtk/src/CPanel.cpp

1
gb.gtk3/src/CPanel.h Symbolic link
View File

@ -0,0 +1 @@
../../gb.gtk/src/CPanel.h

View File

@ -18,7 +18,7 @@ gb_gtk3_la_SOURCES = \
gcontrol.cpp gcontainer.cpp \
gbutton.cpp gslider.cpp glabel.cpp gsignals.cpp \
gcombobox.cpp gtextbox.cpp gtextarea.cpp \
gframe.cpp gtabstrip.cpp \
gpanel.cpp gtabstrip.cpp \
gmenu.cpp gtrayicon.cpp gmainwindow.cpp \
gtree.h gtree.cpp \
watcher.h watcher.cpp \
@ -43,8 +43,8 @@ gb_gtk3_la_SOURCES = \
CButton.h CButton.cpp \
CTextBox.h CTextBox.cpp \
CTextArea.h CTextArea.cpp \
CFrame.h CFrame.cpp \
CTabStrip.h CTabStrip.cpp \
CPanel.h CPanel.cpp \
CMenu.h CMenu.cpp CTrayIcon.h CTrayIcon.cpp CWindow.h CWindow.cpp \
cprinter.h cprinter.cpp \
csvgimage.h csvgimage.cpp \
@ -68,8 +68,7 @@ gb_gtk3_la_SOURCES = \
gscrollbar.h \
gcontainer.h \
gdrawingarea.h gdrawingarea.cpp \
gtabstrip.h \
gframe.h \
gpanel.h gtabstrip.h \
gmenu.h \
gmainwindow.h \
gapplication.h gapplication.cpp \

View File

@ -1 +0,0 @@
../../gb.gtk/src/gframe.cpp

View File

@ -1 +0,0 @@
../../gb.gtk/src/gframe.h

1
gb.gtk3/src/gpanel.cpp Symbolic link
View File

@ -0,0 +1 @@
../../gb.gtk/src/gpanel.cpp

1
gb.gtk3/src/gpanel.h Symbolic link
View File

@ -0,0 +1 @@
../../gb.gtk/src/gpanel.h

View File

@ -50,7 +50,7 @@
#include "CWidget.h"
#include "CDrawingArea.h"
#include "CContainer.h"
#include "CFrame.h"
#include "CPanel.h"
#include "CMenu.h"
#include "CWindow.h"
#include "CLabel.h"
@ -217,7 +217,6 @@ GB_DESC *GB_CLASSES[] EXPORT =
ContainerChildrenDesc,
ContainerDesc,
CDrawingAreaDesc,
CFrameDesc,
UserControlDesc,
UserContainerDesc,
CPanelDesc,

View File

@ -316,7 +316,7 @@ void CWINDOW_ensure_active_window()
void *_object = CWINDOW_Active;
if (THIS)
WINDOW->activateWindow();
WINDOW->activate();
}
@ -1327,7 +1327,7 @@ END_PROPERTY
BEGIN_METHOD_VOID(Window_Activate)
if (THIS->toplevel && WINDOW->isVisible() && !WINDOW->isHidden())
WINDOW->activateWindow();
WINDOW->activate();
END_METHOD
@ -1606,7 +1606,7 @@ void MyMainWindow::showEvent(QShowEvent *e)
//qDebug("showEvent: activate: %s", THIS->widget.name);
raise();
//setFocus();
activateWindow();
activate();
_activate = false;
}
@ -1671,11 +1671,6 @@ void MyMainWindow::setEventLoop()
THIS->loopLevel = CWINDOW_Current ? CWINDOW_Current->loopLevel : 0;
}
void MyMainWindow::activateLater()
{
activateWindow();
}
void MyMainWindow::present(QWidget *parent)
{
/*CWIDGET *_object = CWidget::get(this);
@ -1747,12 +1742,8 @@ void MyMainWindow::present(QWidget *parent)
}
}
#ifdef QT5
if (!THIS->noTakeFocus && !MAIN_platform_is_wayland)
#else
if (!THIS->noTakeFocus) // && (parent || hasBorder()))
#endif
activateWindow();
activate();
if (parent)
{
@ -2573,7 +2564,7 @@ void MyMainWindow::doReparent(QWidget *parent, const QPoint &pos)
#ifndef NO_X_WINDOW
initProperties(PROP_ALL);
if (active && hasBorder())
activateWindow();
activate();
#endif
setWindowIcon(icon);
@ -2808,6 +2799,14 @@ void MyMainWindow::setBetterMask(QPixmap &bg)
setMask(QBitmap::fromImage(mask));
}
void MyMainWindow::activate(void)
{
#ifdef QT5
if (!MAIN_platform_is_wayland)
#endif
activateWindow();
}
/***************************************************************************
CWindow

View File

@ -205,10 +205,6 @@ protected:
//bool eventFilter(QObject *, QEvent *);
public slots:
void activateLater();
public:
enum { BorderNone = 0, BorderFixed = 1, BorderResizable = 2 };
@ -236,13 +232,7 @@ public:
bool isResizable(void) const { return _resizable; }
void setResizable(bool);
#if 0
#ifdef NO_X_WINDOW
#else
int getType(void);
void setType(int type);
#endif
#endif
void activate(void);
bool isUtility(void) const { return _utility; }
void setUtility(bool b);

View File

@ -31,7 +31,6 @@ gb_qt4_la_SOURCES = \
CColor.h CColor_moc.cpp CColor.cpp \
CConst.h CConst.cpp \
CCheckBox.h CCheckBox_moc.cpp CCheckBox.cpp \
CFrame.h CFrame_moc.cpp CFrame.cpp \
CPanel.h CPanel_moc.cpp CPanel.cpp \
CRadioButton.h CRadioButton_moc.cpp CRadioButton.cpp \
CTextArea.h CTextArea_moc.cpp CTextArea.cpp \

View File

@ -74,7 +74,6 @@
#include "CColor.h"
#include "CConst.h"
#include "CCheckBox.h"
#include "CFrame.h"
#include "CRadioButton.h"
#include "CTabStrip.h"
#include "CDialog.h"
@ -1355,7 +1354,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
CCheckBoxDesc, CRadioButtonDesc,
CTextBoxSelectionDesc, CTextBoxDesc, CComboBoxItemDesc, CComboBoxDesc,
CTextAreaSelectionDesc, CTextAreaDesc,
CFrameDesc, CPanelDesc, CHBoxDesc, CVBoxDesc, CHPanelDesc, CVPanelDesc,
CPanelDesc, CHBoxDesc, CVBoxDesc, CHPanelDesc, CVPanelDesc,
CTabStripContainerChildrenDesc, CTabStripContainerDesc, CTabStripDesc,
CDrawingAreaDesc,
CSliderDesc, CScrollBarDesc,

View File

@ -29,7 +29,6 @@ gb_qt5_la_SOURCES = \
CColor.h CColor_moc.cpp CColor.cpp \
CConst.h CConst.cpp \
CCheckBox.h CCheckBox_moc.cpp CCheckBox.cpp \
CFrame.h CFrame_moc.cpp CFrame.cpp \
CPanel.h CPanel_moc.cpp CPanel.cpp \
CRadioButton.h CRadioButton_moc.cpp CRadioButton.cpp \
CTextArea.h CTextArea_moc.cpp CTextArea.cpp \

View File

@ -73,7 +73,6 @@
#include "CColor.h"
#include "CConst.h"
#include "CCheckBox.h"
#include "CFrame.h"
#include "CRadioButton.h"
#include "CTabStrip.h"
#include "CDialog.h"
@ -1107,7 +1106,7 @@ GB_DESC *GB_CLASSES[] EXPORT =
CCheckBoxDesc, CRadioButtonDesc,
CTextBoxSelectionDesc, CTextBoxDesc, CComboBoxItemDesc, CComboBoxDesc,
CTextAreaSelectionDesc, CTextAreaDesc,
CFrameDesc, CPanelDesc, CHBoxDesc, CVBoxDesc, CHPanelDesc, CVPanelDesc,
CPanelDesc, CHBoxDesc, CVBoxDesc, CHPanelDesc, CVPanelDesc,
CTabStripContainerChildrenDesc, CTabStripContainerDesc, CTabStripDesc,
CDrawingAreaDesc,
CSliderDesc, CScrollBarDesc,

View File

@ -300,6 +300,8 @@ GB_DESC PaintExtentsDesc[] =
GB_PROPERTY_READ("Y", "f", PaintExtents_Y),
GB_PROPERTY_READ("X2", "f", PaintExtents_X2),
GB_PROPERTY_READ("Y2", "f", PaintExtents_Y2),
GB_PROPERTY_READ("W", "f", PaintExtents_Width),
GB_PROPERTY_READ("H", "f", PaintExtents_Height),
GB_PROPERTY_READ("Width", "f", PaintExtents_Width),
GB_PROPERTY_READ("Height", "f", PaintExtents_Height),