File: extendedDisplay.c

package info (click to toggle)
ggobi 2.1.9~20091212-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 19,340 kB
  • ctags: 5,083
  • sloc: ansic: 57,242; xml: 30,604; cpp: 833; makefile: 355; java: 225; perl: 201; sh: 122; python: 23
file content (95 lines) | stat: -rw-r--r-- 2,313 bytes parent folder | download | duplicates (4)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* extendedDisplay.c */
/*
 * ggobi
 * Copyright (C) AT&T, Duncan Temple Lang, Dianne Cook 1999-2005
 *
 * ggobi is free software; you may use, redistribute, and/or modify it
 * under the terms of the Common Public License, which is distributed
 * with the source code and displayed on the ggobi web site, 
 * www.ggobi.org.  For more information, contact the authors:
 *
 *   Deborah F. Swayne   dfs@research.att.com
 *   Di Cook             dicook@iastate.edu
 *   Duncan Temple Lang  duncan@wald.ucdavis.edu
 *   Andreas Buja        andreas.buja@wharton.upenn.edu
*/

#include "ggobi.h"
#include "display.h"

const gchar *                   /*const */
ggobi_display_tree_label (displayd * dpy)
{
  GGobiExtendedDisplayClass *klass;
  gchar *const label = "?";
  klass = GGOBI_EXTENDED_DISPLAY_GET_CLASS (dpy);
  if (klass->treeLabel)
    return (klass->treeLabel);
  if (klass->tree_label)
    return (klass->tree_label (dpy));

  return (label);
}

const gchar *                   /*const */
ggobi_display_title_label (displayd * dpy)
{
  GGobiExtendedDisplayClass *klass;
  extendedDisplayd *edpy;
  gchar *const label = "?";

  edpy = GGOBI_EXTENDED_DISPLAY (dpy);
  if (edpy->titleLabel) {
    return (edpy->titleLabel);
  }

  klass = GGOBI_EXTENDED_DISPLAY_GET_CLASS (dpy);
  if (klass->titleLabel)
    return (klass->treeLabel);
  if (klass->title_label)
    return (klass->title_label (dpy));


  return (label);
}



/********************************/


/*
 Add by type and deduce the class from that.

 Can add be specifying pointers to routines to get the GType.
 Also can do this with dlsym() to resolve a routine by name.
 And can also lookup the name of a previously instantiated GType.
*/

GSList *ExtendedDisplayTypes = NULL;

int
addDisplayType (GType type)
{
  GObjectClass *klass;
  if (!g_type_is_a (type, GGOBI_TYPE_EXTENDED_DISPLAY)) {
    g_printerr ("%s is not a GType that extends GGobiExtendedDisplay",
                g_type_name (type));
  }
  klass = g_type_class_ref (type);
  ExtendedDisplayTypes = g_slist_append (ExtendedDisplayTypes, klass);
  return (g_slist_length (ExtendedDisplayTypes));
}


void
registerDisplayTypes (const GTypeLoad * const loaders, int n)
{
  int i;
  GType type;

  for (i = 0; i < n; i++) {
    type = loaders[i] ();
    addDisplayType (type);
  }
}