aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-06 15:45:05 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-06 15:45:05 +0000
commita652044cd4e99b896c418b7aa7a63b5f8eac0131 (patch)
tree94036301fb214c957e39f5ad25e4122fe77a2b47
parentfc1f578b28eca027cf9cee91adeba5317f7d722d (diff)
import template
-rw-r--r--Spectrogram.c148
-rw-r--r--Spectrogram.h37
-rw-r--r--SpectrogramP.h28
3 files changed, 198 insertions, 15 deletions
diff --git a/Spectrogram.c b/Spectrogram.c
index 13c376a..6c47725 100644
--- a/Spectrogram.c
+++ b/Spectrogram.c
@@ -15,4 +15,152 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
#include "SpectrogramP.h"
+
+/* Class Methods */
+static void SpectrogramInitialize(Widget, Widget, ArgList, Cardinal *);
+
+/* Prototypes */
+static Bool SpectrogramFunction(SpectrogramWidget, int, int, Bool);
+
+/* Actions */
+static void SpectrogramAction(Widget, XEvent *, String *, Cardinal *);
+
+/* Initialization */
+#define offset(field) XtOffsetOf(SpectrogramRec, spectrogram.field)
+static XtResource resources[] = {
+ {
+ XtNspectrogramResource, /* name */
+ XtCSpectrogramResource, /* class */
+ XtRSpectrogramResource, /* type */
+ sizeof(char *), /* size */
+ offset(resource), /* offset */
+ XtRString, /* default_type */
+ (XtPointer) "default" /* default_addr */
+ },
+};
+#undef offset
+
+static XtActionsRec actions[] =
+{
+ {
+ "spectrogram", /* name */
+ SpectrogramAction /* procedure */
+ },
+};
+
+static char translations[] = "<Key>:" "spectrogram()\n";
+
+#define Superclass (&widgetClassRec)
+SpectrogramClassRec spectrogramClassRec = {
+ /* core */
+ {
+ (WidgetClass) Superclass, /* superclass */
+ "Spectrogram", /* class_name */
+ sizeof(SpectrogramRec), /* widget_size */
+ NULL, /* class_initialize */
+ NULL, /* class_part_initialize */
+ False, /* class_inited */
+ SpectrogramInitialize, /* initialize */
+ NULL, /* initialize_hook */
+ XtInheritRealize, /* realize */
+ actions, /* actions */
+ XtNumber(actions), /* num_actions */
+ resources, /* resources */
+ XtNumber(resources), /* num_resources */
+ NULLQUARK, /* xrm_class */
+ True, /* compress_motion */
+ True, /* compress_exposure */
+ True, /* compress_enterleave */
+ False, /* visible_interest */
+ NULL, /* destroy */
+ NULL, /* resize */
+ NULL, /* expose */
+ NULL, /* set_values */
+ NULL, /* set_values_hook */
+ XtInheritSetValuesAlmost, /* set_values_almost */
+ NULL, /* get_values_hook */
+ NULL, /* accept_focus */
+ XtVersion, /* version */
+ NULL, /* callback_private */
+ translations, /* tm_table */
+ XtInheritQueryGeometry, /* query_geometry */
+ XtInheritDisplayAccelerator, /* display_accelerator */
+ NULL, /* extension */
+ },
+ /* spectrogram */
+ {
+ NULL, /* extension */
+ }
+};
+
+WidgetClass spectrogramWidgetClass = (WidgetClass) & spectrogramClassRec;
+
+/* Implementation */
+
+/*
+ * Function:
+ * SpectrogramInitialize
+ *
+ * Parameters:
+ * request - requested widget
+ * w - the widget
+ * args - arguments
+ * num_args - number of arguments
+ *
+ * Description:
+ * Initializes widget instance.
+ */
+/* ARGSUSED */
+static void
+SpectrogramInitialize(Widget request, Widget w, ArgList args, Cardinal * num_args)
+{
+ SpectrogramWidget tw = (SpectrogramWidget) w;
+
+ tw->spectrogram.private = NULL;
+}
+
+/*
+ * Function:
+ * SpectrogramFunction
+ *
+ * Parameters:
+ * tw - spectrogram widget
+ * x - x coordinate
+ * y - y coordinate
+ * force - force action
+ *
+ * Description:
+ * This function does nothing.
+ *
+ * Return:
+ * Parameter force
+ */
+/* ARGSUSED */
+static Bool
+SpectrogramFunction(SpectrogramWidget tw, int x, int y, Bool force)
+{
+ return (force);
+}
+
+/*
+ * Function:
+ * SpectrogramAction
+ *
+ * Parameters:
+ * w - spectrogram widget
+ * event - event that caused this action
+ * params - parameters
+ * num_params - number of parameters
+ *
+ * Description:
+ * This function does nothing.
+ */
+/* ARGSUSED */
+static void
+SpectrogramAction(Widget w, XEvent * event, String * params, Cardinal * num_params)
+{
+}
diff --git a/Spectrogram.h b/Spectrogram.h
index 8d33021..58b023a 100644
--- a/Spectrogram.h
+++ b/Spectrogram.h
@@ -18,14 +18,41 @@
#ifndef _Spectrogram_h
#define _Spectrogram_h
-/* Spectrogram Widget */
-/* Parameters:
- * Name Class RepType Default Value
- */
+#include <X11/Intrinsic.h>
-typedef struct _SpectrogramRec *SpectrogramWidget;
+/****************************************************************
+ *
+ * Spectrogram widget
+ *
+ ****************************************************************/
+
+/* Resources:
+
+ Name Class RepType Default Value
+ ---- ----- ------- -------------
+ background Background Pixel XtDefaultBackground
+ border BorderColor Pixel XtDefaultForeground
+ borderWidth BorderWidth Dimension 1
+ destroyCallback Callback Pointer NULL
+ height Height Dimension 0
+ mappedWhenManaged MappedWhenManaged Boolean True
+ sensitive Sensitive Boolean True
+ width Width Dimension 0
+ x Position Position 0
+ y Position Position 0
+
+*/
+
+/* define any special resource names here that are not in <X11/StringDefs.h> */
+#define XtNspectrogramResource "spectrogramResource"
+
+#define XtCSpectrogramResource "SpectrogramResource"
+
+/* declare specific SpectrogramWidget class and instance datatypes */
typedef struct _SpectrogramClassRec *SpectrogramWidgetClass;
+typedef struct _SpectrogramRec *SpectrogramWidget;
+/* declare the class constant */
extern WidgetClass spectrogramWidgetClass;
#endif
diff --git a/SpectrogramP.h b/SpectrogramP.h
index 67ac82e..afca1b1 100644
--- a/SpectrogramP.h
+++ b/SpectrogramP.h
@@ -20,25 +20,33 @@
#include "Spectrogram.h"
-typedef struct {
- int dummy;
-} SpectrogramPart;
+/* include superclass private header file */
+#include <X11/CoreP.h>
-typedef struct _SpectrogramRec {
- int dummy;
-} SpectrogramRec;
+/* define unique representation types not found in <X11/StringDefs.h> */
+#define XtRSpectrogramResource "SpectrogramResource"
typedef struct {
- int dummy;
+ XtPointer extension;
} SpectrogramClassPart;
typedef struct _SpectrogramClassRec {
- int dummy;
+ CoreClassPart core_class;
+ SpectrogramClassPart spectrogram_class;
} SpectrogramClassRec;
extern SpectrogramClassRec spectrogramClassRec;
-__BEGIN_DECLS
-__END_DECLS
+typedef struct {
+ /* resources */
+ char* resource;
+ /* private */
+ char *private;
+} SpectrogramPart;
+
+typedef struct _SpectrogramRec {
+ CorePart core;
+ SpectrogramPart spectrogram;
+} SpectrogramRec;
#endif