[DEVELOPMENT ENVIRONMENT]
* BUG: Remove old console search code. [GB.FORM] * NEW: MenuButton controls now automatically pop up when one of their sibling is already opened. [GB.FORM.EDITOR] * NEW: TextEditor: The cursor position label background is now semi-transparent. [GB.GTK] * BUG: Mouse.ScreenX and Mouse.ScreenY now always query the pointer. * NEW: Menu.Close() is a new method that hides a popup menu from the screen. [GB.GTK3] * BUG: Mouse.ScreenX and Mouse.ScreenY now always query the pointer. * NEW: Menu.Close() is a new method that hides a popup menu from the screen. [GB.QT4] * BUG: Mouse.ScreenX and Mouse.ScreenY now always query the pointer. * NEW: Menu.Close() is a new method that hides a popup menu from the screen. [GB.QT5] * BUG: Mouse.ScreenX and Mouse.ScreenY now always query the pointer. * NEW: Menu.Close() is a new method that hides a popup menu from the screen. git-svn-id: svn://localhost/gambas/trunk@7751 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
0b928f80ef
commit
5da7ed1c4e
@ -89,9 +89,9 @@ Private Sub UpdateTitle()
|
|||||||
|
|
||||||
Dim sWhere As String
|
Dim sWhere As String
|
||||||
|
|
||||||
If $hCurrent Is FOutput Then
|
' If $hCurrent Is FOutput Then
|
||||||
sWhere = ("Console")
|
' sWhere = ("Console")
|
||||||
Else If $hCurrent Then
|
If $hCurrent Then
|
||||||
sWhere = $hCurrent.Title
|
sWhere = $hCurrent.Title
|
||||||
Else
|
Else
|
||||||
sWhere = ("Project")
|
sWhere = ("Project")
|
||||||
@ -114,14 +114,14 @@ Public Sub Update(Optional bForce As Boolean)
|
|||||||
If hWindow = Me Then Return
|
If hWindow = Me Then Return
|
||||||
$hCurrent = hWindow
|
$hCurrent = hWindow
|
||||||
|
|
||||||
If $hCurrent Is FOutput Then
|
' If $hCurrent Is FOutput Then
|
||||||
radCurrentProcedure.Enabled = False
|
' radCurrentProcedure.Enabled = False
|
||||||
radCurrentFile.Enabled = True
|
' radCurrentFile.Enabled = True
|
||||||
radCurrentFile.Value = True
|
' radCurrentFile.Value = True
|
||||||
btnReplace.Enabled = False
|
' btnReplace.Enabled = False
|
||||||
btnReplaceAll.Enabled = False
|
' btnReplaceAll.Enabled = False
|
||||||
cmbReplace.Enabled = False
|
' cmbReplace.Enabled = False
|
||||||
Else
|
' Else
|
||||||
$hCurrent = Project.ActiveForm
|
$hCurrent = Project.ActiveForm
|
||||||
If $hCurrent Then
|
If $hCurrent Then
|
||||||
If $hCurrent Is FEditor Or If $hCurrent Is FTextEditor Then
|
If $hCurrent Is FEditor Or If $hCurrent Is FTextEditor Then
|
||||||
@ -138,7 +138,7 @@ Public Sub Update(Optional bForce As Boolean)
|
|||||||
btnReplace.Enabled = True
|
btnReplace.Enabled = True
|
||||||
btnReplaceAll.Enabled = True
|
btnReplaceAll.Enabled = True
|
||||||
cmbReplace.Enabled = True
|
cmbReplace.Enabled = True
|
||||||
Endif
|
'Endif
|
||||||
|
|
||||||
If radCurrentProcedure.Value And If Not radCurrentProcedure.Enabled Then
|
If radCurrentProcedure.Value And If Not radCurrentProcedure.Enabled Then
|
||||||
radCurrentFile.Value = True
|
radCurrentFile.Value = True
|
||||||
@ -318,13 +318,13 @@ Private Sub GrepFile(hFile As Object, Optional sPath As String, Optional bUseRep
|
|||||||
hResult = New CFindResult
|
hResult = New CFindResult
|
||||||
|
|
||||||
If hFile Then
|
If hFile Then
|
||||||
If hFile Is FOutput Then
|
' If hFile Is FOutput Then
|
||||||
hResult.Path = ""
|
' hResult.Path = ""
|
||||||
hResult.File = "Console"
|
' hResult.File = "Console"
|
||||||
Else
|
' Else
|
||||||
hResult.Path = sPath
|
hResult.Path = sPath
|
||||||
hResult.File = hFile.Name
|
hResult.File = hFile.Name
|
||||||
Endif
|
'Endif
|
||||||
Else
|
Else
|
||||||
hResult.Path = sPath
|
hResult.Path = sPath
|
||||||
hResult.File = If(Project.IsSourcePath(sPath), File.BaseName(sPath), File.Name(sPath))
|
hResult.File = If(Project.IsSourcePath(sPath), File.BaseName(sPath), File.Name(sPath))
|
||||||
|
@ -2749,7 +2749,7 @@ Private Sub ShowPosition_Write(Value As Boolean)
|
|||||||
If $bShowPosition Then
|
If $bShowPosition Then
|
||||||
If Not $hLabel Then
|
If Not $hLabel Then
|
||||||
$hLabelFrame = New Panel(Me)
|
$hLabelFrame = New Panel(Me)
|
||||||
$hLabelFrame.Background = $hStyles[Highlight.Background].Color
|
$hLabelFrame.Background = Color.SetAlpha($hStyles[Highlight.Background].Color, 128)
|
||||||
$hLabelFrame.Ignore = True
|
$hLabelFrame.Ignore = True
|
||||||
$hLabel = New Label($hLabelFrame) ' TODO: NULL + gb.gtk => crash!
|
$hLabel = New Label($hLabelFrame) ' TODO: NULL + gb.gtk => crash!
|
||||||
$hLabel.AutoResize = True
|
$hLabel.AutoResize = True
|
||||||
|
@ -2340,6 +2340,10 @@ Arrow_Click
|
|||||||
m
|
m
|
||||||
|
|
||||||
|
|
||||||
|
WatchTimer_Timer
|
||||||
|
m
|
||||||
|
|
||||||
|
|
||||||
DrawingArea_GotFocus
|
DrawingArea_GotFocus
|
||||||
m
|
m
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# Gambas Project File 3.0
|
# Gambas Project File 3.0
|
||||||
# Compiled with Gambas 3.8.90
|
# Compiled with Gambas 3.8.90
|
||||||
Title=More controls for graphical components
|
Title=More controls for graphical components
|
||||||
Startup=FTestDateChooser
|
Startup=FTestMenuButton
|
||||||
Version=3.8.90
|
Version=3.8.90
|
||||||
VersionFile=1
|
VersionFile=1
|
||||||
Component=gb.image
|
Component=gb.image
|
||||||
Component=gb.gui
|
Component=gb.gui
|
||||||
Component=gb.settings
|
Component=gb.settings
|
||||||
Authors="Benoît Minisini"
|
Authors="Benoît Minisini"
|
||||||
Environment="GB_GUI=gb.qt4"
|
Environment="GB_GUI=gb.gtk"
|
||||||
TabSize=2
|
TabSize=2
|
||||||
Translate=1
|
Translate=1
|
||||||
Language=en
|
Language=en
|
||||||
|
@ -41,6 +41,9 @@ Private $bArrow As Boolean
|
|||||||
Private $bAutoResize As Boolean
|
Private $bAutoResize As Boolean
|
||||||
Private $bMenuOnly As Boolean
|
Private $bMenuOnly As Boolean
|
||||||
|
|
||||||
|
Static Private $hCurrent As MenuButton
|
||||||
|
Static Private $hCurrentMenu As Menu
|
||||||
|
|
||||||
Public Sub _new()
|
Public Sub _new()
|
||||||
|
|
||||||
'Dim hObs As Observer
|
'Dim hObs As Observer
|
||||||
@ -141,17 +144,72 @@ Public Sub Button_Click()
|
|||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub WatchTimer_Timer()
|
||||||
|
|
||||||
|
Dim hMenuButton As MenuButton
|
||||||
|
Dim X As Integer
|
||||||
|
Dim Y As Integer
|
||||||
|
|
||||||
|
X = Mouse.ScreenX - Me.Parent.ScreenX
|
||||||
|
Y = Mouse.ScreenY - Me.Parent.ScreenY
|
||||||
|
|
||||||
|
'Debug X;; Y
|
||||||
|
|
||||||
|
If X < 0 Or If Y < 0 Or If X >= Me.Parent.W Or If Y >= Me.Parent.H Then Return
|
||||||
|
|
||||||
|
Try hMenuButton = Me.Parent.FindChild(X, Y)
|
||||||
|
If hMenuButton And If hMenuButton <> $hCurrent Then
|
||||||
|
If Main.FindMenu(hMenuButton, hMenuButton.Menu) Then
|
||||||
|
$hCurrentMenu.Close
|
||||||
|
$hCurrent.Refresh
|
||||||
|
$hCurrent = hMenuButton
|
||||||
|
Endif
|
||||||
|
Endif
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Static Private Sub HandleMenu(hCurrent As MenuButton)
|
||||||
|
|
||||||
|
Dim hMenu As Menu
|
||||||
|
Dim hWatch As Timer
|
||||||
|
|
||||||
|
hWatch = New Timer As "WatchTimer"
|
||||||
|
hWatch.Delay = 50
|
||||||
|
hWatch.Start
|
||||||
|
|
||||||
|
Do
|
||||||
|
|
||||||
|
hMenu = Main.FindMenu(hCurrent, hCurrent.Menu)
|
||||||
|
|
||||||
|
$hCurrent = hCurrent
|
||||||
|
$hCurrentMenu = hMenu
|
||||||
|
|
||||||
|
hMenu.Popup(hCurrent.ScreenX, hCurrent.ScreenY + hCurrent.H)
|
||||||
|
|
||||||
|
If $hCurrent = hCurrent Then Break
|
||||||
|
hCurrent = $hCurrent
|
||||||
|
|
||||||
|
Loop
|
||||||
|
|
||||||
|
$hCurrent.Refresh
|
||||||
|
hWatch.Stop
|
||||||
|
hWatch = Null
|
||||||
|
$hCurrent = Null
|
||||||
|
$hCurrentMenu = Null
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Public Sub Arrow_Click()
|
Public Sub Arrow_Click()
|
||||||
|
|
||||||
Dim hMenu As Menu
|
If Not Main.FindMenu(Me, $sMenu) Then
|
||||||
|
|
||||||
hMenu = Main.FindMenu(Me, $sMenu)
|
|
||||||
If hMenu Then
|
|
||||||
hMenu.Popup(Me.ScreenX, Me.ScreenY + Me.H)
|
|
||||||
Else
|
|
||||||
Raise Click
|
Raise Click
|
||||||
|
Return
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
HandleMenu(Me)
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
' Public Sub ShowMenu()
|
' Public Sub ShowMenu()
|
||||||
@ -321,7 +379,12 @@ Public Sub DrawingArea_Draw()
|
|||||||
Dim bDrawArrow As Boolean
|
Dim bDrawArrow As Boolean
|
||||||
|
|
||||||
iFlag = Style.StateOf(Last)
|
iFlag = Style.StateOf(Last)
|
||||||
If $bInside Or If $bPressed Then iFlag = iFlag Or Draw.Hover
|
|
||||||
|
If $hCurrent Then
|
||||||
|
If $hCurrent = Me Then iFlag = iFlag Or Draw.Hover
|
||||||
|
Else
|
||||||
|
If $bInside Then iFlag = iFlag Or Draw.Hover
|
||||||
|
Endif
|
||||||
'If $bInside And If Me.Enabled And If Not Me.Design Then iFlag += Draw.Hover
|
'If $bInside And If Me.Enabled And If Not Me.Design Then iFlag += Draw.Hover
|
||||||
'If Not Me.Enabled Then iFlag += Draw.Disabled
|
'If Not Me.Enabled Then iFlag += Draw.Disabled
|
||||||
'If $hDrawingArea.HasFocus Then iFlag += Draw.Focus
|
'If $hDrawingArea.HasFocus Then iFlag += Draw.Focus
|
||||||
|
2
comp/src/gb.form/.src/Test/FTestMenuButton.class
Normal file
2
comp/src/gb.form/.src/Test/FTestMenuButton.class
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
' Gambas class file
|
||||||
|
|
77
comp/src/gb.form/.src/Test/FTestMenuButton.form
Normal file
77
comp/src/gb.form/.src/Test/FTestMenuButton.form
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# Gambas Form File 3.0
|
||||||
|
|
||||||
|
{ Form Form
|
||||||
|
MoveScaled(0,0,64,64)
|
||||||
|
{ mnuProject Menu
|
||||||
|
Text = ("Project")
|
||||||
|
Visible = False
|
||||||
|
{ Menu1 Menu
|
||||||
|
Text = ("Menu1")
|
||||||
|
}
|
||||||
|
{ Menu2 Menu
|
||||||
|
Text = ("Menu2")
|
||||||
|
}
|
||||||
|
{ Menu3 Menu
|
||||||
|
Text = ("Menu3")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{ mnuView Menu
|
||||||
|
Text = ("View")
|
||||||
|
Visible = False
|
||||||
|
{ Menu4 Menu
|
||||||
|
Text = ("Menu4")
|
||||||
|
}
|
||||||
|
{ Menu5 Menu
|
||||||
|
Text = ("Menu5")
|
||||||
|
}
|
||||||
|
{ Menu6 Menu
|
||||||
|
Text = ("Menu6")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{ mnuTools Menu
|
||||||
|
Text = ("Tools")
|
||||||
|
Visible = False
|
||||||
|
{ Menu7 Menu
|
||||||
|
Text = ("Menu7")
|
||||||
|
}
|
||||||
|
{ Menu8 Menu
|
||||||
|
Text = ("Menu8")
|
||||||
|
}
|
||||||
|
{ Menu9 Menu
|
||||||
|
Text = ("Menu9")
|
||||||
|
{ Menu10 Menu
|
||||||
|
Text = ("Menu10")
|
||||||
|
}
|
||||||
|
{ Menu11 Menu
|
||||||
|
Text = ("Menu11")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{ HBox1 HBox
|
||||||
|
MoveScaled(3,14,56,5)
|
||||||
|
{ MenuButton1 MenuButton
|
||||||
|
MoveScaled(0,0,17,4)
|
||||||
|
AutoResize = True
|
||||||
|
Text = ("Project")
|
||||||
|
Arrow = False
|
||||||
|
Border = False
|
||||||
|
Menu = "mnuProject"
|
||||||
|
}
|
||||||
|
{ MenuButton2 MenuButton
|
||||||
|
MoveScaled(18,0,16,4)
|
||||||
|
AutoResize = True
|
||||||
|
Text = ("View")
|
||||||
|
Arrow = False
|
||||||
|
Border = False
|
||||||
|
Menu = "mnuView"
|
||||||
|
}
|
||||||
|
{ MenuButton3 MenuButton
|
||||||
|
MoveScaled(35,0,16,4)
|
||||||
|
AutoResize = True
|
||||||
|
Text = ("Tools")
|
||||||
|
Arrow = False
|
||||||
|
Border = False
|
||||||
|
Menu = "mnuTools"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -386,6 +386,12 @@ BEGIN_METHOD(Menu_Popup, GB_INTEGER x; GB_INTEGER y)
|
|||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
BEGIN_METHOD_VOID(Menu_Close)
|
||||||
|
|
||||||
|
MENU->close();
|
||||||
|
|
||||||
|
END_METHOD
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROPERTY(Menu_Tag)
|
BEGIN_PROPERTY(Menu_Tag)
|
||||||
|
|
||||||
@ -496,6 +502,7 @@ GB_DESC CMenuDesc[] =
|
|||||||
MENU_DESCRIPTION,
|
MENU_DESCRIPTION,
|
||||||
|
|
||||||
GB_METHOD("Popup", 0, Menu_Popup, "[(X)i(Y)i]"),
|
GB_METHOD("Popup", 0, Menu_Popup, "[(X)i(Y)i]"),
|
||||||
|
GB_METHOD("Close", NULL, Menu_Close, NULL),
|
||||||
GB_METHOD("Delete", 0, Menu_Delete, 0),
|
GB_METHOD("Delete", 0, Menu_Delete, 0),
|
||||||
GB_METHOD("Show", 0, Menu_Show, 0),
|
GB_METHOD("Show", 0, Menu_Show, 0),
|
||||||
GB_METHOD("Hide", 0, Menu_Hide, 0),
|
GB_METHOD("Hide", 0, Menu_Hide, 0),
|
||||||
|
@ -776,6 +776,13 @@ void gMenu::popup()
|
|||||||
doPopup(false);
|
doPopup(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gMenu::close()
|
||||||
|
{
|
||||||
|
if (!child)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_menu_popdown(child);
|
||||||
|
}
|
||||||
|
|
||||||
int gMenu::winChildCount(gMainWindow *par)
|
int gMenu::winChildCount(gMainWindow *par)
|
||||||
{
|
{
|
||||||
|
@ -82,6 +82,7 @@ public:
|
|||||||
//"Methods"
|
//"Methods"
|
||||||
void popup();
|
void popup();
|
||||||
void popup(int x, int y);
|
void popup(int x, int y);
|
||||||
|
void close();
|
||||||
void destroy();
|
void destroy();
|
||||||
static bool insidePopup() { return _in_popup > 0; }
|
static bool insidePopup() { return _in_popup > 0; }
|
||||||
static gMenu *currentPopup() { return _current_popup; }
|
static gMenu *currentPopup() { return _current_popup; }
|
||||||
|
@ -140,9 +140,6 @@ int gMouse::screenX()
|
|||||||
{
|
{
|
||||||
gint x;
|
gint x;
|
||||||
|
|
||||||
if (_isValid)
|
|
||||||
x = _screen_x;
|
|
||||||
else
|
|
||||||
#ifdef GTK3
|
#ifdef GTK3
|
||||||
gdk_device_get_position(get_pointer(), NULL, &x, NULL);
|
gdk_device_get_position(get_pointer(), NULL, &x, NULL);
|
||||||
#else
|
#else
|
||||||
@ -156,9 +153,6 @@ int gMouse::screenY()
|
|||||||
{
|
{
|
||||||
gint y;
|
gint y;
|
||||||
|
|
||||||
if (_isValid)
|
|
||||||
y = _screen_y;
|
|
||||||
else
|
|
||||||
#ifdef GTK3
|
#ifdef GTK3
|
||||||
gdk_device_get_position(get_pointer(), NULL, NULL, &y);
|
gdk_device_get_position(get_pointer(), NULL, NULL, &y);
|
||||||
#else
|
#else
|
||||||
|
@ -741,6 +741,11 @@ BEGIN_METHOD(Menu_Popup, GB_INTEGER x; GB_INTEGER y)
|
|||||||
|
|
||||||
END_METHOD
|
END_METHOD
|
||||||
|
|
||||||
|
BEGIN_METHOD_VOID(Menu_Close)
|
||||||
|
|
||||||
|
THIS->menu->close();
|
||||||
|
|
||||||
|
END_METHOD
|
||||||
|
|
||||||
BEGIN_PROPERTY(Menu_Window)
|
BEGIN_PROPERTY(Menu_Window)
|
||||||
|
|
||||||
@ -826,6 +831,7 @@ GB_DESC CMenuDesc[] =
|
|||||||
MENU_DESCRIPTION,
|
MENU_DESCRIPTION,
|
||||||
|
|
||||||
GB_METHOD("Popup", NULL, Menu_Popup, "[(X)i(Y)i]"),
|
GB_METHOD("Popup", NULL, Menu_Popup, "[(X)i(Y)i]"),
|
||||||
|
GB_METHOD("Close", NULL, Menu_Close, NULL),
|
||||||
GB_METHOD("Delete", NULL, Menu_Delete, NULL),
|
GB_METHOD("Delete", NULL, Menu_Delete, NULL),
|
||||||
GB_METHOD("Show", NULL, Menu_Show, NULL),
|
GB_METHOD("Show", NULL, Menu_Show, NULL),
|
||||||
GB_METHOD("Hide", NULL, Menu_Hide, NULL),
|
GB_METHOD("Hide", NULL, Menu_Hide, NULL),
|
||||||
|
@ -182,22 +182,14 @@ END_PROPERTY
|
|||||||
|
|
||||||
BEGIN_PROPERTY(Mouse_ScreenX)
|
BEGIN_PROPERTY(Mouse_ScreenX)
|
||||||
|
|
||||||
#ifdef QT5
|
|
||||||
GB.ReturnInteger(QCursor::pos().x());
|
GB.ReturnInteger(QCursor::pos().x());
|
||||||
#else
|
|
||||||
GB.ReturnInteger(MOUSE_info.valid ? MOUSE_info.screenX : QCursor::pos().x());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
|
|
||||||
BEGIN_PROPERTY(Mouse_ScreenY)
|
BEGIN_PROPERTY(Mouse_ScreenY)
|
||||||
|
|
||||||
#ifdef QT5
|
|
||||||
GB.ReturnInteger(QCursor::pos().y());
|
GB.ReturnInteger(QCursor::pos().y());
|
||||||
#else
|
|
||||||
GB.ReturnInteger(MOUSE_info.valid ? MOUSE_info.screenY : QCursor::pos().y());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
END_PROPERTY
|
END_PROPERTY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user