示例#1
0
JNIEXPORT void JNICALL Java_org_mahu_proto_jnitest_nativewrapper_HelloJNI_processDataClass1_b
  (JNIEnv *env, jobject obj, jobject dataClass1Obj) {
  
  printf("### Java_org_mahu_proto_jnitest_nativewrapper_HelloJNI_processDataClass1\n"); 
  
  MyDataClass1 dc1(env, *myMyDataClass1, dataClass1Obj);

  jboolean boolValue =  dc1.booleanField.get();
  dc1.booleanField.set(true);
  
  jint intValue =  dc1.intField.get();
  dc1.intField.set(intValue*2);

//  JavaStringIn str(env,javaObjectDataClass.getStringField("stringValue"));
//  std::ostringstream os;
//  os << str.getString() << "-jni" << "\0";
//  javaObjectDataClass.setStringField("stringValue", os.str());
  
//  jfloat f = javaObjectDataClass.getFloatField("floatValue");
//  javaObjectDataClass.setFloatField("floatValue",f * 3);  
  
  jdouble d = dc1.doubleField.get();
  dc1.doubleField.set(d/2);   

  JByteArrayPtrIn byteArray(env, dc1.byteArrayField.get());
  if (byteArray.getNumberOfBytes()>0) 
  {
    int nrOfBytes = byteArray.getNumberOfBytes()*2;
    jbyte buf[nrOfBytes];
	dc1.byteArrayField.set(buf, nrOfBytes);
  }  
}
示例#2
0
/*
 * Metoda przemalowuj¹ca panel
 */
void TangramDlg::RepaintMainPanel(){
    int w,h;
    wxClientDC dc1(WxPanel1);
    wxBufferedDC dc(&dc1); 
    dc.SetBackground(wxBrush(RGB(56,89,223)));
    dc.Clear(); 
    WxPanel1->GetSize(&w,&h);
    PaintTans(dc);
}
示例#3
0
void CStaticLink::AdjustSize()
{
    // adjust width of link text
    CClientDC dc1(this);
    CFont *pFontOld = dc1.SelectObject(this->GetFont());

    CString str;
    GetWindowText(str);
    CSize size = dc1.GetTextExtent(str);

    this->SetWindowPos(NULL, 0, 0, size.cx, size.cy, SWP_NOZORDER | SWP_NOMOVE);
    dc1.SelectObject(pFontOld);
    DeleteObject(dc1);
}
示例#4
0
文件: test_db.cpp 项目: Hoglet/TimeIT
void database_testDatacell()
{
	std::string data("Text");
	DBAbstraction::DataCell dc1(data.c_str());
	DBAbstraction::DataCell dc2("");

	dc2=dc1;
	ASSERT_EQUAL(data,dc2.getString());
	ASSERT_THROWS(dc2.getInt(), dbexception );
	ASSERT_THROWS(dc2.getBool(), dbexception );

	DBAbstraction::DataCell dci(1);
	ASSERT_EQUAL(1,dci.getInt());
	ASSERT_THROWS(dci.getString(), dbexception );

}
示例#5
0
void StudentDlg::OnPaint()
{
	Greeting.SetText(L"Welcome back ,                         ");
	Greeting.SetFontItalic(TRUE);
	Greeting.SetFontSize(16);
	Greeting.SetTextColor(RGB(255, 255, 255));


	CString text = L"Welcome back , ";
	text += CurAccount.Name;
	Greeting.SetText(text);
	Greeting.SetFontItalic(TRUE);
	Greeting.SetFontSize(16);
	Greeting.SetTextColor(RGB(255, 255, 255));
	if (IsIconic())
	{
		CPaintDC dc1(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc1.GetSafeHdc()), 0);
		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc1.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialogEx::OnPaint();

	}
}
示例#6
0
bool BF3PointCircle::getCircle(BFCoordinate<int> c1, BFCoordinate<int> c2, BFCoordinate<int> c3, BFCircle& circle) {
	BFCoordinate<double> center;
	bool bCenter = BF3PointCircle::getCenter(c1,c2,c3,center);

	if(bCenter == false)
		return false;

	circle.setX0(center.getX());
	circle.setY0(center.getY());

	BFCoordinate<double> dc1(static_cast<double>(c1.getX()), static_cast<double>(c1.getY()));
	BFCoordinate<double> dc2(static_cast<double>(c2.getX()), static_cast<double>(c2.getY()));
	BFCoordinate<double> dc3(static_cast<double>(c3.getX()), static_cast<double>(c3.getY()));

	double r1 = BFCoordinate<double>::distance(center, dc1);
	double r2 = BFCoordinate<double>::distance(center, dc2);
	double r3 = BFCoordinate<double>::distance(center ,dc3);

	double r = (r1+r2+r3)/3.0;

	circle.setR(r);

	return true;
}