Example #1
0
 Color _getForeground() {
   int /*long*/[] ptr = new int /*long*/[1];
   OS.gtk_tree_model_get(parent.modelHandle, handle, Table.FOREGROUND_COLUMN, ptr, -1);
   if (ptr[0] == 0) return parent.getForeground();
   GdkColor gdkColor = new GdkColor();
   OS.memmove(gdkColor, ptr[0], GdkColor.sizeof);
   return Color.gtk_new(display, gdkColor);
 }
Example #2
0
 Color _getForeground(int index) {
   int count = Math.max(1, parent.columnCount);
   if (0 > index || index > count - 1) return _getForeground();
   int /*long*/[] ptr = new int /*long*/[1];
   int modelIndex =
       parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns[index].modelIndex;
   OS.gtk_tree_model_get(parent.modelHandle, handle, modelIndex + Table.CELL_FOREGROUND, ptr, -1);
   if (ptr[0] == 0) return _getForeground();
   GdkColor gdkColor = new GdkColor();
   OS.memmove(gdkColor, ptr[0], GdkColor.sizeof);
   return Color.gtk_new(display, gdkColor);
 }
Example #3
0
 Image _getImage(int index) {
   int count = Math.max(1, parent.getColumnCount());
   if (0 > index || index > count - 1) return null;
   int /*long*/[] ptr = new int /*long*/[1];
   int modelIndex =
       parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns[index].modelIndex;
   OS.gtk_tree_model_get(parent.modelHandle, handle, modelIndex + Table.CELL_PIXBUF, ptr, -1);
   if (ptr[0] == 0) return null;
   ImageList imageList = parent.imageList;
   int imageIndex = imageList.indexOf(ptr[0]);
   if (imageIndex == -1) return null;
   return imageList.get(imageIndex);
 }
Example #4
0
 String _getText(int index) {
   int count = Math.max(1, parent.getColumnCount());
   if (0 > index || index > count - 1) return "";
   int /*long*/[] ptr = new int /*long*/[1];
   int modelIndex =
       parent.columnCount == 0 ? Table.FIRST_COLUMN : parent.columns[index].modelIndex;
   OS.gtk_tree_model_get(parent.modelHandle, handle, modelIndex + Table.CELL_TEXT, ptr, -1);
   if (ptr[0] == 0) return "";
   int length = OS.strlen(ptr[0]);
   byte[] buffer = new byte[length];
   OS.memmove(buffer, ptr[0], length);
   OS.g_free(ptr[0]);
   return new String(Converter.mbcsToWcs(null, buffer));
 }
Example #5
0
 /**
  * Sets the grayed state of the checkbox for this item. This state change only applies if the
  * Table was created with the SWT.CHECK style.
  *
  * @param grayed the new grayed state of the checkbox;
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public void setGrayed(boolean grayed) {
   checkWidget();
   if ((parent.style & SWT.CHECK) == 0) return;
   if (this.grayed == grayed) return;
   this.grayed = grayed;
   /*
    * GTK+'s "inconsistent" state does not match SWT's concept of grayed.
    * Render checked+grayed as "inconsistent", unchecked+grayed as blank.
    */
   int /*long*/[] ptr = new int /*long*/[1];
   OS.gtk_tree_model_get(parent.modelHandle, handle, Table.CHECKED_COLUMN, ptr, -1);
   OS.gtk_list_store_set(
       parent.modelHandle, handle, Table.GRAYED_COLUMN, ptr[0] == 0 ? false : grayed, -1);
   cached = true;
 }
Example #6
0
 boolean _getChecked() {
   int /*long*/[] ptr = new int /*long*/[1];
   OS.gtk_tree_model_get(parent.modelHandle, handle, Table.CHECKED_COLUMN, ptr, -1);
   return ptr[0] != 0;
 }