Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/FakeMenuBar/FakeMenuBar
Function:
Required plugins for this example: MBS MacCG Plugin, MBS Picture Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/FakeMenuBar/FakeMenuBar
This example is the version from Thu, 16th Nov 2016.
Project "FakeMenuBar.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Activate() if not SystemInformationMBS.isMacOSX then MsgBox "Sorry, this is Mac-OSX only!" quit end if FakeMenuBar.Show MenuBar1 End EventHandler
EventHandler Sub Open() app.FrontmostMBS = True End EventHandler
End Class
Class Window1 Inherits Window
Control BevelButton1 Inherits BevelButton
ControlInstance BevelButton1 Inherits BevelButton
EventHandler Sub Action() FakeMenuBar.Show MenuBar1 End EventHandler
End Control
Control BevelButton2 Inherits BevelButton
ControlInstance BevelButton2 Inherits BevelButton
EventHandler Sub Action() FakeMenuBar.Close End EventHandler
End Control
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
EventHandler Sub Open() me.SelStart = 169 me.SelLength = 11 me.SelUnderline = true me.SelStart = 226 me.SelLength = 26 me.SelBold = true me.SelStart = 289 me.SelLength = 17 me.SelBold = true me.SelStart = 308 me.SelLength = 67 me.SelItalic = true me.SelStart = 429 me.SelLength = 12 me.SelBold = true me.SelStart = 442 me.SelLength = 200 me.SelItalic = true me.SelLength = 0 End EventHandler
EventHandler Sub SelChange() StaticText1.text=str(me.SelStart) StaticText2.text=str(me.SelLength) End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control BevelButton4 Inherits BevelButton
ControlInstance BevelButton4 Inherits BevelButton
EventHandler Sub Action() FakeMenuBar.Hide End EventHandler
End Control
EventHandler Sub Close() quit End EventHandler
Function ApplicationAbout() As Boolean MsgBox "Fake Menu Bar" Return True End Function
Function ApplicationPreferences() As Boolean MsgBox "Preferences" Return True End Function
Function ApplicationQuit() As Boolean Quit Return True End Function
Function FileOpen() As Boolean MsgBox "File Open..." Return True End Function
Function FileSave() As Boolean MsgBox " File Save" Return True End Function
End Class
MenuBar MenuBar1
MenuItem ApplicationMenu = "FakeMenuBar Demo"
MenuItem ApplicationAbout = "About FakeMenuBar Demo..."
MenuItem UntitledSeparator0 = "-"
MenuItem ApplicationPreferences = "Preferences..."
MenuItem UntitledSeparator = "-"
MenuItem ApplicationQuit = "Quit FakeMenuBar"
MenuItem FileMenu = "&File"
MenuItem FileOpen = "Open"
MenuItem FileSave = "Save"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class FakeMenuBarMBS Inherits EasyOverlayWindow
EventHandler Function MouseDown(x As Integer, y As Integer, ModifierKeys As Integer,MouseButton as integer, ClickCount As Integer) As Boolean // check if the mouse click is ok if x < mPosition(0)-10 then Return True // too much left - ignore it if x>mPosition(UBound(mPosition))+mWidth(UBound(mWidth)) then Return True // too much right - ignore it Dim i As Integer dim m As MenuItem = GetMenuItem(X, i) // Get the MenuItem at the mouse x position and set i to the clicked item number if m <> nil then // a item was clicked // Draw the blue background for the selected Item ForeColor = &c2364E2 FillRect mPosition(i)-10, 0, mWidth(i), me.Height // Draw the MenuItem text Bold = (i=0) // The first Item is Bold ForeColor = &cffffff // selected item text color is white DrawString ItemName(i), mPosition(i), 0 // Draw the MenuItem text DrawWindow // Execute the drawing // PopUp the MenuItem dim hit As MenuItem hit = m.PopUp(mPosition(i)-10, self.Height+4) me.Refresh // redraw the MenuItem (Trigger the Paint event) end if Return true Exception End EventHandler
EventHandler Sub Paint(g As EasyOverlayWindow) dim i As Integer // Draw the menubar background g.DrawPicture Backdrop,0,0 g.ForeColor = &c000000 // unselected item text color is black // Draw the items for i = 0 to TheMenubar.Count - 1 g.Bold = (i=0) // The first Item is Bold g.DrawString ItemName(i), mPosition(i), 0 // Draw the MenuItem text next Exception End EventHandler
Private Sub CreateBackdrop() // Create MenuBar background picture and set the size/position of the MenuBar me.Height = 22 // MenuBar height dim i As Integer dim h As Integer = me.Height dim s As Screen = Screen(0) dim leo As Boolean = isLeopard dim b As Picture // create the MenuBar background dim p As Picture = new Picture(s.Width, h, 32) if leo then b= mRightLeo else b= mRightPic end if dim mMidPic As Picture = new Picture(12,h,32) mMidPic.Graphics.DrawPicture b, 0, 0 // Fill the MenuBar for i = 0 to s.Width/mMidPic.Width p.Graphics.DrawPicture mMidPic, i * mMidPic.Width, 0 next // draw right pic p.Graphics.DrawPicture b, p.Width-b.Width, 0 // Draw left pic if leo then b= mLeftLeo else b= mLeftPic end if p.Graphics.DrawPicture b, 0, 0 // MenuBar transparency If leo and MenuBarTranslucent then MakeTransparent p me.Backdrop = p // save the MenuBar picture Exception End Sub
Private Function GetMenuItem(X As Integer, ByRef ClickedItem As Integer) As MenuItem // return the MenuItem at the mouse X position - triggert by MouseDown Dim i As Integer for i = UBound(mPosition) DownTo 0 if X > mPosition(i)-10 then ClickedItem = i Return TheMenuBar.Item(i) end if next Exception End Function
Sub InitMenuBar() // save all MenuBar items position and width so we know where to draw it (and where to click) dim w As Integer dim s As String dim i, o As Integer dim p As Picture = new Picture(32, 32, 32) // a dummy to calculate the stringwidth dim g As Graphics = p.Graphics // Mac OSX system font g.TextFont = SystemInformationMBS.SystemFont g.TextSize = 14 o = 54 // left position of the first MenuItem for i = 0 to TheMenuBar.Count -1 g.Bold =( i=0) // The Application MenuItem is bold ( 1st Item ) // get the MenuItem.Text s = ItemName(i) // calculate the width w = g.StringWidth(s) // save the MenuItem width so we know where to draw it (and where to click) mWidth.Append w + 19 // +19 is the space between the menuitems // save the MenuItem position so we know where to draw it (and where to click) mPosition.Append o o = o + w + 19 // the left position for the next MenuItem next CreateBackdrop // Create menu backdrop // Set the system font TextFont = SystemInformationMBS.SystemFont TextSize = 14 me.ShowWindow // show the FakeMenuBar Exception End Sub
Private Function ItemName(nr As Integer) As String // Returns the MenuItem name (text) Return Replace(TheMenubar.Item(nr).Text, "&", "") Exception End Function
Private Sub MakeTransparent(ByRef p As Picture) // Make the FakeMenuBar transparent (Leopard Only) dim dp As Picture = GetFolderItem( GetDesktopPicturePath ).OpenAsPicture // Get the DesktopPicture if dp = Nil then Return // DesktopPicture not found dp = dp.scaleMBS(screen(0).width, screen(0).Height) // Scale the DesktopPicture dp= dp.TrimMBS(0, 0, dp.Width, me.Height) // trim it to the size of the MenuBar dp = dp.ChangeBrightnessAbsoluteMBS(100) // brighten it up a bit dim m As Picture = new Picture(p.Width, p.Height,32) if m <> NIL Then m.Graphics.DrawPicture p, 0, 0 // copy of he original MenuBar picture m.Mask.Graphics.ForeColor = &c707070 // set the transparency m.Mask.Graphics.FillRect 0, 0, m.Width, m.Height p.Graphics.DrawPicture dp, 0, 0, p.Width,p.Height // Draw the DesktopPicture p.Graphics.DrawPicture m, 0, 0, p.Width,p.Height // Draw the transparent MenuBar on top end if End Sub
Private Function MenuBarTranslucent() As Boolean // Check if the MenuBar is translucent (Leopard only) dim s As new shell s.Execute "defaults read -g AppleEnableMenuBarTransparency" Return val(s.Result) = 1 End Function
Private Function isLeopard() As Boolean // used by CreateBackdrop so we know what type of MenuBar to draw dim d As Double = val(mid(SystemInformationMBS.OSVersionString,10,4)) if d > 10.4 then Return true End Function
Property Private Backdrop As Picture
pic of the empty menubar (created in SetupWindow)
Property TheMenubar As MenuItem
the application MenuBar
Property Private mPosition() As Integer
array of the MenuItem positions - set in InitMenuBar
Property Private mWidth() As Integer
array of the MenuItem widths - set in InitMenuBar
End Class
Class EasyOverlayWindow Inherits OverlayWindowMBS
Event MouseDown(x As Integer, y As Integer, ModifierKeys As Integer,MouseButton as integer, ClickCount As Integer) As Boolean End Event
Event MouseDrag(x As Integer, y As Integer, ModifierKeys As Integer,MouseButton as integer) End Event
Event MouseMove(X As Integer, Y As Integer,ModifierKeys As Integer) End Event
Event MouseUp(x As Integer, y As Integer, ModifierKeys As Integer,MouseButton as integer, ClickCount As Integer) End Event
Event Paint(g As EasyOverlayWindow) End Event
Event WindowDragAction(X As Integer, Y As Integer) End Event
EventHandler Function MouseDown(x as double, y as double, ModifierKeys as integer, MouseButton as integer, ClickCount as integer) As boolean MouseClicked=MouseDown(x-left,y-top,ModifierKeys, MouseButton, ClickCount) if Moveable then return true end if if MouseClicked then Return True End EventHandler
EventHandler Function MouseDragged(x as double, y as double, ModifierKeys as integer, MouseDeltaX as double, MouseDeltaY as double, MouseButton as integer) As boolean if Moveable then top=top+MouseDeltaY left=left+MouseDeltaX if MouseDeltaX<>0 or MouseDeltaY<>0 then WindowDragAction left,top end if if MouseClicked then MouseDrag x-left,y-top,ModifierKeys, MouseButton end if End EventHandler
EventHandler Function MouseMoved(x as double, y as double, ModifierKeys as integer, MouseDeltaX as double, MouseDeltaY as double) As boolean MouseMove x-left,y-top,ModifierKeys End EventHandler
EventHandler Function MouseUp(x as double, y as double, ModifierKeys as integer, MouseButton as integer, ClickCount as integer) As boolean if MouseClicked then MouseUp x-left,y-top,ModifierKeys, MouseButton, ClickCount end if End EventHandler
Private Sub AddOval(c as CGContextMBS, center as CGPOintMBS, a as single, b as single) dim pi as single pi=ACos(0)*2.0 c.SaveGState c.TranslateCTM center.x, center.y c.ScaleCTM a,b c.MoveToPoint 1,0 c.AddArc 0, 0, 1, 0.0, 2*pi, false c.ClosePath c.RestoreGState End Sub
Sub Clear() myContext.ClearRect myRect End Sub
Sub Constructor(wLeft As Integer, wTop As Integer, wWidth As Integer, wHeight As Integer, AttachedWindow As Window = NIL) Init wLeft, wTop, wWidth, wHeight, AttachedWindow End Sub
Sub DrawBevelFrame(x As Integer, y As Integer, w As Integer, h As integer, TopLeftColor As color, ButtomRightColor As color) dim d,i,LineWidthMerk As integer dim ColorMerk As color ColorMerk=foreColor // Remember ForeColor LineWidthMerk=LineWidth// Remember LineWidth d=ceil(LineWidth/2) LineWidth=1 for i= 1 to LineWidthMerk ForeColor=ButtomRightColor //Draw ButtomRight DrawLine x+w-i, y+i, x+w-i, y+h //right vert DrawLine x+i, y+h-i, x+w-i, y+h-i //down hor ForeColor=TopLeftColor // Draw TopLeft DrawLine x, y+i, x+w-i, y+i //Up hor DrawLine x+i, y, x+i, y+h-i // left vert next ForeColor=ColorMerk // Set ForeColor as it was before LineWidth=LineWidthMerk // set LineWidth as it was before End Sub
Sub DrawLine(x1 As integer, y1 As integer, x2 As integer, y2 As integer) dim ct As CGContextMBS dim yy1 As integer, yy2 ,xx1,xx2 As integer dim c As color 'c=rgb(255,0,0) 'myForeColor xx1=x1'+LineWidth/2 xx2=x2'+LineWidth/2 yy1=height-y1 yy2=height-y2 ct=myContext ct.beginPath ct.moveToPoint xx1,yy1 ct.AddLineToPoint xx2,yy2 ct.strokePath End Sub
Sub DrawOval(x As Integer, y As Integer, w As Integer, h As Integer) dim c as CGContextMBS dim center as CGPointMBS dim yy,l As integer yy=height-y l=lineWidth/2 center=CGMakePointMBS(x+l+w/2,yy-l-h/2) c=myContext c.BeginPath AddOval c,center, w/2,h/2 c.strokePath End Sub
Sub DrawOverlayString(Text As string, x As integer, y As Integer) dim c As CGContextMBS c=myContext c.selectFont TextFont, TextSize, 1 c.ShowTextAtPoint text,x,height-y-TextSize End Sub
Sub DrawPicture(p As Picture, x As Integer, y As integer) dim r As CGRectMBS dim ci As CGImageMBS ci=CGCreateImageMBS(p,p.mask) r=CGMakeRectMBS(x,height-p.height-y, p.width, p.height) myContext.DrawPicture ci,r End Sub
Sub DrawRect(x As integer, y As integer, w As integer, h As integer) dim r As CGRectMBS dim d As integer d=ceil(LineWidth/2) r=CGMakeRectMBS(x+d,height-h-y+d,w-LineWidth,h-LineWidth) myContext.strokerect r End Sub
Sub DrawRoundRect(x As Integer, y As Integer,w As Integer, h As Integer,arcx As integer,arcy as integer) doDrawRoundRect x+Linewidth/2, y+LineWidth/2, w-lineWidth, h-LineWidth, arcx, arcy,false End Sub
Sub DrawString(Text As string, x As integer, y As Integer) dim ac As Integer DrawPicture StringPic(Text, ac), x, y-ac End Sub
Sub DrawStringWithShadow(text As string, x As Integer, y As Integer, ShadowSize As integer, ShadowTransparency As Integer, ShadowColor as Color=&c000000) dim colorMerk As Color dim transMerk As Integer ColorMerk=ForeColor transMerk=ForeColorTransparency // set Shadow values ForeColor=ShadowColor ForeColorTransparency=ShadowTransparency // Draw Shadow DrawString text,x+ShadowSize,y+shadowSize // set String values ForeColor=colorMerk ForeColorTransparency=transMerk // draw string DrawString text,x,y End Sub
Sub DrawWindow() myContext.flush End Sub
Sub FadeIn(duration As double = 1, async As Boolean = True) myContext.Flush show call TransitionOverlay(me, 4, 1, async, duration) End Sub
Sub FadeOut(duration As double = 1, async As Boolean = True) call TransitionOverlay(me, 4, 2, async, duration) End Sub
Sub FillOval(x As integer, y As integer, w As integer, h As integer) dim c as CGContextMBS dim center as CGPointMBS dim yy,xx As integer yy=height-y xx=width-x center=CGMakePointMBS(x+w/2,yy-h/2) c=myContext c.BeginPath AddOval c,center, w/2,h/2 c.FillPath End Sub
Sub FillRect(x As Integer, y As Integer, w As Integer, h As Integer) dim r As CGRectMBS r=CGMakeRectMBS(x,height-h-y,w,h) myContext.Fillrect r End Sub
Sub FillRoundRect(x As Integer, y As Integer,w As Integer, h As Integer,arcx As integer,arcy as integer) doDrawRoundRect x,y,w,h,arcx,arcy,true End Sub
Function ForeColor() As Color return myForeColor End Function
Sub ForeColor(Assigns c As Color) myContext.setRGBFillColor c.red/255, c.green/255, c.blue/255, ForeColorTransparency/255 myContext.SetRGBStrokeColor c.red/255, c.green/255, c.blue/255, ForeColorTransparency/255 myForeColor=c End Sub
Function ForeColorTransparency() As Integer return myTransparency End Function
Sub ForeColorTransparency(Assigns v As Integer) dim c As color c=ForeColor myContext.setRGBFillColor c.red/255, c.green/255, c.blue/255, v/255 myContext.SetRGBStrokeColor c.red/255, c.green/255, c.blue/255, v/255 myTransparency=v End Sub
Private Sub Init(wLeft As Integer, wTop As Integer, wWidth As integer, wHeight As integer,AttachedWindow As window=nil) // Create Overlay Window ' if me.Create(wLeft,wTop,wWidth,wHeight)<>0 then beep InstallEventHandler if AttachedWindow<>NIL then AttachToWindow(AttachedWindow, true) // Create RECT and CONTEXT myRect=CGMakeRectMBS(0,0,me.width,me.height) myContext=me.context myContext.ClearRect myRect // set Defaults foreColor=rgb(0,0,0) ForeColorTransparency=255 LineWidth=1 TextFont=SystemInformationMBS.SystemFont TextSize=12 Width=wWidth Height=wHeight End Sub
Function LineWidth() As single Return myLineWidth End Function
Sub LineWidth(Assigns v As single) myContext.setLineWidth(v/2) myLineWidth=v/2 End Sub
Function Moveable() As Boolean Return myMoveable End Function
Sub Moveable(Assigns b As Boolean) myMoveable = b if b then me.IgnoreClicks = False End Sub
Sub Refresh() if myContext<>NIL and myRect<>Nil then Paint me myContext.flush end if End Sub
Sub ShowWindow(Options As Integer = 0) me.Show me.Refresh End Sub
Sub SmoothMovement(X As Integer, Y As Integer, duration As double = 1, async As Boolean = False) SmoothResizeAndMovement X, Y, me.Width, me.Height, duration, async End Sub
Sub SmoothResize(w As Integer, h As Integer, duration As double = 1, async As Boolean = False) SmoothResizeAndMovement me.left, me.top, w, h, duration, async End Sub
Sub SmoothResizeAndMovement(X As Integer, Y As Integer, w As Integer, h As Integer, duration As double = 1, async As Boolean = False) dim effect, action As Integer effect = 3 action = 3 call TransitionOverlay(me, effect, action, X, Y, w, h, async, duration) End Sub
Private Function StringPic(s As string, byRef Ascent As Integer) As Picture // Calculate the picture size dim w, h As Integer dim d As Picture = new Picture(32, 32, 32) // Dummy pic to calculate StringWidth and stringheight d.Graphics.TextFont = TextFont d.Graphics.TextSize = TextSize d.Graphics.Bold = Bold d.Graphics.Italic = Italic d.Graphics.Underline = Underline w=d.Graphics.StringWidth(s) h=d.Graphics.StringHeight(s,w) // Create the picture with the calculated size dim p As Picture = new Picture(w, h, 32) dim g As Graphics = p.Graphics dim mg As Graphics = p.Mask.Graphics // set Graphics text values mg.TextFont = TextFont mg.TextSize = TextSize mg.Bold = Bold mg.Italic = Italic mg.Underline = Underline // Text Color g.ForeColor = ForeColor g.FillRect 0,0,g.Width,g.Height // fill the picture with text color // clear the mask and make it full transparent mg.ForeColor = &cffffff mg.FillRect 0,0,g.Width,g.Height // draw the string into the mask mg.ForeColor = &c000000 mg.DrawString s, 0, p.Height - mg.TextAscent Ascent = mg.TextAscent / 3 Return p End Function
Function StringWidth(text As String) As Integer dim p As picture dim g As graphics p = new Picture(1,1,1) // Dummy Picture g=p.graphics g.TextFont=TextFont g.TextSize=TextSize g.Bold = Bold g.Underline = Underline g.Italic = Italic return g.stringWidth(text) End Function
Sub Update() myRect=CGMakeRectMBS(0,0,width,height) myContext=me.context myContext.ClearRect myRect refresh End Sub
Private Sub doDrawRoundRect(x As Integer, y As Integer,w As Integer, h As Integer,arcx As integer,arcy as integer,filled As boolean) dim ct As CGContextMBS dim yy, xp, yp As integer yy=height-h-y ct=myContext ct.beginPath xp=x+arcX yp=yy ct.MoveToPoint xp,yp //goto TopLeft xp=xp+w - 2*arcx ct.AddLineToPoint xp,yp // top line xp=xp+arcx ct.AddQuadCurveToPoint xp, yp, xp, yp+arcy // TopRight corner yp=yp+h-arcy ct.AddLineToPoint xp,yp // right line yp=yp+arcy ct.AddQuadCurveToPoint xp, yp, xp-arcx, yp // Bottom/Right Corner xp=xp-w+arcx ct.addLineToPoint xp, yp //bottom line xp=x yp=yp-arcy ct.AddQuadCurveToPoint xp, yp+arcy, xp, yp //BottomLeft corner yp=yy+arcy ct.addLineToPoint xp,yp // left line ct.AddQuadCurveToPoint x, yy, x+arcX, yy // TopLeft corner if filled then ct.fillPath else ct.StrokePath end if End Sub
Note "Info"
EasyOverlay is a easy to use OverlayWindowMBS You can use it almost like a Graphics Class This Methods and Properties are equal with the Graphics Class: DrawLine x1,y1,x2,y2 DrawOval x, y, width, height FillOval x, y, width, height DrawRect x, y, width, height FillRect x, y, width, height DrawRoundRect x As Integer, y As Integer, width As Integer, height As Integer, arcx As integer, arcy as integer FillRoundRect x As Integer, y As Integer, width As Integer, height As Integer, arcx As integer, arcy as integer DrawPicture p, x, y // No scaling yet! DrawString text, x, y TextSize TextFont StringWidth ForeColor Bold Italic Underline New Methods: DrawStringWithShadow text As string, x As Integer, y As Integer, ShadowSize As integer, ShadowTransparency As Integer, ShadowColor as Color DrawBevelFrame x As Integer, y As Integer, width As Integer, height As integer, TopLeftColor As color, ButtomRightColor As color Refresh (Fire the Paint Event) Clear (Clear the content of the OverlayWindow) Update (use it after you resized the overlay) Show DrawWindow (use it after you draw outside the Paint Event) FadeIn duration As Double = 1, async As Boolean = False FadeOut duration As Double = 1, async As Boolean = False New Properties: ForeColorTransparency as Integer (0=transparent, 255=opaque) LineWidth as Integer (Use this insteat of PenWidth/PenHeight) Moveable as boolean (if true, the overlay can be draged) IgnoreClicks as Boolean (True by default, If you set this to False you can handle mouse clicks) Counstructor: Exemples: This Example creates a moveable OverlayWindow // Create a Class name: "TestOverlay" Super: "EasyOverlayWindow" // Add a Propertie "myTestOverlay as TestOverlay" to your 'App Class' // Put this code into the 'Open Event' of your 'App Class' myTestOverlay =new TestOverlay(200,200,400,200) myTestOverlay.Moveable=true // IgnoreClicks will set to False automatically myTestOverlay.ShowWIndow // Put this code into the 'Paint Event' of 'TestOverlay' g.ForeColorTransparency=127 g.FillRoundRect 0,0,400,200,10,10 g.ForeColorTransparency=255 g.ForeColor=rgb(0,0,255) g.DrawString "My first EasyOverlayWindow",100,50
Property Protected Bold As Boolean
Property Protected Italic As Boolean
Property Private MouseClicked As Boolean
Property Protected TextFont As String
Property Protected TextSize As Integer
Property Protected Underline As Boolean
Property Private myContext As CGContextMBS
Property Private myForeColor As Color
Property Private myLineWidth As single
Property Private myMoveable As Boolean
Property Private myRect As CGRectMBS
Property Private myTransparency As Integer
End Class
Module FakeMenuBar
Protected Sub Close() if myFakeMenuBar <> nil then myFakeMenuBar.Close myFakeMenuBar = nil end if Exception End Sub
Protected Sub Hide() if myFakeMenuBar <> Nil then myFakeMenuBar.Hide myFakeMenuBar.Refresh end if Exception End Sub
Protected Sub Show(aMenuBar As Menuitem) if myFakeMenuBar = NIL then dim s As Screen = Screen(0) myFakeMenuBar = new FakeMenuBarMBS(s.left,s.top,s.width,22) // Create the OverlayWindow myFakeMenuBar.IgnoreClicks=false // Enable the Mouse click events myFakeMenuBar.TheMenubar = aMenuBar // pass the MenuBar myFakeMenuBar.HideOnSuspend = true // hide the MenuBar if the application goes out of focus myFakeMenuBar.InitMenuBar else // if it was hidden, just show it again myFakeMenuBar.Show myFakeMenuBar.Refresh end if Exception End Sub
Note "FakeMenuBar Info"
------------------------------- --- FakeMenuBar Version 1.3 ---- ------------------------------- The MBSPlugin is required! FakeMenuBar let you have a MenuBar in 'background only' applications. How to use: Just build your regular MenuBar and use: FakeMenuBar.Show(MenuBar1) To close the FakeMenuBar use. FakeMenuBar.Close This will close the FakeMenubar and free all used system resources. If you want to just hide the FakeMenuBar use: FakeMenuBar.Hide Note: The FakeMenuBar will hide automatically if the application goes out ouf focus. Don't use 'AppleMenuItem', 'PrefsMenuItem' or 'QuitMenuItem' in your application. Build your own AppleMenu instead
Property Private myFakeMenuBar As FakeMenuBarMBS
End Module
ExternalFile GetDesktopPicturePath
End ExternalFile
ExternalFile mLeftLeo
End ExternalFile
ExternalFile mLeftPic
End ExternalFile
ExternalFile mRightLeo
End ExternalFile
ExternalFile mRightPic
End ExternalFile
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacCG Plugin.




Links
MBS Xojo Chart Plugins