Пример #1
0
 void redraw() {
   if ((OS.GTK_WIDGET_FLAGS(parent.handle) & OS.GTK_REALIZED) != 0) {
     int /*long*/ parentHandle = parent.handle;
     int /*long*/ path = OS.gtk_tree_model_get_path(parent.modelHandle, handle);
     GdkRectangle rect = new GdkRectangle();
     OS.gtk_tree_view_get_cell_area(parentHandle, path, 0, rect);
     OS.gtk_tree_path_free(path);
     int /*long*/ window = OS.gtk_tree_view_get_bin_window(parentHandle);
     rect.x = 0;
     int[] w = new int[1], h = new int[1];
     OS.gdk_drawable_get_size(window, w, h);
     rect.width = w[0];
     OS.gdk_window_invalidate_rect(window, rect, false);
   }
 }
Пример #2
0
  void updateBar(int selection, int minimum, int maximum) {
    /*
     * Bug in GTK.  When a progress bar has been unrealized after being
     * realized at least once, gtk_progress_bar_set_fraction() GP's.  The
     * fix is to update the progress bar state only when realized and restore
     * the state when the progress bar becomes realized.
     */
    if ((OS.GTK_WIDGET_FLAGS(handle) & OS.GTK_REALIZED) == 0) return;

    double fraction = minimum == maximum ? 1 : (double) (selection - minimum) / (maximum - minimum);
    OS.gtk_progress_bar_set_fraction(handle, fraction);
    /*
     * Feature in GTK.  The progress bar does
     * not redraw right away when a value is
     * changed.  This is not strictly incorrect
     * but unexpected.  The fix is to force all
     * outstanding redraws to be delivered.
     */
    long /*int*/ window = paintWindow();
    OS.gdk_window_process_updates(window, false);
    OS.gdk_flush();
  }