summary refs log tree commit diff stats
path: root/tests/concepts/libs
Commit message (Expand)AuthorAgeFilesLines
* fixes #7222; fixes #5595; fixes #3747Zahary Karadjov2018-06-162-0/+38
=b559285b78bfa76533d25e77f3f61cab2427bb03'>b559285b7 ^
405b86068




b559285b7 ^

405b86068
b559285b7 ^





405b86068
b559285b7 ^

405b86068

405b86068

b559285b7 ^

4ee65a08d ^

b559285b7 ^







795afb002 ^
405b86068
b559285b7 ^







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50




             

                              




                                             

                                                          
 





                                                                
        

                                             

    

                               

                                        

                                                







                                                                        
                                                                
                        







                                                               
import 
  glib2, gtk2

type 
  TButtonSignalState = object 
    Obj: gtk2.PObject
    SignalID: int32
    Disable: bool

  PButtonSignalState = ptr TButtonSignalState

proc destroy(widget: pWidget, data: pgpointer){.cdecl.} = 
  main_quit()

proc widgetDestroy(w: PWidget) {.cdecl.} = destroy(w)

proc disablesignal(widget: pWidget, data: pgpointer){.cdecl.} = 
  var s = cast[PButtonSignalState](Data)
  if s.Disable: 
    signal_handler_block(s.Obj, s.SignalID)
  else: 
    signal_handler_unblock(s.Obj, s.SignalID)
  s.disable = not s.disable

var 
  QuitState: TButtonSignalState

nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var quitbutton = button_new("Quit program")
var disablebutton = button_new("Disable button")
var windowbox = vbox_new(TRUE, 10)
pack_start(windowbox, disablebutton, True, false, 0)
pack_start(windowbox, quitbutton, True, false, 0)
set_border_width(Window, 10)
add(window, windowbox)
discard signal_connect(window, "destroy", SIGNAL_FUNC(ex6.destroy), nil)
QuitState.Obj = QuitButton
quitState.SignalID = signal_connect_object(QuitState.Obj, "clicked", 
                       SIGNAL_FUNC(widgetDestroy), window).int32
QuitState.Disable = True
discard signal_connect(disablebutton, "clicked", 
                   SIGNAL_FUNC(disablesignal), addr(QuitState))
show(quitbutton)
show(disablebutton)
show(windowbox)
show(window)
main()