Exemplo n.º 1
0
void WInteractWidget::setDraggable(const std::string& mimeType,
				   WWidget *dragWidget, bool isDragWidgetOnly,
				   WObject *sourceObject)
{
  if (dragWidget == 0)
    dragWidget = this;

  if (sourceObject == 0)
    sourceObject = this;

  if (isDragWidgetOnly) {
    dragWidget->hide();
  }

  WApplication *app = WApplication::instance();

  setAttributeValue("dmt", mimeType);
  setAttributeValue("dwid", dragWidget->id());
  setAttributeValue("dsid", app->encodeObject(sourceObject));

  if (!dragSlot_) {
    dragSlot_ = new JSlot();
    dragSlot_->setJavaScript("function(o,e){" + app->javaScriptClass()
			     + "._p_.dragStart(o,e);" + "}");
  }

  mouseWentDown().connect(*dragSlot_);
}
Exemplo n.º 2
0
TTAudioObjectBase::TTAudioObjectBase(const TTValue& arguments) :
	TTObjectBase(arguments), 
	mMaxNumChannels(0),
	attrMute(0), 
	inputArray(kTTSym_audiosignalarray,2),
	outputArray(kTTSym_audiosignalarray,2),
	startProcessingTime(0.0),
	accumulatedProcessingTime(0.0),
	accumulatedProcessingCalls(0.0)
{
	// Convention: 'Public' attribute names begin with a capital letter, 'Private' attribute names begin with a lower case letter
//	registerAttribute("maxNumChannels",		kTypeUInt8,		&maxNumChannels,	(TTSetterMethod)&TTAudioObjectBase::setMaxNumChannels);
	addAttributeWithSetter(MaxNumChannels,	kTypeUInt16);
	addAttributeProperty(MaxNumChannels,	defaultValue,	1);
	
	registerAttribute(kTTSym_sampleRate,	kTypeUInt32,	&sr,				(TTSetterMethod)&TTAudioObjectBase::setSr);
	registerAttribute("bypass",				kTypeBoolean,	&attrBypass,		(TTSetterMethod)&TTAudioObjectBase::setBypass);
	registerAttribute("mute",				kTypeBoolean,	&attrMute,			(TTSetterMethod)&TTAudioObjectBase::setMute);
	
	registerMessage("test",						(TTMethod)&TTAudioObjectBase::test);
	registerMessage("calculate",				(TTMethod)&TTAudioObjectBase::calculateMessage);
	registerMessage("resetBenchmarking",		(TTMethod)&TTAudioObjectBase::resetBenchmarking, kTTMessagePassNone);
	registerMessage("getProcessingBenchmark",	(TTMethod)&TTAudioObjectBase::getProcessingBenchmark);
	
	// Set Defaults...
		
	setAttributeValue(kTTSym_sampleRate, ttEnvironment->mSampleRate);
	setProcess(&TTAudioObjectBase::bypassProcess);
    setCalculate(&TTAudioObjectBase::defaultCalculateMethod);
	setAttributeValue("bypass",			NO);
}
Exemplo n.º 3
0
Arquivo: job.cpp Projeto: JoelB/BITS
bool Job::createFromFile(QString filename)
{
	XMLParser bitsParser;
	Task *tempTask;
	QFile *xmlFile = new QFile(filename);
	bitsParser.parseFile(xmlFile);
	
	QMapIterator<QString, QMap<QString,QVariant> > it(bitsParser.properties);
	while (it.hasNext())
	{
		it.next();
		if (it.key() == "Job")
			setAttributeValue("Filename",filename);
		else if (it.key() == "Task")
		{
			tempTask = new Task;
			tempTask->setAttributeValue("Filename",filename);
		}
		else
			continue;
		
		QMapIterator<QString,QVariant> j(it.value());
		while (j.hasNext())
		{
			j.next();
			if (it.key() == "Job")
			{
				addAttribute(j.key());
				setAttributeValue(j.key(),j.value());
			}
			else if (it.key() == "Task" && tempTask)
			{
				if (j.key() != "Name" && j.key() != "StartDate" && j.key() != "EndDate" && j.key() != "TimeSpent" && j.key() != "TaskID" && j.key() != "HotKey" && j.key() != "Completed")
					tempTask->addAttribute(j.key());
				tempTask->setAttributeValue(j.key(),j.value());
			}
		}
		if (it.key() == "Task" && tempTask)
		{
			if (tempTask->isValid())
				addTask(tempTask);	
			else
				emit statusChanged("Invalid Task not added!");
		}
			
	}
	if (isValid())
	{
		makeTaskIDs();
		writeConfigFile();
	}
	else
		emit statusChanged(QString("Invalid Job in %1 not added!").arg(filename));
	xmlFile->close();
	delete xmlFile;
	return true;
}
Exemplo n.º 4
0
void SoundManager::play(WSound *sound, int loops)
{
  setup(sound);

  setAttributeValue("loops", std::string());
  setAttributeValue("loops", std::to_string(loops - 1));

  current_ = sound;

  WMediaPlayer::play();
}
Exemplo n.º 5
0
// DiffRotDiscreteCircle::DiffRotDiscreteCircle()
void DiffRotDiscreteCircle::init() {
  m_elastic = boost::dynamic_pointer_cast<ElasticDiffRotDiscreteCircle>(
      API::FunctionFactory::Instance().createFunction(
          "ElasticDiffRotDiscreteCircle"));
  addFunction(m_elastic);
  m_inelastic = boost::dynamic_pointer_cast<InelasticDiffRotDiscreteCircle>(
      API::FunctionFactory::Instance().createFunction(
          "InelasticDiffRotDiscreteCircle"));
  addFunction(m_inelastic);

  setAttributeValue("NumDeriv", true);

  declareAttribute("Q", API::IFunction::Attribute(0.5));
  declareAttribute("N", API::IFunction::Attribute(3));

  // Set the aliases
  setAlias("f1.Intensity", "Intensity");
  setAlias("f1.Radius", "Radius");
  setAlias("f1.Decay", "Decay");
  setAlias("f1.Shift", "Shift");

  // Set the ties between Elastic and Inelastic parameters
  addDefaultTies("f0.Height=f1.Intensity,f0.Radius=f1.Radius");
  applyTies();
}
Exemplo n.º 6
0
void WProgressBar::resize(const WLength& width, const WLength& height)
{
  WInteractWidget::resize(width, height);

  if (!height.isAuto())
    setAttributeValue("style", "line-height: " + height.cssText());
}
Exemplo n.º 7
0
void XMLAttr::setAttributeValue(const char **name, const char **value, int size) const
{
    for (int i = 0; i < size; i++)
    {
        setAttributeValue(name[i], value[i]);
    }
}
/** Uses Polynomial as a ChildAlgorithm to fit the log of the exponential curve
 * expected for the transmission.
 * @param[in] WS The single-spectrum workspace to fit
 * @param[in] order The order of the polynomial from 2 to 6
 * @param[out] coeficients of the polynomial. c[0] + c[1]x + c[2]x^2 + ...
 */
