File: ExampleAttribute.cs

package info (click to toggle)
opentk 1.1.4c%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 68,640 kB
  • sloc: cs: 525,501; xml: 277,501; ansic: 3,597; makefile: 41
file content (59 lines) | stat: -rw-r--r-- 1,948 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
#region --- License ---
/* Copyright (c) 2006-2008 the OpenTK team
 * See license.txt for licensing details
 */
#endregion

using System;
using System.Collections.Generic;
using System.Text;

namespace Examples
{
    [AttributeUsage(AttributeTargets.Class)]
    public class ExampleAttribute : System.Attribute
    {
        string title;
        bool visible = true;
        public string Title { get { return title; } internal set { title = value; } }
        public readonly ExampleCategory Category;
        public readonly string Subcategory;
        public int Difficulty;
        public string Documentation;
        public bool Visible { get { return visible; } set { visible = value; } }

        public ExampleAttribute(string title, ExampleCategory category, string subcategory)
            : this(title, category, subcategory, Int32.MaxValue, true) { }

        public ExampleAttribute(string title, ExampleCategory category, string subcategory, int difficulty)
            : this(title, category, subcategory, difficulty, true) { }

        public ExampleAttribute(string title, ExampleCategory category, string subcategory, bool visible)
            : this(title, category, subcategory, Int32.MaxValue, visible) { }

        public ExampleAttribute(string title, ExampleCategory category, string subcategory, int difficulty, bool visible)
        {
            this.Title = title;
            this.Category = category;
            this.Subcategory = subcategory;
            this.Difficulty = difficulty;
            this.Visible = visible;
        }

        public override string ToString()
        {
            if (Difficulty != 0)
                return String.Format("{0} {1}: {2}", Category, Difficulty, Title);
            return String.Format("{0}: {1}", Category, Title);
        }
    }

    public enum ExampleCategory
    {
        OpenTK = 0,
        OpenGL,
        OpenAL,
        OpenCL,
        OpenGLES
    }
}