OSDN Git Service

hide or show vscrollbar.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 9 Dec 2007 20:49:58 +0000 (05:49 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sun, 9 Dec 2007 20:49:58 +0000 (05:49 +0900)
src/FukuiNoNamari/thread_view.py

index 6722770..120bd64 100644 (file)
@@ -63,6 +63,7 @@ class ThreadView(gtk.HBox):
         self.adjustment.upper = pangolayout.posY + y
         self.prevent_adjustment_overflow()
         self.redraw()
+        self.change_vscrollbar_visible()
 
     def create_pango_layout(self, text):
         return self.drawingarea.create_pango_layout(text)
@@ -84,6 +85,13 @@ class ThreadView(gtk.HBox):
             sum_height += y
         self.adjustment.upper = sum_height
         self.prevent_adjustment_overflow()
+        self.change_vscrollbar_visible()
+
+    def change_vscrollbar_visible(self):
+        if self.adjustment.upper < self.adjustment.page_size:
+            self.vscrollbar.hide()
+        else:
+            self.vscrollbar.show()
 
     def jump(self, value):
         if value > self.adjustment.upper - self.adjustment.page_size:
@@ -134,6 +142,7 @@ class ThreadView(gtk.HBox):
         self.adjustment.page_increment = self.drawingarea.allocation.height
 
         self.prevent_adjustment_overflow()
+        self.change_vscrollbar_visible()
 
     def prevent_adjustment_overflow(self):
         if (self.adjustment.value >