the other on the gadget in Windows Os
why it is not implemented in Linux?
Code: Select all
flags = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered
OpenWindow(1, 0, 0, 600, 400, "Main Form", flags )
MainToolBar1 = CreateToolBar(1, WindowID(1))
If MainToolBar1
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
EndIf
ContainerGadget(1,10,50,550,160,#PB_Container_Flat)
MainToolBar2 = CreateToolBar(2, GadgetID(1))
If MainToolBar2
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
EndIf
CloseGadgetList()
Repeat :Event=WaitWindowEvent() :Until Event=#PB_Event_CloseWindow
Code: Select all
EnableExplicit
;XIncludeFile "/media/as/BC56CB3A56CAF3E4/Project/PureBasicDesigner/All.pbi" ;"WindowAllFunc/WaitWindowClose.pbi"
Structure PropType
Value.i
EndStructure
Structure PropMap
Map PropName.PropType()
EndStructure
Global NewMap Props.PropMap()
Procedure IDWindow(WindowID)
If MapSize(Props()) ;And Props(Str(WindowID))
ProcedureReturn (Props(Str(WindowID))\PropName("PB_WindowID")\Value) -1
EndIf
ProcedureReturn -1
EndProcedure
Procedure IDGadget(GadgetID)
If MapSize(Props()) ;And Props(Str(GadgetID))
ProcedureReturn (Props(Str(GadgetID))\PropName("PB_GadgetID")\Value) -1
EndIf
ProcedureReturn -1
EndProcedure
Procedure IsWindowID(WindowID)
If IsWindow(IDWindow(WindowID))
ProcedureReturn #True
EndIf
EndProcedure
Procedure IsGadgetID(GadgetID)
If IsGadget(IDGadget(GadgetID))
ProcedureReturn #True
EndIf
EndProcedure
Procedure SetWindow(Window)
If IsWindow(Window)
Props(Str(WindowID(Window)))\PropName("PB_WindowID")\Value = Window +1
EndIf
EndProcedure
Procedure SetGadget(Gadget)
If IsGadget(Gadget)
Props(Str(GadgetID(Gadget)))\PropName("PB_GadgetID")\Value = Gadget +1
EndIf
EndProcedure
ProcedureDLL SetParent(ChildID,ParentID) ;Set Parent
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If ParentID = #False
SetParent_(ChildID,GetDesktopWindow_())
ElseIf IsHandle(ParentID)
SetParent_(ChildID, ParentID)
If GetWindowLongPtr_(ParentID, #GWL_STYLE) & #WS_EX_COMPOSITED = #False
SetWindowLongPtr_(ParentID,#GWL_STYLE, GetWindowLongPtr_(ParentID, #GWL_STYLE)|#WS_EX_COMPOSITED)
EndIf
If GetWindowLong_(ChildID, #GWL_STYLE) & #WS_CHILD = #False
SetWindowLongPtr_(ChildID,#GWL_STYLE, GetWindowLongPtr_(ChildID, #GWL_STYLE)|#WS_CHILD|#WS_POPUP)
EndIf
EndIf
CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
Protected *Window.GTKWindow
Protected *Widget.GtkWidget
Protected *Fixed.GtkFixed
Protected Gadget
If Not IsWindowID(ChildID)
If IsGadgetID(ChildID)
*Widget.GtkWidget = ChildID :ChildID = *Widget\object
Gadget = IDGadget(ChildID)
*Widget.GtkWidget = ChildID :ChildID = *Widget\parent
If IsGadget(Gadget) And (GadgetType(Gadget) = #PB_GadgetType_Container Or GadgetType(Gadget) = #PB_GadgetType_Panel)
ChildID = gtk_widget_get_parent_(ChildID) ;если ContainerGadget или PanelGadget
EndIf
EndIf
If IsWindowID(ParentID)
*Fixed.GtkFixed = ParentID
ParentID = *Fixed\children
ElseIf IsGadgetID(ParentID)
*Widget.GtkWidget = ParentID
ParentID = *Widget\object
Gadget = IDGadget(ParentID)
If IsGadget(Gadget) And Not (GadgetType(Gadget) = #PB_GadgetType_Container Or GadgetType(Gadget) = #PB_GadgetType_Panel)
*Widget.GtkWidget = ParentID
ParentID = *Widget\parent
EndIf
EndIf
; gtk_widget_set_parent_window_(ChildID,ParentID)
; gtk_widget_set_parent_(ChildID,ParentID)
gtk_widget_reparent_(ChildID,ParentID)
EndIf
CompilerEndIf
EndProcedure
DisableExplicit
CompilerIf #PB_Compiler_IsMainFile
flags = #PB_Window_Invisible | #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered
hWnd=OpenWindow(1, 0, 0, 600, 400, "Main Form", flags ) :SetWindow(1)
;PanelGadget(1,10,50,550,160) :AddGadgetItem(1,-1,"yyy"):AddGadgetItem(1,-1,"ff"):CloseGadgetList() :SetGadget(1)
ContainerGadget(1,10,50,550,160,#PB_Container_Flat) :CloseGadgetList() :SetGadget(1)
MainToolBar = CreateToolBar(1, UseGadgetList(0));, WindowID(1))
If MainToolBar
ToolBarStandardButton(0, #PB_ToolBarIcon_New)
ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
EndIf
ButtonGadget(111,60,220,150,40,"move") :SetGadget(111)
ButtonGadget(112,210,220,150,40,"back1") :SetGadget(112)
ButtonGadget(113,360,220,150,40,"back2") :SetGadget(113)
HideWindow(1,0)
Repeat
Event=WaitWindowEvent()
If Event=#PB_Event_Gadget
If EventGadget()=111
SetParent(MainToolBar, GadgetID(1))
ElseIf EventGadget()=112
SetParent(MainToolBar, GadgetID(111))
ElseIf EventGadget()=113
SetParent(MainToolBar, WindowID(1))
EndIf
EndIf
Until Event=#PB_Event_CloseWindow
CompilerEndIf