C++ SDK Reference  12.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diguyViewLabel.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 1992-2013 Boston Dynamics
4  * ALL RIGHTS RESERVED.
5  *
6  * These coded instructions, statements, and computer programs
7  * contain unpublished proprietary information of Boston Dynamics
8  * and are protected by Copyright Laws of the United States.
9  * They may not be used, duplicated, or disclosed in any form, in
10  * whole or in part, without the prior written consent from Boston
11  * Dynamics.
12  *
13  * RESTRICTED RIGHTS LEGEND
14  * Use, duplication, or disclosure by the government is subject
15  * to restrictions as set forth in FAR 52.227.19(c)(2) or
16  * subparagraph (c)(1)(ii) of the Rights in Technical Data and
17  * Computer Software clause at DFARS 252.227-7013 and/or in
18  * similar or successor clauses in the FAR, or the DOD or NASA
19  * FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the
20  * Commercial Computer Software--Restricted Rights at 48 CFR
21  * 52.227-19, as applicable. Unpublished-rights reserved under
22  * the Copyright Laws of the United States.
23  * Contractor/Manufacturer is:
24  * Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.
25  */
26 
27 /*********************************************************************/
33 #ifndef __diguyViewLabel_H
34 #define __diguyViewLabel_H
35 
36 #ifdef SWIG
37 %module diguyViewLabel
38 #else
39 #define CPLUSPLUS_ONLY
40 #endif
41 
42 #ifdef CPLUSPLUS_ONLY
43 class bdiGraphicsLabel;
44 
45 #include <stdio.h> // for NULL definition
46 #include <diguy_constants.h>
47 #include <diguy_typedefs.h>
48 class diguyViewLabel;
49 
50 
51 #endif
52 
53 
54 /****************************************************************************/
56 enum {
62 };
63 
64 #include <declspec_diguy.h>
65 
66 
67 /****************************************************************************/
68 class BDI_DECLSPEC_diguy diguyViewLabel
69 {
70 
71 public:
72 
73 /*****************************************************************************/
79  /*l
80  *b Description:
81  **
82  ** Returns the name of the object. This pointer will
83  ** never be NULL.
84  **
85  *b Returns:
86  **
87  ** name of the object
88  **
89  *b Callable From:
90  **
91  *- - C++
92  *- - Script
93  */
94  const char* get_name();
95 
96 
97 /*****************************************************************************/
103  /*l
104  *b Description:
105  **
106  ** Sets the text on the label.
107  **
108  *b Callable From:
109  **
110  *- - C++
111  *- - Script
112  */
113  void set_text(const char* text);
114 
115  /*l
116  *b Description:
117  **
118  ** Returns the text on the label.
119  **
120  *b Returns:
121  **
122  ** pointer to NULL-terminated string
123  **
124  *b Callable From:
125  **
126  *- - C++
127  *- - Script
128  */
129  const char* get_text();
130 
131  /*l
132  *b Description:
133  **
134  ** Similar to set_background_color(), but sets the color
135  ** of the label text.
136  **
137  ** Default color is solid white (1, 1, 1, 1).
138  **
139  *b Callable From:
140  **
141  *- - C++
142  *- - Script
143  */
144  void set_text_color(float r, float g, float b, float a,
145  float interp_time = 0.0f);
146 
147  /*l
148  *b Description:
149  **
150  ** Similar to set_background_color(), but sets the shadow color
151  ** of the label text.
152  **
153  ** Default color is solid black (0, 0, 0, 1).
154  **
155  *b Callable From:
156  **
157  *- - C++
158  *- - Script
159  */
160  void set_text_shadow_color(float r, float g, float b, float a,
161  float interp_time = 0.0f);
162 
163  /*l
164  *b Description:
165  **
166  ** Enables or disables text shadow. Default is 0 (disabled).
167  **
168  *b Arguments:
169  **
170  *a text_shadow_enabled - pass 1 to enable shadow, 0 to disable
171  **
172  *b Callable From:
173  **
174  *- - C++
175  *- - Script
176  */
177  void set_text_shadow_enabled(int text_shadow_enabled);
178 
179  /*l
180  *b Description:
181  **
182  ** Sets how the label text is justified, possible values are:
183  **
184  ** - DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT
185  ** - DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT
186  ** - DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER
187  **
188  ** Depending on how the flag is set the text will either draw flowing
189  ** to the right of the current x. The left of the current x or
190  ** centered above x.
191  **
192  *b Callable From:
193  **
194  *- - C++
195  *- - Script
196  */
197  void set_text_justification(diguyViewLabelJustification just);
198 
199  /*l
200  *b Description:
201  **
202  ** Returns how the text on the label is being justified.
203  **
204  *b Returns:
205  **
206  ** One of the following values:
207  **
208  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT
209  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT
210  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER
211  **
212  *b Callable From:
213  **
214  *- - C++
215  *- - Script
216  */
217  diguyViewLabelJustification get_text_justification();
218 
219  /*l
220  *b Description:
221  **
222  ** Adds an x offset to the text part of the label.
223  **
224  *b Callable From:
225  **
226  *- - C++
227  *- - Script
228  */
229  void set_text_offset_x(int offset);
230 
231  /*l
232  *b Returns:
233  **
234  ** returns the x offset of the text part of the label.
235  **
236  *b Callable From:
237  **
238  *- - C++
239  *- - Script
240  */
241  int get_text_offset_x();
242 
243  /*l
244  *b Description:
245  **
246  ** Adds a y offset to the text part of the label.
247  **
248  *b Callable From:
249  **
250  *- - C++
251  *- - Script
252  */
253  void set_text_offset_y(int offset);
254 
255  /*l
256  *b Returns:
257  **
258  ** returns the y offset of the text part of the label.
259  **
260  *b Callable From:
261  **
262  *- - C++
263  *- - Script
264  */
265  int get_text_offset_y();
266 
267 
268 /*****************************************************************************/
274  /*l
275  *b Description:
276  **
277  ** Sets the x location of the label. Positive numbers are
278  ** relative to the left side of the screen; negative numbers
279  ** are relative to the right side of the screen.
280  **
281  ** The optional interp_time argument will make the label
282  ** animate to its new location.
283  **
284  *b Arguments:
285  **
286  *a screen_x_offset - x offset in pixels
287  *a interp_time - amount of time in seconds used to
288  *a shift to new position
289  **
290  *b Callable From:
291  **
292  *- - C++
293  *- - Script
294  */
295  void set_x(float screen_x_offset,
296  float interp_time = 0.0f);
297 
298  /*l
299  *b Description:
300  **
301  ** Gets the x location of the label.
302  **
303  ** Note: this will return the current x value, not the desired one.
304  **
305  *b Callable From:
306  **
307  *- - C++
308  *- - Script
309  */
310  float get_x();
311 
312  /*l
313  *b Description:
314  **
315  ** Sets the y location of the label. Positive numbers are
316  ** relative to the bottom of the screen; negative numbers
317  ** are relative to the top of the screen.
318  **
319  ** The optional interp_time argument will make the label
320  ** animate to its new location.
321  **
322  *b Arguments:
323  **
324  *a screen_y_offset - y offset in pixels
325  *a interp_time - amount of time in seconds used to
326  *a shift to new position
327  **
328  *b Callable From:
329  **
330  *- - C++
331  *- - Script
332  */
333  void set_y(float screen_y_offset,
334  float interp_time = 0.0f);
335 
336  /*l
337  *b Description:
338  **
339  ** Gets the y location of the label.
340  **
341  ** Note: this will return the current y value, not the desired one.
342  **
343  **
344  *b Callable From:
345  **
346  *- - C++
347  *- - Script
348  */
349  float get_y();
350 
351  /*l
352  *b Description:
353  **
354  ** Sets if having a negative value wraps to the other side of the
355  ** viewport. Defaults to 1.
356  **
357  *b Arguments:
358  **
359  *a wrap - 1 if x should wrap; 0 if not
360  **
361  *b Callable From:
362  **
363  *- - C++
364  *- - Script
365  */
366  void set_negative_wraps_x(int wrap);
367 
368  /*l
369  *b Returns:
370  **
371  ** 1 if x wraps its offset when negative
372  **
373  *b Callable From:
374  **
375  *- - C++
376  *- - Script
377  */
378  int get_negative_wraps_x();
379 
380  /*l
381  *b Description:
382  **
383  ** Sets if having a negative value wraps to the other side of the
384  ** viewport. Defaults to 1.
385  **
386  *b Arguments:
387  **
388  *a wrap - 1 if y should wrap; 0 if not
389  **
390  *b Callable From:
391  **
392  *- - C++
393  *- - Script
394  */
395  void set_negative_wraps_y(int wrap);
396 
397  /*l
398  *b Returns:
399  **
400  ** 1 if y wraps its offset when negative
401  **
402  *b Callable From:
403  **
404  *- - C++
405  *- - Script
406  */
407  int get_negative_wraps_y();
408 
409  /*l
410  *b Description:
411  **
412  ** Sets how the label is positioned relative to the window, possible
413  ** values are:
414  **
415  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_LEFT
416  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_RIGHT
417  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER
418  **
419  ** Depending on how the flag is set the x offset will be measured from
420  ** the right of the screen, the left or from the center of the window.
421  **
422  *b Callable From:
423  **
424  *- - C++
425  *- - Script
426  */
427  void set_window_justification_x(diguyViewLabelJustification just);
428 
429  /*l
430  *b Returns:
431  **
432  ** label's x positioning parameter described above
433  **
434  *b Callable From:
435  **
436  *- - C++
437  *- - Script
438  */
439  diguyViewLabelJustification get_window_justification_x();
440 
441  /*l
442  *b Description:
443  **
444  ** Sets how the label is positioned relative to the window. Possible
445  ** values are:
446  **
447  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_BOTTOM
448  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_TOP
449  *- - DIGUY_GRAPHICS_LABEL_JUSTIFIED_CENTER
450  **
451  ** Depending on how the flag is set the y offset will be measured from
452  ** the bottom of the screen, from the top or from the center of the
453  ** window.
454  **
455  *b Callable From:
456  **
457  *- - C++
458  *- - Script
459  */
460  void set_window_justification_y(diguyViewLabelJustification just);
461 
462  /*l
463  *b Returns:
464  **
465  ** label's y positioning parameter described above
466  **
467  *b Callable From:
468  **
469  *- - C++
470  *- - Script
471  */
472  diguyViewLabelJustification get_window_justification_y();
473 
474  /*l
475  *b Description:
476  **
477  ** Sets the minimum width of the label. The default is 0,
478  ** which will size the label width to fit the label text or bar
479  ** graph.
480  **
481  *b Arguments:
482  **
483  *a min_x - minimum width, in pixels
484  **
485  *b Callable From:
486  **
487  *- - C++
488  *- - Script
489  */
490  void set_minimum_width(int min_x);
491 
492  /*l
493  *b Returns:
494  **
495  ** minimum width of the label, as set by set_minimum_width()
496  **
497  *b Callable From:
498  **
499  *- - C++
500  *- - Script
501  */
502  int get_minimum_width();
503 
504  /*l
505  *b Description:
506  **
507  ** Similar to set_minimum_width(), but sets minimum label height.
508  */
509  void set_minimum_height(int min_y);
510 
511  /*l
512  *b Description:
513  **
514  ** Similar to set_minimum_height(), but returns minimum label height.
515  */
516  int get_minimum_height();
517 
518  /*l
519  *b Returns:
520  **
521  ** the current label width
522  **
523  *b Callable From:
524  **
525  *- - C++
526  *- - Script
527  */
528  int get_width();
529 
530  /*l
531  *b Returns:
532  **
533  ** the current label height
534  **
535  *b Callable From:
536  **
537  *- - C++
538  *- - Script
539  */
540  int get_height();
541 
542  /*l
543  *b Description:
544  **
545  ** Turns the label into a full-window overlay. This can be useful
546  ** for things like Heads-Up Displays (HUDs).
547  **
548  ** If there is a background image (see set_background_image()), the
549  ** image will be scaled to fit the entire screen.
550  **
551  ** Default is 0 (not full-window).
552  ** Note: turning a label into a full window will automatically make
553  ** it non-clickable.
554  **
555  *b Arguments:
556  **
557  *a full_window - pass 1 for full-window, 0 for not full-window
558  **
559  *b Callable From:
560  **
561  *- - C++
562  *- - Script
563  */
564  void set_full_window(int full_window);
565 
566  /*l
567  *b Returns:
568  **
569  ** whether label is full-window, as set by set_full_window()
570  **
571  *b Callable From:
572  **
573  *- - C++
574  *- - Script
575  */
576  int get_full_window();
577 
578  /*l
579  *b Description:
580  **
581  ** Resets the parameters of the label to the values from the
582  ** constructor.
583  **
584  *b Callable From:
585  **
586  *- - C++
587  *- - Script
588  */
589  void reset();
590 
591  /*l
592  *b Description:
593  **
594  ** Sets the visibility of a label. Default is 1 (visible).
595  **
596  *b Arguments:
597  **
598  *a visible - pass 1 to make label visible, 0 for invisible
599  **
600  *b Callable From:
601  **
602  *- - C++
603  *- - Script
604  */
605  void set_visible(int visible);
606 
607  /*l
608  *b Returns:
609  **
610  ** visibility of label, as set by set_visible()
611  **
612  *b Callable From:
613  **
614  *- - C++
615  *- - Script
616  */
617  int get_visible();
618 
619 
620 /*****************************************************************************/
626  /*l
627  *b Description:
628  **
629  ** Sets the color of the label background.
630  **
631  ** The optional interp_time argument will make the label gradually
632  ** shift to its new color.
633  **
634  *b Arguments:
635  **
636  *a r, g, b, a - RGBA values of new color, between 0.0 and 1.0
637  *a interp_time - amount of time in seconds used to shift to
638  *a new color
639  **
640  ** Default color is translucent blue (0, 0, 0.3, 0.7).
641  **
642  *b Callable From:
643  **
644  *- - C++
645  *- - Script
646  */
647  void set_background_color(float r, float g, float b, float a,
648  float interp_time = 0.0f);
649 
650  /*l
651  *b Description:
652  **
653  ** Sets the background image of the label. The file will
654  ** be looked for in $DIGUY/custom/geometry/rgb first,
655  ** then in $DIGUY/geometry/rgb.
656  **
657  ** The default is no background image.
658  **
659  *b Callable From:
660  **
661  *- - C++
662  *- - Script
663  */
664  void set_background_image(const char* filename);
665 
666  /*l
667  *b Description:
668  **
669  ** Enables or disables label background. Default is 1 (enabled).
670  **
671  *b Arguments:
672  **
673  *a background_enabled - pass 1 to enable shadow, 0 to disable
674  **
675  *b Callable From:
676  **
677  *- - C++
678  *- - Script
679  */
680  void set_background_enabled(int background_enabled);
681 
682 
683 /*****************************************************************************/
689  /*l
690  *b Description:
691  **
692  ** Similar to set_border_color(), but sets the border color of the
693  ** label background.
694  **
695  ** Default color is translucent white (1, 1, 1, 0.7).
696  *a r, g, b, a - RGBA values of new color, between 0.0 and 1.0
697  *a interp_time - amount of time in seconds used to shift to
698  *a new color
699  **
700  *b Callable From:
701  **
702  *- - C++
703  *- - Script
704  */
705  void set_border_color(float r, float g, float b, float a,
706  float interp_time = 0.0f);
707 
708  /*l
709  *b Description:
710  **
711  ** Sets the margin, of the label. Default is 6 pixels.
712  **
713  *b Arguments:
714  **
715  *a margin_size - margin size in pixels
716  **
717  *b Callable From:
718  **
719  *- - C++
720  *- - Script
721  */
722  void set_margin_size(int margin_size);
723 
724  /*l
725  *b Description:
726  **
727  ** Sets if the border should be visible. Default is 1 (enabled).
728  **
729  *b Arguments:
730  **
731  *a border_enabled - pass 1 to enable, 0 to disable
732  **
733  *b Callable From:
734  **
735  *- - C++
736  *- - Script
737  */
738  void set_border_enabled(int border_enabled);
739 
740 
741 /*****************************************************************************/
781  /*l
782  *b Description:
783  **
784  ** Enables bar graph functionality for this label. Note that this
785  ** doesn't automatically turn off text or background image.
786  **
787  ** Label position and minimum sizes should be set before this
788  ** is called.
789  **
790  *b Arguments:
791  **
792  *a num_lines - number of lines/bars that will be shown
793  *a lines_are_vertical - pass 1 for lines to go bottom to top,
794  *a 0 for lines to go left to right
795  *a line_thickness - line thickness, in pixels
796  *a space_between_lines - space between lines, in pixels
797  *a derive_minimum_label_size - derive and set the minimum label size,
798  *a as if set_minimum_width() and
799  *a set_minimum_height() were called to fit
800  *a this bar graph
801  **
802  *b Callable From:
803  **
804  *- - C++
805  *- - Script
806  */
807  void enable_bar_graph(int num_lines,
808  int lines_are_vertical = 1,
809  int line_thickness = 10,
810  int space_between_lines = 2,
811  int derive_minimum_label_size = 1);
812 
813  /*l
814  *b Description:
815  **
816  ** Disables bar graph functionality for this label. Bar graph lines
817  ** will no longer be visible.
818  */
819  void disable_bar_graph();
820 
821  /*l
822  *b Returns:
823  **
824  ** number of bars/lines in bar graph
825  */
826  int get_bar_graph_num_lines();
827 
828  /*l
829  *b Returns:
830  **
831  ** 1 if lines to go bottom to top, 0 if lines to go left to right
832  */
833  int get_bar_graph_lines_are_vertical();
834 
835  /*l
836  *b Description:
837  **
838  ** Sets the color of the specified line.
839  */
840  void set_bar_graph_line_color(int line_number,
841  float r, float g, float b, float a);
842 
843  /*l
844  *b Description:
845  **
846  ** Sets how much of the usable space (bottom to top for vertical
847  ** lines, left to right for horizontal lines) a line will take up
848  ** at its maximum length.
849  **
850  *b Arguments:
851  **
852  *a line_number - line to change
853  *a ratio - how much of the line to display, from 0 (none) to
854  *a 1 (all)
855  **
856  ** For example, if, based on the label height, the bar graph has at
857  ** most 20 pixels to show each line, passing 0.5 for ratio will
858  ** fill 10 pixels with the line color, while passing 1.0 for ratio
859  ** will fill all 20 pixels.
860  */
861  void set_bar_graph_line_magnitude_ratio(int line_number, float ratio);
862 
863  /*l
864  *b Description:
865  **
866  ** Similar to set_bar_graph_line_magnitude_ratio(), but sets the
867  ** length of the line based on absolute pixels.
868  **
869  ** Note that care should be taken to not overrun the current height
870  ** or width of the label when using this function.
871  **
872  *b Arguments:
873  **
874  *a line_number - line to change
875  *a pixels - line length in pixels
876  */
877  void set_bar_graph_line_magnitude_pixels(int line_number, int pixels);
878 
879 
880 /*****************************************************************************/
886  /*l
887  *b Description:
888  **
889  ** Sets if a label is temporary. Temporary labels are destroyed on
890  ** scenario reset, and will not re-appear unless they are recreated.
891  **
892  ** Pass 1 to make label temporary, 0 to make it permanent.
893  */
894  void set_is_temporary(int temporary);
895 
896  /*l
897  *b Returns:
898  **
899  ** 1 if a label is temporary, 0 if not; see set_is_temporary()
900  */
901  int get_is_temporary();
902 
903  /*l
904  *b Description:
905  **
906  ** Sets how far away the label will be drawn.
907  **
908  *b Arguments:
909  **
910  *a draw_limit - -1 to always draw, otherwise will draw till draw_limit
911  *a is reached
912  **
913  *b Callable From:
914  **
915  *- - C++
916  *- - Script
917  */
918  void set_draw_limit(float draw_limit);
919 
920  /*l
921  *b Description:
922  **
923  ** Gets how far away the label will be drawn.
924  ** Defaults to -1 which always draws.
925  **
926  *b Callable From:
927  **
928  *- - C++
929  *- - Script
930  */
931  float get_draw_limit();
932 
933  /*l
934  *b Description:
935  **
936  ** Sets if the label is clickable with the mouse.
937  **
938  ** For character labels this is the equivalent of clicking on the
939  ** character itself, and can trigger the CALLBACK_ID_IGUY_INTERACT
940  ** callback.
941  **
942  ** For screen labels it triggers CALLBACK_ID_USER_SELECTED on mouse
943  ** down, and CALLBACK_ID_USER_UNSELECTED on mouse up.
944  **
945  ** By default labels are clickable.
946  **
947  *b Arguments:
948  **
949  *a is_clickable - pass 1 to enable, 0 to disable
950  **
951  *b Callable From:
952  **
953  *- - C++
954  *- - Script
955  */
956  void set_is_clickable(int is_clickable);
957 
958  /*l
959  *b Returns:
960  **
961  ** 1 if label responds to mouse clicks, 0 if not; see
962  ** set_is_clickable()
963  **
964  *b Callable From:
965  **
966  *- - C++
967  *- - Script
968  */
969  int get_is_clickable();
970 
971  /*l
972  *b Description:
973  **
974  ** Sets if the label is "noise".
975  **
976  ** The textures of noise labels with be shifted every frame.
977  **
978  ** By default labels not noise.
979  **
980  *b Arguments:
981  **
982  *a is_noise - pass 1 to enable, 0 to disable
983  **
984  *b Callable From:
985  **
986  *- - C++
987  *- - Script
988  */
989  void set_is_noise(int is_noise);
990 
991  /*l
992  *b Returns:
993  **
994  ** 1 if label textures shift every frame, 0 if not; see
995  ** set_is_noise()
996  **
997  *b Callable From:
998  **
999  *- - C++
1000  *- - Script
1001  */
1002  int get_is_noise();
1003 
1004  /*l
1005  *b Resturs:
1006  **
1007  ** NULL-terminated string "label"
1008  */
1009  const char* get_type_name();
1010 
1011  /*l
1012  *b Description:
1013  **
1014  ** This is an enumeration of the different callbacks that can be
1015  ** registered with add_callback() and add_callback_script().
1016  **
1017  *b Usable From:
1018  **
1019  *- - C++
1020  *- - Script
1021  */
1022  enum {
1023  CALLBACK_ID_USER_SELECTED = 1,
1024  CALLBACK_ID_USER_UNSELECTED,
1025  CALLBACK_ID_IGUY_INTERACT
1026  };
1027 
1028  /*l
1029  *b Description:
1030  **
1031  ** This function adds a user callback script. Callback scripts can
1032  ** be removed with remove_callback_script().
1033  **
1034  *b Arguments:
1035  **
1036  *a callback_id - integer id of the callback
1037  *a callback_script - script text of callback to be added
1038  *a callback_script_type - the type of script contained in
1039  *a callback_script
1040  **
1041  ** If NULL is passed for callback_script_type, a default script type
1042  ** will be derived based on the default script interpreter of the
1043  ** scenario.
1044  **
1045  *i lua specific:
1046  **
1047  ** When the script is called, the object for which it is being called
1048  ** will be in the callback_object global.
1049  **
1050  ** To pass NULL when calling from a lua script, use nil.
1051  **
1052  *b Returns:
1053  **
1054  ** 0 on success, -1 on failure
1055  **
1056  *b Callable From:
1057  **
1058  *- - C++
1059  *- - Script
1060  **
1061  *b lua Example:
1062  **
1063  *e ------------------------------------------------------------------------------
1064  *e local on_clicked_callback = [[
1065  *e
1066  *e local la_name = callback_object:get_name();
1067  *e bdi_log_print(BDI_LOG_WARN, "Calling on_click for label ".. la_name .. "'.\n");
1068  *e
1069  *e ]]
1070  *e ------------------------------------------------------------------------------
1071  *e
1072  *e label:add_callback_script(diguyViewLabel_CALLBACK_ID_USER_UNSELECTED,
1073  *e on_clicked_callback,
1074  *e "lua");
1075  */
1076  int add_callback_script(int callback_id,
1077  const char* callback_script,
1078  const char* callback_script_type = NULL);
1079 
1080  /*l
1081  *b Description:
1082  **
1083  ** This function removes a user callback script previously added with
1084  ** add_callback_script().
1085  **
1086  *b Arguments:
1087  **
1088  *a callback_id - integer id of the callback
1089  *a callback_script - script text of callback previously added
1090  *a callback_script_type - the type of script contained in
1091  *a callback_script
1092  **
1093  ** If NULL is passed for callback_script, all callback
1094  ** scripts whose ids match callback_id and whose types match
1095  ** callback_script_type will be removed.
1096  **
1097  ** If NULL is passed for callback_script_type, a default script type
1098  ** will be derived based on the default script interpreter of the
1099  ** scenario.
1100  **
1101  *i lua specific:
1102  **
1103  ** To pass NULL when calling from a lua script, use nil.
1104  **
1105  *b Returns:
1106  **
1107  ** 0 on success, -1 on failure
1108  **
1109  *b Callable From:
1110  **
1111  *- - C++
1112  *- - Script
1113  **
1114  *b Lua Example:
1115  **
1116  *e --
1117  *e -- Remove all callback scripts with id
1118  *e -- diguyViewLabel_CALLBACK_ID_USER_UNSELECTED
1119  *e --
1120  *e label:remove_callback_script(diguyViewLabel_CALLBACK_ID_USER_UNSELECTED,
1121  *e nil,
1122  *e "lua");
1123  */
1124  int remove_callback_script(int callback_id,
1125  const char* callback_script,
1126  const char* callback_script_type = NULL);
1127 
1128 
1129 #ifdef CPLUSPLUS_ONLY
1130 
1131  /*l
1132  *b Description:
1133  **
1134  ** This function adds a user callback. Callbacks can be removed
1135  ** with remove_callback() or remove_callback_with_user_data().
1136  **
1137  *b Arguments:
1138  **
1139  *a callback - pointer to function with prototype
1140  *a diguyViewLabelCallback (typedefed above)
1141  *a callback_id - integer id of when this callback is to be called
1142  *a callback_params - not currently used; pass NULL
1143  *a callback_user_data - pointer for user's own use; DI-Guy will
1144  *a do nothing to the contents of this pointer
1145  *a beyond passing it back when the callback is
1146  *a invoked
1147  **
1148  *b Returns:
1149  **
1150  ** 0 on success, -1 on failure
1151  **
1152  *b Callable From:
1153  **
1154  *- - C++
1155  */
1156  int add_callback(int callback_id,
1157  diguyViewLabelCallback* callback,
1158  void* callback_params = NULL,
1159  void* callback_user_data = NULL);
1160 
1161  /*l
1162  *b Description:
1163  **
1164  ** This function removes a user callback. All callbacks matching
1165  ** the specified callback_id and callback function will be removed.
1166  **
1167  *b Arguments:
1168  **
1169  *a callback_id - integer id of when this callback is to be called
1170  *a callback - pointer to function with prototype
1171  *a diguyViewLabelCallback (typedefed above)
1172  **
1173  *b Returns:
1174  **
1175  ** 0 on success, -1 on failure
1176  **
1177  *b Callable From:
1178  **
1179  *- - C++
1180  */
1181  int remove_callback(int callback_id,
1182  diguyViewLabelCallback* callback);
1183 
1184  /*b Description:
1185  **
1186  ** This function removes a user callback. All callbacks matching
1187  ** the specified callback_id and callback_user_data pointer will
1188  ** be removed.
1189  **
1190  *b Arguments:
1191  **
1192  *a callback_id - integer id of when this callback is to be called
1193  *a callback_user_data - pointer for user's own use
1194  **
1195  *b Returns:
1196  **
1197  ** 0 on success, -1 on failure
1198  **
1199  *b Callable From:
1200  **
1201  *- - C++
1202  */
1203  int remove_callback_with_user_data(int callback_id,
1204  void* callback_user_data);
1205 
1211  bdiGraphicsLabel* get_scripted_object() {return m_label;}
1212 
1213 private:
1214 
1215  /*l
1216  ** A private constructor.
1217  */
1218  diguyViewLabel(bdiGraphicsLabel* label);
1219 
1220  /*l
1221  ** A pointer to internal data.
1222  */
1223  bdiGraphicsLabel* m_label;
1224 
1225  friend class bdiGraphicsLabel;
1226 
1227 #endif
1228 
1229 };
1230 
1231 #endif /* __diguyViewFog_H */
1232