void MSTextRect::sensitive(MSBoolean sensitive_) { if (sensitive()!=sensitive_) { _sensitive=sensitive_; if (sensitive()) textMSGC().fillStyle(FillSolid); else textMSGC().fillStyle(FillStippled); updateSensitivity(); } }
void MSVGauge::init(void) { acceptFocus(MSFalse); sensitive(MSFalse); _gaugeHeight=0; _startValue.unset(); }
// Frequency-sensitive competitive learning REAL CFCluster::FSCL( REAL* data, int sampNum, int dim, REAL* center, int cenNum, int iter ) { int* frequ; frequ = new int [cenNum]; for( int m=0; m<cenNum; m++ ) frequ[m] = 1; REAL rate0=(REAL)0.2; REAL rate; REAL dmin, total; int index; int n; for( int cycle=0; cycle<iter; cycle++ ) { rate = rate0*(iter-cycle)/iter; total = 0; for( n=0; n<sampNum; n++ ) { index = sensitive( data+(_int64)n*dim, dim, center, cenNum, frequ, dmin ); frequ[index] ++; total += dmin; modify( data+(_int64)n*dim, dim, center+index*dim, rate ); } total /= sampNum; //printf( "%2d %8.2f\n", cycle, total ); } if (frequ) delete[]frequ; return total; }
void MSWidget::set(MSAttrValueList& avList_) { MSIndexVector index; for (unsigned i=0;i<avList_.length();i++) { if (avList_[i].attribute()=="foreground") foreground(avList_[i].value()),index<<i; else if (avList_[i].attribute()=="background") background(avList_[i].value()),index<<i; else if (avList_[i].attribute()=="font") font(avList_[i].value()),index<<i; else if (avList_[i].attribute()=="acceptFocus") acceptFocus(avList_[i].value().asBoolean()),index<<i; else if (avList_[i].attribute()=="dynamic") dynamic(avList_[i].value().asBoolean()),index<<i; else if (avList_[i].attribute()=="sensitive") sensitive(avList_[i].value().asBoolean()),index<<i; else if (avList_[i].attribute()=="readOnly") readOnly(avList_[i].value().asBoolean()),index<<i; else if (avList_[i].attribute()=="at") at(At(avList_[i].value())),index<<i; else if (avList_[i].attribute()=="resizeConstraints") resizeConstraints(avList_[i].value()),index<<i; } avList_.remove(index); }
GUI_Status ListWidget::MouseDown( const SDL_MouseButtonEvent &button ) { SDL_MouseButtonEvent mybutton = button; if ( ((button.button == SDL_BUTTON_WHEELUP) || (button.button == SDL_BUTTON_WHEELDOWN)) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { // reroute all wheel events to the scroller SliderWidget *s = static_cast<SliderWidget *>( GetWidget(0) ); if ( s ) { mybutton.x = s->LeftEdge() + surface->LeftEdge(); mybutton.y = s->TopEdge() + surface->TopEdge(); } } GUI_Status rc = CompositeWidget::MouseDown( mybutton ); if ( (rc == GUI_OK) && (button.button == SDL_BUTTON_LEFT) ) { short mx = button.x - surface->LeftEdge(); short my = button.y - surface->TopEdge(); Rect sensitive( x + 2, y + spacing, listboxw - 4, h - 2 * spacing ); if ( sensitive.Contains( mx, my ) ) { short item = (my - y - spacing - 1 + toprow) / ItemHeight(); if ( (item < nodes) ) return Select( item ); } } return rc; }
void MSWidget::sensitive(MSBoolean sensitive_) { if (sensitive()!=sensitive_) { _sensitive=sensitive_; updateSensitivity(); } }
void MSTableColumn::init(void) { _style=0; _breakStyle=reportTable()->breakStyle(); _headingStyle=reportTable()->headingStyle(); _breakOffset=reportTable()->breakOffset(); _breakLeading=reportTable()->breakLeading(); _fgGrayScale=reportTable()->fgGrayScale(); _bgGrayScale=reportTable()->bgGrayScale(); _breakFgGrayScale=reportTable()->fgGrayScale(); _breakBgGrayScale=reportTable()->bgGrayScale(); _headingFgGrayScale=reportTable()->headingFgGrayScale(); _headingBgGrayScale=reportTable()->headingBgGrayScale(); _headingForeground=0; _suppressDuplicate=MSFalse; _breakOn=MSFalse; _pageBreakOn=MSFalse; _breakProcessOn=MSTrue; _breakProcessMode=MSP::Total; _column=reportTable()->columnList()->count(); _breakFgPixel=ULONG_MAX; _breakBgPixel=ULONG_MAX; _valueQuoted=MSTrue; _owner=table(); if (owner()!=0) { _bg=owner()->background(); _fg=owner()->foreground(); _fontID=owner()->font(); } sensitive(MSTrue); _resizable=MSTrue; _columnWidth=MSTableColumnDefaultColumnWidth; _columnAlignment=MSRight; _clipMode=MSNoClipping; _editWidth=MSTableColumnDefaultEditWidth; _cycleMode=MSForeground; headingForeground(reportTable()->headingForeground()); if (table()!=0) { _headingFont=table()->headingFont(); _headingAlignment=table()->headingAlignment(); fontStruct((XFontStruct *)server()->fontStruct(font())); if (font()!=headingFont()) headingFontStruct((XFontStruct *)server()->fontStruct(headingFont())); else headingFontStruct((XFontStruct *)fontStruct()); createGCs(); childCreateNotify(); } else reportTable()->addColumn(this); }
MSBoolean MSWidget::isTraversable(void) const { if (mapped()==MSTrue&&sensitive()==MSTrue&&acceptFocus()==MSTrue) { // do not trust visible, because of server sync problems MSWidget *pWidget=(MSWidget *)_owner; for (;pWidget!=0;pWidget=pWidget->_owner) { if (pWidget->mapped()==MSFalse) return MSFalse; } return MSTrue; } return MSFalse; }
void MSEntryFieldCombo::buttonPress(const XEvent *pEvent_) { if (sensitive()==MSTrue) { if(pEvent_->xbutton.x<_fieldValue->x()+_fieldValue->width()) { MSEntryField::buttonPress(pEvent_); } else { activate(); if (_editor->mapped()==MSFalse) { MSBoolean focusOK=MSTrue; if (acceptFocus()==MSTrue) focusOK=traverseFocus(this); if (focusOK==MSTrue) { if (pEvent_->xbutton.button==Button1&&_buttonFlags!=0) { if (comboOrTextButton()==MSTrue&& pEvent_->xbutton.x>=buttonRect().x()&& pEvent_->xbutton.y>=buttonRect().y()) { if(buttonState(ComboButton) == MSTrue) { buttonActivate(); } else { drawTextButton(MSTrue); _buttonSelected = MSTrue; } } else if(buttonState(UpDownArrows) == MSTrue) { if (isProtected()==MSFalse) { if(pEvent_->xbutton.y <_fieldValue->y() +_fieldValue->height()/2) armUpArrow(); else armDownArrow(); } } } } } } } }
MSAttrValueList& MSWidget::get(MSAttrValueList& avList_) { MSStringVector aStringVector("MSFalse\nMSTrue"); avList_<<MSAttrValue("foreground",_server->colorName(foreground()),MSAttrValue::Color); avList_<<MSAttrValue("background",_server->colorName(background()),MSAttrValue::Color); avList_<<MSAttrValue("font",_server->fontName(font()),MSAttrValue::Font); avList_<<MSAttrValue("acceptFocus",aStringVector(acceptFocus()),aStringVector); avList_<<MSAttrValue("sensitive",aStringVector(sensitive()),aStringVector); avList_<<MSAttrValue("readOnly",aStringVector(readOnly()),aStringVector); avList_<<MSAttrValue("dynamic",aStringVector(dynamic()),aStringVector); At aAt=at(); avList_<<MSAttrValue("resizeConstraints",aAt.parsedConstraints(),MSAttrValue::String); avList_<<MSAttrValue("at",aAt.asString(),MSAttrValue::String); avList_<<MSAttrValue("destroy","",MSAttrValue::Callback); avList_<<MSAttrValue("takefocus","",MSAttrValue::Callback); return avList_; }
MSBoolean MSTableColumn::isValid(unsigned) { return sensitive()==MSFalse ? MSFalse : table()->sensitive(); }
MSBoolean MSWidget::isProtected(void) const { return (readOnly()==MSTrue || sensitive()==MSFalse)?MSTrue:MSFalse;}