Beispiel #1
0
struct Gadget *CreateAllGadgets(piObject *o)
{
	struct Gadget *g=NULL;
	piObject *go;
	struct Node_Window *nw;

	piGetAttr(o,OBJ_Node,(ULONG *)&nw);

	nw->nw_Gadgets=NULL;
	if(nw->nw_PageGadget==0 && GUI.gui_Mode==MODE_TEST)
	{
		if(nw->nw_MyFlags&MYWA_BBottomSlider)
		{
			g=CreateContext(&nw->nw_Gadgets);
			unless(nw->nw_Object[0]=NewObject(NULL, BUTTONGCLASS,
//				ICA_TARGET, ICTARGET_IDCMP,
				GA_RelVerify,TRUE,
				GA_Image, gui_LeftImage,
				GA_RelRight, 1-(IM_WIDTH(gui_LeftImage)+IM_WIDTH(gui_SizeImage)+IM_WIDTH(gui_RightImage)),
				GA_RelBottom, 1-(IM_HEIGHT(gui_LeftImage)),
				GA_BottomBorder,TRUE,
				GA_Previous,(ULONG *)g,
				(nw->nw_Flags&WFLG_GIMMEZEROZERO) ? GA_GZZGadget : TAG_IGNORE,TRUE,
				GA_ID, GD_LEFTBUTTON,
				TAG_DONE)) return NULL;
			g=(struct Gadget *)nw->nw_Object[0];
			unless(nw->nw_Object[1]=NewObject(NULL, BUTTONGCLASS,
//				ICA_TARGET, ICTARGET_IDCMP,
				GA_RelVerify,TRUE,
				GA_Image, gui_RightImage,
				GA_RelRight, 1-(IM_WIDTH(gui_RightImage)+IM_WIDTH(gui_SizeImage)),
				GA_RelBottom, 1-(IM_HEIGHT(gui_RightImage)),
				GA_BottomBorder,TRUE,
				GA_Previous,(ULONG *)g,
				(nw->nw_Flags&WFLG_GIMMEZEROZERO) ? GA_GZZGadget : TAG_IGNORE,TRUE,
				GA_ID, GD_RIGHTBUTTON,
				TAG_DONE)) return NULL;
			g=(struct Gadget *)nw->nw_Object[1];
			unless(nw->nw_Object[2]=NewObject(NULL, PROPGCLASS,
//				ICA_TARGET, ICTARGET_IDCMP,
				GA_RelVerify,TRUE,
				PGA_Freedom, FREEHORIZ,
				PGA_NewLook, TRUE,
				PGA_Borderless, ((DrawInfo->dri_Flags & DRIF_NEWLOOK) && DrawInfo->dri_Depth != 1),
				GA_Left, 3,
				GA_RelBottom, -(IM_HEIGHT(gui_SizeImage)-3),
				GA_RelWidth, -(4+IM_WIDTH(gui_LeftImage)+IM_WIDTH(gui_RightImage)+IM_WIDTH(gui_SizeImage)+1),
				GA_Height, IM_HEIGHT(gui_SizeImage)-4,
				GA_BottomBorder, TRUE,
				GA_Previous,(ULONG *)g,
				(nw->nw_Flags&WFLG_GIMMEZEROZERO) ? GA_GZZGadget : TAG_IGNORE,TRUE,
				GA_ID, GD_HORIZBUTTON,
				PGA_Total, 1,
				PGA_Visible, 1,
				TAG_DONE)) return NULL;
			g=(struct Gadget *)nw->nw_Object[2];
		}
		else
		{
Beispiel #2
0
static void makegads(void)
{
    struct ColorWheelRGB    rgb;
    struct ColorWheelHSB    hsb;
    Object  	    	    *im;
    WORD    	    	    sizeheight = 14;
    WORD    	    	    gradx, grady, gradw, gradh;
    WORD    	    	    wheelx, wheely, wheelw, wheelh;

    im = NewObject(NULL, SYSICLASS, SYSIA_DrawInfo, (IPTR)dri, SYSIA_Which, SIZEIMAGE, TAG_DONE);
    if (im)
    {
        sizeheight = ((struct Image *)im)->Height;
        DisposeObject(im);
    }

    wheelx = scr->WBorLeft + BORDERX;
    wheely = scr->WBorTop + scr->Font->ta_YSize + 1 + BORDERY;
    wheelw = -(scr->WBorLeft + scr->WBorRight + BORDERX * 2 + SPACINGX + GRADWIDTH);
    wheelh = -(scr->WBorTop + scr->Font->ta_YSize + 1 + sizeheight + BORDERY * 2);

    gradx = -(scr->WBorRight + BORDERX + GRADWIDTH) + 1;
    grady = scr->WBorTop + scr->Font->ta_YSize + 1 + BORDERY;
    gradw = GRADWIDTH;
    gradh = -(scr->WBorTop + scr->Font->ta_YSize + 1 + sizeheight + BORDERY * 2);

    gradgad = (struct Gadget *)NewObject(0, "gradientslider.gadget", GA_RelRight	, gradx,
                                         GA_Top		, grady,
                                         GA_Width		, gradw,
                                         GA_RelHeight	, gradh,
                                         GRAD_PenArray	, (IPTR)pens,
                                         GRAD_KnobPixels	, 10,
                                         PGA_Freedom	, LORIENT_VERT,
                                         TAG_DONE);

    if (!gradgad) cleanup("Can't create gradientslider gadget!");

    wheelgad = (struct Gadget *)NewObject(0, "colorwheel.gadget", GA_Left		, wheelx,
                                          GA_Top		, wheely,
                                          GA_RelWidth		, wheelw,
                                          GA_RelHeight		, wheelh,
                                          GA_RelVerify		, TRUE,
                                          WHEEL_Screen		, (IPTR)scr,
                                          WHEEL_BevelBox	, TRUE,
                                          WHEEL_GradientSlider	, (IPTR)gradgad,
                                          GA_Previous		, (IPTR)gradgad,
                                          ICA_TARGET		, ICTARGET_IDCMP,
                                          TAG_DONE);

    if (!wheelgad) cleanup("Can't create colorwheel gadget!");

    GetAttr(WHEEL_HSB, (Object *)wheelgad, (IPTR *)&hsb);
    hsb.cw_Brightness = 0xFFFFFFFF;
    ConvertHSBToRGB(&hsb, &rgb);

    SetRGB32(vp, pen1, rgb.cw_Red, rgb.cw_Green, rgb.cw_Blue);
}
BOOL PRIVATE DispatchScrollerNew(struct ClassBase *cb,struct ScrollerGData *sd,struct Gadget *gad,struct opSet *ops)
{
  static struct TagItem upmap[] = {{GA_ID,SGA_Up},{TAG_END}};
  static struct TagItem downmap[] = {{GA_ID,SGA_Down},{TAG_END}};
  struct Gadget *previous;
  long   x,y,w,h;

  if (!(previous = (struct Gadget *)GetTagData(GA_Previous,0,ops->ops_AttrList)))
    return(FALSE);
  sd->sd_ItemHeight = GetTagData(SGA_ItemHeight,13,ops->ops_AttrList);

  if (!(sd->sd_DownImage = NewObject(cb->cb_ArrowClass,NULL,IA_Width,    gad->Width,
                                                            IA_Height,   sd->sd_ItemHeight,
                                                            SYSIA_Which, ADT_DOWN,
                                                            TAG_END)))
    return(FALSE);
  if (!(sd->sd_UpImage = NewObject(cb->cb_ArrowClass,NULL,IA_Width,    gad->Width,
                                                          IA_Height,   sd->sd_ItemHeight,
                                                          SYSIA_Which, ADT_UP,
                                                          TAG_END)))
    return(FALSE);
  if (!(sd->sd_Frame = NewObject(NULL,"frameiclass",IA_Left,      gad->LeftEdge,
                                                    IA_Top,       gad->TopEdge,
                                                    IA_Width,     gad->Width,
                                                    IA_Height,    gad->Height-(h = sd->sd_UpImage->Height)*2,
                                                    IA_FrameType, FRAME_BUTTON,
                                                    TAG_END)))
    return(FALSE);
  if (!(sd->sd_Up = NewObject(NULL,"buttongclass",GA_ID,        1,
                                                  GA_Left,      x = gad->LeftEdge,
                                                  GA_Top,       y = gad->TopEdge+gad->Height-h*2,
                                                  GA_Width,     w = sd->sd_UpImage->Width,
                                                  GA_Height,    h,
                                                  GA_Image,     sd->sd_UpImage,
                                                  GA_Previous,  previous,
                                                  ICA_TARGET,   gad,
                                                  ICA_MAP,      upmap,
                                                  TAG_END)))
    return(FALSE);
  if (!(sd->sd_Down = NewObject(NULL,"buttongclass",GA_ID,        1,
                                                    GA_Left,      x,
                                                    GA_Top,       y+h,
                                                    GA_Width,     w,
                                                    GA_Height,    h,
                                                    GA_Image,     sd->sd_DownImage,
                                                    GA_Previous,  sd->sd_Up,
                                                    ICA_TARGET,   gad,
                                                    ICA_MAP,      downmap,
                                                    TAG_END)))
    return(FALSE);
  sd->sd_Down->NextGadget = gad;
  return(TRUE);
}
Beispiel #4
0
///
/// SetupSelectPointer()
void SetupSelectPointer(struct InstData *data)
{
  ENTER();

  #if defined(__amigaos4__)
  if(LIB_VERSION_IS_AT_LEAST(IntuitionBase, 53, 40))
    data->PointerObj = (APTR)POINTERTYPE_TEXT;
  #elif defined(__MORPHOS__)
  if(IS_MORPHOS2)
    data->PointerObj = (APTR)POINTERTYPE_SELECTTEXT;
  #endif

  if(data->PointerObj == NULL)
  {
    #if defined(__amigaos4__)
    data->PointerObj = (Object *)NewObject(NULL, "pointerclass",
      POINTERA_ImageData,   selectPointer,
      POINTERA_Width,       selectPointerWidth,
      POINTERA_Height,      selectPointerHeight,
      POINTERA_BitMap,      &selectPointerBitmap,
      POINTERA_WordWidth,   (ULONG)1,
      POINTERA_XResolution, (ULONG)POINTERXRESN_SCREENRES,
      POINTERA_YResolution, (ULONG)POINTERYRESN_SCREENRESASPECT,
      POINTERA_XOffset,     (LONG)selectPointerXOffset,
      POINTERA_YOffset,     (LONG)selectPointerYOffset,
      TAG_DONE);
    #else
    if(LIB_VERSION_IS_AT_LEAST(IntuitionBase, 39, 0))
    {
      data->PointerObj = (Object *)NewObject(NULL, (STRPTR)"pointerclass",
        POINTERA_BitMap,      (SIPTR)&selectPointerBitmap,
        POINTERA_WordWidth,   (ULONG)1,
        POINTERA_XResolution, (ULONG)POINTERXRESN_SCREENRES,
        POINTERA_YResolution, (ULONG)POINTERYRESN_SCREENRESASPECT,
        POINTERA_XOffset,     (LONG)selectPointerXOffset,
        POINTERA_YOffset,     (LONG)selectPointerYOffset,
        TAG_DONE);
    }
    else
    {
      if((data->PointerObj = (Object *)AllocVec(sizeof(selectPointer), MEMF_CHIP|MEMF_PUBLIC)) != NULL)
        memcpy(data->PointerObj, selectPointer, sizeof(selectPointer));
    }
    #endif
  }

  data->activeSelectPointer = FALSE;

  LEAVE();
}
Beispiel #5
0
Object* PushDict(VM* vm)
{
	Object* obj = NewObject(vm, OBJ_DICT);
	InitDict(&obj->dict);
	PushObject(vm, obj);
	return obj;
}
Beispiel #6
0
IntervalList * IntervalList_new ()
{
	IntervalList * temp=NewObject(IntervalList);

	temp->head=NULL;
	temp->length=0;
}
Beispiel #7
0
ArrayListIter * ArrayListIter_new (ArrayList * list)
{
	ArrayListIter * _this=NewObject(ArrayListIter);
	_this->list=list;

	return _this;
}
Beispiel #8
0
ULONG TAPEDECK_CREATE_Gadget(piClass *cl,piObject *o,struct piWindow *msg)
{
	struct TagItem *ti;
	struct Node_Gadget *ng;
	struct Node_Window *nw;
	WORD x,y,w,h;

	piGetAttr(o,GAOBJ_Tags,(ULONG *)&ti);
	piGetAttr(o,OBJ_Node,(ULONG *)&ng);
	piGetAttr(ng->ng_Window,OBJ_Node,(ULONG *)&nw);
	
	if(ng->ng_RelX) x=-(nw->nw_Window->Width-nw->nw_Window->BorderLeft-ng->ng_X-1);
	else x=piCX(o);
	if(ng->ng_RelY) y=-(nw->nw_Window->Height-nw->nw_Window->BorderTop-ng->ng_Y-1);
	else y=piCY(o);
	if(ng->ng_RelWidth) w=-(nw->nw_Window->BorderLeft+nw->nw_Window->BorderRight+(nw->nw_Window->Width-nw->nw_Window->BorderLeft-nw->nw_Window->BorderRight-ng->ng_Width)-1);
	else w=piCW(o)+1;
	if(ng->ng_RelHeight) h=-(nw->nw_Window->BorderTop+nw->nw_Window->BorderBottom+(nw->nw_Window->Height-nw->nw_Window->BorderTop-nw->nw_Window->BorderBottom-ng->ng_Height)-1);
	else h=piCH(o)+1;

	return (ULONG) (ng->ng_Gadget=NewObject(NULL, "tapedeck.gadget",
									ng->ng_RelX?GA_RelRight:GA_Left,x,
									ng->ng_RelY?GA_RelBottom:GA_Top,y,
									ng->ng_RelWidth?GA_RelWidth:GA_Width,w,
									ng->ng_RelHeight?GA_RelHeight:GA_Height,h,
									(msg->Window) ? GA_Previous : TAG_IGNORE, msg->Window,
									GA_ID,0,
									TAG_MORE,ti));
}
Beispiel #9
0
/**************************************************************************
*
*  Called first to create an empty blob object with a given threshold.
*    Elements are added by calling Ray_BlobAddSphere(),
*  Ray_BlobAddCylinder() and Ray_BlobAddPlane() one or more times on this
*  object. When the object is finished Ray_BlobFinish() is called to
*  perform any needed post-processing and validation.
*
**************************************************************************/
Object *Ray_MakeBlob(double threshold)
{
	Object *obj;
	BlobData *blob;

	if((obj = NewObject()) == NULL)
		return NULL;

	/* Allocate the main blob data structure... */
	if((blob = (BlobData *)Malloc(sizeof(BlobData))) == NULL)
	{
		Ray_DeleteObject(obj);
		return NULL;
	}
	blob->nrefs = 1;
	blob->threshold = threshold;
	blob->solver = 0;
	blob->bound = NULL;
	blob->elems = NULL;

	obj->data.blob = blob;
	obj->procs = &blob_procs;

	return obj;
}
Beispiel #10
0
void warn_user(const char *warning, const char *detail)
{
	Object *req = NULL;
	char *utf8warning = ami_utf8_easy(messages_get(warning));
	STRPTR bodytext = NULL;

	LOG(("%s %s", warning, detail));

	bodytext = ASPrintf("\33b%s\33n\n%s",
		utf8warning != NULL ? utf8warning : warning, detail);

	req = NewObject(REQUESTER_GetClass(), NULL,
		REQ_Type,               REQTYPE_INFO,
		REQ_TitleText,          messages_get("NetSurf"),
		REQ_BodyText,           bodytext,
		REQ_GadgetText,         messages_get("OK"),
#ifdef __amigaos4__
		REQ_VarArgs,			
		REQ_Image,				(struct Image *)REQIMAGE_WARNING,
		/* REQ_CharSet,			106, */
#endif
		TAG_DONE);

	if (req) {
		LONG result = IDoMethod(req, RM_OPENREQ, NULL, NULL, scrn);
		DisposeObject(req);
	}

	if(bodytext) FreeVec(bodytext);
	if(utf8warning) free(utf8warning);
}
void FolderSuggestionProvider::run()
{
	while (true)
	{
		m_work.pass();

		m_lock.await();
		m_bReset = false;
		UTF16 sPrefix = m_sPrefix;
		int iSuggestionsRequired = m_iSuggestionsRequired;
		m_lock.release();
		
		HFolderSuggestionList hList = NewObject(FolderSuggestionList);
		listPathCompletions(sPrefix, (*hList), iSuggestionsRequired);

		Synchronizer sync(m_lock);

		if (m_bShutdown)
			break;

		if (m_bReset)
			continue;

		TreeSet<Listener*>::Iterator it(m_pListeners);
		Listener* pListener;

		while (it(pListener))
		{
			TaskTracker::instance()->add(buildFunctionTask(notifySuggestions, pListener, hList), TaskTracker::eMainThread);
		}
	}
}
Beispiel #12
0
 Value Interpreter::MakeGlobal(const char * name)
 {
     int index = DefineGlobal(String(name));
     Value global = NewObject(mObject, name);
     SetGlobal(index, global);
     return global;
 }
Beispiel #13
0
Object* quote(){
  Object* r;
  r = NewObject(Object);
  r->fProc = NULL;
  r->fOne.uObject = NULL;
  r->fName = "quote";
  return r;
}
Beispiel #14
0
Object* _constant_function(Object* self, Object* other){
  Object* k1;
  k1 = NewObject(Object);
  k1->fProc = _k1;
  k1->fName = "k1";
  k1->fOne.uObject = other;
  return k1;
}
Beispiel #15
0
Object* identity(void){
  Object* r;
  r = NewObject(Object);
  r->fProc = &_identity;
  r->fOne.uObject = NULL;
  r->fName = "identity";
  return r;
}
Beispiel #16
0
Object* print(char x){
  Object* r;
  r = NewObject(Object);
  r->fProc = &_print;
  r->fOne.uChar = x;
  r->fName = "print";
  return r;
}
Beispiel #17
0
void PushNative(VM* vm, void* value, void (*onFree)(void*), void (*onMark)())
{
	Object* obj = NewObject(vm, OBJ_NATIVE);
	obj->native.value = value;
	obj->native.onFree = onFree;
	obj->native.onMark = onMark;
	PushObject(vm, obj);
}
Beispiel #18
0
UnlambdaEval* NewUnlambdaEval(World* world){
  UnlambdaEval* ue;
  ue = NewObject(UnlambdaEval);

  ue->fBase.fOne.uObject = (Object*)World_getMemory(world);
  ue->fBase.fTwo.uObject = (Object*)NewStack();
  return ue;
}
Beispiel #19
0
void PushString(VM* vm, const char* string)
{
	Object* obj = NewObject(vm, OBJ_STRING);
	
	obj->string.raw = estrdup(string);
	
	PushObject(vm, obj);
}
Beispiel #20
0
UTF8 JSON::generate(Error& error) const
{
	Buffer buf(0);
	HOutputStream out = NewObject(MemoryOutputStream, buf);
	generate(error, out);
	out->twrite(error,'\0');
	return UTF8(Blob(buf));
}
Beispiel #21
0
Object *CreateGUI(struct IClass *cl, Object *obj, struct ObjStore *os, struct DnetcLibrary *LibBase)
{
	UBYTE about[512];
	ULONG array[] =
	{
		(ULONG) LibBase->Version,
		LibBase->Library.lib_Version,
		LibBase->Library.lib_Revision
	};

//#define SysBase LibBase->MySysBase
	RawDoFmt(
	 "\33cdistributed.net client - a product of distributed.net\n"
	 "%s\n"
	 "Copyright 1997-2011 distributed.net\n"
	 "\n"
	 "\n"
	 "MorphOS client maintained by\n"
	 "Harry Sintonen\n"
	 "<*****@*****.**>\n"
	 "\n"
	 "\n"
	 "MUI GUI module (v%ld.%ld) maintained by\n"
	 "Ilkka Lehtoranta\n"
	 "<*****@*****.**>",
	array, NULL, about);
//#undef SysBase

	return (Object*)DoSuperNew(cl, obj,
		MUIA_Application_DiskObject, (IPTR)LibBase->dobj,
		MUIA_Application_Commands, (IPTR)commands,
		MUIA_Application_Version, (IPTR)&VerString[1],
		MUIA_Application_Copyright, (IPTR)"distributed.net",
		MUIA_Application_Author, (IPTR)"Ilkka Lehtoranta",
		MUIA_Application_Base, (IPTR)"DNETC",
		MUIA_Application_UsedClasses, (IPTR)ClassList,
		MUIA_Application_Title, (IPTR)"dnetc",
		MUIA_Application_Description, (IPTR)"GUI for distributed.net client",
		MUIA_Application_Window, (IPTR)(os->wnd = MUI_NewObject(MUIC_Window,
			MUIA_Window_Title, (IPTR)"distributed.net client",
			MUIA_Window_ID, MAKE_ID('M','A','I','N'),
			MUIA_Window_Width, MUIV_Window_Width_Visible(55),
			MUIA_Window_Height, MUIV_Window_Height_Visible(45),
			MUIA_Window_Menustrip, (IPTR)MUI_MakeObject(MUIO_MenustripNM, (IPTR)&Menus, 0),
			MUIA_Window_RootObject, (IPTR)MUI_NewObject(MUIC_Group,
				MUIA_Group_Child, (IPTR)(os->lst = NewObject(LibBase->ListMCC->mcc_Class, NULL,
					MUIA_Background, MUII_ReadListBack,
					MUIA_Frame, MUIV_Frame_ReadList,
					MUIA_CycleChain, TRUE,
				TAG_END)),
			TAG_END),
		TAG_END)),
		MUIA_Application_Window, (IPTR)(os->req = MUI_NewObject(MUIC_Aboutbox,
			MUIA_Aboutbox_Credits, (IPTR)about,
		TAG_END)),
	TAG_END);
}
Beispiel #22
0
DYN_EXPORT int dyn_NewMessage(int sched,dyn_id *oid,dyn_callback cb,dyn_id sid,int argc,t_atom *argv)
{
    try {
        ASSERT(oid);
        *oid = NewObject(DYN_TYPE_MESSAGE,cb,sid,NULL,argc,argv);
        return *oid?DYN_ERROR_NONE:DYN_ERROR_GENERAL;
    }
    catch(int err) { return err; }
}
Beispiel #23
0
DYN_EXPORT int dyn_NewObject(int sched,dyn_id *oid,dyn_callback cb,dyn_id sid,const t_symbol *obj,int argc,const t_atom *argv)
{
    try {
        ASSERT(oid);
        *oid = NewObject(DYN_TYPE_OBJECT,cb,sid,obj,argc,argv);      
        return *oid?DYN_ERROR_NONE:DYN_ERROR_GENERAL;
    }
    catch(int err) { return err; }
}
Beispiel #24
0
DYN_EXPORT int dyn_NewPatcher(int sched,dyn_id *sid,dyn_callback cb,dyn_id psid /*,const char *name*/)
{
    try {
        ASSERT(sid);
        *sid = NewObject(DYN_TYPE_PATCHER,cb,psid,NULL);
        return *sid?DYN_ERROR_NONE:DYN_ERROR_GENERAL;
    }
    catch(int err) { return err; }
}
Beispiel #25
0
static Object *MakeNumStr(void)
{
   return NewObject(SWObjStringClass(), NULL,
                    StringFrame,
                    MUIA_CycleChain,    1,
                    MUIA_String_Accept, "0123456789",
                    MUIA_String_MaxLen, 4,
                    TAG_DONE);
}
Beispiel #26
0
Object* _generalized_evaluation(Object* self, Object* other){
  /* self == s, other == x */
  Object* s1;
  s1 = NewObject(Object);
  s1->fProc = &_s1;
  s1->fOne.uObject = other;
  s1->fName = "s1";
  return s1;
}
Beispiel #27
0
HandleProxy* V8EngineProxy::CreateObject(int32_t managedObjectID)
{
	if (managedObjectID == -1)
		managedObjectID = GetNextNonTemplateObjectID();

	auto handle = GetHandleProxy(NewObject());
	ConnectObject(handle, managedObjectID, nullptr);
	return handle;
}
Beispiel #28
0
    ActivityState* ActivityState::create(ANativeActivity* activity)
    {
        JOP_ASSERT(ns_instance == nullptr, "There must only be one ActivityState!");

        ns_instance.reset(new ActivityState);
        ns_instance->nativeActivity = activity;

        ANativeActivity_setWindowFlags(activity, AWINDOW_FLAG_KEEP_SCREEN_ON, AWINDOW_FLAG_KEEP_SCREEN_ON);

        Thread::attachJavaThread(activity->vm, activity->env);

        // Get the screen size
        {
            auto env = Thread::getCurrentJavaEnv();

            if (!env)
            {
                JOP_DEBUG_ERROR("No current java environment, function \"" << __func__ << "\"");
                return get();
            }

            jclass activityClass = env->GetObjectClass(activity->clazz);

            jclass displayMetricsClass = env->FindClass("android/util/DisplayMetrics");
            jmethodID displayMetricsInit = env->GetMethodID(displayMetricsClass, "<init>", "()V");
            jobject displayMetricsObject = env->NewObject(displayMetricsClass, displayMetricsInit);

            jmethodID getWindowManagerMethod = env->GetMethodID(activityClass, "getWindowManager", "()Landroid/view/WindowManager;");
            jobject windowManagerObject = env->CallObjectMethod(activity->clazz, getWindowManagerMethod);

            jclass windowManagerClass = env->FindClass("android/view/WindowManager");
            jmethodID getDefaultDisplayMethod = env->GetMethodID(windowManagerClass, "getDefaultDisplay", "()Landroid/view/Display;");
            jobject displayObject = env->CallObjectMethod(windowManagerObject, getDefaultDisplayMethod);

            jclass displayClass = env->FindClass("android/view/Display");
            jmethodID getMetricsMethod = env->GetMethodID(displayClass, "getMetrics", "(Landroid/util/DisplayMetrics;)V");
            env->CallVoidMethod(displayObject, getMetricsMethod, displayMetricsObject);

            jfieldID pixelsWidth = env->GetFieldID(displayMetricsClass, "widthPixels", "I");
            jfieldID pixelsHeight = env->GetFieldID(displayMetricsClass, "heightPixels", "I");

            ns_instance->screenSize.x = env->GetIntField(displayMetricsObject, pixelsWidth);
            ns_instance->screenSize.y = env->GetIntField(displayMetricsObject, pixelsHeight);

            //jmethodID getRefreshRateMethod = env->GetMethodID(displayClass, "getRefreshRate", "(Landroid/view/Display;)F");
            ns_instance->screenRefreshRate = 60;//env->CallFloatMethod(displayObject, getRefreshRateMethod);

            env->DeleteLocalRef(activityClass);
            env->DeleteLocalRef(displayMetricsObject);
            env->DeleteLocalRef(windowManagerObject);
            env->DeleteLocalRef(windowManagerClass);
            env->DeleteLocalRef(displayObject);
            env->DeleteLocalRef(displayClass);
        }

        return get();
    }
Beispiel #29
0
Object* _s1(Object* self, Object* other){
  /* self == s1, other == y */
  Object* s2;
  s2 = NewObject(Object);
  s2->fProc = &_s2;
  s2->fOne.uObject = other;
  s2->fTwo.uObject = self; /* may be it is better idea to reference x, instead of s1 */
  s2->fName = "s2";
  return s2;
}
Beispiel #30
0
static Object *MakeNumStr(void)
{
   return NewObject(SWKbsliderClass(), NULL,
                    MUIA_CycleChain,         1,
                    MUIA_Numeric_Min,        0,
                    MUIA_Numeric_Max,        5*1024*1024,
                    SWA_KbSlider_Bytes,      TRUE,
                    SWA_KbSlider_NumIncMult, 256,
                    TAG_DONE);
}