+int SetTextColor(
+ HPS hPS
+, int nForegroundColour
+)
+{
+ CHARBUNDLE vCbnd;
+
+ vCbnd.lColor = nForegroundColour;
+ ::GpiSetAttrs( hPS // presentation-space handle
+ ,PRIM_CHAR // Char primitive.
+ ,CBB_COLOR // sets color.
+ ,0 //
+ ,&vCbnd // buffer for attributes.
+ );
+ return 0;
+}
+
+int QueryTextBkColor(
+ HPS hPS
+)
+{
+ CHARBUNDLE vCbnd;
+
+ ::GpiQueryAttrs( hPS // presentation-space handle
+ ,PRIM_CHAR // Char primitive.
+ ,CBB_BACK_COLOR // Background color.
+ ,&vCbnd // buffer for attributes.
+ );
+ return vCbnd.lBackColor;
+}
+
+
+int SetTextBkColor(
+ HPS hPS
+, int nBackgroundColour
+)
+{
+ CHARBUNDLE vCbnd;
+ int rc;
+
+ rc = QueryTextBkColor(hPS);
+
+ vCbnd.lBackColor = nBackgroundColour;
+ ::GpiSetAttrs(hPS, // presentation-space handle
+ PRIM_CHAR, // Char primitive.
+ CBB_BACK_COLOR, // sets color.
+ 0,
+ &vCbnd // buffer for attributes.
+ );
+ return rc;
+}
+
+int SetBkMode(
+ HPS hPS
+, int nBackgroundMode
+)
+{
+ if(nBackgroundMode == wxTRANSPARENT)
+ ::GpiSetBackMix( hPS
+ ,BM_LEAVEALONE
+ );
+ else
+ // the background of the primitive takes over whatever is underneath.
+ ::GpiSetBackMix( hPS
+ ,BM_OVERPAINT
+ );
+ return 0;
+}
+