; Module/File: Gadget_GetGtkStructure.pb ; Function: Get the gtk-type (name)-structure of widget up to window - Linux ; Author: Omi ; Date: Dec. 29, 2014 ; Version: 0.1 ; Target Compiler: PureBasic 5.22/5.31/5.40 ; Target OS: Linux: (X/K/L)ubuntu, Mint, 32/64, Ascii/Uni ;-------------------------------------------------------------- EnableExplicit #MainWin = 0 #ToolBar1 = 0 #StatusBar1= 0 #Text1 = 0 Global.i gEvent, gQuit Procedure GetGtkWidgetParents(GadgetID) Protected.i I Static Widget If GadgetID > 0 Debug Str(I) + ". " + PeekS(gtk_widget_get_name_(GadgetID), -1, #PB_UTF8) While GadgetID Widget = GadgetID GadgetID= gtk_widget_get_parent_(GadgetID) If GadgetID I+ 1 Debug Str(I) + ". " + PeekS(gtk_widget_get_name_(GadgetID), -1, #PB_UTF8) EndIf Wend EndIf Debug "---" EndProcedure If OpenWindow(#MainWin, #PB_Ignore, 32, 400, 200, "Gadget-Structure up to window (small example)", #PB_Window_ScreenCentered) If CreateToolBar(#ToolBar1, WindowID(#MainWin)) ToolBarStandardButton(0, #PB_ToolBarIcon_New) ToolBarStandardButton(1, #PB_ToolBarIcon_Open) ToolBarStandardButton(2, #PB_ToolBarIcon_Save) EndIf If CreateStatusBar(#StatusBar1, WindowID(#MainWin)) AddStatusBarField(100) StatusBarText(#StatusBar1, 0, "PB-StatusBar") EndIf TextGadget(#Text1, 5, 5, 100, 22, "TextGadget", #PB_Text_Border) Debug "TextGadget:" GetGtkWidgetParents(GadgetID(#Text1)) Debug "ToolBar:" GetGtkWidgetParents(ToolBarID(#ToolBar1)) Debug "StatusBar:" GetGtkWidgetParents(StatusBarID(#StatusBar1)) Else End EndIf Repeat gEvent = WaitWindowEvent() If EventWindow() = #MainWin Select gEvent Case #PB_Event_CloseWindow gQuit= #True EndSelect EndIf Until gQuit End ; IDE Options = PureBasic 5.45 LTS (Linux - x86) ; CursorPosition = 10 ; Folding = - ; EnableUnicode ; EnableXP