25 |
class MyModule(module.Module): |
class MyModule(module.Module): |
26 |
"""Test Window Frame class""" |
"""Test Window Frame class""" |
27 |
|
|
28 |
|
my_events = [X.Expose] |
29 |
my_actions = { |
my_actions = { |
30 |
"win_move" : "move", |
"win_move" : "move", |
31 |
"win_toggle_iconified" : "win_toggle_maximize", |
"win_toggle_iconified" : "win_toggle_maximize", |
54 |
#overall_width = font.query_text_extents("Phoenix [nightly]").overall_width |
#overall_width = font.query_text_extents("Phoenix [nightly]").overall_width |
55 |
gc = self.screen.root.create_gc(background = white_color, |
gc = self.screen.root.create_gc(background = white_color, |
56 |
forerground = black_color, |
forerground = black_color, |
57 |
font = font, |
font = font) |
|
event_mask = X.ExposureMask) |
|
58 |
|
|
59 |
for win in self.screen.root.query_tree().children: |
for win in self.screen.root.query_tree().children: |
60 |
self.build_win(win) |
self.build_win(win) |
83 |
print "build_win" |
print "build_win" |
84 |
appwin_width = appwin.get_geometry().width |
appwin_width = appwin.get_geometry().width |
85 |
appwin_height = appwin.get_geometry().height |
appwin_height = appwin.get_geometry().height |
86 |
|
appwin_x = appwin.get_geometry().x |
87 |
print self.colormap.alloc_named_color("#ff00ff") |
appwin_y = appwin.get_geometry().y |
88 |
bg_color = self.colormap.alloc_named_color("#ff0000") |
titlebar_height = 16 |
89 |
|
border_width = 1 |
90 |
# This surrounds the app window |
|
91 |
frame = self.display.screen().root.create_window(0, 10, |
bg_color = self.colormap.alloc_named_color("#ffec8b") |
92 |
appwin_width, appwin_height, 1, self.display.screen().root_depth, |
border_color = self.colormap.alloc_named_color("#666666") |
93 |
|
|
94 |
|
# This surrounds the app window and titlebar |
95 |
|
frame = self.display.screen().root.create_window(appwin_x, appwin_y, |
96 |
|
appwin_width, appwin_height + titlebar_height + (border_width * 2), 1, |
97 |
|
self.display.screen().root_depth, |
98 |
X.InputOutput, X.CopyFromParent, |
X.InputOutput, X.CopyFromParent, |
99 |
background_pixel = bg_color.pixel) |
background_pixel = bg_color.pixel, |
100 |
|
border_pixel = border_color.pixel, |
101 |
titlebar = self.display.screen().root.create_window(0, 0, |
event_mask = (X.ButtonMotionMask | X.ButtonPressMask)) |
102 |
appwin_width, 10, 1, self.display.screen().root_depth, |
|
103 |
|
# titlebar |
104 |
|
titlebar = frame.create_window(1, 1, |
105 |
|
appwin_width, titlebar_height, 1, |
106 |
|
self.display.screen().root_depth, |
107 |
X.CopyFromParent, X.CopyFromParent, |
X.CopyFromParent, X.CopyFromParent, |
108 |
background_pixel = self.colormap.alloc_named_color("#ff0000").pixel) |
background_pixel = bg_color.pixel, |
109 |
|
border_pixel = border_color.pixel) |
110 |
|
|
111 |
|
frame.map_sub_windows() |
112 |
frame.map() |
frame.map() |
|
titlebar.map() |
|
113 |
|
|
114 |
appwin.reparent(frame, 0, 0) |
appwin.reparent(frame, 0, titlebar_height) |
115 |
|
|
|
#titlebar = self.display.screen().root.create_window(80, 200, |
|
|
# 250, 200, 1, depth, |
|
|
# X.InputOutput, |
|
|
# X.CopyFromParent, |
|
|
# background_pixel = white_color) |
|
116 |
|
|
|
|
|
117 |
def move(self, event): |
def move(self, event): |
118 |
win.configure(x = dest_x, y = dest_y) |
win.configure(x = dest_x, y = dest_y) |
119 |
|
|
121 |
pass |
pass |
122 |
|
|
123 |
def handle_event(self, event): |
def handle_event(self, event): |
124 |
pass |
if event.type == X.Expose: |
125 |
|
print "EXPOSE" |
126 |
|
|
127 |
def win_toggle_maximize(self, win): |
def win_toggle_maximize(self, win): |
128 |
pass |
pass |