API::MatrixWorkspace_sptr
CalculateTransmission::fitPolynomial(API::MatrixWorkspace_sptr WS, int order,
                                     std::vector<double> &coeficients) {
  g_log.notice("Fitting the experimental transmission curve fitpolyno");
  double start = m_done;
  IAlgorithm_sptr childAlg = createChildAlgorithm("Fit", start, m_done = 0.9);
  auto polyfit = API::FunctionFactory::Instance().createFunction("Polynomial");
  polyfit->setAttributeValue("n", order);
  polyfit->initialize();
  childAlg->setProperty("Function", polyfit);
  childAlg->setProperty<MatrixWorkspace_sptr>("InputWorkspace", WS);
  childAlg->setProperty("Minimizer", "Levenberg-MarquardtMD");
  childAlg->setProperty("CreateOutput", true);
  childAlg->setProperty("IgnoreInvalidData", true);
  childAlg->executeAsChildAlg();
  std::string fitStatus = childAlg->getProperty("OutputStatus");
  if (fitStatus != "success") {
    g_log.error("Unable to successfully fit the data: " + fitStatus);
    throw std::runtime_error("Unable to successfully fit the data");
  }

  // Only get to here if successful
  coeficients.resize(order + 1);
  for (int i = 0; i <= order; i++) {
    coeficients[i] = polyfit->getParameter(i);
  }
  return this->extractSpectra(childAlg->getProperty("OutputWorkspace"),
                              std::vector<size_t>(1, 1));
}
Exemplo n.º 9
0
void EnvironmentNode::setAttributeValues(const std::vector<NameValue> &values, Status &status, bool allowInvalid, bool forceCreate)
{
    for (auto it = values.begin(); it != values.end(); ++it)
    {
        setAttributeValue((*it).name, (*it).value, status, allowInvalid, forceCreate);
    }
}
Exemplo n.º 10
0
 WForm::WForm(Type type, int labelColumns, WContainerWidget *parent) : WContainerWidget(parent), dptr(type, labelColumns)
 {
   static map<Type, string> typeClass {
     {Default, ""},
     {Horizontal, "form-horizontal"},
     {Inline, "form-inline"},
   };
   addStyleClass(typeClass[type]);
   setAttributeValue("role", "form");
 }
