MSSash::MSSash(MSPane *owner_) : MSWidgetCommon(owner_) { _highlightThickness=0; _shadowThickness=0; _row=0,_column=0,_min=0,_max=0; acceptFocus(MSFalse); unsigned long whitePixel=server()->pixel("white"); unsigned long blackPixel=server()->pixel("black"); _crossCursor=new MSDisplayCursor(server(),XC_tcross,blackPixel,whitePixel); XSetWindowAttributes attrib; attrib.cursor=_crossCursor->cursor(); XChangeWindowAttributes(display(),window(),CWCursor,&attrib); XGCValues values; values.foreground=whitePixel^background(); values.background=blackPixel; values.line_width=2; values.function=GXxor; values.subwindow_mode=IncludeInferiors; _drawGC.setGCValues(server(),MSTrue,&values, GCForeground|GCBackground|GCLineWidth|GCFunction|GCSubwindowMode); selectInput(MSSashEventMask); }
void MSComposite::init(void) { _shadowThickness=MSCompositeDefaultShadowThickness; _highlightThickness=MSCompositeDefaultHighlightThickness; shadowStyle(MSRaised); selectInput(MSCompositeEventMask); }
NSTextField::NSTextField(unsigned int arg, NSTextListener* bl, void* la, NSTextCallback* bc, void* ca) : NSPlate(down), _listener(bl), _callback(bc), _listenerArg(la), _callbackArg(ca) { if (!initialized) { initialized = true; fontStruct = XQueryFont(NSdpy, font); gc = XCreateGC(NSdpy, window(), 0, 0); XSetForeground(NSdpy, gc, bgPixel() ^ BlackPixel(NSdpy, 0)); XSetFunction(NSdpy, gc, GXxor); } cursorPos = 0; strStart = 0; mode = down; cursorOnTF = false; width(arg); height(fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent + gap * 2); selectInput(EnterWindowMask | LeaveWindowMask | KeyPressMask | ExposureMask | ButtonPressMask); // charWidth = fontStruct->max_bounds.rbearing - fontStruct->min_bounds.lbearing; charWidth = fontStruct->max_bounds.width - 1; // Can't figure out why, but this works. charHeight = fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent; maxCharNum = width() / charWidth; selectIndex = SELEC_NONE; }
NSSelector::NSSelector(unsigned int w, unsigned int h) : NSWindow(true), _font(font), _vscroll(100, h - NSHScrollbar::defaultHeight(), this), _hscroll(100, w - NSVScrollbar::defaultWidth(), this) { if (!_initialized) { _initialized = true; _gc = XCreateGC(NSdpy, window(), 0, 0); XSetFunction(NSdpy, _gc, GXxor); XSetForeground(NSdpy, _gc, WhitePixel(NSdpy, 0) ^ BlackPixel(NSdpy, 0)); XSetLineAttributes(NSdpy, _gc, 1, LineSolid, CapButt, JoinMiter); } _selected = 0; _hilighted = false; _first = _last = 0; _vGap = _defaultVGap; _hGap = _defaultHGap; resize(w - NSVScrollbar::defaultWidth(), h - NSHScrollbar::defaultHeight()); borderWidth(1); border(nameToPixel("black")); XFlush(NSdpy); background(nameToPixel("white")); selectInput(ButtonPressMask | ExposureMask); _displayableNum = (NSWindow::height() - _vGap) / (_font.height() + _vGap); }
// PlayStack PlayStack::PlayStack(int x_ini, int y_ini) : Stack(x_ini, y_ini) { resize(cardWidth, cardHeight * 20); background(getColor(dpy, DefaultBackground)); selectInput(ButtonPressMask | EnterWindowMask | LeaveWindowMask); map(); }
void MSOptionMenu::init(void) { freeze(); _marginHeight=MSOptionMenuDefaultMarginHeight; _selectedItem=0; _optionMenu=0; _columns=1; _internalEvent=MSFalse; selectInput(MSOptionMenuEventMask); }
void MSArrowButton::init(void) { _highlightThickness=MSArrowButtonDefaultHighlightThickness; _shadowThickness=MSArrowButtonDefaultShadowThickness; _shadowStyle=MSSunken; _acceptFocus=MSFalse; _arrowTimer=0; _repeatInterval=0; _repeatThreshold=0; selectInput(MSArrowButtonEventMask); }
//SingleStack SingleStack::SingleStack(int x_ini, int y_ini) : Stack(x_ini, y_ini) { resize(cardWidth, cardHeight); background(getColor(dpy, "darkgreen")); border(getColor(dpy, "green")); borderWidth(1); selectInput(ButtonPressMask | EnterWindowMask | LeaveWindowMask); map(); }
NSLabel::NSLabel(const char* str) : NSWindow(true), NSString(str) { if (!initialized) { gc = XCreateGC(NSdpy, root(), 0, 0); XSetFont(NSdpy, gc, font); XSetForeground(NSdpy, gc, BlackPixel(NSdpy, 0)); initialized = true; } selectInput(ExposureMask); NSWindow::resize(fontWindowWidth(), fontWindowHeight()); NSWindow::background(WhitePixel(NSdpy, 0)); }
NSPlate::NSPlate(Mode m) : NSWindow(true, RootWindow(NSdpy, 0)), mode(m) { if (!plateInitialized) { plateInitialized = true; _bgPixel = allocColor(NSdpy, 0x6180,0xa290,0xc300); _bRimPixel = allocColor(NSdpy, 0x8a20,0xe380,0xffff); _dRimPixel = allocColor(NSdpy, 0x30c0,0x5144,0x6180); bgGC = XCreateGC(NSdpy, root(), 0, 0); XSetForeground(NSdpy, bgGC, _bgPixel); bRimGC = XCreateGC(NSdpy, root(), 0, 0); XSetForeground(NSdpy, bRimGC, _bRimPixel); dRimGC = XCreateGC(NSdpy, root(), 0, 0); XSetForeground(NSdpy, dRimGC, _dRimPixel); } selectInput(ExposureMask); background(_bgPixel); }
NSPlate::NSPlate(Mode m) : NSWindow(true, GI_DESKTOP_WINDOW_ID), mode(m) { if (!plateInitialized) { plateInitialized = true; _bgPixel = allocColor( 0x6180,0xa290,0xc300); _bRimPixel = allocColor( 0x8a20,0xe380,0xffff); _dRimPixel = allocColor( 0x30c0,0x5144,0x6180); bgGC = gi_create_gc( root(), 0); gi_set_gc_foreground( bgGC, _bgPixel); bRimGC = gi_create_gc( root(), 0); gi_set_gc_foreground( bRimGC, _bRimPixel); dRimGC = gi_create_gc( root(), 0); gi_set_gc_foreground( dRimGC, _dRimPixel); } selectInput(GI_MASK_EXPOSURE); background(_bgPixel); }
VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf ) { p_vlm = vlm_New( p_intf ); if( !p_vlm ) { msg_Warn( p_intf, "Couldn't build VLM object "); return; } vlmWrapper = new VLMWrapper( p_vlm ); // UI stuff ui.setupUi( this ); ui.saveButton->hide(); #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) ); ADDMEDIATYPES( N_("Broadcast"), QVLM_Broadcast ); ADDMEDIATYPES( N_("Schedule"), QVLM_Schedule ); ADDMEDIATYPES( N_("Video On Demand ( VOD )"), QVLM_VOD ); #undef ADDMEDIATYPES /* Schedule Stuffs */ QGridLayout *schetimelayout = new QGridLayout( ui.schedBox ); QLabel *schetimelabel = new QLabel( qtr( "Hours / Minutes / Seconds:" ) ); schetimelayout->addWidget( schetimelabel, 0, 0 ); QLabel *schedatelabel = new QLabel( qtr( "Day / Month / Year:" ) ); schetimelayout->addWidget( schedatelabel, 1, 0 ); QLabel *scherepeatLabel = new QLabel( qtr( "Repeat:" ) ); schetimelayout->addWidget( scherepeatLabel, 2, 0 ); QLabel *scherepeatTimeLabel = new QLabel( qtr( "Repeat delay:" ) ); schetimelayout->addWidget( scherepeatTimeLabel, 3, 0 ); time = new QDateTimeEdit( QTime::currentTime() ); time->setAlignment( Qt::AlignRight ); time->setDisplayFormat( "hh:mm:ss" ); schetimelayout->addWidget( time, 0, 1, 1, 3 ); date = new QDateTimeEdit( QDate::currentDate() ); date->setAlignment( Qt::AlignRight ); date->setCalendarPopup( true ); #ifdef WIN32 date->setDisplayFormat( "dd MM yyyy" ); #else date->setDisplayFormat( "dd MMMM yyyy" ); #endif schetimelayout->addWidget( date, 1, 1, 1, 3 ); scherepeatnumber = new QSpinBox; scherepeatnumber->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( scherepeatnumber, 2, 1, 1, 3 ); repeatDays = new QSpinBox; repeatDays->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( repeatDays, 3, 1, 1, 1 ); repeatDays->setSuffix( qtr(" days") ); repeatTime = new QDateTimeEdit; repeatTime->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( repeatTime, 3, 2, 1, 2 ); repeatTime->setDisplayFormat( "hh:mm:ss" ); /* scrollArea */ ui.vlmItemScroll->setFrameStyle( QFrame::NoFrame ); ui.vlmItemScroll->setWidgetResizable( true ); vlmItemWidget = new QWidget; vlmItemLayout = new QVBoxLayout( vlmItemWidget ); vlmItemWidget->setLayout( vlmItemLayout ); ui.vlmItemScroll->setWidget( vlmItemWidget ); QSpacerItem *spacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); vlmItemLayout->addItem( spacer ); QPushButton *importButton = new QPushButton( qtr( "I&mport" ) ); ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole ); QPushButton *exportButton = new QPushButton( qtr( "E&xport" ) ); ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole ); QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); ui.buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole ); showScheduleWidget( QVLM_Broadcast ); /* Connect the comboBox to show the right Widgets */ CONNECT( ui.mediaType, currentIndexChanged( int ), this, showScheduleWidget( int ) ); /* Connect the leftList to show the good VLMItem */ CONNECT( ui.vlmListItem, currentRowChanged( int ), this, selectVLMItem( int ) ); BUTTONACT( closeButton, close() ); BUTTONACT( exportButton, exportVLMConf() ); BUTTONACT( importButton, importVLMConf() ); BUTTONACT( ui.addButton, addVLMItem() ); BUTTONACT( ui.clearButton, clearWidgets() ); BUTTONACT( ui.saveButton, saveModifications() ); BUTTONACT( ui.inputButton, selectInput() ); BUTTONACT( ui.outputButton, selectOutput() ); if( !restoreGeometry( getSettings()->value("VLM/geometry").toByteArray() ) ) { resize( QSize( 700, 500 ) ); } }
int main ( int argc, char** argv ) { dp = XOpenDisplay ( NULL ); int scr = DefaultScreen ( dp ); Window root = RootWindow ( dp, scr ); XEvent event; cfg_rule* rule; char* name; signal(SIGINT, SIGINT_handler); signal(SIGHUP, SIGHUP_handler); parse_options ( argc, argv ); char* configfile = (char*) malloc ( strlen ( getenv("HOME") ) + strlen ("/.transd") + 1 ); *configfile = '\0'; DEBUG(1, "configfile: %s\n", configfile ); DEBUG(1, "configfile: %s\n", configfile ); if ( cfg_parse_config_file ( configfile ) == -1 ) { DEBUG(1, "User-based config-file %s/transd.conf not found!\n", configfile); DEBUG(1, "Using global configuration file /etc/transd/transd.conf\n"); if ( cfg_parse_config_file ( "/etc/transd" ) == -1 ) { printf("Error: Could not find any config file! Exiting...\n"); return(1); } } free ( configfile ); XSetErrorHandler ( XmuSimpleErrorHandler ); /* select window-enter/-leave events from all currently existing windows */ walkWindowTree ( root, selectInput, NULL ); DEBUG(1, "got %d initial windows in list\n", slist_size(window_list)); /* select substructure events from root window (so we can keep track of new windows) */ XSelectInput ( dp, root, SubstructureNotifyMask | EnterWindowMask ); for (;;) { XNextEvent ( dp, &event ); switch ( event.type ) { case CreateNotify: DEBUG(5, "CreateNotify for 0x%x\n", event.xcreatewindow.window); selectInput ( event.xcreatewindow.window, NULL ); break; case EnterNotify: DEBUG(5, "EnterNotify for 0x%x (detail %d)\n", event.xcrossing.window, event.xcrossing.detail); rule = cfg_get_rule ( dp, event.xcrossing.window, "Enter" ); if ( rule != NULL ) { DEBUG(5, "got rule for 0x%x\n", event.xcrossing.window); if ( !strcmp ( rule->action.property, "__TRANSD_SELF" ) ) { Window dummy, parent, *children; unsigned int n; XQueryTree ( dp, event.xcrossing.window, &dummy, &parent, &children, &n ); setOpacity ( parent, rule->action.opacity ); } else walkWindowList ( executeRule, rule ); /* check whether this Enter-rule has reverted the cached Leave-rule */ if ( cached_rule != NULL ) { Window dummy, parent, *children; unsigned int n; DEBUG(4, "SMART: A1. found cached rule for 0x%x\n", cached_window); XQueryTree ( dp, cached_window, &dummy, &parent, &children, &n ); DEBUG(4, "Opacity matching: 0x%x == 0x%x ?\n", getOpacity(parent, 0), rule->action.opacity ); if ( getOpacity(parent, 0) == rule->action.opacity ) { DEBUG(4,"SMART: A2. opac matching\n"); if ( cfg_check_property ( dp, cached_window, rule->action.property, rule->action.value ) ) { DEBUG(4,"SMART: A3. rule was not reverted, executing...\n"); /* left window is not affected by this rule, execute cached rule */ if ( !strcmp ( cached_rule->action.property, "__TRANSD_SELF" ) ) { setOpacity ( parent, cached_rule->action.opacity ); } else walkWindowList ( executeRule, rule ); cached_rule = NULL; } } } } else if ( event.xcrossing.detail != 4 ) { DEBUG(5, "no rule for 0x%x\n", event.xcrossing.window); /* execute cached rule */ if ( cached_rule != NULL ) { DEBUG(5, "SMART: B1. found cached rule for 0x%x\n", cached_window); if ( !strcmp ( cached_rule->action.property, "__TRANSD_SELF" ) ) { Window dummy, parent, *children; unsigned int n; XQueryTree ( dp, cached_window, &dummy, &parent, &children, &n ); setOpacity ( parent, cached_rule->action.opacity ); } else walkWindowList ( executeRule, cached_rule ); cached_rule = NULL; } } break; case LeaveNotify: DEBUG(5, "LeaveNotify for 0x%x (detail %d)\n", event.xcrossing.window, event.xcrossing.detail); if ( event.xcrossing.detail != 2 ) { rule = cfg_get_rule ( dp, event.xcrossing.window, "Leave" ); if ( rule != NULL ) { DEBUG(5, "got rule for 0x%x\n", event.xcrossing.window); /* cache rule and current opacity */ DEBUG(5, "caching rule for 0x%x\n", event.xcrossing.window); cached_rule = rule; cached_window = event.xcrossing.window; } else { DEBUG(5, "no rule for 0x%x\n", event.xcrossing.window); } } break; case VisibilityNotify: DEBUG(5, "VisibilityNotify for 0x%x (state %d)\n", event.xvisibility.window, event.xvisibility.state); switch ( event.xvisibility.state ) { case VisibilityFullyObscured: DEBUG(5, "Removing 0x%x from our list\n", event.xvisibility.window); removeWindowFromList ( event.xvisibility.window ); DEBUG(1, "got %d windows in list now\n", slist_size(window_list)); break; default: DEBUG(5, "Adding 0x%x to our list\n", event.xvisibility.window); selectInput( event.xvisibility.window, NULL ); DEBUG(1, "got %d windows in list now\n", slist_size(window_list)); } break; case DestroyNotify: DEBUG(5, "DestroyNotify for 0x%x (state %d)\n", event.xdestroywindow.window); DEBUG(5, "Removing 0x%x from our list\n", event.xdestroywindow.window); removeWindowFromList ( event.xdestroywindow.window ); break; } } return(0); }
Card::Card(Suit s, unsigned int v) : NSWindow(true, gameWindow, 0, 0, cardWidth, cardHeight, 1, BlackPixel(dpy, 0)) { #ifdef SHAPE if (Option::roundCard() && !initialized) { //Shape boundingMask = XCreateBitmapFromData(dpy, root(), (char*)boundingMask_bits, boundingMask_width, boundingMask_height); clipMask = XCreateBitmapFromData(dpy, root(), (char*)clipMask_bits, clipMask_width, clipMask_height); //Cursor XColor fore, back, xc; Pixmap p, mask; Colormap cm = DefaultColormap(dpy, 0); p = XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_bits, cursor_width, cursor_height); mask = XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_back_bits, cursor_back_width, cursor_back_height); XAllocNamedColor(dpy, cm, "white", &fore, &xc); XAllocNamedColor(dpy, cm, "black", &back, &xc); cursor = XCreatePixmapCursor(dpy, p,mask, &fore, &back, 0, 0); initialized = true; } #endif _parent = 0; _stack = 0; _suit = s; _value = v; _removed = false; makeBitmap(s, v, bitmap); // initialization on X things unsigned long fore, back, hilight; if (suitColor(s) == RedSuit) fore = getColor(dpy, "red"); else fore = getColor(dpy, "black"); back = WhitePixel(dpy, 0); hilight = getColor(dpy, "lightskyblue4"); _usualPixmap = XCreatePixmapFromBitmapData(dpy, gameWindow, bitmap, cardWidth - 2, cardHeight - 2, fore, back, DefaultDepth(dpy, DefaultScreen(dpy))); _hilightedPixmap = XCreatePixmapFromBitmapData(dpy, gameWindow, bitmap, cardWidth - 2, cardHeight - 2, fore, hilight, DefaultDepth(dpy, DefaultScreen(dpy))); selectInput(ButtonPressMask | EnterWindowMask | LeaveWindowMask); backgroundPixmap(_usualPixmap); #ifdef SHAPE if (Option::roundCard()) { XShapeCombineMask(dpy, window(), ShapeBounding, 0, 0, boundingMask, ShapeSet); XShapeCombineMask(dpy, window(), ShapeClip, 0, 0, clipMask, ShapeSet); } #endif NSWindow::move(0, 0); map(); }
Card::Card(Suit s, unsigned int v) : NSWindow(true, gameWindow, 0, 0, cardWidth, cardHeight, 1, XC_BLACK) { if (!initialized) { #ifdef SHAPE if (Option::roundCard()) { //Shape boundingMask = XCreateBitmapFromData(dpy, root(), boundingMask_bits, boundingMask_width, boundingMask_height); clipMask = XCreateBitmapFromData(dpy, root(), clipMask_bits, clipMask_width, clipMask_height); } #endif //Cursor //XColor fore, back, xc; //gi_window_id_t p, mask; //Colormap cm = DefaultColormap(dpy, 0); //p = XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_bits, cursor_width, cursor_height); //mask = XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_back_bits, cursor_back_width, cursor_back_height); //XAllocNamedColor(dpy, cm, "white", &fore, &xc); //XAllocNamedColor(dpy, cm, "black", &back, &xc); //cursor = XCreatePixmapCursor(dpy, p,mask, &fore, &back, 0, 0); #ifdef GIXOK uint16_t *p = gi_create_bitmap_from_data(16, 16, cursor_width, cursor_height, cursor_bits, TRUE,TRUE); uint16_t *mask = gi_create_bitmap_from_data(16, 16, cursor_back_width, cursor_back_height, cursor_back_bits, TRUE,TRUE); cursor = GrNewCursor(16, 16, 8, 0, XC_BLACK, XC_WHITE, p, mask); free(p); free(mask); #endif initialized = true; } _parent = 0; _stack = 0; _suit = s; _value = v; _removed = false; makeBitmap(s, v, bitmap); // initialization on X things unsigned long fore, back, hilight; if (suitColor(s) == RedSuit) fore = getColor( XC_RED); else fore = getColor( XC_BLACK); back = XC_WHITE; hilight = getColor( XC_LIGHTSKYBLUE4); _usualPixmap = gi_create_pixmap_from_bitmap( gameWindow, bitmap, cardWidth - 2, cardHeight - 2, fore, back, gi_screen_format() ); _hilightedPixmap = gi_create_pixmap_from_bitmap( gameWindow, bitmap, cardWidth - 2, cardHeight - 2, fore, hilight, gi_screen_format() ); selectInput(GI_MASK_BUTTON_DOWN | GI_MASK_MOUSE_ENTER | GI_MASK_MOUSE_EXIT); backgroundPixmap(_usualPixmap); #ifdef SHAPE if (Option::roundCard()) { XShapeCombineMask(dpy, window(), ShapeBounding, 0, 0, boundingMask, ShapeSet); XShapeCombineMask(dpy, window(), ShapeClip, 0, 0, clipMask, ShapeSet); } #endif NSWindow::move(0, 0); map(); }
void MSWidget::selectInput(void) { selectInput((long)NoEventMask); }
TestFrame() : l(""), con(100, 100) { con.add(&l); container(&con); selectInput(ButtonPressMask); }
byte MUX8_16::readInput(int pota) { selectInput(pota); current_value = ceil(analogRead(_analogPort)/8); return current_value; }
// the following 2 methods are used to support an application builder void MSWidget::eventHandler(long mask_,EventHandler eventHandler_,void *clientData_) { selectInput(mask_); _eventHandler=eventHandler_; _eventHandlerData=clientData_; }