Exemplo n.º 11
0
void XMLAttr::setAttributeValue(xmlNode * node, const char **name, const char **value, int size)
{
    if (node && node->type == XML_ELEMENT_NODE)
    {
        for (int i = 0; i < size; i++)
        {
            setAttributeValue(node, name[i], value[i]);
        }
    }
}
Exemplo n.º 12
0
	void AttributeColorComponent::valueChanged(Value& val)
	{
		if (val == m_color)
		{
			const Colour col = getColour();

			if (col != m_lastcolor)
				setAttributeValue({(double)col.getFloatRed(), (double)col.getFloatGreen(), (double)col.getFloatBlue(), (double)col.getFloatAlpha()});

			m_lastcolor = col;
		}
	}
Exemplo n.º 13
0
TTBuffer::TTBuffer(TTValue& arguments) : 
	TTAudioObject(arguments)
{
	// By convention, the first argument for a TTAudioObject is the number of channels
	// So we'll maintain that here, and then use the second argument for the name of the buffer
	
	TTUInt16	channelCount = 1;
	TTSymbol	name = kTTSymEmpty;
	
	if (arguments.getSize() > 0) {
		arguments.get(0, channelCount);	// TODO: should we limit range?  should zero mean to just reference an existing buffers channelcount?
		if (arguments.getSize() > 1)
			arguments.get(1, name);
	}
	
	if (!gTTBufferNameMap)
		gTTBufferNameMap = new TTHash;
	
	addMessageWithArguments(getNames);
	addAttributeWithSetter(Name, kTypeSymbol);
	
	addAttributeWithGetterAndSetter(NumChannels,		kTypeUInt16);
	addAttributeWithGetterAndSetter(Length,				kTypeFloat64);
	addAttributeWithGetterAndSetter(LengthInSamples,	kTypeUInt64);
//	addAttribute(SampleRate,							kTypeFloat64);
	
	addMessage(normalize);
	addMessageWithArguments(fill);

	addMessageWithArguments(getValueAtIndex);
	registerMessage("peek", (TTMethod)&TTBuffer::getValueAtIndex);

	addMessageWithArguments(setValueAtIndex);
	registerMessage("poke", (TTMethod)&TTBuffer::setValueAtIndex);
	
	// initialize
	setAttributeValue("name", name);
	if (channelCount)
		setAttributeValue("numChannels", channelCount);			
}
Exemplo n.º 14
0
void AnyNode::processMessage(const char *inlet, const Message &message)
{
    if (message.getTypes() == "") // bang only outputs the value
    {
        // pass
    }
    else // any message with some type tags sets the value and outputs it
    {
        setAttributeValue("value", message);
    }
    if (utils::stringsMatch(inlet, "0"))
        output("0", getAttributeValue("value"));
}
Exemplo n.º 15
0
/** Set an x attribute for the spline
 *
 * @param index :: index of x attribute to set
 * @param x :: The value of the x attribute
 */
void CubicSpline::setXAttribute(const size_t index, double x) {
  size_t n = static_cast<size_t>(getAttribute("n").asInt());

  // check that setting the x attribute is within our range
  if (index < n) {
    std::string xName = "x" + boost::lexical_cast<std::string>(index);
    setAttributeValue(xName, x);

    // attributes updated, flag for recalculation
    m_recalculateSpline = true;
  } else {
    throw std::range_error("Cubic Spline: x index out of range.");
  }
}
Exemplo n.º 16
0
TTEnvironment::TTEnvironment()
	: TTObject(kTTValNONE), mDebugBasic(false), mDebugMessaging(false), mSampleRate(0)
{	
	classes = new TTHash();
	tags = new TTHash();

	addAttribute(DebugBasic,		kTypeBoolean);
	addAttribute(DebugMessaging,	kTypeBoolean);
	addAttribute(SampleRate,		kTypeUInt32);

	addMessageWithArgument(GetVersion);

	// can't use the SymbolCache here because it hasn't been initialized yet!
	setAttributeValue(TT("SampleRate"), TTUInt32(44100));
}
bool AttributeManager::setAttributeValue( const std::string &name, const std::string &type, const std::string &value )
{
    bool bRet = false;
    std::stringstream strBuffer( value );

    // the type information is case-insensitve
    std::string citype;    
    for ( size_t i = 0; i < type.size(); ++i ) citype += toupper( type[ i ] );

    if ( ( citype == "BOOLEAN" ) || ( citype == "BOOL" ) ) 
    {
        std::string bVal;
        strBuffer >> bVal;
        bool   bValue = ( bVal == "true" ) ? true : false;
        bRet = setAttributeValue( name, bValue );
    }
Exemplo n.º 18
0
void WSuggestionPopup::init()
{
  impl_ = dynamic_cast<WContainerWidget *>(implementation());

  impl_->setList(true);
  impl_->setLoadLaterWhenInvisible(false);

  /*
   * We use display: none because logically, the popup is visible and
   * propagates signals
   */
  setAttributeValue("style", "z-index: 10000; display: none; overflow: auto");

  setModel(new WStringListModel(this));

  filter_.connect(this, &WSuggestionPopup::doFilter);
  jactivated_.connect(this, &WSuggestionPopup::doActivate);
}
Exemplo n.º 19
0
TTErr TTObjectBase::setAttributeValue(const TTSymbol name, TTValue& value)
{
	TTAttributePtr	attribute = NULL;
    
    // Retreive the registered attribute
	TTErr err = findAttribute(name, &attribute);
	
    if (!err)
    {
        // If no value : use attribute default value
        if (value.empty())
            return setAttributeValue(name, attribute->mDefaultValue);
        
        // Can't set read only attribute
		if (attribute->readOnly)
			err = kTTErrReadOnly;
        
		else
        {
            // Clipping
			if (attribute->rangeChecking == kTTSym_clip)
				value.clip(attribute->rangeLowBound, attribute->rangeHighBound);
			else if (attribute->rangeChecking == kTTSym_cliplow)
				value.cliplow(attribute->rangeLowBound);
			else if (attribute->rangeChecking == kTTSym_cliphigh)
				value.cliphigh(attribute->rangeHighBound);
            
            // Calling the attribute accessor of the object depending of the arguments it takes
            
            // Passing attribute structure with the value
			if (attribute->setterFlags & kTTAttrPassObject)
				err = (this->*attribute->setter)(*attribute, value);
            
            // Or passing the value only
			else
            {
				TTMethodInputValue setter = (TTMethodInputValue)attribute->setter;
				err = (this->*setter)(value);
			}
		}
	}
    
	return err;
}
Exemplo n.º 20
0
//
// Called to initialize a newly added node to the environment (not just read from the environment)
void EnvironmentNode::initialize()
{
    //
    // Add missing attributes
    addMissingAttributesFromConfig();

    //
    // If we are a component and there is a buildSet attribute, set the value to the configItem's type
    if (!(m_pSchemaItem->getProperty("itemType").empty()) && hasAttribute("buildSet"))
    {
        Status status;
        setAttributeValue("buildSet", m_pSchemaItem->getProperty("itemType"), status);
    }

    //
    // Initilize each attribute
    for (auto attrIt = m_attributes.begin(); attrIt != m_attributes.end(); ++attrIt)
    {
        attrIt->second->initialize();
    }
}
/*! Encargado de llenar la lista de registros del modelo con el resultado de la consulta.
\param query Query de donde tomar los datos.
*/
void GrupoPermisoModelBase::addSelectQueryToRecords(QSqlQuery query)
{
	query.first();

	//no se cuenta el ultimo ya que ese es solo para saber si hay mas datos a consultar
	for ( int c=0; c<actualQuerySize-( actualQuerySize==(limit+1)?1:0 ); c++ )
	{
		int pos=0;
		GrupoPermisoRecordBase *p=new GrupoPermisoRecordBase(this,NULL,DB);
		setRecordEnabledBackup( p,false );
		foreach ( confInsertValue *iv, lstCIV )
			setAttributeValue(p,iv,query.value(pos++));
		setRecordEnabledBackup( p,true );
		
		connect( p,SIGNAL(hasValuesWithOutSave(bool,RecordBase*)),
				this, SLOT(record_hasRecordsWithOutSave(bool,RecordBase*)));

		lstRecord.append(p);
		query.next();
	}
}
Exemplo n.º 22
0
void WSuggestionPopup::init()
{
  setImplementation(impl_);
  impl_->setLoadLaterWhenInvisible(false);
  impl_->setStyleClass("Wt-suggest Wt-outset");

  impl_->bindString("shadow-x1-x2", WTemplate::DropShadow_x1_x2);
  impl_->bindWidget("contents", content_ = new WContainerWidget());
  content_->setStyleClass("content");

  /*
   * We use display: none because logically, the popup is visible and
   * propagates signals
   */
  setAttributeValue("style", "z-index: 10000; display: none");
  setPositionScheme(Absolute);

  setModel(new WStringListModel(this));

  filter_.connect(this, &WSuggestionPopup::doFilter);
  jactivated_.connect(this, &WSuggestionPopup::doActivate);
}
Exemplo n.º 23
0
SoundManager::SoundManager()
  : WMediaPlayer(MediaType::Audio)
{
  resize(0, 0);
  setAttributeValue("style", "overflow: hidden");

  controlsWidget()->hide();
  decorationStyle().setBorder(WBorder());

  WStringStream ss;
  ss <<
    "function() { "
    """var s = " << jsRef() << ", l = s.getAttribute('loops');"
    """if (l && l != '0') {"
    ""   "s.setAttribute('loops', l - 1);"
    ""   << jsPlayerRef() << ".jPlayer('play');"
    """}"
    "}";

  ended().connect(ss.str());
  ended().setNotExposed();
}
Exemplo n.º 24
0
//RampUnit::RampUnit(const char* rampName, RampUnitCallback aCallbackMethod, void *aBaton) : 
RampUnit::RampUnit(TTValue& arguments) :
	TTObject(kTTValNONE),
	mFunction(NULL),
	callback(NULL),
	baton(NULL),
	startValue(NULL),
	targetValue(NULL),
	currentValue(NULL),
	normalizedValue(0.0),
	numValues(0),
	functionUnit(NULL)
{
	setNumValues(1);
	currentValue[0] = 0.0;
	targetValue[0] = 0.0;
	startValue[0] = 0.0;

	arguments.get(0, (TTPtr*)&callback);
	arguments.get(1, (TTPtr*)&baton);
	
	addAttributeWithSetter(Function, kTypeSymbol);
	setAttributeValue(TT("function"), TT("linear"));
}
Exemplo n.º 25
0
Arquivo: http.c Projeto: ic-hep/emi3
/************************************************
Function:    extractRequestSubjectToAOS
Parameters:  const xacml_request_t           request
Description:
             This function extracts the Subject information details
             from the request and puts that into the EEF AOS.
Return:
          0 : good
         !0 : bad 
************************************************/
int extractRequestSubjectToAOS (const xacml_request_t request)
{
  /*char * logstr = "extractRequestSubjectToAOS()";*/
    size_t count = 0;
    size_t i     = 0;

    const char *category;
    const char *attribute_id;
    const char *data_type;
    const char *issuer;
    const char *value;
        
    aos_context_t*   aos_context = NULL;
    aos_attribute_t* aos_attribute = NULL;

    xacml_request_get_subject_attribute_count(request, &count);

    if (count > 0)
    {
      rewindContexts();
      if((aos_context = getNextContext(SUBJECT, NULL)) == NULL){
        if((aos_context = createContext (SUBJECT)) == NULL){
          return 1;
        }
      }
      /* aos_context should be set now */
    }

    for (i = 0; i < count; i++)
    {

        category     = NULL;
        attribute_id = NULL;
        data_type    = NULL;
        issuer       = NULL;
        value        = NULL;

        xacml_request_get_subject_attribute(
                request, i, &category, &attribute_id, &data_type, &issuer, &value);

        /* EEF AOS magic */
        /*fprintf (stderr, "aos_set_string (\"%s\", \"%s\")\n", attribute_id, (const char *) value);*/
        /* if (strcmp ("http://authz-interop.org/xacml/subject/voms-fqan", attribute_id) == 0) */
        /* { */
            /* fprintf (stderr, "Skipping voms-fqan\n"); */
            /* continue; */
        /* } */

        /* aos_set_string (attribute_id, (char *) value); */

        if (aos_context){
          if((aos_attribute = createAttribute())){
            setAttributeId    (aos_attribute, attribute_id);
            setAttributeIssuer(aos_attribute, issuer);
            setAttributeType  (aos_attribute, data_type);
            setAttributeValue (aos_attribute, value, strlen(value) + 1);
            addAttribute(aos_context, aos_attribute);
          }
        }
    }

    if(aos_context){
      addContext (aos_context);
    }

    return 0;
}
Exemplo n.º 26
0
//----------------------------------------------------------------------------------------------------
void MultipleAttributeChangeAction::undo ()
{
	setAttributeValue (oldValue.c_str ());
}
Exemplo n.º 27
0
//----------------------------------------------------------------------------------------------------
void MultipleAttributeChangeAction::perform ()
{
	setAttributeValue (newValue.c_str ());
}
Exemplo n.º 28
0
Arquivo: http.c Projeto: ic-hep/emi3
/************************************************
Function:    extractRequestActionToAOS
Parameters:  const xacml_request_t           request
Description:
             This function extracts the Action information details
             from the request and puts that into the EEF AOS.
Return:
          0 : good
         !0 : bad 
************************************************/
int extractRequestActionToAOS (const xacml_request_t request)
{
    int                           rc;
    size_t                        i;
    size_t                        count;
    const char *                  attribute_id;
    const char *                  data_type;
    const char *                  issuer;
    const char *                  value;
    /*char *                        logstr = "extractRequestActionToAOS";*/

    aos_context_t*   aos_context = NULL;
    aos_attribute_t* aos_attribute = NULL;

    rc = xacml_request_get_action_attribute_count(request, &count);


    if (count > 0)
    {
      rewindContexts();
      if((aos_context = getNextContext(ACTION, NULL)) == NULL){
        if((aos_context = createContext (ACTION)) == NULL){
          return 1;
        }
      }
      /* aos_context should be set now */
    }

    for (i = 0 ; i < count; i++)
    {
        attribute_id = NULL;
        data_type    = NULL;
        issuer       = NULL;
        value        = NULL;
        rc = xacml_request_get_action_attribute(
                request,
                i,
                &attribute_id,
                &data_type,
                &issuer,
                &value);
        /* EEF AOS magic */
        /*fprintf (stderr, "aos_set_string (\"%s\", \"%s\")\n", attribute_id, (char *) value);*/

        /* aos_set_string (attribute_id, (char *) value); */

        if (aos_context){
          if((aos_attribute = createAttribute())){
            setAttributeId    (aos_attribute, attribute_id);
            setAttributeIssuer(aos_attribute, issuer);
            setAttributeType  (aos_attribute, data_type);
            setAttributeValue (aos_attribute, value, strlen(value) + 1);
            addAttribute(aos_context, aos_attribute);
          }
        }
    }

    if(aos_context){
      addContext (aos_context);
    }

    return 0;
}
Exemplo n.º 29
0
void WDialog::create()
{
  closeIcon_ = 0;
  footer_ = 0;
  modal_ = true;
  resizable_ = false;
  recursiveEventLoop_ = false;
  impl_ = dynamic_cast<WTemplate *>(implementation());

  const char *CSS_RULES_NAME = "Wt::WDialog";

  WApplication *app = WApplication::instance();

  if (!app->styleSheet().isDefined(CSS_RULES_NAME)) {
    /* Needed for the dialog cover */
    if (app->environment().agentIsIElt(9))
      app->styleSheet().addRule("body", "height: 100%;");

    std::string position
      = app->environment().agent() == WEnvironment::IE6 ? "absolute" : "fixed";

    // we use left: 50%, top: 50%, margin hack when JavaScript is not available
    // see below for an IE workaround
    app->styleSheet().addRule("div.Wt-dialog", std::string() +
			      (app->environment().ajax() ?
			       "visibility: hidden;" : "") 
			      //"position: " + position + ';'
			      + (!app->environment().ajax() ?
				 "left: 50%; top: 50%;"
				 "margin-left: -100px; margin-top: -50px;" :
				 "left: 0px; top: 0px;"),
			      CSS_RULES_NAME);

    if (app->environment().agent() == WEnvironment::IE6) {
      app->styleSheet().addRule
	("div.Wt-dialogcover",
	 "position: absolute;"
	 "left: expression("
	 "(ignoreMe2 = document.documentElement.scrollLeft) + 'px' );"
	 "top: expression("
	 "(ignoreMe = document.documentElement.scrollTop) + 'px' );");

      // simulate position: fixed left: 50%; top 50%
      if (!app->environment().ajax())
	app->styleSheet().addRule
	  ("div.Wt-dialog",
	   "position: absolute;"
	   "left: expression("
	   "(ignoreMe2 = document.documentElement.scrollLeft + "
	   "document.documentElement.clientWidth/2) + 'px' );"
	   "top: expression("
	   "(ignoreMe = document.documentElement.scrollTop + "
	   "document.documentElement.clientHeight/2) + 'px' );");
    }
  }

  LOAD_JAVASCRIPT(app, "js/WDialog.js", "WDialog", wtjs1);

  WContainerWidget *layoutContainer = new WContainerWidget();
  layoutContainer->setStyleClass("dialog-layout");
  WVBoxLayout *layout = new WVBoxLayout(layoutContainer);
  layout->setContentsMargins(0, 0, 0, 0);
  layout->setSpacing(0);
  impl_->bindWidget("layout", layoutContainer);

  titleBar_ = new WContainerWidget();
  app->theme()->apply(this, titleBar_, DialogTitleBarRole);

  caption_ = new WText(titleBar_);
  caption_->setInline(false);
  
  contents_ = new WContainerWidget();
  app->theme()->apply(this, contents_, DialogBodyRole);

  layout->addWidget(titleBar_);
  layout->addWidget(contents_, 1);

  saveCoverState(app, app->dialogCover());

  /*
   * Cannot be done using the CSS stylesheet in case there are
   * contained elements with setHideWithOffsets() set
   *
   * For IE, we cannot set it yet since it will confuse width measurements
   * to become minimum size instead of (unconstrained) preferred size
   */
  if (app->environment().ajax()) {
    setAttributeValue("style", "visibility: hidden");

    /*
     * This is needed for animations only, but setting absolute or
     * fixed positioning confuses layout measurement in IE browsers
     */
    if (!app->environment().agentIsIElt(9))
      setPositionScheme(Fixed);
  } else
    setPositionScheme(app->environment().agent() == WEnvironment::IE6
		      ? Absolute : Fixed);
}
Exemplo n.º 30
0
TTDataObject::TTDataObject(TTValue& arguments)
	: TTObject(arguments)
{
	registerAttribute(kTTSym_SampleRate, kTypeUInt32, &sr, (TTSetterMethod)&TTDataObject::setSr);
	setAttributeValue(kTTSym_SampleRate, ttEnvironment->mSampleRate);
}